repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
xoxefdp/farmacia | src/Vista/VistaLaboratorio.java | // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaLaboratorio extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel labs;
private JTextField text;
private Botonera botonera;
public VistaLaboratorio(){
setTitle("Laboratorios");
setModal(true);
labs = new JPanel();
labs.setBorder(BorderFactory.createTitledBorder("Nombre"));
text = new JTextField(20);
labs.add(text);
add(labs, BorderLayout.NORTH);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
| // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaLaboratorio.java
import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaLaboratorio extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel labs;
private JTextField text;
private Botonera botonera;
public VistaLaboratorio(){
setTitle("Laboratorios");
setModal(true);
labs = new JPanel();
labs.setBorder(BorderFactory.createTitledBorder("Nombre"));
text = new JTextField(20);
labs.add(text);
add(labs, BorderLayout.NORTH);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
| botonera.adherirEscucha(0,new OyenteAceptar(this));
|
xoxefdp/farmacia | src/Vista/VistaLaboratorio.java | // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaLaboratorio extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel labs;
private JTextField text;
private Botonera botonera;
public VistaLaboratorio(){
setTitle("Laboratorios");
setModal(true);
labs = new JPanel();
labs.setBorder(BorderFactory.createTitledBorder("Nombre"));
text = new JTextField(20);
labs.add(text);
add(labs, BorderLayout.NORTH);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
botonera.adherirEscucha(0,new OyenteAceptar(this));
| // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaLaboratorio.java
import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaLaboratorio extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel labs;
private JTextField text;
private Botonera botonera;
public VistaLaboratorio(){
setTitle("Laboratorios");
setModal(true);
labs = new JPanel();
labs.setBorder(BorderFactory.createTitledBorder("Nombre"));
text = new JTextField(20);
labs.add(text);
add(labs, BorderLayout.NORTH);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
botonera.adherirEscucha(0,new OyenteAceptar(this));
| botonera.adherirEscucha(1,new OyenteCancelar(this));
|
xoxefdp/farmacia | src/Vista/VistaMedicamento.java | // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaMedicamento extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel meds, labs;
private JTextField text;
private JComboBox opciones;
| // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaMedicamento.java
import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaMedicamento extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel meds, labs;
private JTextField text;
private JComboBox opciones;
| private Botonera botonera;
|
xoxefdp/farmacia | src/Vista/VistaMedicamento.java | // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaMedicamento extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel meds, labs;
private JTextField text;
private JComboBox opciones;
private Botonera botonera;
//referencia declarada
private String[] opcionesLab; //de aqui vendran las opciones que se veran en laboratorio //atributo a ser relocado a CONTROL
public VistaMedicamento(){
setTitle("Medicamento");
setModal(true);
meds = new JPanel();
meds.setBorder(BorderFactory.createTitledBorder("Nombre"));
text = new JTextField(15);
meds.add(text);
add(meds, BorderLayout.NORTH);
//referencia creada
opcionesLab = new String[]{"Seleccione...","Pfizer","Bayer","Novartis", "Genven"}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
labs = new JPanel();
labs.setBorder(BorderFactory.createTitledBorder("Laboratorio"));
opciones = new JComboBox(opcionesLab); //**//
labs.add(opciones);
add(labs, BorderLayout.CENTER);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
| // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaMedicamento.java
import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaMedicamento extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel meds, labs;
private JTextField text;
private JComboBox opciones;
private Botonera botonera;
//referencia declarada
private String[] opcionesLab; //de aqui vendran las opciones que se veran en laboratorio //atributo a ser relocado a CONTROL
public VistaMedicamento(){
setTitle("Medicamento");
setModal(true);
meds = new JPanel();
meds.setBorder(BorderFactory.createTitledBorder("Nombre"));
text = new JTextField(15);
meds.add(text);
add(meds, BorderLayout.NORTH);
//referencia creada
opcionesLab = new String[]{"Seleccione...","Pfizer","Bayer","Novartis", "Genven"}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
labs = new JPanel();
labs.setBorder(BorderFactory.createTitledBorder("Laboratorio"));
opciones = new JComboBox(opcionesLab); //**//
labs.add(opciones);
add(labs, BorderLayout.CENTER);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
| botonera.adherirEscucha(0,new OyenteAceptar(this));
|
xoxefdp/farmacia | src/Vista/VistaMedicamento.java | // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaMedicamento extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel meds, labs;
private JTextField text;
private JComboBox opciones;
private Botonera botonera;
//referencia declarada
private String[] opcionesLab; //de aqui vendran las opciones que se veran en laboratorio //atributo a ser relocado a CONTROL
public VistaMedicamento(){
setTitle("Medicamento");
setModal(true);
meds = new JPanel();
meds.setBorder(BorderFactory.createTitledBorder("Nombre"));
text = new JTextField(15);
meds.add(text);
add(meds, BorderLayout.NORTH);
//referencia creada
opcionesLab = new String[]{"Seleccione...","Pfizer","Bayer","Novartis", "Genven"}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
labs = new JPanel();
labs.setBorder(BorderFactory.createTitledBorder("Laboratorio"));
opciones = new JComboBox(opcionesLab); //**//
labs.add(opciones);
add(labs, BorderLayout.CENTER);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
botonera.adherirEscucha(0,new OyenteAceptar(this));
| // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaMedicamento.java
import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaMedicamento extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel meds, labs;
private JTextField text;
private JComboBox opciones;
private Botonera botonera;
//referencia declarada
private String[] opcionesLab; //de aqui vendran las opciones que se veran en laboratorio //atributo a ser relocado a CONTROL
public VistaMedicamento(){
setTitle("Medicamento");
setModal(true);
meds = new JPanel();
meds.setBorder(BorderFactory.createTitledBorder("Nombre"));
text = new JTextField(15);
meds.add(text);
add(meds, BorderLayout.NORTH);
//referencia creada
opcionesLab = new String[]{"Seleccione...","Pfizer","Bayer","Novartis", "Genven"}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
labs = new JPanel();
labs.setBorder(BorderFactory.createTitledBorder("Laboratorio"));
opciones = new JComboBox(opcionesLab); //**//
labs.add(opciones);
add(labs, BorderLayout.CENTER);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
botonera.adherirEscucha(0,new OyenteAceptar(this));
| botonera.adherirEscucha(1,new OyenteCancelar(this));
|
xoxefdp/farmacia | src/Vista/VistaUnidadesDeMedida.java | // Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.CerrarVentana;
import Control.AceptarCancelar;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaUnidadesDeMedida extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private Container contenedor;
private JPanel udm;
private JTextField text;
| // Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaUnidadesDeMedida.java
import Control.CerrarVentana;
import Control.AceptarCancelar;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaUnidadesDeMedida extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private Container contenedor;
private JPanel udm;
private JTextField text;
| private Botonera botonera;
|
xoxefdp/farmacia | src/Vista/VistaUnidadesDeMedida.java | // Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.CerrarVentana;
import Control.AceptarCancelar;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaUnidadesDeMedida extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private Container contenedor;
private JPanel udm;
private JTextField text;
private Botonera botonera;
public VistaUnidadesDeMedida(){
setTitle("Unidad de Medida");
setModal(true);
udm = new JPanel();
udm.setBorder(BorderFactory.createTitledBorder("Descripcion"));
text = new JTextField(20);
udm.add(text);
add(udm, BorderLayout.NORTH);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
| // Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaUnidadesDeMedida.java
import Control.CerrarVentana;
import Control.AceptarCancelar;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaUnidadesDeMedida extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private Container contenedor;
private JPanel udm;
private JTextField text;
private Botonera botonera;
public VistaUnidadesDeMedida(){
setTitle("Unidad de Medida");
setModal(true);
udm = new JPanel();
udm.setBorder(BorderFactory.createTitledBorder("Descripcion"));
text = new JTextField(20);
udm.add(text);
add(udm, BorderLayout.NORTH);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
| botonera.adherirEscucha(0,new OyenteAceptar(this));
|
xoxefdp/farmacia | src/Vista/VistaUnidadesDeMedida.java | // Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.CerrarVentana;
import Control.AceptarCancelar;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaUnidadesDeMedida extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private Container contenedor;
private JPanel udm;
private JTextField text;
private Botonera botonera;
public VistaUnidadesDeMedida(){
setTitle("Unidad de Medida");
setModal(true);
udm = new JPanel();
udm.setBorder(BorderFactory.createTitledBorder("Descripcion"));
text = new JTextField(20);
udm.add(text);
add(udm, BorderLayout.NORTH);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
botonera.adherirEscucha(0,new OyenteAceptar(this));
| // Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaUnidadesDeMedida.java
import Control.CerrarVentana;
import Control.AceptarCancelar;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaUnidadesDeMedida extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private Container contenedor;
private JPanel udm;
private JTextField text;
private Botonera botonera;
public VistaUnidadesDeMedida(){
setTitle("Unidad de Medida");
setModal(true);
udm = new JPanel();
udm.setBorder(BorderFactory.createTitledBorder("Descripcion"));
text = new JTextField(20);
udm.add(text);
add(udm, BorderLayout.NORTH);
botonera = new Botonera(2);
add(botonera, BorderLayout.SOUTH);
botonera.adherirEscucha(0,new OyenteAceptar(this));
| botonera.adherirEscucha(1,new OyenteCancelar(this));
|
xoxefdp/farmacia | src/Vista/VistaProducto.java | // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| package Vista;
/**
*
* @author José Diaz
*/
public class VistaProducto extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel prodComp, prodUdm, prodCant;
private JComboBox cajaComp, cajaUdm;
private JTextField opcionesCant;
| // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaProducto.java
import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
package Vista;
/**
*
* @author José Diaz
*/
public class VistaProducto extends JDialog implements AceptarCancelar, ActionListener, CerrarVentana{
private JPanel prodComp, prodUdm, prodCant;
private JComboBox cajaComp, cajaUdm;
private JTextField opcionesCant;
| private Botonera botonera;
|
xoxefdp/farmacia | src/Vista/VistaProducto.java | // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
| setLayout(new GridLayout(4,1));
//referencia creada
opcionesComp = new String[]{"Seleccione...","","","", ""}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
prodComp = new JPanel();
prodComp.setBorder(BorderFactory.createTitledBorder("Componente"));
cajaComp = new JComboBox(opcionesComp); //**//
prodComp.add(cajaComp);
add(prodComp);
//referencia creada
opcionesUdm = new String[]{"Seleccione...","ML","MG","GR", "UI"}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
prodUdm = new JPanel();
prodUdm.setBorder(BorderFactory.createTitledBorder("Unidad de Medida"));
cajaUdm = new JComboBox(opcionesUdm); //**//
prodUdm.add(cajaUdm);
add(prodUdm);
prodCant = new JPanel();
prodCant.setBorder(BorderFactory.createTitledBorder("Cantidad"));
opcionesCant = new JTextField(20);
prodCant.add(opcionesCant);
add(prodCant);
botonera = new Botonera(2);
add(botonera);
| // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaProducto.java
import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
setLayout(new GridLayout(4,1));
//referencia creada
opcionesComp = new String[]{"Seleccione...","","","", ""}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
prodComp = new JPanel();
prodComp.setBorder(BorderFactory.createTitledBorder("Componente"));
cajaComp = new JComboBox(opcionesComp); //**//
prodComp.add(cajaComp);
add(prodComp);
//referencia creada
opcionesUdm = new String[]{"Seleccione...","ML","MG","GR", "UI"}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
prodUdm = new JPanel();
prodUdm.setBorder(BorderFactory.createTitledBorder("Unidad de Medida"));
cajaUdm = new JComboBox(opcionesUdm); //**//
prodUdm.add(cajaUdm);
add(prodUdm);
prodCant = new JPanel();
prodCant.setBorder(BorderFactory.createTitledBorder("Cantidad"));
opcionesCant = new JTextField(20);
prodCant.add(opcionesCant);
add(prodCant);
botonera = new Botonera(2);
add(botonera);
| botonera.adherirEscucha(0,new OyenteAceptar(this));
|
xoxefdp/farmacia | src/Vista/VistaProducto.java | // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
| import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
|
//referencia creada
opcionesComp = new String[]{"Seleccione...","","","", ""}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
prodComp = new JPanel();
prodComp.setBorder(BorderFactory.createTitledBorder("Componente"));
cajaComp = new JComboBox(opcionesComp); //**//
prodComp.add(cajaComp);
add(prodComp);
//referencia creada
opcionesUdm = new String[]{"Seleccione...","ML","MG","GR", "UI"}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
prodUdm = new JPanel();
prodUdm.setBorder(BorderFactory.createTitledBorder("Unidad de Medida"));
cajaUdm = new JComboBox(opcionesUdm); //**//
prodUdm.add(cajaUdm);
add(prodUdm);
prodCant = new JPanel();
prodCant.setBorder(BorderFactory.createTitledBorder("Cantidad"));
opcionesCant = new JTextField(20);
prodCant.add(opcionesCant);
add(prodCant);
botonera = new Botonera(2);
add(botonera);
botonera.adherirEscucha(0,new OyenteAceptar(this));
| // Path: src/Control/AceptarCancelar.java
// public interface AceptarCancelar {
//
// public abstract void aceptar();
//
// public abstract void cancelar();
// }
//
// Path: src/Control/CerrarVentana.java
// public interface CerrarVentana {
//
// public abstract void cerrarVentana();
// }
//
// Path: src/Control/OyenteAceptar.java
// public class OyenteAceptar implements ActionListener{
//
// AceptarCancelar eventoAceptar;
//
// public OyenteAceptar(AceptarCancelar accionAceptar){
// eventoAceptar = accionAceptar;
// }
//
// @Override
// public void actionPerformed(ActionEvent ae) {
// eventoAceptar.aceptar();
// }
// }
//
// Path: src/Control/OyenteCancelar.java
// public class OyenteCancelar implements ActionListener{
//
// AceptarCancelar eventoCancelar;
//
// public OyenteCancelar(AceptarCancelar accionCancelar){
// eventoCancelar = accionCancelar;
// }
//
// @Override
// public void actionPerformed(ActionEvent e) {
// eventoCancelar.cancelar();
// }
// }
//
// Path: src/Vista/Formatos/Botonera.java
// public class Botonera extends JPanel{
// JButton[] botones;
// JPanel cuadroBotonera;
//
// public Botonera(int botonesBotonera){
// cuadroBotonera = new JPanel();
// cuadroBotonera.setLayout(new FlowLayout());
//
// if (botonesBotonera == 2) {
// botones = new JButton[2];
// botones[0] = new JButton("Aceptar");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Cancelar");
// cuadroBotonera.add(botones[1]);
// }
// if (botonesBotonera == 3) {
// botones = new JButton[3];
// botones[0] = new JButton("Incluir");
// cuadroBotonera.add(botones[0]);
// botones[1] = new JButton("Modificar");
// cuadroBotonera.add(botones[1]);
// botones[2] = new JButton("Eliminar");
// cuadroBotonera.add(botones[2]);
// }
// add(cuadroBotonera);
// }
//
// public void adherirEscucha(int posBoton, ActionListener escucha){
// if (posBoton >= 0 && posBoton <= 2){
// botones[posBoton].addActionListener(escucha);
// }
// if (posBoton >= 0 && posBoton <= 1){
// botones[posBoton].addActionListener(escucha);
// }
// }
// }
// Path: src/Vista/VistaProducto.java
import Control.AceptarCancelar;
import Control.CerrarVentana;
import Control.OyenteAceptar;
import Control.OyenteCancelar;
import Vista.Formatos.Botonera;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.JTextField;
//referencia creada
opcionesComp = new String[]{"Seleccione...","","","", ""}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
prodComp = new JPanel();
prodComp.setBorder(BorderFactory.createTitledBorder("Componente"));
cajaComp = new JComboBox(opcionesComp); //**//
prodComp.add(cajaComp);
add(prodComp);
//referencia creada
opcionesUdm = new String[]{"Seleccione...","ML","MG","GR", "UI"}; //elemento que se generara
//a partir de los elementos almacenados en la base de datos
prodUdm = new JPanel();
prodUdm.setBorder(BorderFactory.createTitledBorder("Unidad de Medida"));
cajaUdm = new JComboBox(opcionesUdm); //**//
prodUdm.add(cajaUdm);
add(prodUdm);
prodCant = new JPanel();
prodCant.setBorder(BorderFactory.createTitledBorder("Cantidad"));
opcionesCant = new JTextField(20);
prodCant.add(opcionesCant);
add(prodCant);
botonera = new Botonera(2);
add(botonera);
botonera.adherirEscucha(0,new OyenteAceptar(this));
| botonera.adherirEscucha(1,new OyenteCancelar(this));
|
xoxefdp/farmacia | src/Vista/Tablas/TablaDeLaboratorios.java | // Path: src/Vista/Formatos/ModeloDeTabla.java
// public class ModeloDeTabla extends DefaultTableModel{
//
// private ArrayList <Object> data;
// private Object[] nombreColumnas;
// private Object[] claseColumnas;
//
// public ModeloDeTabla(Object[] nombresCampos, Object[] claseColumnas){
// nombreColumnas = nombresCampos;
// data = new ArrayList<>();
// setColumnIdentifiers(nombreColumnas);
// }
//
// @Override
// public Class getColumnClass(int c) {
// return claseColumnas[c].getClass();
// }
// }
| import Vista.Formatos.ModeloDeTabla;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.sql.ResultSet;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableColumn;
| package Vista.Tablas;
/**
*
* @author José Diaz
*/
public class TablaDeLaboratorios extends JPanel{
private Object[] nombreCamposLab, claseCamposLab;
| // Path: src/Vista/Formatos/ModeloDeTabla.java
// public class ModeloDeTabla extends DefaultTableModel{
//
// private ArrayList <Object> data;
// private Object[] nombreColumnas;
// private Object[] claseColumnas;
//
// public ModeloDeTabla(Object[] nombresCampos, Object[] claseColumnas){
// nombreColumnas = nombresCampos;
// data = new ArrayList<>();
// setColumnIdentifiers(nombreColumnas);
// }
//
// @Override
// public Class getColumnClass(int c) {
// return claseColumnas[c].getClass();
// }
// }
// Path: src/Vista/Tablas/TablaDeLaboratorios.java
import Vista.Formatos.ModeloDeTabla;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.sql.ResultSet;
import javax.swing.BorderFactory;
import javax.swing.DefaultCellEditor;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.table.TableColumn;
package Vista.Tablas;
/**
*
* @author José Diaz
*/
public class TablaDeLaboratorios extends JPanel{
private Object[] nombreCamposLab, claseCamposLab;
| private ModeloDeTabla tablaLabDobleColumna;
|
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiResourceLoadingList.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
| import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiResourceLoadingList<U extends GuiElement<U> & Comparable<U>>
extends AbstractGuiResourceLoadingList<GuiResourceLoadingList<U>, U> {
public GuiResourceLoadingList() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiResourceLoadingList.java
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiResourceLoadingList<U extends GuiElement<U> & Comparable<U>>
extends AbstractGuiResourceLoadingList<GuiResourceLoadingList<U>, U> {
public GuiResourceLoadingList() {
}
| public GuiResourceLoadingList(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiNumberField.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiNumberField extends AbstractGuiNumberField<GuiNumberField> {
public GuiNumberField() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiNumberField.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiNumberField extends AbstractGuiNumberField<GuiNumberField> {
public GuiNumberField() {
}
| public GuiNumberField(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiColorPicker.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiColorPicker extends AbstractGuiColorPicker<GuiColorPicker> {
public GuiColorPicker() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiColorPicker.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiColorPicker extends AbstractGuiColorPicker<GuiColorPicker> {
public GuiColorPicker() {
}
| public GuiColorPicker(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiTextArea.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiTextArea extends AbstractGuiTextArea<GuiTextArea> {
public GuiTextArea() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiTextArea.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiTextArea extends AbstractGuiTextArea<GuiTextArea> {
public GuiTextArea() {
}
| public GuiTextArea(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinMouseListener.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/MouseCallback.java
// public interface MouseCallback {
// Event<MouseCallback> EVENT = Event.create((listeners) ->
// new MouseCallback() {
// @Override
// public boolean mouseDown(double x, double y, int button) {
// for (MouseCallback listener : listeners) {
// if (listener.mouseDown(x, y, button)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean mouseDrag(double x, double y, int button, double dx, double dy) {
// for (MouseCallback listener : listeners) {
// if (listener.mouseDrag(x, y, button, dx, dy)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean mouseUp(double x, double y, int button) {
// for (MouseCallback listener : listeners) {
// if (listener.mouseUp(x, y, button)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean mouseScroll(double x, double y, double scroll) {
// for (MouseCallback listener : listeners) {
// if (listener.mouseScroll(x, y, scroll)) {
// return true;
// }
// }
// return false;
// }
// }
// );
//
// boolean mouseDown(double x, double y, int button);
// boolean mouseDrag(double x, double y, int button, double dx, double dy);
// boolean mouseUp(double x, double y, int button);
// boolean mouseScroll(double x, double y, double scroll);
// }
| import de.johni0702.minecraft.gui.versions.callbacks.MouseCallback;
import net.minecraft.client.Mouse;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.gui.Element; | //#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
//#if MC>=11700
//#else
//#endif
@Mixin(Mouse.class)
public abstract class MixinMouseListener {
@Accessor // Note: for some reason Mixin doesn't include this in the refmap json if it's just a @Shadow field
abstract int getActiveButton();
@Inject(method = "method_1611", at = @At("HEAD"), cancellable = true)
//#if MC>=11700
//$$ private static void mouseDown(boolean[] result, Screen screen, double x, double y, int button, CallbackInfo ci) {
//#else
private void mouseDown(boolean[] result, double x, double y, int button, CallbackInfo ci) {
//#endif | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/MouseCallback.java
// public interface MouseCallback {
// Event<MouseCallback> EVENT = Event.create((listeners) ->
// new MouseCallback() {
// @Override
// public boolean mouseDown(double x, double y, int button) {
// for (MouseCallback listener : listeners) {
// if (listener.mouseDown(x, y, button)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean mouseDrag(double x, double y, int button, double dx, double dy) {
// for (MouseCallback listener : listeners) {
// if (listener.mouseDrag(x, y, button, dx, dy)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean mouseUp(double x, double y, int button) {
// for (MouseCallback listener : listeners) {
// if (listener.mouseUp(x, y, button)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean mouseScroll(double x, double y, double scroll) {
// for (MouseCallback listener : listeners) {
// if (listener.mouseScroll(x, y, scroll)) {
// return true;
// }
// }
// return false;
// }
// }
// );
//
// boolean mouseDown(double x, double y, int button);
// boolean mouseDrag(double x, double y, int button, double dx, double dy);
// boolean mouseUp(double x, double y, int button);
// boolean mouseScroll(double x, double y, double scroll);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinMouseListener.java
import de.johni0702.minecraft.gui.versions.callbacks.MouseCallback;
import net.minecraft.client.Mouse;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.gui.Element;
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
//#if MC>=11700
//#else
//#endif
@Mixin(Mouse.class)
public abstract class MixinMouseListener {
@Accessor // Note: for some reason Mixin doesn't include this in the refmap json if it's just a @Shadow field
abstract int getActiveButton();
@Inject(method = "method_1611", at = @At("HEAD"), cancellable = true)
//#if MC>=11700
//$$ private static void mouseDown(boolean[] result, Screen screen, double x, double y, int button, CallbackInfo ci) {
//#else
private void mouseDown(boolean[] result, double x, double y, int button, CallbackInfo ci) {
//#endif | if (MouseCallback.EVENT.invoker().mouseDown(x, y, button)) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinScreen.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
| import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List; | //#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
//#if MC>=11700
//$$ import com.google.common.collect.Collections2;
//$$ import net.minecraft.client.gui.Element;
//#endif
@Mixin(Screen.class)
public class MixinScreen {
//#if MC>=11700
//$$ @Shadow @Final private List<Element> children;
//#else
@Shadow
protected @Final List<AbstractButtonWidget> buttons;
//#endif
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;II)V", at = @At("HEAD"))
private void preInit(MinecraftClient minecraftClient_1, int int_1, int int_2, CallbackInfo ci) { | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
// Path: src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinScreen.java
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.List;
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
//#if MC>=11700
//$$ import com.google.common.collect.Collections2;
//$$ import net.minecraft.client.gui.Element;
//#endif
@Mixin(Screen.class)
public class MixinScreen {
//#if MC>=11700
//$$ @Shadow @Final private List<Element> children;
//#else
@Shadow
protected @Final List<AbstractButtonWidget> buttons;
//#endif
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;II)V", at = @At("HEAD"))
private void preInit(MinecraftClient minecraftClient_1, int int_1, int int_2, CallbackInfo ci) { | InitScreenCallback.Pre.EVENT.invoker().preInitScreen((Screen) (Object) this); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiTimeline.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiTimeline extends AbstractGuiTimeline<GuiTimeline> {
public GuiTimeline() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiTimeline.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiTimeline extends AbstractGuiTimeline<GuiTimeline> {
public GuiTimeline() {
}
| public GuiTimeline(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/layout/CustomLayout.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
| import org.apache.commons.lang3.tuple.Pair;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public abstract class CustomLayout<T extends GuiContainer<T>> implements Layout {
private final Layout parent; | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/layout/CustomLayout.java
import org.apache.commons.lang3.tuple.Pair;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public abstract class CustomLayout<T extends GuiContainer<T>> implements Layout {
private final Layout parent; | private final Map<GuiElement, Pair<Point, Dimension>> result = new LinkedHashMap<>(); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/IGuiTextField.java | // Path: src/main/java/de/johni0702/minecraft/gui/function/Focusable.java
// public interface Focusable<T extends Focusable<T>> {
//
// boolean isFocused();
// T setFocused(boolean focused);
//
// T onFocusChange(Consumer<Boolean> consumer);
//
// Focusable getNext();
// T setNext(Focusable next);
//
// Focusable getPrevious();
// T setPrevious(Focusable previous);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
| import de.johni0702.minecraft.gui.function.Focusable;
import de.johni0702.minecraft.gui.utils.Consumer;
import de.johni0702.minecraft.gui.utils.NonNull;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public interface IGuiTextField<T extends IGuiTextField<T>> extends GuiElement<T>, Focusable<T> {
/**
* Set the text to the specified string.
* If the string is longer than {@link #getMaxLength()} it is truncated from the end.
* This method positions the cursor at the end of the text and removes any selections.
* @param text The new text
* @return {@code this} for chaining
*/
@NonNull T setText(String text);
/**
* Set the text to the specified string.
* If the string is longer than {@link #getMaxLength()} it is truncated from the end.
* This method positions the cursor at the end of the text and removes any selections.
* @param text The language key for the new text
* @param args The arguments used in translating the language key
* @return {@code this} for chaining
*/
@NonNull T setI18nText(String text, Object... args);
/**
* Return the whole text in this text field.
* @return The text, may be empty
*/
@NonNull String getText();
/**
* Return the maximum allowed length of the text in this text field.
* @return Maximum number of characters
*/
int getMaxLength();
/**
* Set the maximum allowed length of the text in this text field.
* If the current test is longer than the new limit, it is truncated from the end (the cursor and selection
* are reset in that process, see {@link #setText(String)}).
* @param maxLength Maximum number of characters
* @return {@code this} for chaining
* @throws IllegalArgumentException When {@code maxLength} is negative
*/
T setMaxLength(int maxLength);
/**
* Deletes the text between {@code from} and {@code to} (inclusive).
* @param from Index at which to start
* @param to Index to which to delete
* @return The deleted text
* @throws IllegalArgumentException If {@code from} is greater than {@code to} or either is out of bounds
*/
@NonNull String deleteText(int from, int to);
/**
* Return the index at which the selection starts (inclusive)
* @return Index of first character
*/
int getSelectionFrom();
/**
* Return the index at which the selection ends (exclusive)
* @return Index after the last character
*/
int getSelectionTo();
/**
* Return the selected text.
* @return The selected text
*/
@NonNull String getSelectedText();
/**
* Delete the selected text. Positions the cursor at the beginning of the selection and clears the selection.
* @return The deleted text
*/
@NonNull String deleteSelectedText();
/**
* Appends the specified string to this text field character by character.
* Excess characters are ignored.
* @param append String to append
* @return {@code this} for chaining
* @see #writeChar(char)
*/
@NonNull T writeText(String append);
/**
* Appends the specified character to this text field replacing the current selection (if any).
* This does nothing if the maximum character limit is reached.
* @param c Character to append
* @return {@code this} for chaining
*/
@NonNull T writeChar(char c);
/**
* Delete the nex character (if any).
* Clears the selection.
* @return {@code this} for chaining
*/
T deleteNextChar();
/**
* Delete everything from the cursor (inclusive) to the beginning of the next word (exclusive).
* If there are no more words, delete everything until the end of the line.
* @return The deleted text
*/
String deleteNextWord();
/**
* Delete the previous character (if any).
* @return {@code this} for chaining
*/
@NonNull T deletePreviousChar();
/**
* Delete everything from cursor to the first character of the previous word (or the start of the line).
* @return The deleted text
*/
@NonNull String deletePreviousWord();
/**
* Set the cursor position.
* @param pos Position of the cursor
* @return {@code this} for chaining
* @throws IllegalArgumentException If {@code pos} < 0 or pos > length
*/
@NonNull T setCursorPosition(int pos);
T onEnter(Runnable onEnter); | // Path: src/main/java/de/johni0702/minecraft/gui/function/Focusable.java
// public interface Focusable<T extends Focusable<T>> {
//
// boolean isFocused();
// T setFocused(boolean focused);
//
// T onFocusChange(Consumer<Boolean> consumer);
//
// Focusable getNext();
// T setNext(Focusable next);
//
// Focusable getPrevious();
// T setPrevious(Focusable previous);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/IGuiTextField.java
import de.johni0702.minecraft.gui.function.Focusable;
import de.johni0702.minecraft.gui.utils.Consumer;
import de.johni0702.minecraft.gui.utils.NonNull;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public interface IGuiTextField<T extends IGuiTextField<T>> extends GuiElement<T>, Focusable<T> {
/**
* Set the text to the specified string.
* If the string is longer than {@link #getMaxLength()} it is truncated from the end.
* This method positions the cursor at the end of the text and removes any selections.
* @param text The new text
* @return {@code this} for chaining
*/
@NonNull T setText(String text);
/**
* Set the text to the specified string.
* If the string is longer than {@link #getMaxLength()} it is truncated from the end.
* This method positions the cursor at the end of the text and removes any selections.
* @param text The language key for the new text
* @param args The arguments used in translating the language key
* @return {@code this} for chaining
*/
@NonNull T setI18nText(String text, Object... args);
/**
* Return the whole text in this text field.
* @return The text, may be empty
*/
@NonNull String getText();
/**
* Return the maximum allowed length of the text in this text field.
* @return Maximum number of characters
*/
int getMaxLength();
/**
* Set the maximum allowed length of the text in this text field.
* If the current test is longer than the new limit, it is truncated from the end (the cursor and selection
* are reset in that process, see {@link #setText(String)}).
* @param maxLength Maximum number of characters
* @return {@code this} for chaining
* @throws IllegalArgumentException When {@code maxLength} is negative
*/
T setMaxLength(int maxLength);
/**
* Deletes the text between {@code from} and {@code to} (inclusive).
* @param from Index at which to start
* @param to Index to which to delete
* @return The deleted text
* @throws IllegalArgumentException If {@code from} is greater than {@code to} or either is out of bounds
*/
@NonNull String deleteText(int from, int to);
/**
* Return the index at which the selection starts (inclusive)
* @return Index of first character
*/
int getSelectionFrom();
/**
* Return the index at which the selection ends (exclusive)
* @return Index after the last character
*/
int getSelectionTo();
/**
* Return the selected text.
* @return The selected text
*/
@NonNull String getSelectedText();
/**
* Delete the selected text. Positions the cursor at the beginning of the selection and clears the selection.
* @return The deleted text
*/
@NonNull String deleteSelectedText();
/**
* Appends the specified string to this text field character by character.
* Excess characters are ignored.
* @param append String to append
* @return {@code this} for chaining
* @see #writeChar(char)
*/
@NonNull T writeText(String append);
/**
* Appends the specified character to this text field replacing the current selection (if any).
* This does nothing if the maximum character limit is reached.
* @param c Character to append
* @return {@code this} for chaining
*/
@NonNull T writeChar(char c);
/**
* Delete the nex character (if any).
* Clears the selection.
* @return {@code this} for chaining
*/
T deleteNextChar();
/**
* Delete everything from the cursor (inclusive) to the beginning of the next word (exclusive).
* If there are no more words, delete everything until the end of the line.
* @return The deleted text
*/
String deleteNextWord();
/**
* Delete the previous character (if any).
* @return {@code this} for chaining
*/
@NonNull T deletePreviousChar();
/**
* Delete everything from cursor to the first character of the previous word (or the start of the line).
* @return The deleted text
*/
@NonNull String deletePreviousWord();
/**
* Set the cursor position.
* @param pos Position of the cursor
* @return {@code this} for chaining
* @throws IllegalArgumentException If {@code pos} < 0 or pos > length
*/
@NonNull T setCursorPosition(int pos);
T onEnter(Runnable onEnter); | T onTextChanged(Consumer<String> textChanged); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/IGuiColorPicker.java | // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
| import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.Consumer;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public interface IGuiColorPicker<T extends IGuiColorPicker<T>> extends GuiElement<T> {
T setColor(ReadableColor color);
ReadableColor getColor();
T setOpened(boolean opened);
boolean isOpened();
| // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/IGuiColorPicker.java
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.Consumer;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public interface IGuiColorPicker<T extends IGuiColorPicker<T>> extends GuiElement<T> {
T setColor(ReadableColor color);
ReadableColor getColor();
T setOpened(boolean opened);
boolean isOpened();
| T onSelection(Consumer<ReadableColor> consumer); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/AbstractComposedGuiElement.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer;
import java.util.function.BiFunction;
import java.util.function.Function; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public abstract class AbstractComposedGuiElement<T extends AbstractComposedGuiElement<T>>
extends AbstractGuiElement<T> implements ComposedGuiElement<T> {
public AbstractComposedGuiElement() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/AbstractComposedGuiElement.java
import de.johni0702.minecraft.gui.container.GuiContainer;
import java.util.function.BiFunction;
import java.util.function.Function;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public abstract class AbstractComposedGuiElement<T extends AbstractComposedGuiElement<T>>
extends AbstractGuiElement<T> implements ComposedGuiElement<T> {
public AbstractComposedGuiElement() {
}
| public AbstractComposedGuiElement(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiTextField.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiTextField extends AbstractGuiTextField<GuiTextField> {
public GuiTextField() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiTextField.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiTextField extends AbstractGuiTextField<GuiTextField> {
public GuiTextField() {
}
| public GuiTextField(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinMinecraft.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
| import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | // Note: this will also work in 1.13 but we don't really support 1.13 and MixinGradle is yet to be updated
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
@Mixin(MinecraftClient.class)
public abstract class MixinMinecraft {
@Inject(method = "tick", at = @At("HEAD"))
private void preTick(CallbackInfo ci) { | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
// Path: src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinMinecraft.java
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
// Note: this will also work in 1.13 but we don't really support 1.13 and MixinGradle is yet to be updated
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
@Mixin(MinecraftClient.class)
public abstract class MixinMinecraft {
@Inject(method = "tick", at = @At("HEAD"))
private void preTick(CallbackInfo ci) { | PreTickCallback.EVENT.invoker().preTick(); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinMinecraft.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
| import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | // Note: this will also work in 1.13 but we don't really support 1.13 and MixinGradle is yet to be updated
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
@Mixin(MinecraftClient.class)
public abstract class MixinMinecraft {
@Inject(method = "tick", at = @At("HEAD"))
private void preTick(CallbackInfo ci) {
PreTickCallback.EVENT.invoker().preTick();
}
@Inject(method = "openScreen", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;"))
private void openGuiScreen(Screen newGuiScreen, CallbackInfo ci) { | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
// Path: src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinMinecraft.java
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
// Note: this will also work in 1.13 but we don't really support 1.13 and MixinGradle is yet to be updated
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
@Mixin(MinecraftClient.class)
public abstract class MixinMinecraft {
@Inject(method = "tick", at = @At("HEAD"))
private void preTick(CallbackInfo ci) {
PreTickCallback.EVENT.invoker().preTick();
}
@Inject(method = "openScreen", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;currentScreen:Lnet/minecraft/client/gui/screen/Screen;"))
private void openGuiScreen(Screen newGuiScreen, CallbackInfo ci) { | OpenGuiScreenCallback.EVENT.invoker().openGuiScreen(newGuiScreen); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/versions/mixin/Mixin_RenderHudCallback.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
| import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | //#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
@Mixin(InGameHud.class)
public class Mixin_RenderHudCallback {
@Inject(
method = "render",
at = @At(
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/client/options/GameOptions;debugEnabled:Z"
)
)
//#if MC>=11600
private void renderOverlay(MatrixStack stack, float partialTicks, CallbackInfo ci) {
//#else
//$$ private void renderOverlay(float partialTicks, CallbackInfo ci) {
//$$ MatrixStack stack = new MatrixStack();
//#endif | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/versions/mixin/Mixin_RenderHudCallback.java
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
@Mixin(InGameHud.class)
public class Mixin_RenderHudCallback {
@Inject(
method = "render",
at = @At(
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/client/options/GameOptions;debugEnabled:Z"
)
)
//#if MC>=11600
private void renderOverlay(MatrixStack stack, float partialTicks, CallbackInfo ci) {
//#else
//$$ private void renderOverlay(float partialTicks, CallbackInfo ci) {
//$$ MatrixStack stack = new MatrixStack();
//#endif | RenderHudCallback.EVENT.invoker().renderHud(stack, partialTicks); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiDropdownMenu.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiDropdownMenu<V> extends AbstractGuiDropdownMenu<V, GuiDropdownMenu<V>> {
public GuiDropdownMenu() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiDropdownMenu.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiDropdownMenu<V> extends AbstractGuiDropdownMenu<V, GuiDropdownMenu<V>> {
public GuiDropdownMenu() {
}
| public GuiDropdownMenu(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/IGuiDropdownMenu.java | // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/IGuiClickable.java
// public interface IGuiClickable<T extends IGuiClickable<T>> extends GuiElement<T> {
// T onClick(Runnable onClick);
// Runnable getOnClick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
| import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.element.IGuiClickable;
import de.johni0702.minecraft.gui.utils.Consumer;
import java.util.Map;
import java.util.function.Function; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public interface IGuiDropdownMenu<V, T extends IGuiDropdownMenu<V, T>> extends GuiElement<T> {
T setValues(V... values);
T setSelected(int selected);
T setSelected(V value);
V getSelectedValue();
T setOpened(boolean opened);
int getSelected();
V[] getValues();
boolean isOpened();
| // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/IGuiClickable.java
// public interface IGuiClickable<T extends IGuiClickable<T>> extends GuiElement<T> {
// T onClick(Runnable onClick);
// Runnable getOnClick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/IGuiDropdownMenu.java
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.element.IGuiClickable;
import de.johni0702.minecraft.gui.utils.Consumer;
import java.util.Map;
import java.util.function.Function;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public interface IGuiDropdownMenu<V, T extends IGuiDropdownMenu<V, T>> extends GuiElement<T> {
T setValues(V... values);
T setSelected(int selected);
T setSelected(V value);
V getSelectedValue();
T setOpened(boolean opened);
int getSelected();
V[] getValues();
boolean isOpened();
| T onSelection(Consumer<Integer> consumer); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/IGuiDropdownMenu.java | // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/IGuiClickable.java
// public interface IGuiClickable<T extends IGuiClickable<T>> extends GuiElement<T> {
// T onClick(Runnable onClick);
// Runnable getOnClick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
| import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.element.IGuiClickable;
import de.johni0702.minecraft.gui.utils.Consumer;
import java.util.Map;
import java.util.function.Function; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public interface IGuiDropdownMenu<V, T extends IGuiDropdownMenu<V, T>> extends GuiElement<T> {
T setValues(V... values);
T setSelected(int selected);
T setSelected(V value);
V getSelectedValue();
T setOpened(boolean opened);
int getSelected();
V[] getValues();
boolean isOpened();
T onSelection(Consumer<Integer> consumer);
/**
* Returns an unmodifiable map of values with their GUI elements.
* The GUI elements may be modified.<br>
* The returned map is only valid until {@link #setValues(Object[])} is
* called, at which point new GUI elements are created.<br>
* This may return null if {@link #setValues(Object[])} has not yet been called.
* @return Unmodifiable, ordered map of entries
*/ | // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/IGuiClickable.java
// public interface IGuiClickable<T extends IGuiClickable<T>> extends GuiElement<T> {
// T onClick(Runnable onClick);
// Runnable getOnClick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/IGuiDropdownMenu.java
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.element.IGuiClickable;
import de.johni0702.minecraft.gui.utils.Consumer;
import java.util.Map;
import java.util.function.Function;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public interface IGuiDropdownMenu<V, T extends IGuiDropdownMenu<V, T>> extends GuiElement<T> {
T setValues(V... values);
T setSelected(int selected);
T setSelected(V value);
V getSelectedValue();
T setOpened(boolean opened);
int getSelected();
V[] getValues();
boolean isOpened();
T onSelection(Consumer<Integer> consumer);
/**
* Returns an unmodifiable map of values with their GUI elements.
* The GUI elements may be modified.<br>
* The returned map is only valid until {@link #setValues(Object[])} is
* called, at which point new GUI elements are created.<br>
* This may return null if {@link #setValues(Object[])} has not yet been called.
* @return Unmodifiable, ordered map of entries
*/ | Map<V, IGuiClickable> getDropdownEntries(); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiHorizontalScrollbar.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiHorizontalScrollbar extends AbstractGuiHorizontalScrollbar<GuiHorizontalScrollbar> {
public GuiHorizontalScrollbar() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiHorizontalScrollbar.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiHorizontalScrollbar extends AbstractGuiHorizontalScrollbar<GuiHorizontalScrollbar> {
public GuiHorizontalScrollbar() {
}
| public GuiHorizontalScrollbar(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/utils/Utils.java | // Path: src/main/java/de/johni0702/minecraft/gui/GuiRenderer.java
// public interface GuiRenderer {
//
// ReadablePoint getOpenGlOffset();
//
// MatrixStack getMatrixStack();
//
// ReadableDimension getSize();
//
// void setDrawingArea(int x, int y, int width, int height);
//
// void bindTexture(Identifier location);
//
// void bindTexture(int glId);
//
// void drawTexturedRect(int x, int y, int u, int v, int width, int height);
//
// void drawTexturedRect(int x, int y, int u, int v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight);
//
// void drawRect(int x, int y, int width, int height, int color);
//
// void drawRect(int x, int y, int width, int height, ReadableColor color);
//
// void drawRect(int x, int y, int width, int height, int topLeftColor, int topRightColor, int bottomLeftColor, int bottomRightColor);
//
// void drawRect(int x, int y, int width, int height, ReadableColor topLeftColor, ReadableColor topRightColor, ReadableColor bottomLeftColor, ReadableColor bottomRightColor);
//
// int drawString(int x, int y, int color, String text);
//
// int drawString(int x, int y, ReadableColor color, String text);
//
// int drawCenteredString(int x, int y, int color, String text);
//
// int drawCenteredString(int x, int y, ReadableColor color, String text);
//
// int drawString(int x, int y, int color, String text, boolean shadow);
//
// int drawString(int x, int y, ReadableColor color, String text, boolean shadow);
//
// int drawCenteredString(int x, int y, int color, String text, boolean shadow);
//
// int drawCenteredString(int x, int y, ReadableColor color, String text, boolean shadow);
//
// /**
// * Inverts all colors on the screen.
// * @param right Right border of the inverted rectangle
// * @param bottom Bottom border of the inverted rectangle
// * @param left Left border of the inverted rectangle
// * @param top Top border of the inverted rectangle
// */
// void invertColors(int right, int bottom, int left, int top);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/function/Focusable.java
// public interface Focusable<T extends Focusable<T>> {
//
// boolean isFocused();
// T setFocused(boolean focused);
//
// T onFocusChange(Consumer<Boolean> consumer);
//
// Focusable getNext();
// T setNext(Focusable next);
//
// Focusable getPrevious();
// T setPrevious(Focusable previous);
//
// }
| import static com.google.common.base.Preconditions.checkArgument;
import de.johni0702.minecraft.gui.GuiRenderer;
import de.johni0702.minecraft.gui.function.Focusable;
import java.util.Arrays;
import java.util.HashSet; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.utils;
public class Utils {
/**
* Interval (in ms) within which two clicks have to be made on the same element to be counted as a double click.
*/
public static final int DOUBLE_CLICK_INTERVAL = 250;
/**
* Link the specified focusable compontents in the order they're supplied.
* @param focusables Focusables to link
* @see Focusable#setNext(Focusable)
* @see Focusable#setPrevious(Focusable)
*/ | // Path: src/main/java/de/johni0702/minecraft/gui/GuiRenderer.java
// public interface GuiRenderer {
//
// ReadablePoint getOpenGlOffset();
//
// MatrixStack getMatrixStack();
//
// ReadableDimension getSize();
//
// void setDrawingArea(int x, int y, int width, int height);
//
// void bindTexture(Identifier location);
//
// void bindTexture(int glId);
//
// void drawTexturedRect(int x, int y, int u, int v, int width, int height);
//
// void drawTexturedRect(int x, int y, int u, int v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight);
//
// void drawRect(int x, int y, int width, int height, int color);
//
// void drawRect(int x, int y, int width, int height, ReadableColor color);
//
// void drawRect(int x, int y, int width, int height, int topLeftColor, int topRightColor, int bottomLeftColor, int bottomRightColor);
//
// void drawRect(int x, int y, int width, int height, ReadableColor topLeftColor, ReadableColor topRightColor, ReadableColor bottomLeftColor, ReadableColor bottomRightColor);
//
// int drawString(int x, int y, int color, String text);
//
// int drawString(int x, int y, ReadableColor color, String text);
//
// int drawCenteredString(int x, int y, int color, String text);
//
// int drawCenteredString(int x, int y, ReadableColor color, String text);
//
// int drawString(int x, int y, int color, String text, boolean shadow);
//
// int drawString(int x, int y, ReadableColor color, String text, boolean shadow);
//
// int drawCenteredString(int x, int y, int color, String text, boolean shadow);
//
// int drawCenteredString(int x, int y, ReadableColor color, String text, boolean shadow);
//
// /**
// * Inverts all colors on the screen.
// * @param right Right border of the inverted rectangle
// * @param bottom Bottom border of the inverted rectangle
// * @param left Left border of the inverted rectangle
// * @param top Top border of the inverted rectangle
// */
// void invertColors(int right, int bottom, int left, int top);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/function/Focusable.java
// public interface Focusable<T extends Focusable<T>> {
//
// boolean isFocused();
// T setFocused(boolean focused);
//
// T onFocusChange(Consumer<Boolean> consumer);
//
// Focusable getNext();
// T setNext(Focusable next);
//
// Focusable getPrevious();
// T setPrevious(Focusable previous);
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Utils.java
import static com.google.common.base.Preconditions.checkArgument;
import de.johni0702.minecraft.gui.GuiRenderer;
import de.johni0702.minecraft.gui.function.Focusable;
import java.util.Arrays;
import java.util.HashSet;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.utils;
public class Utils {
/**
* Interval (in ms) within which two clicks have to be made on the same element to be counted as a double click.
*/
public static final int DOUBLE_CLICK_INTERVAL = 250;
/**
* Link the specified focusable compontents in the order they're supplied.
* @param focusables Focusables to link
* @see Focusable#setNext(Focusable)
* @see Focusable#setPrevious(Focusable)
*/ | public static void link(Focusable... focusables) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/utils/Utils.java | // Path: src/main/java/de/johni0702/minecraft/gui/GuiRenderer.java
// public interface GuiRenderer {
//
// ReadablePoint getOpenGlOffset();
//
// MatrixStack getMatrixStack();
//
// ReadableDimension getSize();
//
// void setDrawingArea(int x, int y, int width, int height);
//
// void bindTexture(Identifier location);
//
// void bindTexture(int glId);
//
// void drawTexturedRect(int x, int y, int u, int v, int width, int height);
//
// void drawTexturedRect(int x, int y, int u, int v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight);
//
// void drawRect(int x, int y, int width, int height, int color);
//
// void drawRect(int x, int y, int width, int height, ReadableColor color);
//
// void drawRect(int x, int y, int width, int height, int topLeftColor, int topRightColor, int bottomLeftColor, int bottomRightColor);
//
// void drawRect(int x, int y, int width, int height, ReadableColor topLeftColor, ReadableColor topRightColor, ReadableColor bottomLeftColor, ReadableColor bottomRightColor);
//
// int drawString(int x, int y, int color, String text);
//
// int drawString(int x, int y, ReadableColor color, String text);
//
// int drawCenteredString(int x, int y, int color, String text);
//
// int drawCenteredString(int x, int y, ReadableColor color, String text);
//
// int drawString(int x, int y, int color, String text, boolean shadow);
//
// int drawString(int x, int y, ReadableColor color, String text, boolean shadow);
//
// int drawCenteredString(int x, int y, int color, String text, boolean shadow);
//
// int drawCenteredString(int x, int y, ReadableColor color, String text, boolean shadow);
//
// /**
// * Inverts all colors on the screen.
// * @param right Right border of the inverted rectangle
// * @param bottom Bottom border of the inverted rectangle
// * @param left Left border of the inverted rectangle
// * @param top Top border of the inverted rectangle
// */
// void invertColors(int right, int bottom, int left, int top);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/function/Focusable.java
// public interface Focusable<T extends Focusable<T>> {
//
// boolean isFocused();
// T setFocused(boolean focused);
//
// T onFocusChange(Consumer<Boolean> consumer);
//
// Focusable getNext();
// T setNext(Focusable next);
//
// Focusable getPrevious();
// T setPrevious(Focusable previous);
//
// }
| import static com.google.common.base.Preconditions.checkArgument;
import de.johni0702.minecraft.gui.GuiRenderer;
import de.johni0702.minecraft.gui.function.Focusable;
import java.util.Arrays;
import java.util.HashSet; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.utils;
public class Utils {
/**
* Interval (in ms) within which two clicks have to be made on the same element to be counted as a double click.
*/
public static final int DOUBLE_CLICK_INTERVAL = 250;
/**
* Link the specified focusable compontents in the order they're supplied.
* @param focusables Focusables to link
* @see Focusable#setNext(Focusable)
* @see Focusable#setPrevious(Focusable)
*/
public static void link(Focusable... focusables) {
checkArgument(new HashSet<>(Arrays.asList(focusables)).size() == focusables.length, "focusables must be unique and not null");
for (int i = 0; i < focusables.length; i++) {
Focusable next = focusables[(i + 1) % focusables.length];
focusables[i].setNext(next);
next.setPrevious(focusables[i]);
}
}
| // Path: src/main/java/de/johni0702/minecraft/gui/GuiRenderer.java
// public interface GuiRenderer {
//
// ReadablePoint getOpenGlOffset();
//
// MatrixStack getMatrixStack();
//
// ReadableDimension getSize();
//
// void setDrawingArea(int x, int y, int width, int height);
//
// void bindTexture(Identifier location);
//
// void bindTexture(int glId);
//
// void drawTexturedRect(int x, int y, int u, int v, int width, int height);
//
// void drawTexturedRect(int x, int y, int u, int v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight);
//
// void drawRect(int x, int y, int width, int height, int color);
//
// void drawRect(int x, int y, int width, int height, ReadableColor color);
//
// void drawRect(int x, int y, int width, int height, int topLeftColor, int topRightColor, int bottomLeftColor, int bottomRightColor);
//
// void drawRect(int x, int y, int width, int height, ReadableColor topLeftColor, ReadableColor topRightColor, ReadableColor bottomLeftColor, ReadableColor bottomRightColor);
//
// int drawString(int x, int y, int color, String text);
//
// int drawString(int x, int y, ReadableColor color, String text);
//
// int drawCenteredString(int x, int y, int color, String text);
//
// int drawCenteredString(int x, int y, ReadableColor color, String text);
//
// int drawString(int x, int y, int color, String text, boolean shadow);
//
// int drawString(int x, int y, ReadableColor color, String text, boolean shadow);
//
// int drawCenteredString(int x, int y, int color, String text, boolean shadow);
//
// int drawCenteredString(int x, int y, ReadableColor color, String text, boolean shadow);
//
// /**
// * Inverts all colors on the screen.
// * @param right Right border of the inverted rectangle
// * @param bottom Bottom border of the inverted rectangle
// * @param left Left border of the inverted rectangle
// * @param top Top border of the inverted rectangle
// */
// void invertColors(int right, int bottom, int left, int top);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/function/Focusable.java
// public interface Focusable<T extends Focusable<T>> {
//
// boolean isFocused();
// T setFocused(boolean focused);
//
// T onFocusChange(Consumer<Boolean> consumer);
//
// Focusable getNext();
// T setNext(Focusable next);
//
// Focusable getPrevious();
// T setPrevious(Focusable previous);
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/utils/Utils.java
import static com.google.common.base.Preconditions.checkArgument;
import de.johni0702.minecraft.gui.GuiRenderer;
import de.johni0702.minecraft.gui.function.Focusable;
import java.util.Arrays;
import java.util.HashSet;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.utils;
public class Utils {
/**
* Interval (in ms) within which two clicks have to be made on the same element to be counted as a double click.
*/
public static final int DOUBLE_CLICK_INTERVAL = 250;
/**
* Link the specified focusable compontents in the order they're supplied.
* @param focusables Focusables to link
* @see Focusable#setNext(Focusable)
* @see Focusable#setPrevious(Focusable)
*/
public static void link(Focusable... focusables) {
checkArgument(new HashSet<>(Arrays.asList(focusables)).size() == focusables.length, "focusables must be unique and not null");
for (int i = 0; i < focusables.length; i++) {
Focusable next = focusables[(i + 1) % focusables.length];
focusables[i].setNext(next);
next.setPrevious(focusables[i]);
}
}
| public static void drawDynamicRect(GuiRenderer renderer, int width, int height, int u, int v, int uWidth, int vHeight, |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiLabel.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiLabel extends AbstractGuiLabel<GuiLabel> {
public GuiLabel() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiLabel.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiLabel extends AbstractGuiLabel<GuiLabel> {
public GuiLabel() {
}
| public GuiLabel(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiToggleButton.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiToggleButton<V> extends AbstractGuiToggleButton<V, GuiToggleButton<V>> {
public GuiToggleButton() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiToggleButton.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiToggleButton<V> extends AbstractGuiToggleButton<V, GuiToggleButton<V>> {
public GuiToggleButton() {
}
| public GuiToggleButton(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/layout/HorizontalLayout.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
| import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class HorizontalLayout implements Layout {
private static final Data DEFAULT_DATA = new Data(0);
private final Alignment alignment;
private int spacing;
public HorizontalLayout() {
this(Alignment.LEFT);
}
public HorizontalLayout(Alignment alignment) {
this.alignment = alignment;
}
@Override | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/layout/HorizontalLayout.java
import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class HorizontalLayout implements Layout {
private static final Data DEFAULT_DATA = new Data(0);
private final Alignment alignment;
private int spacing;
public HorizontalLayout() {
this(Alignment.LEFT);
}
public HorizontalLayout(Alignment alignment) {
this.alignment = alignment;
}
@Override | public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/layout/HorizontalLayout.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
| import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class HorizontalLayout implements Layout {
private static final Data DEFAULT_DATA = new Data(0);
private final Alignment alignment;
private int spacing;
public HorizontalLayout() {
this(Alignment.LEFT);
}
public HorizontalLayout(Alignment alignment) {
this.alignment = alignment;
}
@Override | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/layout/HorizontalLayout.java
import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class HorizontalLayout implements Layout {
private static final Data DEFAULT_DATA = new Data(0);
private final Alignment alignment;
private int spacing;
public HorizontalLayout() {
this(Alignment.LEFT);
}
public HorizontalLayout(Alignment alignment) {
this.alignment = alignment;
}
@Override | public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiImage.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiImage extends AbstractGuiImage<GuiImage> {
public GuiImage() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiImage.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiImage extends AbstractGuiImage<GuiImage> {
public GuiImage() {
}
| public GuiImage(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/layout/GridLayout.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
| import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import com.google.common.base.Preconditions;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class GridLayout implements Layout {
private static final Data DEFAULT_DATA = new Data();
private int columns;
private int spacingX, spacingY;
private boolean cellsEqualSize = true;
@Override | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/layout/GridLayout.java
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import com.google.common.base.Preconditions;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class GridLayout implements Layout {
private static final Data DEFAULT_DATA = new Data();
private int columns;
private int spacingX, spacingY;
private boolean cellsEqualSize = true;
@Override | public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/layout/GridLayout.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
| import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import com.google.common.base.Preconditions;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class GridLayout implements Layout {
private static final Data DEFAULT_DATA = new Data();
private int columns;
private int spacingX, spacingY;
private boolean cellsEqualSize = true;
@Override | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/layout/GridLayout.java
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
import org.apache.commons.lang3.tuple.Pair;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import com.google.common.base.Preconditions;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class GridLayout implements Layout {
private static final Data DEFAULT_DATA = new Data();
private int columns;
private int spacingX, spacingY;
private boolean cellsEqualSize = true;
@Override | public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/container/GuiPanel.java | // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
//
// Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
//
// ReadableDimension calcMinSize(GuiContainer<?> container);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
// LayoutData NONE = VoidLayoutData.INSTANCE;
// }
| import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import java.util.ArrayList;
import java.util.Map; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.container;
public class GuiPanel extends AbstractGuiContainer<GuiPanel> {
public GuiPanel() {
}
public GuiPanel(GuiContainer container) {
super(container);
}
| // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
//
// Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
//
// ReadableDimension calcMinSize(GuiContainer<?> container);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
// LayoutData NONE = VoidLayoutData.INSTANCE;
// }
// Path: src/main/java/de/johni0702/minecraft/gui/container/GuiPanel.java
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import java.util.ArrayList;
import java.util.Map;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.container;
public class GuiPanel extends AbstractGuiContainer<GuiPanel> {
public GuiPanel() {
}
public GuiPanel(GuiContainer container) {
super(container);
}
| GuiPanel(Layout layout, int width , int height, Map<GuiElement, LayoutData> withElements) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/container/GuiPanel.java | // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
//
// Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
//
// ReadableDimension calcMinSize(GuiContainer<?> container);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
// LayoutData NONE = VoidLayoutData.INSTANCE;
// }
| import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import java.util.ArrayList;
import java.util.Map; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.container;
public class GuiPanel extends AbstractGuiContainer<GuiPanel> {
public GuiPanel() {
}
public GuiPanel(GuiContainer container) {
super(container);
}
| // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
//
// Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
//
// ReadableDimension calcMinSize(GuiContainer<?> container);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
// LayoutData NONE = VoidLayoutData.INSTANCE;
// }
// Path: src/main/java/de/johni0702/minecraft/gui/container/GuiPanel.java
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import java.util.ArrayList;
import java.util.Map;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.container;
public class GuiPanel extends AbstractGuiContainer<GuiPanel> {
public GuiPanel() {
}
public GuiPanel(GuiContainer container) {
super(container);
}
| GuiPanel(Layout layout, int width , int height, Map<GuiElement, LayoutData> withElements) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/container/GuiPanel.java | // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
//
// Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
//
// ReadableDimension calcMinSize(GuiContainer<?> container);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
// LayoutData NONE = VoidLayoutData.INSTANCE;
// }
| import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import java.util.ArrayList;
import java.util.Map; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.container;
public class GuiPanel extends AbstractGuiContainer<GuiPanel> {
public GuiPanel() {
}
public GuiPanel(GuiContainer container) {
super(container);
}
| // Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
//
// Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
//
// ReadableDimension calcMinSize(GuiContainer<?> container);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
// LayoutData NONE = VoidLayoutData.INSTANCE;
// }
// Path: src/main/java/de/johni0702/minecraft/gui/container/GuiPanel.java
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import java.util.ArrayList;
import java.util.Map;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.container;
public class GuiPanel extends AbstractGuiContainer<GuiPanel> {
public GuiPanel() {
}
public GuiPanel(GuiContainer container) {
super(container);
}
| GuiPanel(Layout layout, int width , int height, Map<GuiElement, LayoutData> withElements) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinGameRenderer.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
| import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | //#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
@Mixin(GameRenderer.class)
public class MixinGameRenderer {
@Inject(
method = "render",
at = @At(
value = "INVOKE",
//#if MC>=11600
target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V",
//#else
//$$ target = "Lnet/minecraft/client/gui/screen/Screen;render(IIF)V",
//#endif
shift = At.Shift.AFTER
)
)
private void postRenderScreen(float partialTicks, long nanoTime, boolean renderWorld, CallbackInfo ci) {
MatrixStack stack = new MatrixStack(); | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinGameRenderer.java
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
@Mixin(GameRenderer.class)
public class MixinGameRenderer {
@Inject(
method = "render",
at = @At(
value = "INVOKE",
//#if MC>=11600
target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V",
//#else
//$$ target = "Lnet/minecraft/client/gui/screen/Screen;render(IIF)V",
//#endif
shift = At.Shift.AFTER
)
)
private void postRenderScreen(float partialTicks, long nanoTime, boolean renderWorld, CallbackInfo ci) {
MatrixStack stack = new MatrixStack(); | PostRenderScreenCallback.EVENT.invoker().postRenderScreen(stack, partialTicks); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/layout/VerticalLayout.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
| import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class VerticalLayout implements Layout {
private static final Data DEFAULT_DATA = new Data(0);
private final Alignment alignment;
private int spacing;
public VerticalLayout() {
this(Alignment.TOP);
}
public VerticalLayout(Alignment alignment) {
this.alignment = alignment;
}
@Override | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/layout/VerticalLayout.java
import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class VerticalLayout implements Layout {
private static final Data DEFAULT_DATA = new Data(0);
private final Alignment alignment;
private int spacing;
public VerticalLayout() {
this(Alignment.TOP);
}
public VerticalLayout(Alignment alignment) {
this.alignment = alignment;
}
@Override | public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/layout/VerticalLayout.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
| import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class VerticalLayout implements Layout {
private static final Data DEFAULT_DATA = new Data(0);
private final Alignment alignment;
private int spacing;
public VerticalLayout() {
this(Alignment.TOP);
}
public VerticalLayout(Alignment alignment) {
this.alignment = alignment;
}
@Override | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
// Path: src/main/java/de/johni0702/minecraft/gui/layout/VerticalLayout.java
import org.apache.commons.lang3.tuple.Pair;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Objects;
import de.johni0702.minecraft.gui.container.GuiContainer;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.utils.lwjgl.Dimension;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.layout;
public class VerticalLayout implements Layout {
private static final Data DEFAULT_DATA = new Data(0);
private final Alignment alignment;
private int spacing;
public VerticalLayout() {
this(Alignment.TOP);
}
public VerticalLayout(Alignment alignment) {
this.alignment = alignment;
}
@Override | public Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiButton.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiButton extends AbstractGuiButton<GuiButton> {
public GuiButton() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiButton.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiButton extends AbstractGuiButton<GuiButton> {
public GuiButton() {
}
| public GuiButton(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiProgressBar.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiProgressBar extends AbstractGuiProgressBar<GuiProgressBar> {
public GuiProgressBar() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiProgressBar.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiProgressBar extends AbstractGuiProgressBar<GuiProgressBar> {
public GuiProgressBar() {
}
| public GuiProgressBar(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiSlider.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiSlider extends AbstractGuiSlider<GuiSlider> {
public GuiSlider() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiSlider.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiSlider extends AbstractGuiSlider<GuiSlider> {
public GuiSlider() {
}
| public GuiSlider(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiCheckbox.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiCheckbox extends AbstractGuiCheckbox<GuiCheckbox> {
public GuiCheckbox() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiCheckbox.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiCheckbox extends AbstractGuiCheckbox<GuiCheckbox> {
public GuiCheckbox() {
}
| public GuiCheckbox(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinKeyboardListener.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/KeyboardCallback.java
// public interface KeyboardCallback {
// Event<KeyboardCallback> EVENT = Event.create((listeners) ->
// new KeyboardCallback() {
// @Override
// public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
// for (KeyboardCallback listener : listeners) {
// if (listener.keyPressed(keyCode, scanCode, modifiers)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
// for (KeyboardCallback listener : listeners) {
// if (listener.keyReleased(keyCode, scanCode, modifiers)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean charTyped(char charCode, int scanCode) {
// for (KeyboardCallback listener : listeners) {
// if (listener.charTyped(charCode, scanCode)) {
// return true;
// }
// }
// return false;
// }
// }
// );
//
// boolean keyPressed(int keyCode, int scanCode, int modifiers);
// boolean keyReleased(int keyCode, int scanCode, int modifiers);
// boolean charTyped(char keyChar, int scanCode);
// }
| import de.johni0702.minecraft.gui.versions.callbacks.KeyboardCallback;
import net.minecraft.client.Keyboard;
import net.minecraft.client.gui.Element;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.gui.ParentElement; | //#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
//#if MC>=11700
//$$ import net.minecraft.client.gui.screen.Screen;
//#else
//#endif
@Mixin(Keyboard.class)
public class MixinKeyboardListener {
@Inject(
method = "method_1454",
//#if MC>=11700
//$$ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyPressed(III)Z"),
//#else
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ParentElement;keyPressed(III)Z"),
//#endif
cancellable = true
)
//#if MC>=11700
//$$ private void keyPressed(int i, Screen screen, boolean[] bls, int keyCode, int scanCode, int modifiers, CallbackInfo ci) {
//#else
private void keyPressed(int i, boolean[] bls, ParentElement element, int keyCode, int scanCode, int modifiers, CallbackInfo ci) {
//#endif | // Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/KeyboardCallback.java
// public interface KeyboardCallback {
// Event<KeyboardCallback> EVENT = Event.create((listeners) ->
// new KeyboardCallback() {
// @Override
// public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
// for (KeyboardCallback listener : listeners) {
// if (listener.keyPressed(keyCode, scanCode, modifiers)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean keyReleased(int keyCode, int scanCode, int modifiers) {
// for (KeyboardCallback listener : listeners) {
// if (listener.keyReleased(keyCode, scanCode, modifiers)) {
// return true;
// }
// }
// return false;
// }
//
// @Override
// public boolean charTyped(char charCode, int scanCode) {
// for (KeyboardCallback listener : listeners) {
// if (listener.charTyped(charCode, scanCode)) {
// return true;
// }
// }
// return false;
// }
// }
// );
//
// boolean keyPressed(int keyCode, int scanCode, int modifiers);
// boolean keyReleased(int keyCode, int scanCode, int modifiers);
// boolean charTyped(char keyChar, int scanCode);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/versions/mixin/MixinKeyboardListener.java
import de.johni0702.minecraft.gui.versions.callbacks.KeyboardCallback;
import net.minecraft.client.Keyboard;
import net.minecraft.client.gui.Element;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Group;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.gui.ParentElement;
//#if FABRIC>=1
package de.johni0702.minecraft.gui.versions.mixin;
//#if MC>=11700
//$$ import net.minecraft.client.gui.screen.Screen;
//#else
//#endif
@Mixin(Keyboard.class)
public class MixinKeyboardListener {
@Inject(
method = "method_1454",
//#if MC>=11700
//$$ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyPressed(III)Z"),
//#else
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ParentElement;keyPressed(III)Z"),
//#endif
cancellable = true
)
//#if MC>=11700
//$$ private void keyPressed(int i, Screen screen, boolean[] bls, int keyCode, int scanCode, int modifiers, CallbackInfo ci) {
//#else
private void keyPressed(int i, boolean[] bls, ParentElement element, int keyCode, int scanCode, int modifiers, CallbackInfo ci) {
//#endif | if (KeyboardCallback.EVENT.invoker().keyPressed(keyCode, scanCode, modifiers)) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiTimelineTime.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiTimelineTime<U extends AbstractGuiTimeline<U>> extends AbstractGuiTimelineTime<GuiTimelineTime<U>, U> {
public GuiTimelineTime() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/advanced/GuiTimelineTime.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element.advanced;
public class GuiTimelineTime<U extends AbstractGuiTimeline<U>> extends AbstractGuiTimelineTime<GuiTimelineTime<U>, U> {
public GuiTimelineTime() {
}
| public GuiTimelineTime(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/AbstractGuiNumberField.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import com.google.common.base.Preconditions;
import de.johni0702.minecraft.gui.container.GuiContainer;
import java.util.Locale;
import java.util.regex.Pattern; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
// TODO: This is suboptimal e.g. if there are trailing zeros, they stay (should be fixed after TextField is done w/o MC)
public abstract class AbstractGuiNumberField<T extends AbstractGuiNumberField<T>>
extends AbstractGuiTextField<T> implements IGuiNumberField<T> {
private int precision;
private volatile Pattern precisionPattern;
private Double minValue;
private Double maxValue;
private boolean validateOnFocusChange = false;
public AbstractGuiNumberField() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/AbstractGuiNumberField.java
import com.google.common.base.Preconditions;
import de.johni0702.minecraft.gui.container.GuiContainer;
import java.util.Locale;
import java.util.regex.Pattern;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
// TODO: This is suboptimal e.g. if there are trailing zeros, they stay (should be fixed after TextField is done w/o MC)
public abstract class AbstractGuiNumberField<T extends AbstractGuiNumberField<T>>
extends AbstractGuiTextField<T> implements IGuiNumberField<T> {
private int precision;
private volatile Pattern precisionPattern;
private Double minValue;
private Double maxValue;
private boolean validateOnFocusChange = false;
public AbstractGuiNumberField() {
}
| public AbstractGuiNumberField(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java | // Path: src/main/java/de/johni0702/minecraft/gui/element/ComposedGuiElement.java
// public interface ComposedGuiElement<T extends ComposedGuiElement<T>> extends GuiElement<T> {
// Collection<GuiElement> getChildren();
//
// default <C, R> R forEach(Class<C> ofType, Function<C, R> function) {
// return forEach((elem, elemLayer) -> elem.forEach(elemLayer, ofType, function));
// }
//
// default <C, R> R forEach(BiFunction<ComposedGuiElement<?>, Integer, R> recurse) {
// int maxLayer = getMaxLayer();
// for (int i = maxLayer; i >= 0; i--) {
// R result = recurse.apply(this, i);
// if (result != null) {
// return result;
// }
// }
// return null;
// }
//
// default <C, R> R forEach(int layer, Class<C> ofType, Function<C, R> function) {
// return forEach(layer, ofType, (elem, elemLayer) -> elem.forEach(elemLayer, ofType, function), function);
// }
//
// <C, R> R forEach(int layer, Class<C> ofType, BiFunction<ComposedGuiElement<?>, Integer, R> recurse, Function<C, R> function);
//
// default <C> void invokeAll(Class<C> ofType, Consumer<C> consumer) {
// forEach((elem, elemLayer) -> {
// elem.invokeAll(elemLayer, ofType, consumer);
// return null;
// });
// }
//
// default <C> void invokeAll(int layer, Class<C> ofType, Consumer<C> consumer) {
// forEach(layer, ofType, (elem, elemLayer) -> {
// elem.invokeAll(elemLayer, ofType, consumer);
// return null;
// }, obj -> {
// consumer.accept(obj);
// return null;
// });
// }
//
// default <C> boolean invokeHandlers(Class<C> ofType, Function<C, Boolean> handle) {
// return forEach((elem, elemLayer) -> elem.invokeHandlers(elemLayer, ofType, handle) ? true : null) == Boolean.TRUE;
// }
//
// default <C> boolean invokeHandlers(int layer, Class<C> ofType, Function<C, Boolean> handle) {
// return forEach(
// layer,
// ofType,
// (elem, elemLayer) -> elem.invokeHandlers(elemLayer, ofType, handle) ? true : null,
// obj -> handle.apply(obj) ? true : null
// ) == Boolean.TRUE;
// }
//
// /**
// * Returns the highest layer this element or any of its children take part in.
// * Events will be called for this composed jgui element for all layers between
// * layer 0 (inclusive) and the returned maximum layer (inclusive).
// * @return Highest layer relevant to this element
// */
// int getMaxLayer();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
//
// Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
//
// ReadableDimension calcMinSize(GuiContainer<?> container);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
// LayoutData NONE = VoidLayoutData.INSTANCE;
// }
| import java.util.Comparator;
import java.util.Map;
import de.johni0702.minecraft.gui.element.ComposedGuiElement;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.container;
public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
T setLayout(Layout layout);
Layout getLayout();
| // Path: src/main/java/de/johni0702/minecraft/gui/element/ComposedGuiElement.java
// public interface ComposedGuiElement<T extends ComposedGuiElement<T>> extends GuiElement<T> {
// Collection<GuiElement> getChildren();
//
// default <C, R> R forEach(Class<C> ofType, Function<C, R> function) {
// return forEach((elem, elemLayer) -> elem.forEach(elemLayer, ofType, function));
// }
//
// default <C, R> R forEach(BiFunction<ComposedGuiElement<?>, Integer, R> recurse) {
// int maxLayer = getMaxLayer();
// for (int i = maxLayer; i >= 0; i--) {
// R result = recurse.apply(this, i);
// if (result != null) {
// return result;
// }
// }
// return null;
// }
//
// default <C, R> R forEach(int layer, Class<C> ofType, Function<C, R> function) {
// return forEach(layer, ofType, (elem, elemLayer) -> elem.forEach(elemLayer, ofType, function), function);
// }
//
// <C, R> R forEach(int layer, Class<C> ofType, BiFunction<ComposedGuiElement<?>, Integer, R> recurse, Function<C, R> function);
//
// default <C> void invokeAll(Class<C> ofType, Consumer<C> consumer) {
// forEach((elem, elemLayer) -> {
// elem.invokeAll(elemLayer, ofType, consumer);
// return null;
// });
// }
//
// default <C> void invokeAll(int layer, Class<C> ofType, Consumer<C> consumer) {
// forEach(layer, ofType, (elem, elemLayer) -> {
// elem.invokeAll(elemLayer, ofType, consumer);
// return null;
// }, obj -> {
// consumer.accept(obj);
// return null;
// });
// }
//
// default <C> boolean invokeHandlers(Class<C> ofType, Function<C, Boolean> handle) {
// return forEach((elem, elemLayer) -> elem.invokeHandlers(elemLayer, ofType, handle) ? true : null) == Boolean.TRUE;
// }
//
// default <C> boolean invokeHandlers(int layer, Class<C> ofType, Function<C, Boolean> handle) {
// return forEach(
// layer,
// ofType,
// (elem, elemLayer) -> elem.invokeHandlers(elemLayer, ofType, handle) ? true : null,
// obj -> handle.apply(obj) ? true : null
// ) == Boolean.TRUE;
// }
//
// /**
// * Returns the highest layer this element or any of its children take part in.
// * Events will be called for this composed jgui element for all layers between
// * layer 0 (inclusive) and the returned maximum layer (inclusive).
// * @return Highest layer relevant to this element
// */
// int getMaxLayer();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiElement.java
// public interface GuiElement<T extends GuiElement<T>> {
//
// MinecraftClient getMinecraft();
//
// GuiContainer getContainer();
// T setContainer(GuiContainer container);
//
// void layout(ReadableDimension size, RenderInfo renderInfo);
// void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo);
//
// ReadableDimension getMinSize();
// ReadableDimension getMaxSize();
//
// T setMaxSize(ReadableDimension maxSize);
//
// boolean isEnabled();
// T setEnabled(boolean enabled);
// T setEnabled();
// T setDisabled();
//
// GuiElement getTooltip(RenderInfo renderInfo);
// T setTooltip(GuiElement tooltip);
//
// /**
// * Returns the layer this element takes part in.
// * The standard layer is layer 0. Event handlers will be called for this layer.
// * @return The layer of this element
// */
// int getLayer();
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/Layout.java
// public interface Layout {
//
// Map<GuiElement, Pair<ReadablePoint, ReadableDimension>> layOut(GuiContainer<?> container, ReadableDimension size);
//
// ReadableDimension calcMinSize(GuiContainer<?> container);
//
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/layout/LayoutData.java
// public interface LayoutData {
// LayoutData NONE = VoidLayoutData.INSTANCE;
// }
// Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
import java.util.Comparator;
import java.util.Map;
import de.johni0702.minecraft.gui.element.ComposedGuiElement;
import de.johni0702.minecraft.gui.element.GuiElement;
import de.johni0702.minecraft.gui.layout.Layout;
import de.johni0702.minecraft.gui.layout.LayoutData;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.container;
public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
T setLayout(Layout layout);
Layout getLayout();
| void convertFor(GuiElement element, Point point); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/function/Focusable.java | // Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
| import de.johni0702.minecraft.gui.utils.Consumer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.function;
public interface Focusable<T extends Focusable<T>> {
boolean isFocused();
T setFocused(boolean focused);
| // Path: src/main/java/de/johni0702/minecraft/gui/utils/Consumer.java
// public interface Consumer<T> {
// void consume(T obj);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/function/Focusable.java
import de.johni0702.minecraft.gui.utils.Consumer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.function;
public interface Focusable<T extends Focusable<T>> {
boolean isFocused();
T setFocused(boolean focused);
| T onFocusChange(Consumer<Boolean> consumer); |
ReplayMod/jGui | versions/1.12/src/main/java/de/johni0702/minecraft/gui/versions/forge/EventsAdapter.java | // Path: src/main/java/de/johni0702/minecraft/gui/utils/EventRegistrations.java
// public class EventRegistrations {
// //#if MC<=11302
// //$$ static { new EventsAdapter().register(); }
// //#endif
//
// private List<EventRegistration<?>> registrations = new ArrayList<>();
//
// public <T> EventRegistrations on(EventRegistration<T> registration) {
// registrations.add(registration);
// return this;
// }
//
// public <T> EventRegistrations on(Event<T> event, T listener) {
// return on(EventRegistration.create(event, listener));
// }
//
// public void register() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.register(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().register(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.register();
// }
// }
//
// public void unregister() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.unregister(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().unregister(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.unregister();
// }
// }
// }
//
// Path: versions/1.14.4/src/main/java/de/johni0702/minecraft/gui/versions/MatrixStack.java
// public class MatrixStack {
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
| import de.johni0702.minecraft.gui.utils.EventRegistrations;
import de.johni0702.minecraft.gui.versions.MatrixStack;
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List; | package de.johni0702.minecraft.gui.versions.forge;
public class EventsAdapter extends EventRegistrations {
public static GuiScreen getScreen(GuiScreenEvent event) {
//#if MC>=10904
return event.getGui();
//#else
//$$ return event.gui;
//#endif
}
public static List<GuiButton> getButtonList(GuiScreenEvent.InitGuiEvent event) {
//#if MC>=10904
return event.getButtonList();
//#else
//$$ return event.buttonList;
//#endif
}
@SubscribeEvent
public void preGuiInit(GuiScreenEvent.InitGuiEvent.Pre event) { | // Path: src/main/java/de/johni0702/minecraft/gui/utils/EventRegistrations.java
// public class EventRegistrations {
// //#if MC<=11302
// //$$ static { new EventsAdapter().register(); }
// //#endif
//
// private List<EventRegistration<?>> registrations = new ArrayList<>();
//
// public <T> EventRegistrations on(EventRegistration<T> registration) {
// registrations.add(registration);
// return this;
// }
//
// public <T> EventRegistrations on(Event<T> event, T listener) {
// return on(EventRegistration.create(event, listener));
// }
//
// public void register() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.register(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().register(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.register();
// }
// }
//
// public void unregister() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.unregister(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().unregister(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.unregister();
// }
// }
// }
//
// Path: versions/1.14.4/src/main/java/de/johni0702/minecraft/gui/versions/MatrixStack.java
// public class MatrixStack {
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
// Path: versions/1.12/src/main/java/de/johni0702/minecraft/gui/versions/forge/EventsAdapter.java
import de.johni0702.minecraft.gui.utils.EventRegistrations;
import de.johni0702.minecraft.gui.versions.MatrixStack;
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List;
package de.johni0702.minecraft.gui.versions.forge;
public class EventsAdapter extends EventRegistrations {
public static GuiScreen getScreen(GuiScreenEvent event) {
//#if MC>=10904
return event.getGui();
//#else
//$$ return event.gui;
//#endif
}
public static List<GuiButton> getButtonList(GuiScreenEvent.InitGuiEvent event) {
//#if MC>=10904
return event.getButtonList();
//#else
//$$ return event.buttonList;
//#endif
}
@SubscribeEvent
public void preGuiInit(GuiScreenEvent.InitGuiEvent.Pre event) { | InitScreenCallback.Pre.EVENT.invoker().preInitScreen(getScreen(event)); |
ReplayMod/jGui | versions/1.12/src/main/java/de/johni0702/minecraft/gui/versions/forge/EventsAdapter.java | // Path: src/main/java/de/johni0702/minecraft/gui/utils/EventRegistrations.java
// public class EventRegistrations {
// //#if MC<=11302
// //$$ static { new EventsAdapter().register(); }
// //#endif
//
// private List<EventRegistration<?>> registrations = new ArrayList<>();
//
// public <T> EventRegistrations on(EventRegistration<T> registration) {
// registrations.add(registration);
// return this;
// }
//
// public <T> EventRegistrations on(Event<T> event, T listener) {
// return on(EventRegistration.create(event, listener));
// }
//
// public void register() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.register(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().register(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.register();
// }
// }
//
// public void unregister() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.unregister(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().unregister(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.unregister();
// }
// }
// }
//
// Path: versions/1.14.4/src/main/java/de/johni0702/minecraft/gui/versions/MatrixStack.java
// public class MatrixStack {
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
| import de.johni0702.minecraft.gui.utils.EventRegistrations;
import de.johni0702.minecraft.gui.versions.MatrixStack;
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List; | package de.johni0702.minecraft.gui.versions.forge;
public class EventsAdapter extends EventRegistrations {
public static GuiScreen getScreen(GuiScreenEvent event) {
//#if MC>=10904
return event.getGui();
//#else
//$$ return event.gui;
//#endif
}
public static List<GuiButton> getButtonList(GuiScreenEvent.InitGuiEvent event) {
//#if MC>=10904
return event.getButtonList();
//#else
//$$ return event.buttonList;
//#endif
}
@SubscribeEvent
public void preGuiInit(GuiScreenEvent.InitGuiEvent.Pre event) {
InitScreenCallback.Pre.EVENT.invoker().preInitScreen(getScreen(event));
}
@SubscribeEvent
public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
InitScreenCallback.EVENT.invoker().initScreen(getScreen(event), getButtonList(event));
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onGuiClosed(GuiOpenEvent event) { | // Path: src/main/java/de/johni0702/minecraft/gui/utils/EventRegistrations.java
// public class EventRegistrations {
// //#if MC<=11302
// //$$ static { new EventsAdapter().register(); }
// //#endif
//
// private List<EventRegistration<?>> registrations = new ArrayList<>();
//
// public <T> EventRegistrations on(EventRegistration<T> registration) {
// registrations.add(registration);
// return this;
// }
//
// public <T> EventRegistrations on(Event<T> event, T listener) {
// return on(EventRegistration.create(event, listener));
// }
//
// public void register() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.register(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().register(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.register();
// }
// }
//
// public void unregister() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.unregister(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().unregister(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.unregister();
// }
// }
// }
//
// Path: versions/1.14.4/src/main/java/de/johni0702/minecraft/gui/versions/MatrixStack.java
// public class MatrixStack {
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
// Path: versions/1.12/src/main/java/de/johni0702/minecraft/gui/versions/forge/EventsAdapter.java
import de.johni0702.minecraft.gui.utils.EventRegistrations;
import de.johni0702.minecraft.gui.versions.MatrixStack;
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List;
package de.johni0702.minecraft.gui.versions.forge;
public class EventsAdapter extends EventRegistrations {
public static GuiScreen getScreen(GuiScreenEvent event) {
//#if MC>=10904
return event.getGui();
//#else
//$$ return event.gui;
//#endif
}
public static List<GuiButton> getButtonList(GuiScreenEvent.InitGuiEvent event) {
//#if MC>=10904
return event.getButtonList();
//#else
//$$ return event.buttonList;
//#endif
}
@SubscribeEvent
public void preGuiInit(GuiScreenEvent.InitGuiEvent.Pre event) {
InitScreenCallback.Pre.EVENT.invoker().preInitScreen(getScreen(event));
}
@SubscribeEvent
public void onGuiInit(GuiScreenEvent.InitGuiEvent.Post event) {
InitScreenCallback.EVENT.invoker().initScreen(getScreen(event), getButtonList(event));
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onGuiClosed(GuiOpenEvent event) { | OpenGuiScreenCallback.EVENT.invoker().openGuiScreen( |
ReplayMod/jGui | versions/1.12/src/main/java/de/johni0702/minecraft/gui/versions/forge/EventsAdapter.java | // Path: src/main/java/de/johni0702/minecraft/gui/utils/EventRegistrations.java
// public class EventRegistrations {
// //#if MC<=11302
// //$$ static { new EventsAdapter().register(); }
// //#endif
//
// private List<EventRegistration<?>> registrations = new ArrayList<>();
//
// public <T> EventRegistrations on(EventRegistration<T> registration) {
// registrations.add(registration);
// return this;
// }
//
// public <T> EventRegistrations on(Event<T> event, T listener) {
// return on(EventRegistration.create(event, listener));
// }
//
// public void register() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.register(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().register(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.register();
// }
// }
//
// public void unregister() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.unregister(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().unregister(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.unregister();
// }
// }
// }
//
// Path: versions/1.14.4/src/main/java/de/johni0702/minecraft/gui/versions/MatrixStack.java
// public class MatrixStack {
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
| import de.johni0702.minecraft.gui.utils.EventRegistrations;
import de.johni0702.minecraft.gui.versions.MatrixStack;
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List; | //$$ event.gui
//#endif
);
}
public static float getPartialTicks(RenderGameOverlayEvent event) {
//#if MC>=10904
return event.getPartialTicks();
//#else
//$$ return event.partialTicks;
//#endif
}
public static float getPartialTicks(GuiScreenEvent.DrawScreenEvent.Post event) {
//#if MC>=10904
return event.getRenderPartialTicks();
//#else
//$$ return event.renderPartialTicks;
//#endif
}
@SubscribeEvent
public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) {
PostRenderScreenCallback.EVENT.invoker().postRenderScreen(new MatrixStack(), getPartialTicks(event));
}
// Even when event was cancelled cause Lunatrius' InGame-Info-XML mod cancels it and we don't actually care about
// the event (i.e. the overlay text), just about when it's called.
@SubscribeEvent(receiveCanceled = true)
public void renderOverlay(RenderGameOverlayEvent.Text event) { | // Path: src/main/java/de/johni0702/minecraft/gui/utils/EventRegistrations.java
// public class EventRegistrations {
// //#if MC<=11302
// //$$ static { new EventsAdapter().register(); }
// //#endif
//
// private List<EventRegistration<?>> registrations = new ArrayList<>();
//
// public <T> EventRegistrations on(EventRegistration<T> registration) {
// registrations.add(registration);
// return this;
// }
//
// public <T> EventRegistrations on(Event<T> event, T listener) {
// return on(EventRegistration.create(event, listener));
// }
//
// public void register() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.register(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().register(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.register();
// }
// }
//
// public void unregister() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.unregister(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().unregister(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.unregister();
// }
// }
// }
//
// Path: versions/1.14.4/src/main/java/de/johni0702/minecraft/gui/versions/MatrixStack.java
// public class MatrixStack {
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
// Path: versions/1.12/src/main/java/de/johni0702/minecraft/gui/versions/forge/EventsAdapter.java
import de.johni0702.minecraft.gui.utils.EventRegistrations;
import de.johni0702.minecraft.gui.versions.MatrixStack;
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List;
//$$ event.gui
//#endif
);
}
public static float getPartialTicks(RenderGameOverlayEvent event) {
//#if MC>=10904
return event.getPartialTicks();
//#else
//$$ return event.partialTicks;
//#endif
}
public static float getPartialTicks(GuiScreenEvent.DrawScreenEvent.Post event) {
//#if MC>=10904
return event.getRenderPartialTicks();
//#else
//$$ return event.renderPartialTicks;
//#endif
}
@SubscribeEvent
public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) {
PostRenderScreenCallback.EVENT.invoker().postRenderScreen(new MatrixStack(), getPartialTicks(event));
}
// Even when event was cancelled cause Lunatrius' InGame-Info-XML mod cancels it and we don't actually care about
// the event (i.e. the overlay text), just about when it's called.
@SubscribeEvent(receiveCanceled = true)
public void renderOverlay(RenderGameOverlayEvent.Text event) { | RenderHudCallback.EVENT.invoker().renderHud(new MatrixStack(), getPartialTicks(event)); |
ReplayMod/jGui | versions/1.12/src/main/java/de/johni0702/minecraft/gui/versions/forge/EventsAdapter.java | // Path: src/main/java/de/johni0702/minecraft/gui/utils/EventRegistrations.java
// public class EventRegistrations {
// //#if MC<=11302
// //$$ static { new EventsAdapter().register(); }
// //#endif
//
// private List<EventRegistration<?>> registrations = new ArrayList<>();
//
// public <T> EventRegistrations on(EventRegistration<T> registration) {
// registrations.add(registration);
// return this;
// }
//
// public <T> EventRegistrations on(Event<T> event, T listener) {
// return on(EventRegistration.create(event, listener));
// }
//
// public void register() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.register(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().register(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.register();
// }
// }
//
// public void unregister() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.unregister(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().unregister(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.unregister();
// }
// }
// }
//
// Path: versions/1.14.4/src/main/java/de/johni0702/minecraft/gui/versions/MatrixStack.java
// public class MatrixStack {
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
| import de.johni0702.minecraft.gui.utils.EventRegistrations;
import de.johni0702.minecraft.gui.versions.MatrixStack;
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List; | //#if MC>=10904
return event.getPartialTicks();
//#else
//$$ return event.partialTicks;
//#endif
}
public static float getPartialTicks(GuiScreenEvent.DrawScreenEvent.Post event) {
//#if MC>=10904
return event.getRenderPartialTicks();
//#else
//$$ return event.renderPartialTicks;
//#endif
}
@SubscribeEvent
public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) {
PostRenderScreenCallback.EVENT.invoker().postRenderScreen(new MatrixStack(), getPartialTicks(event));
}
// Even when event was cancelled cause Lunatrius' InGame-Info-XML mod cancels it and we don't actually care about
// the event (i.e. the overlay text), just about when it's called.
@SubscribeEvent(receiveCanceled = true)
public void renderOverlay(RenderGameOverlayEvent.Text event) {
RenderHudCallback.EVENT.invoker().renderHud(new MatrixStack(), getPartialTicks(event));
}
@SubscribeEvent
public void tickOverlay(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.START) { | // Path: src/main/java/de/johni0702/minecraft/gui/utils/EventRegistrations.java
// public class EventRegistrations {
// //#if MC<=11302
// //$$ static { new EventsAdapter().register(); }
// //#endif
//
// private List<EventRegistration<?>> registrations = new ArrayList<>();
//
// public <T> EventRegistrations on(EventRegistration<T> registration) {
// registrations.add(registration);
// return this;
// }
//
// public <T> EventRegistrations on(Event<T> event, T listener) {
// return on(EventRegistration.create(event, listener));
// }
//
// public void register() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.register(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().register(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.register();
// }
// }
//
// public void unregister() {
// //#if MC<=11302
// //$$ MinecraftForge.EVENT_BUS.unregister(this);
// //#endif
// //#if MC<10809
// //$$ FMLCommonHandler.instance().bus().unregister(this);
// //#endif
// for (EventRegistration<?> registration : registrations) {
// registration.unregister();
// }
// }
// }
//
// Path: versions/1.14.4/src/main/java/de/johni0702/minecraft/gui/versions/MatrixStack.java
// public class MatrixStack {
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/InitScreenCallback.java
// public interface InitScreenCallback {
// Event<InitScreenCallback> EVENT = Event.create((listeners) ->
// (screen, buttons) -> {
// for (InitScreenCallback listener : listeners) {
// listener.initScreen(screen, buttons);
// }
// }
// );
//
// void initScreen(Screen screen, Collection<AbstractButtonWidget> buttons);
//
// interface Pre {
// Event<InitScreenCallback.Pre> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (InitScreenCallback.Pre listener : listeners) {
// listener.preInitScreen(screen);
// }
// }
// );
//
// void preInitScreen(Screen screen);
// }
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/OpenGuiScreenCallback.java
// public interface OpenGuiScreenCallback {
// Event<OpenGuiScreenCallback> EVENT = Event.create((listeners) ->
// (screen) -> {
// for (OpenGuiScreenCallback listener : listeners) {
// listener.openGuiScreen(screen);
// }
// }
// );
//
// void openGuiScreen(Screen screen);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PostRenderScreenCallback.java
// public interface PostRenderScreenCallback {
// Event<PostRenderScreenCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (PostRenderScreenCallback listener : listeners) {
// listener.postRenderScreen(stack, partialTicks);
// }
// }
// );
//
// void postRenderScreen(MatrixStack stack, float partialTicks);
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/PreTickCallback.java
// public interface PreTickCallback {
// Event<PreTickCallback> EVENT = Event.create((listeners) ->
// () -> {
// for (PreTickCallback listener : listeners) {
// listener.preTick();
// }
// }
// );
//
// void preTick();
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/callbacks/RenderHudCallback.java
// public interface RenderHudCallback {
// Event<RenderHudCallback> EVENT = Event.create((listeners) ->
// (stack, partialTicks) -> {
// for (RenderHudCallback listener : listeners) {
// listener.renderHud(stack, partialTicks);
// }
// }
// );
//
// void renderHud(MatrixStack stack, float partialTicks);
// }
// Path: versions/1.12/src/main/java/de/johni0702/minecraft/gui/versions/forge/EventsAdapter.java
import de.johni0702.minecraft.gui.utils.EventRegistrations;
import de.johni0702.minecraft.gui.versions.MatrixStack;
import de.johni0702.minecraft.gui.versions.callbacks.InitScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.OpenGuiScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PostRenderScreenCallback;
import de.johni0702.minecraft.gui.versions.callbacks.PreTickCallback;
import de.johni0702.minecraft.gui.versions.callbacks.RenderHudCallback;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.List;
//#if MC>=10904
return event.getPartialTicks();
//#else
//$$ return event.partialTicks;
//#endif
}
public static float getPartialTicks(GuiScreenEvent.DrawScreenEvent.Post event) {
//#if MC>=10904
return event.getRenderPartialTicks();
//#else
//$$ return event.renderPartialTicks;
//#endif
}
@SubscribeEvent
public void onGuiRender(GuiScreenEvent.DrawScreenEvent.Post event) {
PostRenderScreenCallback.EVENT.invoker().postRenderScreen(new MatrixStack(), getPartialTicks(event));
}
// Even when event was cancelled cause Lunatrius' InGame-Info-XML mod cancels it and we don't actually care about
// the event (i.e. the overlay text), just about when it's called.
@SubscribeEvent(receiveCanceled = true)
public void renderOverlay(RenderGameOverlayEvent.Text event) {
RenderHudCallback.EVENT.invoker().renderHud(new MatrixStack(), getPartialTicks(event));
}
@SubscribeEvent
public void tickOverlay(TickEvent.ClientTickEvent event) {
if (event.phase == TickEvent.Phase.START) { | PreTickCallback.EVENT.invoker().preTick(); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiTexturedButton.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiTexturedButton extends AbstractGuiTexturedButton<GuiTexturedButton> {
public GuiTexturedButton() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiTexturedButton.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiTexturedButton extends AbstractGuiTexturedButton<GuiTexturedButton> {
public GuiTexturedButton() {
}
| public GuiTexturedButton(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/element/GuiPasswordField.java | // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
| import de.johni0702.minecraft.gui.container.GuiContainer; | /*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiPasswordField extends AbstractGuiPasswordField<GuiPasswordField> {
public GuiPasswordField() {
}
| // Path: src/main/java/de/johni0702/minecraft/gui/container/GuiContainer.java
// public interface GuiContainer<T extends GuiContainer<T>> extends ComposedGuiElement<T> {
//
// T setLayout(Layout layout);
// Layout getLayout();
//
// void convertFor(GuiElement element, Point point);
//
// /**
// * Converts the global coordinates of the point to ones relative to the element.
// * @param element The element, must be part of this container
// * @param point The point
// * @param relativeLayer Layer at which the point is relative to this element,
// * positive values are above this element
// */
// void convertFor(GuiElement element, Point point, int relativeLayer);
//
// Map<GuiElement, LayoutData> getElements();
// T addElements(LayoutData layoutData, GuiElement... elements);
// T removeElement(GuiElement element);
// T sortElements();
// T sortElements(Comparator<GuiElement> comparator);
//
// ReadableColor getBackgroundColor();
// T setBackgroundColor(ReadableColor backgroundColor);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/element/GuiPasswordField.java
import de.johni0702.minecraft.gui.container.GuiContainer;
/*
* This file is part of jGui API, licensed under the MIT License (MIT).
*
* Copyright (c) 2016 johni0702 <https://github.com/johni0702>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package de.johni0702.minecraft.gui.element;
public class GuiPasswordField extends AbstractGuiPasswordField<GuiPasswordField> {
public GuiPasswordField() {
}
| public GuiPasswordField(GuiContainer container) { |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/OffsetGuiRenderer.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/MCVer.java
// public static void popScissorState() {
// setScissorBounds(scissorStateStack.pop());
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/MCVer.java
// public static void pushScissorState() {
// scissorStateStack.push(scissorState);
// }
| import net.minecraft.util.Identifier;
import static de.johni0702.minecraft.gui.versions.MCVer.popScissorState;
import static de.johni0702.minecraft.gui.versions.MCVer.pushScissorState;
import de.johni0702.minecraft.gui.utils.NonNull;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
import net.minecraft.client.util.math.MatrixStack; | return renderer.getMatrixStack();
}
@Override
public ReadableDimension getSize() {
return size;
}
@Override
public void setDrawingArea(int x, int y, int width, int height) {
if (!strict) {
renderer.setDrawingArea(x + position.getX(), y + position.getY(), width, height);
return;
}
int x2 = x + width;
int y2 = y + height;
// Convert and clamp top and left border
x = Math.max(0, x + position.getX());
y = Math.max(0, y + position.getY());
// Clamp and convert bottom and right border
x2 = Math.min(x2, size.getWidth()) + position.getX();
y2 = Math.min(y2, size.getHeight()) + position.getY();
// Make sure bottom and top / right and left aren't flipped
x2 = Math.max(x2, x);
y2 = Math.max(y2, y);
// Pass to parent
renderer.setDrawingArea(x, y, x2 - x, y2 - y);
}
public void startUsing() { | // Path: src/main/java/de/johni0702/minecraft/gui/versions/MCVer.java
// public static void popScissorState() {
// setScissorBounds(scissorStateStack.pop());
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/MCVer.java
// public static void pushScissorState() {
// scissorStateStack.push(scissorState);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/OffsetGuiRenderer.java
import net.minecraft.util.Identifier;
import static de.johni0702.minecraft.gui.versions.MCVer.popScissorState;
import static de.johni0702.minecraft.gui.versions.MCVer.pushScissorState;
import de.johni0702.minecraft.gui.utils.NonNull;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
import net.minecraft.client.util.math.MatrixStack;
return renderer.getMatrixStack();
}
@Override
public ReadableDimension getSize() {
return size;
}
@Override
public void setDrawingArea(int x, int y, int width, int height) {
if (!strict) {
renderer.setDrawingArea(x + position.getX(), y + position.getY(), width, height);
return;
}
int x2 = x + width;
int y2 = y + height;
// Convert and clamp top and left border
x = Math.max(0, x + position.getX());
y = Math.max(0, y + position.getY());
// Clamp and convert bottom and right border
x2 = Math.min(x2, size.getWidth()) + position.getX();
y2 = Math.min(y2, size.getHeight()) + position.getY();
// Make sure bottom and top / right and left aren't flipped
x2 = Math.max(x2, x);
y2 = Math.max(y2, y);
// Pass to parent
renderer.setDrawingArea(x, y, x2 - x, y2 - y);
}
public void startUsing() { | pushScissorState(); |
ReplayMod/jGui | src/main/java/de/johni0702/minecraft/gui/OffsetGuiRenderer.java | // Path: src/main/java/de/johni0702/minecraft/gui/versions/MCVer.java
// public static void popScissorState() {
// setScissorBounds(scissorStateStack.pop());
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/MCVer.java
// public static void pushScissorState() {
// scissorStateStack.push(scissorState);
// }
| import net.minecraft.util.Identifier;
import static de.johni0702.minecraft.gui.versions.MCVer.popScissorState;
import static de.johni0702.minecraft.gui.versions.MCVer.pushScissorState;
import de.johni0702.minecraft.gui.utils.NonNull;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
import net.minecraft.client.util.math.MatrixStack; | return size;
}
@Override
public void setDrawingArea(int x, int y, int width, int height) {
if (!strict) {
renderer.setDrawingArea(x + position.getX(), y + position.getY(), width, height);
return;
}
int x2 = x + width;
int y2 = y + height;
// Convert and clamp top and left border
x = Math.max(0, x + position.getX());
y = Math.max(0, y + position.getY());
// Clamp and convert bottom and right border
x2 = Math.min(x2, size.getWidth()) + position.getX();
y2 = Math.min(y2, size.getHeight()) + position.getY();
// Make sure bottom and top / right and left aren't flipped
x2 = Math.max(x2, x);
y2 = Math.max(y2, y);
// Pass to parent
renderer.setDrawingArea(x, y, x2 - x, y2 - y);
}
public void startUsing() {
pushScissorState();
setDrawingArea(0, 0, size.getWidth(), size.getHeight());
}
public void stopUsing() { | // Path: src/main/java/de/johni0702/minecraft/gui/versions/MCVer.java
// public static void popScissorState() {
// setScissorBounds(scissorStateStack.pop());
// }
//
// Path: src/main/java/de/johni0702/minecraft/gui/versions/MCVer.java
// public static void pushScissorState() {
// scissorStateStack.push(scissorState);
// }
// Path: src/main/java/de/johni0702/minecraft/gui/OffsetGuiRenderer.java
import net.minecraft.util.Identifier;
import static de.johni0702.minecraft.gui.versions.MCVer.popScissorState;
import static de.johni0702.minecraft.gui.versions.MCVer.pushScissorState;
import de.johni0702.minecraft.gui.utils.NonNull;
import de.johni0702.minecraft.gui.utils.lwjgl.Point;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableColor;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension;
import de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint;
import net.minecraft.client.util.math.MatrixStack;
return size;
}
@Override
public void setDrawingArea(int x, int y, int width, int height) {
if (!strict) {
renderer.setDrawingArea(x + position.getX(), y + position.getY(), width, height);
return;
}
int x2 = x + width;
int y2 = y + height;
// Convert and clamp top and left border
x = Math.max(0, x + position.getX());
y = Math.max(0, y + position.getY());
// Clamp and convert bottom and right border
x2 = Math.min(x2, size.getWidth()) + position.getX();
y2 = Math.min(y2, size.getHeight()) + position.getY();
// Make sure bottom and top / right and left aren't flipped
x2 = Math.max(x2, x);
y2 = Math.max(y2, y);
// Pass to parent
renderer.setDrawingArea(x, y, x2 - x, y2 - y);
}
public void startUsing() {
pushScissorState();
setDrawingArea(0, 0, size.getWidth(), size.getHeight());
}
public void stopUsing() { | popScissorState(); |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/serialization/OperationSerializationTester.java | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/PrimitiveType.java
// public enum PrimitiveType {
// BOOLEAN(create(Schema.Type.BOOLEAN)),
// DOUBLE(create(Schema.Type.DOUBLE)),
// FLOAT(create(Schema.Type.FLOAT)),
// INTEGER(create(Schema.Type.INT)),
// LONG(create(Schema.Type.LONG)),
// NULL(create(Schema.Type.NULL)),
// STRING(create(Schema.Type.STRING));
//
// private final Schema schema;
//
// PrimitiveType(Schema schema) {
// this.schema = schema;
// }
//
// public Schema getSchema() {
// return schema;
// }
// }
| import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.operation.*;
import io.datanerds.avropatch.value.type.BigDecimalType;
import io.datanerds.avropatch.value.type.BigIntegerType;
import io.datanerds.avropatch.value.type.TimestampType;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import java.io.IOException;
import java.util.*;
import static io.datanerds.avropatch.value.type.PrimitiveType.*;
import static org.apache.avro.Schema.createUnion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; | package io.datanerds.avropatch.serialization;
public class OperationSerializationTester extends SerializationTester<Operation> {
private static final Schema VALUE_TYPE_UNION = createUnion(BOOLEAN.getSchema(), DOUBLE.getSchema(),
FLOAT.getSchema(), INTEGER.getSchema(), LONG.getSchema(), NULL.getSchema(), STRING.getSchema(), | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/PrimitiveType.java
// public enum PrimitiveType {
// BOOLEAN(create(Schema.Type.BOOLEAN)),
// DOUBLE(create(Schema.Type.DOUBLE)),
// FLOAT(create(Schema.Type.FLOAT)),
// INTEGER(create(Schema.Type.INT)),
// LONG(create(Schema.Type.LONG)),
// NULL(create(Schema.Type.NULL)),
// STRING(create(Schema.Type.STRING));
//
// private final Schema schema;
//
// PrimitiveType(Schema schema) {
// this.schema = schema;
// }
//
// public Schema getSchema() {
// return schema;
// }
// }
// Path: src/test/java/io/datanerds/avropatch/serialization/OperationSerializationTester.java
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.operation.*;
import io.datanerds.avropatch.value.type.BigDecimalType;
import io.datanerds.avropatch.value.type.BigIntegerType;
import io.datanerds.avropatch.value.type.TimestampType;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import java.io.IOException;
import java.util.*;
import static io.datanerds.avropatch.value.type.PrimitiveType.*;
import static org.apache.avro.Schema.createUnion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
package io.datanerds.avropatch.serialization;
public class OperationSerializationTester extends SerializationTester<Operation> {
private static final Schema VALUE_TYPE_UNION = createUnion(BOOLEAN.getSchema(), DOUBLE.getSchema(),
FLOAT.getSchema(), INTEGER.getSchema(), LONG.getSchema(), NULL.getSchema(), STRING.getSchema(), | BigDecimalType.SCHEMA, BigIntegerType.SCHEMA, TimestampType.SCHEMA, UuidType.SCHEMA); |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/serialization/OperationSerializationTester.java | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/PrimitiveType.java
// public enum PrimitiveType {
// BOOLEAN(create(Schema.Type.BOOLEAN)),
// DOUBLE(create(Schema.Type.DOUBLE)),
// FLOAT(create(Schema.Type.FLOAT)),
// INTEGER(create(Schema.Type.INT)),
// LONG(create(Schema.Type.LONG)),
// NULL(create(Schema.Type.NULL)),
// STRING(create(Schema.Type.STRING));
//
// private final Schema schema;
//
// PrimitiveType(Schema schema) {
// this.schema = schema;
// }
//
// public Schema getSchema() {
// return schema;
// }
// }
| import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.operation.*;
import io.datanerds.avropatch.value.type.BigDecimalType;
import io.datanerds.avropatch.value.type.BigIntegerType;
import io.datanerds.avropatch.value.type.TimestampType;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import java.io.IOException;
import java.util.*;
import static io.datanerds.avropatch.value.type.PrimitiveType.*;
import static org.apache.avro.Schema.createUnion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; | package io.datanerds.avropatch.serialization;
public class OperationSerializationTester extends SerializationTester<Operation> {
private static final Schema VALUE_TYPE_UNION = createUnion(BOOLEAN.getSchema(), DOUBLE.getSchema(),
FLOAT.getSchema(), INTEGER.getSchema(), LONG.getSchema(), NULL.getSchema(), STRING.getSchema(), | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/PrimitiveType.java
// public enum PrimitiveType {
// BOOLEAN(create(Schema.Type.BOOLEAN)),
// DOUBLE(create(Schema.Type.DOUBLE)),
// FLOAT(create(Schema.Type.FLOAT)),
// INTEGER(create(Schema.Type.INT)),
// LONG(create(Schema.Type.LONG)),
// NULL(create(Schema.Type.NULL)),
// STRING(create(Schema.Type.STRING));
//
// private final Schema schema;
//
// PrimitiveType(Schema schema) {
// this.schema = schema;
// }
//
// public Schema getSchema() {
// return schema;
// }
// }
// Path: src/test/java/io/datanerds/avropatch/serialization/OperationSerializationTester.java
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.operation.*;
import io.datanerds.avropatch.value.type.BigDecimalType;
import io.datanerds.avropatch.value.type.BigIntegerType;
import io.datanerds.avropatch.value.type.TimestampType;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import java.io.IOException;
import java.util.*;
import static io.datanerds.avropatch.value.type.PrimitiveType.*;
import static org.apache.avro.Schema.createUnion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
package io.datanerds.avropatch.serialization;
public class OperationSerializationTester extends SerializationTester<Operation> {
private static final Schema VALUE_TYPE_UNION = createUnion(BOOLEAN.getSchema(), DOUBLE.getSchema(),
FLOAT.getSchema(), INTEGER.getSchema(), LONG.getSchema(), NULL.getSchema(), STRING.getSchema(), | BigDecimalType.SCHEMA, BigIntegerType.SCHEMA, TimestampType.SCHEMA, UuidType.SCHEMA); |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/serialization/OperationSerializationTester.java | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/PrimitiveType.java
// public enum PrimitiveType {
// BOOLEAN(create(Schema.Type.BOOLEAN)),
// DOUBLE(create(Schema.Type.DOUBLE)),
// FLOAT(create(Schema.Type.FLOAT)),
// INTEGER(create(Schema.Type.INT)),
// LONG(create(Schema.Type.LONG)),
// NULL(create(Schema.Type.NULL)),
// STRING(create(Schema.Type.STRING));
//
// private final Schema schema;
//
// PrimitiveType(Schema schema) {
// this.schema = schema;
// }
//
// public Schema getSchema() {
// return schema;
// }
// }
| import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.operation.*;
import io.datanerds.avropatch.value.type.BigDecimalType;
import io.datanerds.avropatch.value.type.BigIntegerType;
import io.datanerds.avropatch.value.type.TimestampType;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import java.io.IOException;
import java.util.*;
import static io.datanerds.avropatch.value.type.PrimitiveType.*;
import static org.apache.avro.Schema.createUnion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; | package io.datanerds.avropatch.serialization;
public class OperationSerializationTester extends SerializationTester<Operation> {
private static final Schema VALUE_TYPE_UNION = createUnion(BOOLEAN.getSchema(), DOUBLE.getSchema(),
FLOAT.getSchema(), INTEGER.getSchema(), LONG.getSchema(), NULL.getSchema(), STRING.getSchema(), | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/PrimitiveType.java
// public enum PrimitiveType {
// BOOLEAN(create(Schema.Type.BOOLEAN)),
// DOUBLE(create(Schema.Type.DOUBLE)),
// FLOAT(create(Schema.Type.FLOAT)),
// INTEGER(create(Schema.Type.INT)),
// LONG(create(Schema.Type.LONG)),
// NULL(create(Schema.Type.NULL)),
// STRING(create(Schema.Type.STRING));
//
// private final Schema schema;
//
// PrimitiveType(Schema schema) {
// this.schema = schema;
// }
//
// public Schema getSchema() {
// return schema;
// }
// }
// Path: src/test/java/io/datanerds/avropatch/serialization/OperationSerializationTester.java
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.operation.*;
import io.datanerds.avropatch.value.type.BigDecimalType;
import io.datanerds.avropatch.value.type.BigIntegerType;
import io.datanerds.avropatch.value.type.TimestampType;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import java.io.IOException;
import java.util.*;
import static io.datanerds.avropatch.value.type.PrimitiveType.*;
import static org.apache.avro.Schema.createUnion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
package io.datanerds.avropatch.serialization;
public class OperationSerializationTester extends SerializationTester<Operation> {
private static final Schema VALUE_TYPE_UNION = createUnion(BOOLEAN.getSchema(), DOUBLE.getSchema(),
FLOAT.getSchema(), INTEGER.getSchema(), LONG.getSchema(), NULL.getSchema(), STRING.getSchema(), | BigDecimalType.SCHEMA, BigIntegerType.SCHEMA, TimestampType.SCHEMA, UuidType.SCHEMA); |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/serialization/OperationSerializationTester.java | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/PrimitiveType.java
// public enum PrimitiveType {
// BOOLEAN(create(Schema.Type.BOOLEAN)),
// DOUBLE(create(Schema.Type.DOUBLE)),
// FLOAT(create(Schema.Type.FLOAT)),
// INTEGER(create(Schema.Type.INT)),
// LONG(create(Schema.Type.LONG)),
// NULL(create(Schema.Type.NULL)),
// STRING(create(Schema.Type.STRING));
//
// private final Schema schema;
//
// PrimitiveType(Schema schema) {
// this.schema = schema;
// }
//
// public Schema getSchema() {
// return schema;
// }
// }
| import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.operation.*;
import io.datanerds.avropatch.value.type.BigDecimalType;
import io.datanerds.avropatch.value.type.BigIntegerType;
import io.datanerds.avropatch.value.type.TimestampType;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import java.io.IOException;
import java.util.*;
import static io.datanerds.avropatch.value.type.PrimitiveType.*;
import static org.apache.avro.Schema.createUnion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; | package io.datanerds.avropatch.serialization;
public class OperationSerializationTester extends SerializationTester<Operation> {
private static final Schema VALUE_TYPE_UNION = createUnion(BOOLEAN.getSchema(), DOUBLE.getSchema(),
FLOAT.getSchema(), INTEGER.getSchema(), LONG.getSchema(), NULL.getSchema(), STRING.getSchema(), | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/type/PrimitiveType.java
// public enum PrimitiveType {
// BOOLEAN(create(Schema.Type.BOOLEAN)),
// DOUBLE(create(Schema.Type.DOUBLE)),
// FLOAT(create(Schema.Type.FLOAT)),
// INTEGER(create(Schema.Type.INT)),
// LONG(create(Schema.Type.LONG)),
// NULL(create(Schema.Type.NULL)),
// STRING(create(Schema.Type.STRING));
//
// private final Schema schema;
//
// PrimitiveType(Schema schema) {
// this.schema = schema;
// }
//
// public Schema getSchema() {
// return schema;
// }
// }
// Path: src/test/java/io/datanerds/avropatch/serialization/OperationSerializationTester.java
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.operation.*;
import io.datanerds.avropatch.value.type.BigDecimalType;
import io.datanerds.avropatch.value.type.BigIntegerType;
import io.datanerds.avropatch.value.type.TimestampType;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import java.io.IOException;
import java.util.*;
import static io.datanerds.avropatch.value.type.PrimitiveType.*;
import static org.apache.avro.Schema.createUnion;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
package io.datanerds.avropatch.serialization;
public class OperationSerializationTester extends SerializationTester<Operation> {
private static final Schema VALUE_TYPE_UNION = createUnion(BOOLEAN.getSchema(), DOUBLE.getSchema(),
FLOAT.getSchema(), INTEGER.getSchema(), LONG.getSchema(), NULL.getSchema(), STRING.getSchema(), | BigDecimalType.SCHEMA, BigIntegerType.SCHEMA, TimestampType.SCHEMA, UuidType.SCHEMA); |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/operation/Replace.java | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
| import io.datanerds.avropatch.value.DefaultSchema;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import java.util.Objects; | package io.datanerds.avropatch.operation;
/**
* This class represents the "replace" operation of RFC 6902 'JavaScript Object Notation (JSON) Patch'.
*
* @see <a href="https://tools.ietf.org/html/rfc6902#section-4.3">https://tools.ietf.org/html/rfc6902#section-4.3</a>
*/
public final class Replace<T> implements Operation {
public final Path path; | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
// Path: src/main/java/io/datanerds/avropatch/operation/Replace.java
import io.datanerds.avropatch.value.DefaultSchema;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import java.util.Objects;
package io.datanerds.avropatch.operation;
/**
* This class represents the "replace" operation of RFC 6902 'JavaScript Object Notation (JSON) Patch'.
*
* @see <a href="https://tools.ietf.org/html/rfc6902#section-4.3">https://tools.ietf.org/html/rfc6902#section-4.3</a>
*/
public final class Replace<T> implements Operation {
public final Path path; | @AvroSchema(DefaultSchema.VALUE) |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/value/conversion/DateConversionTest.java | // Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
| import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.value.type.TimestampType;
import org.apache.avro.Schema;
import org.junit.Test;
import java.io.IOException;
import java.util.Date; | package io.datanerds.avropatch.value.conversion;
public class DateConversionTest {
@Test
public void serializesSingleValue() throws IOException {
ConversionTester | // Path: src/main/java/io/datanerds/avropatch/value/type/TimestampType.java
// public interface TimestampType {
// String NAME = "timestamp";
// String DOC = "Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// int SIZE = Long.BYTES;
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
// Path: src/test/java/io/datanerds/avropatch/value/conversion/DateConversionTest.java
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.value.type.TimestampType;
import org.apache.avro.Schema;
import org.junit.Test;
import java.io.IOException;
import java.util.Date;
package io.datanerds.avropatch.value.conversion;
public class DateConversionTest {
@Test
public void serializesSingleValue() throws IOException {
ConversionTester | .withSchemata(TimestampType.SCHEMA) |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/value/conversion/BigIntegerConversionTest.java | // Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
| import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.value.type.BigIntegerType;
import org.apache.avro.Schema;
import org.junit.Test;
import java.io.IOException;
import java.math.BigInteger; | package io.datanerds.avropatch.value.conversion;
public class BigIntegerConversionTest {
@Test
public void serializesSingleValue() throws IOException {
ConversionTester | // Path: src/main/java/io/datanerds/avropatch/value/type/BigIntegerType.java
// public interface BigIntegerType {
// String NAME = "big-integer";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(Schema.create(Schema.Type.BYTES));
// }
// Path: src/test/java/io/datanerds/avropatch/value/conversion/BigIntegerConversionTest.java
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.value.type.BigIntegerType;
import org.apache.avro.Schema;
import org.junit.Test;
import java.io.IOException;
import java.math.BigInteger;
package io.datanerds.avropatch.value.conversion;
public class BigIntegerConversionTest {
@Test
public void serializesSingleValue() throws IOException {
ConversionTester | .withSchemata(BigIntegerType.SCHEMA) |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/value/conversion/BigDecimalConversionTest.java | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
| import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.value.type.BigDecimalType;
import org.apache.avro.Schema;
import org.junit.Test;
import java.io.IOException;
import java.math.BigDecimal; | package io.datanerds.avropatch.value.conversion;
public class BigDecimalConversionTest {
@Test
public void serializesSingleValue() throws IOException {
ConversionTester | // Path: src/main/java/io/datanerds/avropatch/value/type/BigDecimalType.java
// public interface BigDecimalType {
// String NAME = "big-decimal";
// String DOC = "BigDecimal value represented via its scale and unscaled value.";
// LogicalType LOGICAL_TYPE = new LogicalType(NAME);
// Schema RECORD = SchemaBuilder
// .record("decimal")
// .doc(DOC)
// .fields()
// .name("unscaledValue").type(BigIntegerType.SCHEMA).noDefault()
// .name("scale").type(Schema.create(Schema.Type.INT)).noDefault()
// .endRecord();
//
// Schema SCHEMA = LOGICAL_TYPE.addToSchema(RECORD);
// }
// Path: src/test/java/io/datanerds/avropatch/value/conversion/BigDecimalConversionTest.java
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.value.type.BigDecimalType;
import org.apache.avro.Schema;
import org.junit.Test;
import java.io.IOException;
import java.math.BigDecimal;
package io.datanerds.avropatch.value.conversion;
public class BigDecimalConversionTest {
@Test
public void serializesSingleValue() throws IOException {
ConversionTester | .withSchemata(BigDecimalType.SCHEMA) |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/operation/Path.java | // Path: src/main/java/io/datanerds/avropatch/exception/InvalidReferenceTokenException.java
// public class InvalidReferenceTokenException extends AvroPatchException {
//
// public InvalidReferenceTokenException(String message) {
// super(message);
// }
// }
| import io.datanerds.avropatch.exception.InvalidReferenceTokenException;
import javax.annotation.Generated;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream; | return new Path(parts.subList(parts.size() - 1, parts.size()));
}
public List<String> parts() {
return parts;
}
public List<Path> subPaths() {
if (parts.isEmpty()) {
return Collections.emptyList();
}
List<Path> subPaths = new ArrayList<>();
for (int i = 1; i <= parts.size(); i++) {
subPaths.add(new Path(parts.subList(0, i)));
}
return subPaths;
}
private static Function<Path, Stream<String>> partsStream() {
return path -> path.parts().stream();
}
private static Stream<String> validatedReferenceTokens(String[] referenceTokens) {
return Stream.of(referenceTokens).map(Path::validateReferenceToken);
}
private static String validateReferenceToken(String path) {
if (!VALID_PATTERN.matcher(path).matches()) { | // Path: src/main/java/io/datanerds/avropatch/exception/InvalidReferenceTokenException.java
// public class InvalidReferenceTokenException extends AvroPatchException {
//
// public InvalidReferenceTokenException(String message) {
// super(message);
// }
// }
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
import io.datanerds.avropatch.exception.InvalidReferenceTokenException;
import javax.annotation.Generated;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
return new Path(parts.subList(parts.size() - 1, parts.size()));
}
public List<String> parts() {
return parts;
}
public List<Path> subPaths() {
if (parts.isEmpty()) {
return Collections.emptyList();
}
List<Path> subPaths = new ArrayList<>();
for (int i = 1; i <= parts.size(); i++) {
subPaths.add(new Path(parts.subList(0, i)));
}
return subPaths;
}
private static Function<Path, Stream<String>> partsStream() {
return path -> path.parts().stream();
}
private static Stream<String> validatedReferenceTokens(String[] referenceTokens) {
return Stream.of(referenceTokens).map(Path::validateReferenceToken);
}
private static String validateReferenceToken(String path) {
if (!VALID_PATTERN.matcher(path).matches()) { | throw new InvalidReferenceTokenException(String.format("%s is not a valid JSON path", path)); |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/Patch.java | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Operation.java
// @Union({Add.class, Copy.class, Move.class, Remove.class, Replace.class, Test.class})
// public interface Operation {
// }
| import io.datanerds.avropatch.value.DefaultSchema;
import io.datanerds.avropatch.operation.Operation;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import javax.annotation.concurrent.ThreadSafe;
import java.util.*;
import java.util.stream.Stream; | package io.datanerds.avropatch;
/**
* This class represents a JSON PATCH operation holding a sequence of operations to apply to a given object. It provides
* shortcuts for accessing the list of operations and some additional fields for metadata information, such as the
* resource identifier, a timestamp and a {@link Map} holding arbitrary header information.
*
* @see <a href="https://tools.ietf.org/html/rfc6902">https://tools.ietf.org/html/rfc6902</a>
*/
@ThreadSafe
public class Patch<T> {
| // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Operation.java
// @Union({Add.class, Copy.class, Move.class, Remove.class, Replace.class, Test.class})
// public interface Operation {
// }
// Path: src/main/java/io/datanerds/avropatch/Patch.java
import io.datanerds.avropatch.value.DefaultSchema;
import io.datanerds.avropatch.operation.Operation;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import javax.annotation.concurrent.ThreadSafe;
import java.util.*;
import java.util.stream.Stream;
package io.datanerds.avropatch;
/**
* This class represents a JSON PATCH operation holding a sequence of operations to apply to a given object. It provides
* shortcuts for accessing the list of operations and some additional fields for metadata information, such as the
* resource identifier, a timestamp and a {@link Map} holding arbitrary header information.
*
* @see <a href="https://tools.ietf.org/html/rfc6902">https://tools.ietf.org/html/rfc6902</a>
*/
@ThreadSafe
public class Patch<T> {
| @AvroSchema(DefaultSchema.HEADERS) |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/Patch.java | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Operation.java
// @Union({Add.class, Copy.class, Move.class, Remove.class, Replace.class, Test.class})
// public interface Operation {
// }
| import io.datanerds.avropatch.value.DefaultSchema;
import io.datanerds.avropatch.operation.Operation;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import javax.annotation.concurrent.ThreadSafe;
import java.util.*;
import java.util.stream.Stream; | package io.datanerds.avropatch;
/**
* This class represents a JSON PATCH operation holding a sequence of operations to apply to a given object. It provides
* shortcuts for accessing the list of operations and some additional fields for metadata information, such as the
* resource identifier, a timestamp and a {@link Map} holding arbitrary header information.
*
* @see <a href="https://tools.ietf.org/html/rfc6902">https://tools.ietf.org/html/rfc6902</a>
*/
@ThreadSafe
public class Patch<T> {
@AvroSchema(DefaultSchema.HEADERS)
private final Map<String, Object> headers;
@AvroSchema(DefaultSchema.VALUE)
private final T resource;
@AvroSchema(DefaultSchema.TIMESTAMP)
private final Date timestamp; | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Operation.java
// @Union({Add.class, Copy.class, Move.class, Remove.class, Replace.class, Test.class})
// public interface Operation {
// }
// Path: src/main/java/io/datanerds/avropatch/Patch.java
import io.datanerds.avropatch.value.DefaultSchema;
import io.datanerds.avropatch.operation.Operation;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import javax.annotation.concurrent.ThreadSafe;
import java.util.*;
import java.util.stream.Stream;
package io.datanerds.avropatch;
/**
* This class represents a JSON PATCH operation holding a sequence of operations to apply to a given object. It provides
* shortcuts for accessing the list of operations and some additional fields for metadata information, such as the
* resource identifier, a timestamp and a {@link Map} holding arbitrary header information.
*
* @see <a href="https://tools.ietf.org/html/rfc6902">https://tools.ietf.org/html/rfc6902</a>
*/
@ThreadSafe
public class Patch<T> {
@AvroSchema(DefaultSchema.HEADERS)
private final Map<String, Object> headers;
@AvroSchema(DefaultSchema.VALUE)
private final T resource;
@AvroSchema(DefaultSchema.TIMESTAMP)
private final Date timestamp; | private final List<Operation> operations; |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/operation/Test.java | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
| import io.datanerds.avropatch.value.DefaultSchema;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import java.util.Objects; | package io.datanerds.avropatch.operation;
/**
* This class represents the "test" operation of RFC 6902 'JavaScript Object Notation (JSON) Patch'.
*
* @see <a href="https://tools.ietf.org/html/rfc6902#section-4.6">https://tools.ietf.org/html/rfc6902#section-4.6</a>
*/
public final class Test<T> implements Operation {
public final Path path; | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
// Path: src/main/java/io/datanerds/avropatch/operation/Test.java
import io.datanerds.avropatch.value.DefaultSchema;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import java.util.Objects;
package io.datanerds.avropatch.operation;
/**
* This class represents the "test" operation of RFC 6902 'JavaScript Object Notation (JSON) Patch'.
*
* @see <a href="https://tools.ietf.org/html/rfc6902#section-4.6">https://tools.ietf.org/html/rfc6902#section-4.6</a>
*/
public final class Test<T> implements Operation {
public final Path path; | @AvroSchema(DefaultSchema.VALUE) |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/value/conversion/UUIDConversionTest.java | // Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
| import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import org.junit.Test;
import java.io.IOException;
import java.util.UUID; | package io.datanerds.avropatch.value.conversion;
public class UUIDConversionTest {
@Test
public void serializesSingleValue() throws IOException {
ConversionTester | // Path: src/main/java/io/datanerds/avropatch/value/type/UuidType.java
// public interface UuidType {
// String NAME = LogicalTypes.uuid().getName();
// String DOC = "UUID serialized via two long values: Its most significant and least significant 64 bits.";
// int SIZE = 2 * Long.BYTES;
// Schema SCHEMA = LogicalTypes.uuid().addToSchema(Schema.createFixed(NAME, DOC, null, SIZE));
// }
// Path: src/test/java/io/datanerds/avropatch/value/conversion/UUIDConversionTest.java
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.datanerds.avropatch.value.type.UuidType;
import org.apache.avro.Schema;
import org.junit.Test;
import java.io.IOException;
import java.util.UUID;
package io.datanerds.avropatch.value.conversion;
public class UUIDConversionTest {
@Test
public void serializesSingleValue() throws IOException {
ConversionTester | .withSchemata(UuidType.SCHEMA) |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/serialization/SerializationTester.java | // Path: src/main/java/io/datanerds/avropatch/value/AvroData.java
// public final class AvroData extends ReflectData {
//
// private static final List<Conversion<?>> CONVERTERS = Arrays.asList(
// new DateConversion(),
// new BigIntegerConversion(),
// new BigDecimalConversion(),
// new UUIDConversion()
// );
//
// private static final AvroData INSTANCE = new AvroData();
//
// private AvroData() {
// CONVERTERS.forEach(this::addLogicalTypeConversion);
// }
//
// /**
// * Hides {@link ReflectData#get()} and returns {@link ReflectData} subclass initialized with custom converters.
// * @see ReflectData#get()
// * @see DateConversion
// * @see BigIntegerConversion
// * @see BigDecimalConversion
// * @see UUIDConversion
// * @return singleton instance
// */
// public static AvroData get() {
// return INSTANCE;
// }
// }
| import io.datanerds.avropatch.value.AvroData;
import org.apache.avro.Schema;
import org.apache.avro.io.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Objects;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; | package io.datanerds.avropatch.serialization;
public class SerializationTester<T> {
private final DatumWriter<T> writer;
private final DatumReader<T> reader;
public SerializationTester(Schema schema) {
Objects.nonNull(schema); | // Path: src/main/java/io/datanerds/avropatch/value/AvroData.java
// public final class AvroData extends ReflectData {
//
// private static final List<Conversion<?>> CONVERTERS = Arrays.asList(
// new DateConversion(),
// new BigIntegerConversion(),
// new BigDecimalConversion(),
// new UUIDConversion()
// );
//
// private static final AvroData INSTANCE = new AvroData();
//
// private AvroData() {
// CONVERTERS.forEach(this::addLogicalTypeConversion);
// }
//
// /**
// * Hides {@link ReflectData#get()} and returns {@link ReflectData} subclass initialized with custom converters.
// * @see ReflectData#get()
// * @see DateConversion
// * @see BigIntegerConversion
// * @see BigDecimalConversion
// * @see UUIDConversion
// * @return singleton instance
// */
// public static AvroData get() {
// return INSTANCE;
// }
// }
// Path: src/test/java/io/datanerds/avropatch/serialization/SerializationTester.java
import io.datanerds.avropatch.value.AvroData;
import org.apache.avro.Schema;
import org.apache.avro.io.*;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Objects;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
package io.datanerds.avropatch.serialization;
public class SerializationTester<T> {
private final DatumWriter<T> writer;
private final DatumReader<T> reader;
public SerializationTester(Schema schema) {
Objects.nonNull(schema); | writer = AvroData.get().createDatumWriter(schema); |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/operation/Add.java | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
| import io.datanerds.avropatch.value.DefaultSchema;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import java.util.Objects; | package io.datanerds.avropatch.operation;
/**
* This class represents the "add" operation of RFC 6902 'JavaScript Object Notation (JSON) Patch'.
*
* @see <a href="https://tools.ietf.org/html/rfc6902#section-4.1">https://tools.ietf.org/html/rfc6902#section-4.1</a>
* @param <T> DefaultSchema type of <i>add</i> operation
*/
public final class Add<T> implements Operation {
public final Path path; | // Path: src/main/java/io/datanerds/avropatch/value/DefaultSchema.java
// public interface DefaultSchema {
// String VALUE =
// "[{"
// + " \"type\": \"record\","
// + " \"name\": \"decimal\","
// + " \"fields\": [{"
// + " \"name\": \"unscaledValue\","
// + " \"type\": {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }"
// + " }, {"
// + " \"name\": \"scale\","
// + " \"type\": \"int\""
// + " }],"
// + " \"logicalType\": \"big-decimal\""
// + "}, {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + "}, \"boolean\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}, \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", {"
// + " \"type\": \"fixed\","
// + " \"name\": \"uuid\","
// + " \"size\": 16,"
// + " \"logicalType\": \"uuid\""
// + "}, {"
// + " \"type\": \"array\","
// + " \"items\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}, {\n"
// + " \"type\": \"map\","
// + " \"values\": [\"decimal\", {"
// + " \"type\": \"bytes\","
// + " \"logicalType\": \"big-integer\""
// + " }, \"boolean\", \"timestamp\", \"double\", \"float\", \"int\", \"long\", \"null\", \"string\", \"uuid\"]"
// + "}]";
//
// String HEADERS =
// "{\n"
// + " \"type\": \"map\",\n"
// + " \"values\": [\"boolean\", \"double\", \"float\", \"int\", \"long\", \"string\", {\n"
// + " \"type\": \"record\",\n"
// + " \"name\": \"decimal\",\n"
// + " \"doc\": \"BigDecimal value represented via it's scale and unscaled value.\",\n"
// + " \"fields\": [{\n"
// + " \"name\": \"unscaledValue\",\n"
// + " \"type\": {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }\n"
// + " }, {\n"
// + " \"name\": \"scale\",\n"
// + " \"type\": \"int\"\n"
// + " }],\n"
// + " \"logicalType\": \"big-decimal\"\n"
// + " }, {\n"
// + " \"type\": \"bytes\",\n"
// + " \"logicalType\": \"big-integer\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"timestamp\",\n"
// + " \"doc\": \"Timestamp representing the number of milliseconds since January 1, 1970, 00:00:00 GMT\",\n"
// + " \"size\": 8,\n"
// + " \"logicalType\": \"timestamp\"\n"
// + " }, {\n"
// + " \"type\": \"fixed\",\n"
// + " \"name\": \"uuid\",\n"
// + " \"doc\": \"UUID serialized via two long values: It's most significant and least significant 64 bits.\",\n"
// + " \"size\": 16,\n"
// + " \"logicalType\": \"uuid\"\n"
// + " }]\n"
// + "}";
// String TIMESTAMP =
// "{"
// + " \"type\": \"fixed\","
// + " \"name\": \"timestamp\","
// + " \"size\": 8,"
// + " \"logicalType\": \"timestamp\""
// + "}";
// }
// Path: src/main/java/io/datanerds/avropatch/operation/Add.java
import io.datanerds.avropatch.value.DefaultSchema;
import org.apache.avro.reflect.AvroSchema;
import javax.annotation.Generated;
import java.util.Objects;
package io.datanerds.avropatch.operation;
/**
* This class represents the "add" operation of RFC 6902 'JavaScript Object Notation (JSON) Patch'.
*
* @see <a href="https://tools.ietf.org/html/rfc6902#section-4.1">https://tools.ietf.org/html/rfc6902#section-4.1</a>
* @param <T> DefaultSchema type of <i>add</i> operation
*/
public final class Add<T> implements Operation {
public final Path path; | @AvroSchema(DefaultSchema.VALUE) |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/PatchTest.java | // Path: src/main/java/io/datanerds/avropatch/operation/Operation.java
// @Union({Add.class, Copy.class, Move.class, Remove.class, Replace.class, Test.class})
// public interface Operation {
// }
| import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.testing.EqualsTester;
import io.datanerds.avropatch.operation.Operation;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.*;
import java.util.stream.Collectors;
import static io.datanerds.avropatch.operation.OperationGenerator.randomOperation;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*; | package io.datanerds.avropatch;
public class PatchTest {
private final UUID uuid = UUID.randomUUID();
private final Map<String, Object> headers = ImmutableMap.of("test 1", "foo", "test 2", uuid); | // Path: src/main/java/io/datanerds/avropatch/operation/Operation.java
// @Union({Add.class, Copy.class, Move.class, Remove.class, Replace.class, Test.class})
// public interface Operation {
// }
// Path: src/test/java/io/datanerds/avropatch/PatchTest.java
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.testing.EqualsTester;
import io.datanerds.avropatch.operation.Operation;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import java.util.*;
import java.util.stream.Collectors;
import static io.datanerds.avropatch.operation.OperationGenerator.randomOperation;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.*;
package io.datanerds.avropatch;
public class PatchTest {
private final UUID uuid = UUID.randomUUID();
private final Map<String, Object> headers = ImmutableMap.of("test 1", "foo", "test 2", uuid); | private final List<Operation> operations = ImmutableList.of(randomOperation(), randomOperation(), randomOperation()); |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/operation/PathTest.java | // Path: src/main/java/io/datanerds/avropatch/exception/InvalidReferenceTokenException.java
// public class InvalidReferenceTokenException extends AvroPatchException {
//
// public InvalidReferenceTokenException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final Path ROOT = new Path();
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final String SLASH = "/";
| import com.google.common.testing.EqualsTester;
import com.google.common.testing.NullPointerTester;
import io.datanerds.avropatch.exception.InvalidReferenceTokenException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static io.datanerds.avropatch.operation.Path.ROOT;
import static io.datanerds.avropatch.operation.Path.SLASH;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.emptyIterableOf;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.junit.Assert.assertThat; | package io.datanerds.avropatch.operation;
public class PathTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
public void equality() {
new EqualsTester()
.addEqualityGroup(Path.of("hello"), Path.of("hello"), Path.parse("/hello"), Path.parse("/hello/"))
.addEqualityGroup(Path.of("hello", "world"), Path.of("hello", "world"), Path.parse("/hello/world"),
Path.of("hello").append("world"), Path.of("hello").append(Path.of("world")),
Path.of(Path.of("hello"), Path.of("world"))) | // Path: src/main/java/io/datanerds/avropatch/exception/InvalidReferenceTokenException.java
// public class InvalidReferenceTokenException extends AvroPatchException {
//
// public InvalidReferenceTokenException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final Path ROOT = new Path();
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final String SLASH = "/";
// Path: src/test/java/io/datanerds/avropatch/operation/PathTest.java
import com.google.common.testing.EqualsTester;
import com.google.common.testing.NullPointerTester;
import io.datanerds.avropatch.exception.InvalidReferenceTokenException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static io.datanerds.avropatch.operation.Path.ROOT;
import static io.datanerds.avropatch.operation.Path.SLASH;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.emptyIterableOf;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.junit.Assert.assertThat;
package io.datanerds.avropatch.operation;
public class PathTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
public void equality() {
new EqualsTester()
.addEqualityGroup(Path.of("hello"), Path.of("hello"), Path.parse("/hello"), Path.parse("/hello/"))
.addEqualityGroup(Path.of("hello", "world"), Path.of("hello", "world"), Path.parse("/hello/world"),
Path.of("hello").append("world"), Path.of("hello").append(Path.of("world")),
Path.of(Path.of("hello"), Path.of("world"))) | .addEqualityGroup(Path.of(), Path.parse(SLASH), ROOT) |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/operation/PathTest.java | // Path: src/main/java/io/datanerds/avropatch/exception/InvalidReferenceTokenException.java
// public class InvalidReferenceTokenException extends AvroPatchException {
//
// public InvalidReferenceTokenException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final Path ROOT = new Path();
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final String SLASH = "/";
| import com.google.common.testing.EqualsTester;
import com.google.common.testing.NullPointerTester;
import io.datanerds.avropatch.exception.InvalidReferenceTokenException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static io.datanerds.avropatch.operation.Path.ROOT;
import static io.datanerds.avropatch.operation.Path.SLASH;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.emptyIterableOf;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.junit.Assert.assertThat; | package io.datanerds.avropatch.operation;
public class PathTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
public void equality() {
new EqualsTester()
.addEqualityGroup(Path.of("hello"), Path.of("hello"), Path.parse("/hello"), Path.parse("/hello/"))
.addEqualityGroup(Path.of("hello", "world"), Path.of("hello", "world"), Path.parse("/hello/world"),
Path.of("hello").append("world"), Path.of("hello").append(Path.of("world")),
Path.of(Path.of("hello"), Path.of("world"))) | // Path: src/main/java/io/datanerds/avropatch/exception/InvalidReferenceTokenException.java
// public class InvalidReferenceTokenException extends AvroPatchException {
//
// public InvalidReferenceTokenException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final Path ROOT = new Path();
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final String SLASH = "/";
// Path: src/test/java/io/datanerds/avropatch/operation/PathTest.java
import com.google.common.testing.EqualsTester;
import com.google.common.testing.NullPointerTester;
import io.datanerds.avropatch.exception.InvalidReferenceTokenException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static io.datanerds.avropatch.operation.Path.ROOT;
import static io.datanerds.avropatch.operation.Path.SLASH;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.emptyIterableOf;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.junit.Assert.assertThat;
package io.datanerds.avropatch.operation;
public class PathTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
public void equality() {
new EqualsTester()
.addEqualityGroup(Path.of("hello"), Path.of("hello"), Path.parse("/hello"), Path.parse("/hello/"))
.addEqualityGroup(Path.of("hello", "world"), Path.of("hello", "world"), Path.parse("/hello/world"),
Path.of("hello").append("world"), Path.of("hello").append(Path.of("world")),
Path.of(Path.of("hello"), Path.of("world"))) | .addEqualityGroup(Path.of(), Path.parse(SLASH), ROOT) |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/operation/PathTest.java | // Path: src/main/java/io/datanerds/avropatch/exception/InvalidReferenceTokenException.java
// public class InvalidReferenceTokenException extends AvroPatchException {
//
// public InvalidReferenceTokenException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final Path ROOT = new Path();
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final String SLASH = "/";
| import com.google.common.testing.EqualsTester;
import com.google.common.testing.NullPointerTester;
import io.datanerds.avropatch.exception.InvalidReferenceTokenException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static io.datanerds.avropatch.operation.Path.ROOT;
import static io.datanerds.avropatch.operation.Path.SLASH;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.emptyIterableOf;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.junit.Assert.assertThat; | package io.datanerds.avropatch.operation;
public class PathTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
public void equality() {
new EqualsTester()
.addEqualityGroup(Path.of("hello"), Path.of("hello"), Path.parse("/hello"), Path.parse("/hello/"))
.addEqualityGroup(Path.of("hello", "world"), Path.of("hello", "world"), Path.parse("/hello/world"),
Path.of("hello").append("world"), Path.of("hello").append(Path.of("world")),
Path.of(Path.of("hello"), Path.of("world")))
.addEqualityGroup(Path.of(), Path.parse(SLASH), ROOT)
.testEquals();
}
@Test
public void npe() {
new NullPointerTester().testAllPublicStaticMethods(Path.class);
}
@Test
public void numbersAndUnderscores() {
Path path = Path.of("hello_", "123world-456");
assertThat(path.toString(), is(equalTo("/hello_/123world-456")));
}
@Test
public void noLeadingUnderscores() { | // Path: src/main/java/io/datanerds/avropatch/exception/InvalidReferenceTokenException.java
// public class InvalidReferenceTokenException extends AvroPatchException {
//
// public InvalidReferenceTokenException(String message) {
// super(message);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final Path ROOT = new Path();
//
// Path: src/main/java/io/datanerds/avropatch/operation/Path.java
// public static final String SLASH = "/";
// Path: src/test/java/io/datanerds/avropatch/operation/PathTest.java
import com.google.common.testing.EqualsTester;
import com.google.common.testing.NullPointerTester;
import io.datanerds.avropatch.exception.InvalidReferenceTokenException;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import static io.datanerds.avropatch.operation.Path.ROOT;
import static io.datanerds.avropatch.operation.Path.SLASH;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.Matchers.emptyIterableOf;
import static org.hamcrest.Matchers.iterableWithSize;
import static org.junit.Assert.assertThat;
package io.datanerds.avropatch.operation;
public class PathTest {
@Rule
public ExpectedException expectedException = ExpectedException.none();
@Test
public void equality() {
new EqualsTester()
.addEqualityGroup(Path.of("hello"), Path.of("hello"), Path.parse("/hello"), Path.parse("/hello/"))
.addEqualityGroup(Path.of("hello", "world"), Path.of("hello", "world"), Path.parse("/hello/world"),
Path.of("hello").append("world"), Path.of("hello").append(Path.of("world")),
Path.of(Path.of("hello"), Path.of("world")))
.addEqualityGroup(Path.of(), Path.parse(SLASH), ROOT)
.testEquals();
}
@Test
public void npe() {
new NullPointerTester().testAllPublicStaticMethods(Path.class);
}
@Test
public void numbersAndUnderscores() {
Path path = Path.of("hello_", "123world-456");
assertThat(path.toString(), is(equalTo("/hello_/123world-456")));
}
@Test
public void noLeadingUnderscores() { | expectedException.expect(InvalidReferenceTokenException.class); |
datanerds-io/avropatch | src/test/java/io/datanerds/avropatch/operation/OperationGenerator.java | // Path: src/test/java/io/datanerds/avropatch/value/Bimmel.java
// public class Bimmel {
//
// public final String name;
// public final int number;
// public final UUID id;
// public final Bommel bommel;
//
// @SuppressWarnings("unused") // no-arg constructor for Avro
// private Bimmel() {
// this(null, -42, null, null);
// }
//
// public Bimmel(String name, int number, UUID id, Bommel bommel) {
// this.name = name;
// this.number = number;
// this.id = id;
// this.bommel = bommel;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
// Bimmel bimmel = (Bimmel) o;
// return number == bimmel.number &&
// Objects.equals(name, bimmel.name) &&
// Objects.equals(id, bimmel.id) &&
// Objects.equals(bommel, bimmel.bommel);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(name, number, id, bommel);
// }
//
// public static class Bommel {
// public final String name;
//
// @SuppressWarnings("unused")
// private Bommel() {
// this(null);
// }
//
// public Bommel(String name) {
// this.name = name;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
// Bommel bommel = (Bommel) o;
// return Objects.equals(name, bommel.name);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(name);
// }
// }
// }
| import io.datanerds.avropatch.value.Bimmel;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream; | return values()[random.nextInt(ValueType.values().length)];
}
private static List<?> generateList(ValueType type) {
return IntStream
.range(0, MAX_LIST_SIZE)
.mapToObj(i -> type.generate())
.collect(Collectors.toList());
}
private static String randomString() {
return java.util.UUID.randomUUID().toString();
}
private static BigDecimal randomBigDecimal() {
BigInteger unscaledValue = new BigInteger(random.nextInt(256), random);
int numberOfDigits = getDigitCount(unscaledValue);
int scale = random.nextInt(numberOfDigits + 1);
return new BigDecimal(unscaledValue, scale);
}
private static int getDigitCount(BigInteger number) {
double factor = Math.log(2) / Math.log(10);
int digitCount = (int) (factor * number.bitLength() + 1);
if (BigInteger.TEN.pow(digitCount - 1).compareTo(number) > 0) {
return digitCount - 1;
}
return digitCount;
}
| // Path: src/test/java/io/datanerds/avropatch/value/Bimmel.java
// public class Bimmel {
//
// public final String name;
// public final int number;
// public final UUID id;
// public final Bommel bommel;
//
// @SuppressWarnings("unused") // no-arg constructor for Avro
// private Bimmel() {
// this(null, -42, null, null);
// }
//
// public Bimmel(String name, int number, UUID id, Bommel bommel) {
// this.name = name;
// this.number = number;
// this.id = id;
// this.bommel = bommel;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
// Bimmel bimmel = (Bimmel) o;
// return number == bimmel.number &&
// Objects.equals(name, bimmel.name) &&
// Objects.equals(id, bimmel.id) &&
// Objects.equals(bommel, bimmel.bommel);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(name, number, id, bommel);
// }
//
// public static class Bommel {
// public final String name;
//
// @SuppressWarnings("unused")
// private Bommel() {
// this(null);
// }
//
// public Bommel(String name) {
// this.name = name;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
// Bommel bommel = (Bommel) o;
// return Objects.equals(name, bommel.name);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(name);
// }
// }
// }
// Path: src/test/java/io/datanerds/avropatch/operation/OperationGenerator.java
import io.datanerds.avropatch.value.Bimmel;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.function.Function;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
return values()[random.nextInt(ValueType.values().length)];
}
private static List<?> generateList(ValueType type) {
return IntStream
.range(0, MAX_LIST_SIZE)
.mapToObj(i -> type.generate())
.collect(Collectors.toList());
}
private static String randomString() {
return java.util.UUID.randomUUID().toString();
}
private static BigDecimal randomBigDecimal() {
BigInteger unscaledValue = new BigInteger(random.nextInt(256), random);
int numberOfDigits = getDigitCount(unscaledValue);
int scale = random.nextInt(numberOfDigits + 1);
return new BigDecimal(unscaledValue, scale);
}
private static int getDigitCount(BigInteger number) {
double factor = Math.log(2) / Math.log(10);
int digitCount = (int) (factor * number.bitLength() + 1);
if (BigInteger.TEN.pow(digitCount - 1).compareTo(number) > 0) {
return digitCount - 1;
}
return digitCount;
}
| private static Bimmel randomBimmel() { |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/value/AvroData.java | // Path: src/main/java/io/datanerds/avropatch/value/conversion/BigDecimalConversion.java
// public class BigDecimalConversion extends Conversion<BigDecimal> implements BigDecimalType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigDecimal> getConvertedType() {
// return BigDecimal.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigDecimal fromRecord(IndexedRecord value, Schema schema, LogicalType type) {
// BigInteger unscaledValue = (BigInteger)value.get(0);
// int scale = (int) value.get(1);
// return new BigDecimal(unscaledValue, scale);
// }
//
// @Override
// public IndexedRecord toRecord(BigDecimal value, Schema schema, LogicalType type) {
// GenericData.Record record = new GenericData.Record(schema);
// record.put(0, value.unscaledValue());
// record.put(1, value.scale());
// return record;
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/BigIntegerConversion.java
// public class BigIntegerConversion extends Conversion<BigInteger> implements BigIntegerType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigInteger> getConvertedType() {
// return BigInteger.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigInteger fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
// return new BigInteger(value.array());
// }
//
// @Override
// public ByteBuffer toBytes(BigInteger value, Schema schema, LogicalType type) {
// return ByteBuffer.wrap(value.toByteArray());
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/DateConversion.java
// public class DateConversion extends Conversion<Date> implements TimestampType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<Date> getConvertedType() {
// return Date.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(Date value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getTime());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public Date fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long time = buffer.getLong();
// return new Date(time);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/UUIDConversion.java
// public class UUIDConversion extends Conversion<UUID> implements UuidType {
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<UUID> getConvertedType() {
// return UUID.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(UUID value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getLeastSignificantBits());
// buffer.putLong(value.getMostSignificantBits());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public UUID fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long leastSignificantBits = buffer.getLong();
// long mostSignificantBits = buffer.getLong();
// return new UUID(mostSignificantBits, leastSignificantBits);
// }
// }
| import io.datanerds.avropatch.value.conversion.BigDecimalConversion;
import io.datanerds.avropatch.value.conversion.BigIntegerConversion;
import io.datanerds.avropatch.value.conversion.DateConversion;
import io.datanerds.avropatch.value.conversion.UUIDConversion;
import org.apache.avro.Conversion;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
import java.util.List; | package io.datanerds.avropatch.value;
public final class AvroData extends ReflectData {
private static final List<Conversion<?>> CONVERTERS = Arrays.asList( | // Path: src/main/java/io/datanerds/avropatch/value/conversion/BigDecimalConversion.java
// public class BigDecimalConversion extends Conversion<BigDecimal> implements BigDecimalType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigDecimal> getConvertedType() {
// return BigDecimal.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigDecimal fromRecord(IndexedRecord value, Schema schema, LogicalType type) {
// BigInteger unscaledValue = (BigInteger)value.get(0);
// int scale = (int) value.get(1);
// return new BigDecimal(unscaledValue, scale);
// }
//
// @Override
// public IndexedRecord toRecord(BigDecimal value, Schema schema, LogicalType type) {
// GenericData.Record record = new GenericData.Record(schema);
// record.put(0, value.unscaledValue());
// record.put(1, value.scale());
// return record;
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/BigIntegerConversion.java
// public class BigIntegerConversion extends Conversion<BigInteger> implements BigIntegerType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigInteger> getConvertedType() {
// return BigInteger.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigInteger fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
// return new BigInteger(value.array());
// }
//
// @Override
// public ByteBuffer toBytes(BigInteger value, Schema schema, LogicalType type) {
// return ByteBuffer.wrap(value.toByteArray());
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/DateConversion.java
// public class DateConversion extends Conversion<Date> implements TimestampType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<Date> getConvertedType() {
// return Date.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(Date value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getTime());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public Date fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long time = buffer.getLong();
// return new Date(time);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/UUIDConversion.java
// public class UUIDConversion extends Conversion<UUID> implements UuidType {
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<UUID> getConvertedType() {
// return UUID.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(UUID value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getLeastSignificantBits());
// buffer.putLong(value.getMostSignificantBits());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public UUID fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long leastSignificantBits = buffer.getLong();
// long mostSignificantBits = buffer.getLong();
// return new UUID(mostSignificantBits, leastSignificantBits);
// }
// }
// Path: src/main/java/io/datanerds/avropatch/value/AvroData.java
import io.datanerds.avropatch.value.conversion.BigDecimalConversion;
import io.datanerds.avropatch.value.conversion.BigIntegerConversion;
import io.datanerds.avropatch.value.conversion.DateConversion;
import io.datanerds.avropatch.value.conversion.UUIDConversion;
import org.apache.avro.Conversion;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
import java.util.List;
package io.datanerds.avropatch.value;
public final class AvroData extends ReflectData {
private static final List<Conversion<?>> CONVERTERS = Arrays.asList( | new DateConversion(), |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/value/AvroData.java | // Path: src/main/java/io/datanerds/avropatch/value/conversion/BigDecimalConversion.java
// public class BigDecimalConversion extends Conversion<BigDecimal> implements BigDecimalType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigDecimal> getConvertedType() {
// return BigDecimal.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigDecimal fromRecord(IndexedRecord value, Schema schema, LogicalType type) {
// BigInteger unscaledValue = (BigInteger)value.get(0);
// int scale = (int) value.get(1);
// return new BigDecimal(unscaledValue, scale);
// }
//
// @Override
// public IndexedRecord toRecord(BigDecimal value, Schema schema, LogicalType type) {
// GenericData.Record record = new GenericData.Record(schema);
// record.put(0, value.unscaledValue());
// record.put(1, value.scale());
// return record;
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/BigIntegerConversion.java
// public class BigIntegerConversion extends Conversion<BigInteger> implements BigIntegerType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigInteger> getConvertedType() {
// return BigInteger.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigInteger fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
// return new BigInteger(value.array());
// }
//
// @Override
// public ByteBuffer toBytes(BigInteger value, Schema schema, LogicalType type) {
// return ByteBuffer.wrap(value.toByteArray());
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/DateConversion.java
// public class DateConversion extends Conversion<Date> implements TimestampType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<Date> getConvertedType() {
// return Date.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(Date value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getTime());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public Date fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long time = buffer.getLong();
// return new Date(time);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/UUIDConversion.java
// public class UUIDConversion extends Conversion<UUID> implements UuidType {
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<UUID> getConvertedType() {
// return UUID.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(UUID value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getLeastSignificantBits());
// buffer.putLong(value.getMostSignificantBits());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public UUID fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long leastSignificantBits = buffer.getLong();
// long mostSignificantBits = buffer.getLong();
// return new UUID(mostSignificantBits, leastSignificantBits);
// }
// }
| import io.datanerds.avropatch.value.conversion.BigDecimalConversion;
import io.datanerds.avropatch.value.conversion.BigIntegerConversion;
import io.datanerds.avropatch.value.conversion.DateConversion;
import io.datanerds.avropatch.value.conversion.UUIDConversion;
import org.apache.avro.Conversion;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
import java.util.List; | package io.datanerds.avropatch.value;
public final class AvroData extends ReflectData {
private static final List<Conversion<?>> CONVERTERS = Arrays.asList(
new DateConversion(), | // Path: src/main/java/io/datanerds/avropatch/value/conversion/BigDecimalConversion.java
// public class BigDecimalConversion extends Conversion<BigDecimal> implements BigDecimalType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigDecimal> getConvertedType() {
// return BigDecimal.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigDecimal fromRecord(IndexedRecord value, Schema schema, LogicalType type) {
// BigInteger unscaledValue = (BigInteger)value.get(0);
// int scale = (int) value.get(1);
// return new BigDecimal(unscaledValue, scale);
// }
//
// @Override
// public IndexedRecord toRecord(BigDecimal value, Schema schema, LogicalType type) {
// GenericData.Record record = new GenericData.Record(schema);
// record.put(0, value.unscaledValue());
// record.put(1, value.scale());
// return record;
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/BigIntegerConversion.java
// public class BigIntegerConversion extends Conversion<BigInteger> implements BigIntegerType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigInteger> getConvertedType() {
// return BigInteger.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigInteger fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
// return new BigInteger(value.array());
// }
//
// @Override
// public ByteBuffer toBytes(BigInteger value, Schema schema, LogicalType type) {
// return ByteBuffer.wrap(value.toByteArray());
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/DateConversion.java
// public class DateConversion extends Conversion<Date> implements TimestampType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<Date> getConvertedType() {
// return Date.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(Date value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getTime());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public Date fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long time = buffer.getLong();
// return new Date(time);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/UUIDConversion.java
// public class UUIDConversion extends Conversion<UUID> implements UuidType {
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<UUID> getConvertedType() {
// return UUID.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(UUID value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getLeastSignificantBits());
// buffer.putLong(value.getMostSignificantBits());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public UUID fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long leastSignificantBits = buffer.getLong();
// long mostSignificantBits = buffer.getLong();
// return new UUID(mostSignificantBits, leastSignificantBits);
// }
// }
// Path: src/main/java/io/datanerds/avropatch/value/AvroData.java
import io.datanerds.avropatch.value.conversion.BigDecimalConversion;
import io.datanerds.avropatch.value.conversion.BigIntegerConversion;
import io.datanerds.avropatch.value.conversion.DateConversion;
import io.datanerds.avropatch.value.conversion.UUIDConversion;
import org.apache.avro.Conversion;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
import java.util.List;
package io.datanerds.avropatch.value;
public final class AvroData extends ReflectData {
private static final List<Conversion<?>> CONVERTERS = Arrays.asList(
new DateConversion(), | new BigIntegerConversion(), |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/value/AvroData.java | // Path: src/main/java/io/datanerds/avropatch/value/conversion/BigDecimalConversion.java
// public class BigDecimalConversion extends Conversion<BigDecimal> implements BigDecimalType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigDecimal> getConvertedType() {
// return BigDecimal.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigDecimal fromRecord(IndexedRecord value, Schema schema, LogicalType type) {
// BigInteger unscaledValue = (BigInteger)value.get(0);
// int scale = (int) value.get(1);
// return new BigDecimal(unscaledValue, scale);
// }
//
// @Override
// public IndexedRecord toRecord(BigDecimal value, Schema schema, LogicalType type) {
// GenericData.Record record = new GenericData.Record(schema);
// record.put(0, value.unscaledValue());
// record.put(1, value.scale());
// return record;
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/BigIntegerConversion.java
// public class BigIntegerConversion extends Conversion<BigInteger> implements BigIntegerType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigInteger> getConvertedType() {
// return BigInteger.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigInteger fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
// return new BigInteger(value.array());
// }
//
// @Override
// public ByteBuffer toBytes(BigInteger value, Schema schema, LogicalType type) {
// return ByteBuffer.wrap(value.toByteArray());
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/DateConversion.java
// public class DateConversion extends Conversion<Date> implements TimestampType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<Date> getConvertedType() {
// return Date.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(Date value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getTime());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public Date fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long time = buffer.getLong();
// return new Date(time);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/UUIDConversion.java
// public class UUIDConversion extends Conversion<UUID> implements UuidType {
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<UUID> getConvertedType() {
// return UUID.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(UUID value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getLeastSignificantBits());
// buffer.putLong(value.getMostSignificantBits());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public UUID fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long leastSignificantBits = buffer.getLong();
// long mostSignificantBits = buffer.getLong();
// return new UUID(mostSignificantBits, leastSignificantBits);
// }
// }
| import io.datanerds.avropatch.value.conversion.BigDecimalConversion;
import io.datanerds.avropatch.value.conversion.BigIntegerConversion;
import io.datanerds.avropatch.value.conversion.DateConversion;
import io.datanerds.avropatch.value.conversion.UUIDConversion;
import org.apache.avro.Conversion;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
import java.util.List; | package io.datanerds.avropatch.value;
public final class AvroData extends ReflectData {
private static final List<Conversion<?>> CONVERTERS = Arrays.asList(
new DateConversion(),
new BigIntegerConversion(), | // Path: src/main/java/io/datanerds/avropatch/value/conversion/BigDecimalConversion.java
// public class BigDecimalConversion extends Conversion<BigDecimal> implements BigDecimalType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigDecimal> getConvertedType() {
// return BigDecimal.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigDecimal fromRecord(IndexedRecord value, Schema schema, LogicalType type) {
// BigInteger unscaledValue = (BigInteger)value.get(0);
// int scale = (int) value.get(1);
// return new BigDecimal(unscaledValue, scale);
// }
//
// @Override
// public IndexedRecord toRecord(BigDecimal value, Schema schema, LogicalType type) {
// GenericData.Record record = new GenericData.Record(schema);
// record.put(0, value.unscaledValue());
// record.put(1, value.scale());
// return record;
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/BigIntegerConversion.java
// public class BigIntegerConversion extends Conversion<BigInteger> implements BigIntegerType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigInteger> getConvertedType() {
// return BigInteger.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigInteger fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
// return new BigInteger(value.array());
// }
//
// @Override
// public ByteBuffer toBytes(BigInteger value, Schema schema, LogicalType type) {
// return ByteBuffer.wrap(value.toByteArray());
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/DateConversion.java
// public class DateConversion extends Conversion<Date> implements TimestampType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<Date> getConvertedType() {
// return Date.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(Date value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getTime());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public Date fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long time = buffer.getLong();
// return new Date(time);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/UUIDConversion.java
// public class UUIDConversion extends Conversion<UUID> implements UuidType {
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<UUID> getConvertedType() {
// return UUID.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(UUID value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getLeastSignificantBits());
// buffer.putLong(value.getMostSignificantBits());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public UUID fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long leastSignificantBits = buffer.getLong();
// long mostSignificantBits = buffer.getLong();
// return new UUID(mostSignificantBits, leastSignificantBits);
// }
// }
// Path: src/main/java/io/datanerds/avropatch/value/AvroData.java
import io.datanerds.avropatch.value.conversion.BigDecimalConversion;
import io.datanerds.avropatch.value.conversion.BigIntegerConversion;
import io.datanerds.avropatch.value.conversion.DateConversion;
import io.datanerds.avropatch.value.conversion.UUIDConversion;
import org.apache.avro.Conversion;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
import java.util.List;
package io.datanerds.avropatch.value;
public final class AvroData extends ReflectData {
private static final List<Conversion<?>> CONVERTERS = Arrays.asList(
new DateConversion(),
new BigIntegerConversion(), | new BigDecimalConversion(), |
datanerds-io/avropatch | src/main/java/io/datanerds/avropatch/value/AvroData.java | // Path: src/main/java/io/datanerds/avropatch/value/conversion/BigDecimalConversion.java
// public class BigDecimalConversion extends Conversion<BigDecimal> implements BigDecimalType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigDecimal> getConvertedType() {
// return BigDecimal.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigDecimal fromRecord(IndexedRecord value, Schema schema, LogicalType type) {
// BigInteger unscaledValue = (BigInteger)value.get(0);
// int scale = (int) value.get(1);
// return new BigDecimal(unscaledValue, scale);
// }
//
// @Override
// public IndexedRecord toRecord(BigDecimal value, Schema schema, LogicalType type) {
// GenericData.Record record = new GenericData.Record(schema);
// record.put(0, value.unscaledValue());
// record.put(1, value.scale());
// return record;
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/BigIntegerConversion.java
// public class BigIntegerConversion extends Conversion<BigInteger> implements BigIntegerType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigInteger> getConvertedType() {
// return BigInteger.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigInteger fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
// return new BigInteger(value.array());
// }
//
// @Override
// public ByteBuffer toBytes(BigInteger value, Schema schema, LogicalType type) {
// return ByteBuffer.wrap(value.toByteArray());
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/DateConversion.java
// public class DateConversion extends Conversion<Date> implements TimestampType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<Date> getConvertedType() {
// return Date.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(Date value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getTime());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public Date fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long time = buffer.getLong();
// return new Date(time);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/UUIDConversion.java
// public class UUIDConversion extends Conversion<UUID> implements UuidType {
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<UUID> getConvertedType() {
// return UUID.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(UUID value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getLeastSignificantBits());
// buffer.putLong(value.getMostSignificantBits());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public UUID fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long leastSignificantBits = buffer.getLong();
// long mostSignificantBits = buffer.getLong();
// return new UUID(mostSignificantBits, leastSignificantBits);
// }
// }
| import io.datanerds.avropatch.value.conversion.BigDecimalConversion;
import io.datanerds.avropatch.value.conversion.BigIntegerConversion;
import io.datanerds.avropatch.value.conversion.DateConversion;
import io.datanerds.avropatch.value.conversion.UUIDConversion;
import org.apache.avro.Conversion;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
import java.util.List; | package io.datanerds.avropatch.value;
public final class AvroData extends ReflectData {
private static final List<Conversion<?>> CONVERTERS = Arrays.asList(
new DateConversion(),
new BigIntegerConversion(),
new BigDecimalConversion(), | // Path: src/main/java/io/datanerds/avropatch/value/conversion/BigDecimalConversion.java
// public class BigDecimalConversion extends Conversion<BigDecimal> implements BigDecimalType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigDecimal> getConvertedType() {
// return BigDecimal.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigDecimal fromRecord(IndexedRecord value, Schema schema, LogicalType type) {
// BigInteger unscaledValue = (BigInteger)value.get(0);
// int scale = (int) value.get(1);
// return new BigDecimal(unscaledValue, scale);
// }
//
// @Override
// public IndexedRecord toRecord(BigDecimal value, Schema schema, LogicalType type) {
// GenericData.Record record = new GenericData.Record(schema);
// record.put(0, value.unscaledValue());
// record.put(1, value.scale());
// return record;
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/BigIntegerConversion.java
// public class BigIntegerConversion extends Conversion<BigInteger> implements BigIntegerType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<BigInteger> getConvertedType() {
// return BigInteger.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public BigInteger fromBytes(ByteBuffer value, Schema schema, LogicalType type) {
// return new BigInteger(value.array());
// }
//
// @Override
// public ByteBuffer toBytes(BigInteger value, Schema schema, LogicalType type) {
// return ByteBuffer.wrap(value.toByteArray());
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/DateConversion.java
// public class DateConversion extends Conversion<Date> implements TimestampType {
//
// static {
// LogicalTypes.register(NAME, schema -> LOGICAL_TYPE);
// }
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<Date> getConvertedType() {
// return Date.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(Date value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getTime());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public Date fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long time = buffer.getLong();
// return new Date(time);
// }
// }
//
// Path: src/main/java/io/datanerds/avropatch/value/conversion/UUIDConversion.java
// public class UUIDConversion extends Conversion<UUID> implements UuidType {
//
// @Override
// public Schema getRecommendedSchema() {
// return SCHEMA;
// }
//
// @Override
// public Class<UUID> getConvertedType() {
// return UUID.class;
// }
//
// @Override
// public String getLogicalTypeName() {
// return NAME;
// }
//
// @Override
// public GenericFixed toFixed(UUID value, Schema schema, LogicalType type) {
// return new GenericFixed() {
// @Override
// public byte[] bytes() {
// ByteBuffer buffer = ByteBuffer.allocate(SIZE);
// buffer.putLong(value.getLeastSignificantBits());
// buffer.putLong(value.getMostSignificantBits());
// return buffer.array();
// }
//
// @Override
// public Schema getSchema() {
// return SCHEMA;
// }
// };
// }
//
// @Override
// public UUID fromFixed(GenericFixed value, Schema schema, LogicalType type) {
// ByteBuffer buffer = ByteBuffer.wrap(value.bytes());
// long leastSignificantBits = buffer.getLong();
// long mostSignificantBits = buffer.getLong();
// return new UUID(mostSignificantBits, leastSignificantBits);
// }
// }
// Path: src/main/java/io/datanerds/avropatch/value/AvroData.java
import io.datanerds.avropatch.value.conversion.BigDecimalConversion;
import io.datanerds.avropatch.value.conversion.BigIntegerConversion;
import io.datanerds.avropatch.value.conversion.DateConversion;
import io.datanerds.avropatch.value.conversion.UUIDConversion;
import org.apache.avro.Conversion;
import org.apache.avro.reflect.ReflectData;
import java.util.Arrays;
import java.util.List;
package io.datanerds.avropatch.value;
public final class AvroData extends ReflectData {
private static final List<Conversion<?>> CONVERTERS = Arrays.asList(
new DateConversion(),
new BigIntegerConversion(),
new BigDecimalConversion(), | new UUIDConversion() |
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/plugins/hal/HalDevice.java | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
| import com.bwssystems.HABridge.NamedIP;
| package com.bwssystems.HABridge.plugins.hal;
public class HalDevice {
private String haldevicetype;
private String haldevicename;
| // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/plugins/hal/HalDevice.java
import com.bwssystems.HABridge.NamedIP;
package com.bwssystems.HABridge.plugins.hal;
public class HalDevice {
private String haldevicetype;
private String haldevicename;
| private NamedIP haladdress;
|
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/BridgeSettingsDescriptor.java | // Path: src/main/java/com/bwssystems/HABridge/api/hue/WhitelistEntry.java
// public class WhitelistEntry
// {
// private String lastUseDate;
// private String createDate;
// private String name;
// private static final DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
//
// public static WhitelistEntry createEntry(String devicetype) {
// WhitelistEntry anEntry = new WhitelistEntry();
// anEntry.setName(devicetype);
// anEntry.setCreateDate(getCurrentDate());
// anEntry.setLastUseDate(getCurrentDate());
// return anEntry;
// }
//
// public static String getCurrentDate() {
// return LocalDateTime.now().format(dateTimeFormat);
// }
//
// public String getLastUseDate() {
// return lastUseDate;
// }
//
// public void setLastUseDate(String lastUseDate) {
// this.lastUseDate = lastUseDate;
// }
//
// public String getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(String createDate) {
// this.createDate = createDate;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.util.List;
import java.util.Map;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.bwssystems.HABridge.api.hue.HueConstants;
import com.bwssystems.HABridge.api.hue.WhitelistEntry;
| private IpList harmonyaddress;
@SerializedName("buttonsleep")
@Expose
private Integer buttonsleep;
@SerializedName("traceupnp")
@Expose
private boolean traceupnp;
@SerializedName("nestuser")
@Expose
private String nestuser;
@SerializedName("nestpwd")
@Expose
private String nestpwd;
@SerializedName("farenheit")
@Expose
private boolean farenheit;
@SerializedName("configfile")
@Expose
private String configfile;
@SerializedName("numberoflogmessages")
@Expose
private Integer numberoflogmessages;
@SerializedName("hueaddress")
@Expose
private IpList hueaddress;
@SerializedName("haladdress")
@Expose
private IpList haladdress;
@SerializedName("whitelist")
@Expose
| // Path: src/main/java/com/bwssystems/HABridge/api/hue/WhitelistEntry.java
// public class WhitelistEntry
// {
// private String lastUseDate;
// private String createDate;
// private String name;
// private static final DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
//
// public static WhitelistEntry createEntry(String devicetype) {
// WhitelistEntry anEntry = new WhitelistEntry();
// anEntry.setName(devicetype);
// anEntry.setCreateDate(getCurrentDate());
// anEntry.setLastUseDate(getCurrentDate());
// return anEntry;
// }
//
// public static String getCurrentDate() {
// return LocalDateTime.now().format(dateTimeFormat);
// }
//
// public String getLastUseDate() {
// return lastUseDate;
// }
//
// public void setLastUseDate(String lastUseDate) {
// this.lastUseDate = lastUseDate;
// }
//
// public String getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(String createDate) {
// this.createDate = createDate;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: src/main/java/com/bwssystems/HABridge/BridgeSettingsDescriptor.java
import java.util.List;
import java.util.Map;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.bwssystems.HABridge.api.hue.HueConstants;
import com.bwssystems.HABridge.api.hue.WhitelistEntry;
private IpList harmonyaddress;
@SerializedName("buttonsleep")
@Expose
private Integer buttonsleep;
@SerializedName("traceupnp")
@Expose
private boolean traceupnp;
@SerializedName("nestuser")
@Expose
private String nestuser;
@SerializedName("nestpwd")
@Expose
private String nestpwd;
@SerializedName("farenheit")
@Expose
private boolean farenheit;
@SerializedName("configfile")
@Expose
private String configfile;
@SerializedName("numberoflogmessages")
@Expose
private Integer numberoflogmessages;
@SerializedName("hueaddress")
@Expose
private IpList hueaddress;
@SerializedName("haladdress")
@Expose
private IpList haladdress;
@SerializedName("whitelist")
@Expose
| private Map<String, WhitelistEntry> whitelist;
|
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/plugins/homewizard/HomeWizardHome.java | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
//
// Path: src/main/java/com/bwssystems/HABridge/hue/ColorData.java
// public class ColorData {
// public enum ColorMode { XY, CT, HS}
//
// private ColorMode mode;
// private Object data;
//
// public ColorData(ColorMode mode, Object value) {
// this.mode = mode;
// this.data = value;
// }
//
// public Object getData() {
// return data;
// }
//
// public ColorMode getColorMode() {
// return mode;
// }
//
// public String toString() {
// String formatString;
//
// formatString = "Color Data mode: " + mode + ", data: " + data;
// return formatString;
// }
// }
| import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.BridgeSettings;
import com.bwssystems.HABridge.DeviceMapTypes;
import com.bwssystems.HABridge.Home;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.api.CallItem;
import com.bwssystems.HABridge.dao.DeviceDescriptor;
import com.bwssystems.HABridge.hue.ColorData;
import com.bwssystems.HABridge.hue.MultiCommandUtil; | package com.bwssystems.HABridge.plugins.homewizard;
/**
* Control HomeWizard devices over HomeWizard Cloud
*
* @author Björn Rennfanz (bjoern@fam-rennfanz.de)
*
*/
public class HomeWizardHome implements Home {
private static final Logger log = LoggerFactory.getLogger(HomeWizardHome.class);
private Map<String, HomeWizzardSmartPlugInfo> plugGateways;
private Boolean validHomeWizard;
private boolean closed;
public HomeWizardHome(BridgeSettings bridgeSettings) {
super();
closed = true;
createHome(bridgeSettings);
closed = false;
}
@Override
public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int intensity, | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
//
// Path: src/main/java/com/bwssystems/HABridge/hue/ColorData.java
// public class ColorData {
// public enum ColorMode { XY, CT, HS}
//
// private ColorMode mode;
// private Object data;
//
// public ColorData(ColorMode mode, Object value) {
// this.mode = mode;
// this.data = value;
// }
//
// public Object getData() {
// return data;
// }
//
// public ColorMode getColorMode() {
// return mode;
// }
//
// public String toString() {
// String formatString;
//
// formatString = "Color Data mode: " + mode + ", data: " + data;
// return formatString;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/plugins/homewizard/HomeWizardHome.java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.BridgeSettings;
import com.bwssystems.HABridge.DeviceMapTypes;
import com.bwssystems.HABridge.Home;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.api.CallItem;
import com.bwssystems.HABridge.dao.DeviceDescriptor;
import com.bwssystems.HABridge.hue.ColorData;
import com.bwssystems.HABridge.hue.MultiCommandUtil;
package com.bwssystems.HABridge.plugins.homewizard;
/**
* Control HomeWizard devices over HomeWizard Cloud
*
* @author Björn Rennfanz (bjoern@fam-rennfanz.de)
*
*/
public class HomeWizardHome implements Home {
private static final Logger log = LoggerFactory.getLogger(HomeWizardHome.class);
private Map<String, HomeWizzardSmartPlugInfo> plugGateways;
private Boolean validHomeWizard;
private boolean closed;
public HomeWizardHome(BridgeSettings bridgeSettings) {
super();
closed = true;
createHome(bridgeSettings);
closed = false;
}
@Override
public String deviceHandler(CallItem anItem, MultiCommandUtil aMultiUtil, String lightId, int intensity, | Integer targetBri, Integer targetBriInc, ColorData colorData, DeviceDescriptor device, String body) { |
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/plugins/homewizard/HomeWizardHome.java | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
//
// Path: src/main/java/com/bwssystems/HABridge/hue/ColorData.java
// public class ColorData {
// public enum ColorMode { XY, CT, HS}
//
// private ColorMode mode;
// private Object data;
//
// public ColorData(ColorMode mode, Object value) {
// this.mode = mode;
// this.data = value;
// }
//
// public Object getData() {
// return data;
// }
//
// public ColorMode getColorMode() {
// return mode;
// }
//
// public String toString() {
// String formatString;
//
// formatString = "Color Data mode: " + mode + ", data: " + data;
// return formatString;
// }
// }
| import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.BridgeSettings;
import com.bwssystems.HABridge.DeviceMapTypes;
import com.bwssystems.HABridge.Home;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.api.CallItem;
import com.bwssystems.HABridge.dao.DeviceDescriptor;
import com.bwssystems.HABridge.hue.ColorData;
import com.bwssystems.HABridge.hue.MultiCommandUtil; | for(HomeWizardSmartPlugDevice device : plugGateways.get(key).getDevices())
deviceList.add(device);
}
return deviceList;
}
@Override
public Object getItems(String type) {
if (validHomeWizard)
{
if (type.equalsIgnoreCase(DeviceMapTypes.HOMEWIZARD_DEVICE[DeviceMapTypes.typeIndex]))
{
return getDevices();
}
}
return null;
}
@Override
public Home createHome(BridgeSettings bridgeSettings) {
validHomeWizard = bridgeSettings.getBridgeSettingsDescriptor().isValidHomeWizard();
log.info("HomeWizard Home created. " + (validHomeWizard ? "" : "No HomeWizard gateways configured."));
if (validHomeWizard)
{
plugGateways = new HashMap<>(); | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
//
// Path: src/main/java/com/bwssystems/HABridge/hue/ColorData.java
// public class ColorData {
// public enum ColorMode { XY, CT, HS}
//
// private ColorMode mode;
// private Object data;
//
// public ColorData(ColorMode mode, Object value) {
// this.mode = mode;
// this.data = value;
// }
//
// public Object getData() {
// return data;
// }
//
// public ColorMode getColorMode() {
// return mode;
// }
//
// public String toString() {
// String formatString;
//
// formatString = "Color Data mode: " + mode + ", data: " + data;
// return formatString;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/plugins/homewizard/HomeWizardHome.java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.BridgeSettings;
import com.bwssystems.HABridge.DeviceMapTypes;
import com.bwssystems.HABridge.Home;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.api.CallItem;
import com.bwssystems.HABridge.dao.DeviceDescriptor;
import com.bwssystems.HABridge.hue.ColorData;
import com.bwssystems.HABridge.hue.MultiCommandUtil;
for(HomeWizardSmartPlugDevice device : plugGateways.get(key).getDevices())
deviceList.add(device);
}
return deviceList;
}
@Override
public Object getItems(String type) {
if (validHomeWizard)
{
if (type.equalsIgnoreCase(DeviceMapTypes.HOMEWIZARD_DEVICE[DeviceMapTypes.typeIndex]))
{
return getDevices();
}
}
return null;
}
@Override
public Home createHome(BridgeSettings bridgeSettings) {
validHomeWizard = bridgeSettings.getBridgeSettingsDescriptor().isValidHomeWizard();
log.info("HomeWizard Home created. " + (validHomeWizard ? "" : "No HomeWizard gateways configured."));
if (validHomeWizard)
{
plugGateways = new HashMap<>(); | Iterator<NamedIP> gatewaysList = bridgeSettings.getBridgeSettingsDescriptor().getHomeWizardAddress().getDevices().iterator(); |
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/plugins/mqtt/MQTTHandler.java | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
| import org.apache.commons.lang3.StringEscapeUtils;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.MqttSecurityException;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.NamedIP;
import java.util.Optional;
| package com.bwssystems.HABridge.plugins.mqtt;
public class MQTTHandler {
private static final Logger log = LoggerFactory.getLogger(MQTTHandler.class);
| // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/plugins/mqtt/MQTTHandler.java
import org.apache.commons.lang3.StringEscapeUtils;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.MqttSecurityException;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.NamedIP;
import java.util.Optional;
package com.bwssystems.HABridge.plugins.mqtt;
public class MQTTHandler {
private static final Logger log = LoggerFactory.getLogger(MQTTHandler.class);
| private NamedIP myConfig;
|
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/plugins/homewizard/HomeWizzardSmartPlugInfo.java | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
//
// Path: src/main/java/com/bwssystems/HABridge/plugins/homewizard/json/Device.java
// public class Device {
//
// @SerializedName("id")
// @Expose
// private String id;
//
// @SerializedName("name")
// @Expose
// private String name;
//
// @SerializedName("typeName")
// @Expose
// private String typeName;
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getTypeName() {
// return this.typeName;
// }
//
// public void setTypeName(String typeName) {
// this.typeName = typeName;
// }
// }
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.plugins.homewizard.json.Device;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser; | package com.bwssystems.HABridge.plugins.homewizard;
/**
* Control HomeWizard devices over HomeWizard Cloud
*
* @author Björn Rennfanz (bjoern@fam-rennfanz.de)
*
*/
public class HomeWizzardSmartPlugInfo {
private static final Logger log = LoggerFactory.getLogger(HomeWizardHome.class);
private static final String HOMEWIZARD_LOGIN_URL = "https://cloud.homewizard.com/account/login";
private static final String HOMEWIZARD_API_URL = "https://plug.homewizard.com/plugs";
private static final String EMPTY_STRING = "";
private final String cloudAuth;
private final Gson gson;
private String cloudSessionId;
private String cloudPlugName;
private String cloudPlugId;
| // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
//
// Path: src/main/java/com/bwssystems/HABridge/plugins/homewizard/json/Device.java
// public class Device {
//
// @SerializedName("id")
// @Expose
// private String id;
//
// @SerializedName("name")
// @Expose
// private String name;
//
// @SerializedName("typeName")
// @Expose
// private String typeName;
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getTypeName() {
// return this.typeName;
// }
//
// public void setTypeName(String typeName) {
// this.typeName = typeName;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/plugins/homewizard/HomeWizzardSmartPlugInfo.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.plugins.homewizard.json.Device;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
package com.bwssystems.HABridge.plugins.homewizard;
/**
* Control HomeWizard devices over HomeWizard Cloud
*
* @author Björn Rennfanz (bjoern@fam-rennfanz.de)
*
*/
public class HomeWizzardSmartPlugInfo {
private static final Logger log = LoggerFactory.getLogger(HomeWizardHome.class);
private static final String HOMEWIZARD_LOGIN_URL = "https://cloud.homewizard.com/account/login";
private static final String HOMEWIZARD_API_URL = "https://plug.homewizard.com/plugs";
private static final String EMPTY_STRING = "";
private final String cloudAuth;
private final Gson gson;
private String cloudSessionId;
private String cloudPlugName;
private String cloudPlugId;
| public HomeWizzardSmartPlugInfo(NamedIP gateway, String name) { |
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/plugins/homewizard/HomeWizzardSmartPlugInfo.java | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
//
// Path: src/main/java/com/bwssystems/HABridge/plugins/homewizard/json/Device.java
// public class Device {
//
// @SerializedName("id")
// @Expose
// private String id;
//
// @SerializedName("name")
// @Expose
// private String name;
//
// @SerializedName("typeName")
// @Expose
// private String typeName;
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getTypeName() {
// return this.typeName;
// }
//
// public void setTypeName(String typeName) {
// this.typeName = typeName;
// }
// }
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.plugins.homewizard.json.Device;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser; | if (!buffer.toString().contains("Success"))
{
result = false;
}
}
catch(IOException e)
{
log.warn("Error while post json action: {} ", request, e);
result = false;
}
}
else
{
result = false;
}
return result;
}
public List<HomeWizardSmartPlugDevice> getDevices()
{
List<HomeWizardSmartPlugDevice> homewizardDevices = new ArrayList<>();
try {
String result = requestJson(EMPTY_STRING);
JsonParser parser = new JsonParser();
JsonObject resultJson = parser.parse(result).getAsJsonObject();
cloudPlugId = resultJson.get("id").getAsString();
String all_devices_json = resultJson.get("devices").toString(); | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
//
// Path: src/main/java/com/bwssystems/HABridge/plugins/homewizard/json/Device.java
// public class Device {
//
// @SerializedName("id")
// @Expose
// private String id;
//
// @SerializedName("name")
// @Expose
// private String name;
//
// @SerializedName("typeName")
// @Expose
// private String typeName;
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getTypeName() {
// return this.typeName;
// }
//
// public void setTypeName(String typeName) {
// this.typeName = typeName;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/plugins/homewizard/HomeWizzardSmartPlugInfo.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.plugins.homewizard.json.Device;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
if (!buffer.toString().contains("Success"))
{
result = false;
}
}
catch(IOException e)
{
log.warn("Error while post json action: {} ", request, e);
result = false;
}
}
else
{
result = false;
}
return result;
}
public List<HomeWizardSmartPlugDevice> getDevices()
{
List<HomeWizardSmartPlugDevice> homewizardDevices = new ArrayList<>();
try {
String result = requestJson(EMPTY_STRING);
JsonParser parser = new JsonParser();
JsonObject resultJson = parser.parse(result).getAsJsonObject();
cloudPlugId = resultJson.get("id").getAsString();
String all_devices_json = resultJson.get("devices").toString(); | Device[] devices = gson.fromJson(all_devices_json, Device[].class); |
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/BridgeSecurity.java | // Path: src/main/java/com/bwssystems/HABridge/api/hue/WhitelistEntry.java
// public class WhitelistEntry
// {
// private String lastUseDate;
// private String createDate;
// private String name;
// private static final DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
//
// public static WhitelistEntry createEntry(String devicetype) {
// WhitelistEntry anEntry = new WhitelistEntry();
// anEntry.setName(devicetype);
// anEntry.setCreateDate(getCurrentDate());
// anEntry.setLastUseDate(getCurrentDate());
// return anEntry;
// }
//
// public static String getCurrentDate() {
// return LocalDateTime.now().format(dateTimeFormat);
// }
//
// public String getLastUseDate() {
// return lastUseDate;
// }
//
// public void setLastUseDate(String lastUseDate) {
// this.lastUseDate = lastUseDate;
// }
//
// public String getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(String createDate) {
// this.createDate = createDate;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
| import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.util.Base64;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.UUID;
import java.util.Map.Entry;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.api.hue.HueError;
import com.bwssystems.HABridge.api.hue.HueErrorResponse;
import com.bwssystems.HABridge.api.hue.WhitelistEntry;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import spark.Request;
| theUser.setPassword2(targetUser.getPassword());
if(theUser.validatePassword()) {
theUser.setPassword2(null);
result.setUser(targetUser);
}
else
result.setError("user or password not correct");
} else {
result.setError("input password is not set....");
}
}
else
result.setError("user or password not correct");
}
else
result.setError("input user not given");
return result;
}
public boolean isSecure() {
return securityDescriptor.isSecure();
}
public boolean isSettingsChanged() {
return settingsChanged;
}
public void setSettingsChanged(boolean settingsChanged) {
this.settingsChanged = settingsChanged;
}
| // Path: src/main/java/com/bwssystems/HABridge/api/hue/WhitelistEntry.java
// public class WhitelistEntry
// {
// private String lastUseDate;
// private String createDate;
// private String name;
// private static final DateTimeFormatter dateTimeFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss");
//
// public static WhitelistEntry createEntry(String devicetype) {
// WhitelistEntry anEntry = new WhitelistEntry();
// anEntry.setName(devicetype);
// anEntry.setCreateDate(getCurrentDate());
// anEntry.setLastUseDate(getCurrentDate());
// return anEntry;
// }
//
// public static String getCurrentDate() {
// return LocalDateTime.now().format(dateTimeFormat);
// }
//
// public String getLastUseDate() {
// return lastUseDate;
// }
//
// public void setLastUseDate(String lastUseDate) {
// this.lastUseDate = lastUseDate;
// }
//
// public String getCreateDate() {
// return createDate;
// }
//
// public void setCreateDate(String createDate) {
// this.createDate = createDate;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// }
// Path: src/main/java/com/bwssystems/HABridge/BridgeSecurity.java
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.GeneralSecurityException;
import java.util.Base64;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.UUID;
import java.util.Map.Entry;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;
import javax.crypto.spec.PBEParameterSpec;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.api.hue.HueError;
import com.bwssystems.HABridge.api.hue.HueErrorResponse;
import com.bwssystems.HABridge.api.hue.WhitelistEntry;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import spark.Request;
theUser.setPassword2(targetUser.getPassword());
if(theUser.validatePassword()) {
theUser.setPassword2(null);
result.setUser(targetUser);
}
else
result.setError("user or password not correct");
} else {
result.setError("input password is not set....");
}
}
else
result.setError("user or password not correct");
}
else
result.setError("input user not given");
return result;
}
public boolean isSecure() {
return securityDescriptor.isSecure();
}
public boolean isSettingsChanged() {
return settingsChanged;
}
public void setSettingsChanged(boolean settingsChanged) {
this.settingsChanged = settingsChanged;
}
| public Map<String, WhitelistEntry> getWhitelist() {
|
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/api/hue/GroupResponse.java | // Path: src/main/java/com/bwssystems/HABridge/dao/GroupDescriptor.java
// public class GroupDescriptor{
// @SerializedName("id")
// @Expose
// private String id;
// @SerializedName("name")
// @Expose
// private String name;
// @SerializedName("groupType")
// @Expose
// private String groupType;
// @SerializedName("groupClass")
// @Expose
// private String groupClass;
// @SerializedName("requesterAddress")
// @Expose
// private String requesterAddress;
// @SerializedName("inactive")
// @Expose
// private boolean inactive;
// @SerializedName("description")
// @Expose
// private String description;
// @SerializedName("comments")
// @Expose
// private String comments;
//
// private DeviceState action;
// private GroupState groupState;
//
// @SerializedName("lights")
// @Expose
// private String[] lights;
// @SerializedName("exposeAsLight")
// @Expose
// private String exposeAsLight;
//
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getGroupType() {
// return groupType;
// }
//
// public void setGroupType(String groupType) {
// this.groupType = groupType;
// }
//
// public String getGroupClass() {
// return groupClass;
// }
//
// public void setGroupClass(String groupClass) {
// this.groupClass = groupClass;
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public GroupState getGroupState() {
// if(groupState == null)
// groupState = new GroupState(false,false);
// return groupState;
// }
//
// public void setGroupState(GroupState groupState) {
// this.groupState = groupState;
// }
//
// public DeviceState getAction() {
// if(action == null)
// action = DeviceState.createDeviceState(true);
// return action;
// }
//
// public void setAction(DeviceState action) {
// this.action = action;
// }
//
// public boolean isInactive() {
// return inactive;
// }
//
// public void setInactive(boolean inactive) {
// this.inactive = inactive;
// }
//
// public String getRequesterAddress() {
// return requesterAddress;
// }
//
// public void setRequesterAddress(String requesterAddress) {
// this.requesterAddress = requesterAddress;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getComments() {
// return comments;
// }
//
// public void setComments(String comments) {
// this.comments = comments;
// }
//
// public String[] getLights() {
// return lights;
// }
//
// public void setLights(String[] lights) {
// this.lights = lights;
// }
//
// public void setExposeAsLight(String exposeFor) {
// this.exposeAsLight = exposeFor;
// }
//
// public String getExposeAsLight() {
// return exposeAsLight;
// }
// }
| import java.util.Map;
import com.bwssystems.HABridge.dao.GroupDescriptor;
import com.google.gson.annotations.SerializedName;
| public void setClass_name(String class_name) {
this.class_name = class_name;
}
public static GroupResponse createDefaultGroupResponse(Map<String, DeviceResponse> deviceList) {
String[] theList = new String[deviceList.size()];
Boolean all_on = true;
Boolean any_on = false;
int i = 0;
for (Map.Entry<String, DeviceResponse> device : deviceList.entrySet()) {
if (Integer.parseInt(device.getKey()) >= 10000) { // don't show fake lights for other groups
continue;
}
theList[i] = device.getKey();
Boolean is_on = device.getValue().getState().isOn();
if (is_on)
any_on = true;
else
all_on = false;
i++;
}
GroupResponse theResponse = new GroupResponse();
theResponse.setAction(DeviceState.createDeviceState(true));
theResponse.setState(new GroupState(all_on, any_on));
theResponse.setName("Group 0");
theResponse.setLights(theList);
theResponse.setType("LightGroup");
return theResponse;
}
| // Path: src/main/java/com/bwssystems/HABridge/dao/GroupDescriptor.java
// public class GroupDescriptor{
// @SerializedName("id")
// @Expose
// private String id;
// @SerializedName("name")
// @Expose
// private String name;
// @SerializedName("groupType")
// @Expose
// private String groupType;
// @SerializedName("groupClass")
// @Expose
// private String groupClass;
// @SerializedName("requesterAddress")
// @Expose
// private String requesterAddress;
// @SerializedName("inactive")
// @Expose
// private boolean inactive;
// @SerializedName("description")
// @Expose
// private String description;
// @SerializedName("comments")
// @Expose
// private String comments;
//
// private DeviceState action;
// private GroupState groupState;
//
// @SerializedName("lights")
// @Expose
// private String[] lights;
// @SerializedName("exposeAsLight")
// @Expose
// private String exposeAsLight;
//
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getGroupType() {
// return groupType;
// }
//
// public void setGroupType(String groupType) {
// this.groupType = groupType;
// }
//
// public String getGroupClass() {
// return groupClass;
// }
//
// public void setGroupClass(String groupClass) {
// this.groupClass = groupClass;
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public GroupState getGroupState() {
// if(groupState == null)
// groupState = new GroupState(false,false);
// return groupState;
// }
//
// public void setGroupState(GroupState groupState) {
// this.groupState = groupState;
// }
//
// public DeviceState getAction() {
// if(action == null)
// action = DeviceState.createDeviceState(true);
// return action;
// }
//
// public void setAction(DeviceState action) {
// this.action = action;
// }
//
// public boolean isInactive() {
// return inactive;
// }
//
// public void setInactive(boolean inactive) {
// this.inactive = inactive;
// }
//
// public String getRequesterAddress() {
// return requesterAddress;
// }
//
// public void setRequesterAddress(String requesterAddress) {
// this.requesterAddress = requesterAddress;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getComments() {
// return comments;
// }
//
// public void setComments(String comments) {
// this.comments = comments;
// }
//
// public String[] getLights() {
// return lights;
// }
//
// public void setLights(String[] lights) {
// this.lights = lights;
// }
//
// public void setExposeAsLight(String exposeFor) {
// this.exposeAsLight = exposeFor;
// }
//
// public String getExposeAsLight() {
// return exposeAsLight;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/api/hue/GroupResponse.java
import java.util.Map;
import com.bwssystems.HABridge.dao.GroupDescriptor;
import com.google.gson.annotations.SerializedName;
public void setClass_name(String class_name) {
this.class_name = class_name;
}
public static GroupResponse createDefaultGroupResponse(Map<String, DeviceResponse> deviceList) {
String[] theList = new String[deviceList.size()];
Boolean all_on = true;
Boolean any_on = false;
int i = 0;
for (Map.Entry<String, DeviceResponse> device : deviceList.entrySet()) {
if (Integer.parseInt(device.getKey()) >= 10000) { // don't show fake lights for other groups
continue;
}
theList[i] = device.getKey();
Boolean is_on = device.getValue().getState().isOn();
if (is_on)
any_on = true;
else
all_on = false;
i++;
}
GroupResponse theResponse = new GroupResponse();
theResponse.setAction(DeviceState.createDeviceState(true));
theResponse.setState(new GroupState(all_on, any_on));
theResponse.setName("Group 0");
theResponse.setLights(theList);
theResponse.setType("LightGroup");
return theResponse;
}
| public static GroupResponse createResponse(GroupDescriptor group, Map<String, DeviceResponse> lights){
|
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/plugins/harmony/HarmonyHandler.java | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
| import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.whistlingfish.harmony.HarmonyClient;
import net.whistlingfish.harmony.config.Activity;
import net.whistlingfish.harmony.config.Device;
import net.whistlingfish.harmony.config.HarmonyConfig;
import com.bwssystems.HABridge.NamedIP;
| package com.bwssystems.HABridge.plugins.harmony;
public class HarmonyHandler {
private static final Logger log = LoggerFactory.getLogger(HarmonyHandler.class);
private HarmonyClient harmonyClient;
private Boolean noopCalls;
private Boolean devMode;
private DevModeResponse devResponse;
| // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/plugins/harmony/HarmonyHandler.java
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import net.whistlingfish.harmony.HarmonyClient;
import net.whistlingfish.harmony.config.Activity;
import net.whistlingfish.harmony.config.Device;
import net.whistlingfish.harmony.config.HarmonyConfig;
import com.bwssystems.HABridge.NamedIP;
package com.bwssystems.HABridge.plugins.harmony;
public class HarmonyHandler {
private static final Logger log = LoggerFactory.getLogger(HarmonyHandler.class);
private HarmonyClient harmonyClient;
private Boolean noopCalls;
private Boolean devMode;
private DevModeResponse devResponse;
| private NamedIP myNameAndIP;
|
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/plugins/http/HTTPHandler.java | // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
| import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.DeviceMapTypes;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.api.NameValue;
| log.warn(
"HTTP response code was not an expected successful response of between 200 - 299, the code was: "
+ response.getStatusLine() + " with the content of <<<" + theContent + ">>>");
if (response.getStatusLine().getStatusCode() == 504) {
log.warn("HTTP response code was 504, retrying...");
log.debug("The 504 error content is <<<" + theContent + ">>>");
theContent = null;
} else
retryCount = 2;
}
} catch (ClientProtocolException e) {
log.warn("Client Protocol Exception received, retyring....");
} catch (IOException e) {
log.warn("Error calling out to HA gateway: IOException in log: " + e.getMessage(), e);
retryCount = 2;
}
if (retryCount < 2) {
theContent = null;
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
// noop
}
}
}
return theContent;
}
| // Path: src/main/java/com/bwssystems/HABridge/NamedIP.java
// public class NamedIP {
// private String name;
// private String ip;
// private String webhook;
// private String port;
// private String username;
// private String password;
// private JsonObject extensions;
// private Boolean secure;
// private String httpPreamble;
// private String encodedLogin;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getIp() {
// return ip;
// }
//
// public void setIp(String ip) {
// this.ip = ip;
// }
//
// public String getWebhook() {
// return webhook;
// }
//
// public void setWebhook(final String webhook) {
// this.webhook = webhook;
// }
//
// public String getPort() {
// return port;
// }
//
// public void setPort(String port) {
// this.port = port;
// }
//
// public String getUsername() {
// return username;
// }
//
// public void setUsername(String username) {
// this.username = username;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password;
// }
//
// public Boolean getSecure() {
// return secure;
// }
//
// public void setSecure(Boolean secure) {
// this.secure = secure;
// }
//
// public JsonObject getExtensions() {
// return extensions;
// }
//
// public void setExtensions(JsonObject extensions) {
// this.extensions = extensions;
// }
//
// public String getHttpPreamble() {
// if (httpPreamble == null || !httpPreamble.trim().isEmpty()) {
// if (getSecure() != null && getSecure())
// httpPreamble = "https://";
// else
// httpPreamble = "http://";
//
// httpPreamble = httpPreamble + getIp();
// if (getPort() != null && !getPort().trim().isEmpty()) {
// httpPreamble = httpPreamble + ":" + getPort();
// }
// }
// return httpPreamble;
// }
//
// public void setHttpPreamble(String httpPreamble) {
// this.httpPreamble = httpPreamble;
// }
//
// public String getUserPass64() {
// if (encodedLogin == null || !encodedLogin.trim().isEmpty()) {
// if (getUsername() != null && !getUsername().isEmpty() && getPassword() != null
// && !getPassword().isEmpty()) {
// String userPass = getUsername() + ":" + getPassword();
// encodedLogin = new String(Base64.encodeBase64(userPass.getBytes()));
// }
// }
//
// return encodedLogin;
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/plugins/http/HTTPHandler.java
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.bwssystems.HABridge.DeviceMapTypes;
import com.bwssystems.HABridge.NamedIP;
import com.bwssystems.HABridge.api.NameValue;
log.warn(
"HTTP response code was not an expected successful response of between 200 - 299, the code was: "
+ response.getStatusLine() + " with the content of <<<" + theContent + ">>>");
if (response.getStatusLine().getStatusCode() == 504) {
log.warn("HTTP response code was 504, retrying...");
log.debug("The 504 error content is <<<" + theContent + ">>>");
theContent = null;
} else
retryCount = 2;
}
} catch (ClientProtocolException e) {
log.warn("Client Protocol Exception received, retyring....");
} catch (IOException e) {
log.warn("Error calling out to HA gateway: IOException in log: " + e.getMessage(), e);
retryCount = 2;
}
if (retryCount < 2) {
theContent = null;
try {
Thread.sleep(1000);
} catch (InterruptedException e1) {
// noop
}
}
}
return theContent;
}
| public NameValue[] addBasicAuthHeader(NameValue[] theHeaders, NamedIP theTarget) {
|
bwssytems/ha-bridge | src/main/java/com/bwssystems/HABridge/dao/GroupDescriptor.java | // Path: src/main/java/com/bwssystems/HABridge/api/hue/GroupState.java
// public class GroupState {
// private boolean all_on;
// private boolean any_on;
//
// public boolean isAllOn() {
// return all_on;
// }
//
// public boolean isAnyOn() {
// return any_on;
// }
//
// public void setState(boolean all_on, boolean any_on) {
// this.all_on = all_on;
// this.any_on = any_on;
// }
//
// public GroupState(boolean all_on, boolean any_on) {
// this.all_on = all_on;
// this.any_on = any_on;
// }
//
// @Override
// public String toString() {
// return "GroupState{" +
// "all_on=" + all_on +
// ", any_on=" + any_on +
// '}';
// }
// }
| import com.bwssystems.HABridge.api.hue.DeviceState;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.bwssystems.HABridge.api.hue.GroupState; | package com.bwssystems.HABridge.dao;
/*
* Object to handle the device configuration
*/
public class GroupDescriptor{
@SerializedName("id")
@Expose
private String id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("groupType")
@Expose
private String groupType;
@SerializedName("groupClass")
@Expose
private String groupClass;
@SerializedName("requesterAddress")
@Expose
private String requesterAddress;
@SerializedName("inactive")
@Expose
private boolean inactive;
@SerializedName("description")
@Expose
private String description;
@SerializedName("comments")
@Expose
private String comments;
private DeviceState action; | // Path: src/main/java/com/bwssystems/HABridge/api/hue/GroupState.java
// public class GroupState {
// private boolean all_on;
// private boolean any_on;
//
// public boolean isAllOn() {
// return all_on;
// }
//
// public boolean isAnyOn() {
// return any_on;
// }
//
// public void setState(boolean all_on, boolean any_on) {
// this.all_on = all_on;
// this.any_on = any_on;
// }
//
// public GroupState(boolean all_on, boolean any_on) {
// this.all_on = all_on;
// this.any_on = any_on;
// }
//
// @Override
// public String toString() {
// return "GroupState{" +
// "all_on=" + all_on +
// ", any_on=" + any_on +
// '}';
// }
// }
// Path: src/main/java/com/bwssystems/HABridge/dao/GroupDescriptor.java
import com.bwssystems.HABridge.api.hue.DeviceState;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.bwssystems.HABridge.api.hue.GroupState;
package com.bwssystems.HABridge.dao;
/*
* Object to handle the device configuration
*/
public class GroupDescriptor{
@SerializedName("id")
@Expose
private String id;
@SerializedName("name")
@Expose
private String name;
@SerializedName("groupType")
@Expose
private String groupType;
@SerializedName("groupClass")
@Expose
private String groupClass;
@SerializedName("requesterAddress")
@Expose
private String requesterAddress;
@SerializedName("inactive")
@Expose
private boolean inactive;
@SerializedName("description")
@Expose
private String description;
@SerializedName("comments")
@Expose
private String comments;
private DeviceState action; | private GroupState groupState; |
udalov/jclang | src/org/udalov/jclang/CXFile.java | // Path: src/org/udalov/jclang/structs/CXString.java
// @SuppressWarnings("unused")
// public class CXString extends Structure {
// public Pointer data;
// public int privateFlags;
//
// public CXString() {
// super();
// setFieldOrder(new String[]{"data", "privateFlags"});
// }
//
// public static class ByValue extends CXString implements Structure.ByValue {}
// }
| import com.sun.jna.PointerType;
import org.jetbrains.annotations.NotNull;
import org.udalov.jclang.structs.CXString;
import java.io.File; | /*
* Copyright 2013 Alexander Udalov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.udalov.jclang;
public class CXFile extends PointerType {
@NotNull
public File toFile() { | // Path: src/org/udalov/jclang/structs/CXString.java
// @SuppressWarnings("unused")
// public class CXString extends Structure {
// public Pointer data;
// public int privateFlags;
//
// public CXString() {
// super();
// setFieldOrder(new String[]{"data", "privateFlags"});
// }
//
// public static class ByValue extends CXString implements Structure.ByValue {}
// }
// Path: src/org/udalov/jclang/CXFile.java
import com.sun.jna.PointerType;
import org.jetbrains.annotations.NotNull;
import org.udalov.jclang.structs.CXString;
import java.io.File;
/*
* Copyright 2013 Alexander Udalov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.udalov.jclang;
public class CXFile extends PointerType {
@NotNull
public File toFile() { | CXString.ByValue name = LibClang.I.getFileName(this); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.