diff --git a/src/main/java/xyz/danielcortes/controllers/LaunchController.java b/src/main/java/xyz/danielcortes/controllers/LaunchController.java index 89d80e2..5a0dc40 100644 --- a/src/main/java/xyz/danielcortes/controllers/LaunchController.java +++ b/src/main/java/xyz/danielcortes/controllers/LaunchController.java @@ -19,6 +19,10 @@ import xyz.danielcortes.controllers.correo.CorreoCreateController; import xyz.danielcortes.controllers.correo.CorreoSearchController; import xyz.danielcortes.controllers.correo.CorreoUpdateController; import xyz.danielcortes.controllers.correo.CorreoViewController; +import xyz.danielcortes.controllers.direccion.DireccionCreateController; +import xyz.danielcortes.controllers.direccion.DireccionSearchController; +import xyz.danielcortes.controllers.direccion.DireccionUpdateController; +import xyz.danielcortes.controllers.direccion.DireccionViewController; import xyz.danielcortes.controllers.editorial.EditorialCreateController; import xyz.danielcortes.controllers.editorial.EditorialSearchController; import xyz.danielcortes.controllers.editorial.EditorialUpdateController; @@ -58,6 +62,10 @@ import xyz.danielcortes.views.correo.CorreoCreatePanel; import xyz.danielcortes.views.correo.CorreoSearchPanel; import xyz.danielcortes.views.correo.CorreoUpdatePanel; import xyz.danielcortes.views.correo.CorreoViewPanel; +import xyz.danielcortes.views.direccion.DireccionCreatePanel; +import xyz.danielcortes.views.direccion.DireccionSearchPanel; +import xyz.danielcortes.views.direccion.DireccionUpdatePanel; +import xyz.danielcortes.views.direccion.DireccionViewPanel; import xyz.danielcortes.views.editorial.EditorialCreatePanel; import xyz.danielcortes.views.editorial.EditorialSearchPanel; import xyz.danielcortes.views.editorial.EditorialUpdatePanel; @@ -146,6 +154,11 @@ public class LaunchController { this.controllers.put(PanelName.TELEFONO_CREATE, new TelefonoCreateController(new TelefonoCreatePanel(), this)); this.controllers.put(PanelName.TELEFONO_UPDATE, new TelefonoUpdateController(new TelefonoUpdatePanel(), this)); + this.controllers.put(PanelName.DIRECCION_SEARCH, new DireccionSearchController(new DireccionSearchPanel(), this)); + this.controllers.put(PanelName.DIRECCION_VIEW, new DireccionViewController(new DireccionViewPanel(), this)); + this.controllers.put(PanelName.DIRECCION_CREATE, new DireccionCreateController(new DireccionCreatePanel(), this)); + this.controllers.put(PanelName.DIRECCION_UPDATE, new DireccionUpdateController(new DireccionUpdatePanel(), this)); + for (PanelName name : this.controllers.keySet()) { BaseController controller = this.controllers.get(name); this.frame.addCard(controller.getView().getContentPane(), name); diff --git a/src/main/java/xyz/danielcortes/controllers/direccion/DireccionCreateController.java b/src/main/java/xyz/danielcortes/controllers/direccion/DireccionCreateController.java new file mode 100644 index 0000000..2c06116 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/direccion/DireccionCreateController.java @@ -0,0 +1,87 @@ +package xyz.danielcortes.controllers.direccion; + +import xyz.danielcortes.controllers.LaunchController; +import xyz.danielcortes.framework.BaseController; +import xyz.danielcortes.framework.BasePanel; +import xyz.danielcortes.framework.PanelName; +import xyz.danielcortes.framework.ValidationResult; +import xyz.danielcortes.models.Direccion; +import xyz.danielcortes.models.Trabajador; +import xyz.danielcortes.repository.DireccionRepository; +import xyz.danielcortes.validator.DireccionValidator; +import xyz.danielcortes.views.direccion.DireccionCreatePanel; + +public class DireccionCreateController extends BaseController { + + private Trabajador trabajador; + private DireccionCreatePanel view; + private DireccionRepository repository; + private DireccionValidator validator; + + public DireccionCreateController(DireccionCreatePanel view, LaunchController parentController) { + super(parentController); + this.view = view; + this.repository = new DireccionRepository(); + this.validator = new DireccionValidator(this.repository); + this.setupListeners(); + } + + @Override + public LaunchController getParentController() { + return this.parentController; + } + + @Override + public void show() { + this.view.getCalleField().requestFocus(); + } + + @Override + public BasePanel getView() { + return this.view; + } + + public void setTrabajador(Trabajador trabajador) { + this.trabajador = trabajador; + } + + private void setupListeners() { + this.view.getGuardarButton().addActionListener(e -> save()); + this.view.getNumeroField().addActionListener(e -> save()); + this.view.getVolverButton().addActionListener(e -> volver()); + } + + private void save() { + String calle = this.view.getCalleField().getText(); + String numero = this.view.getNumeroField().getText(); + + ValidationResult direccionValidation = validator.validateCalle(calle); + if (direccionValidation.hasError()) { + direccionValidation.showErrorDialog(); + return; + } + + ValidationResult numeroValidation = validator.validateNumero(numero); + if (numeroValidation.hasError()) { + numeroValidation.showErrorDialog(); + return; + } + + Direccion direccion = new Direccion(); + direccion.setCalle(calle); + direccion.setNumero(numero); + direccion.getTrabajadores().add(trabajador); + + this.repository.save(direccion); + this.trabajador.getDirecciones().add(direccion); + + this.volver(); + } + + private void volver() { + DireccionSearchController controller = (DireccionSearchController) this.getParentController().getCard(PanelName.DIRECCION_SEARCH); + controller.setTrabajador(trabajador); + this.getParentController().showCard(PanelName.DIRECCION_SEARCH); + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/direccion/DireccionSearchController.java b/src/main/java/xyz/danielcortes/controllers/direccion/DireccionSearchController.java new file mode 100644 index 0000000..42510e6 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/direccion/DireccionSearchController.java @@ -0,0 +1,143 @@ +package xyz.danielcortes.controllers.direccion; + +import java.util.List; +import javax.swing.JOptionPane; +import xyz.danielcortes.controllers.LaunchController; +import xyz.danielcortes.controllers.trabajador.TrabajadorViewController; +import xyz.danielcortes.framework.BaseController; +import xyz.danielcortes.framework.BasePanel; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.framework.PanelName; +import xyz.danielcortes.models.Direccion; +import xyz.danielcortes.models.Trabajador; +import xyz.danielcortes.repository.DireccionRepository; +import xyz.danielcortes.validator.DireccionValidator; +import xyz.danielcortes.views.direccion.DireccionSearchPanel; + +public class DireccionSearchController extends BaseController { + + private Trabajador trabajador; + private DireccionSearchPanel view; + private DireccionRepository direccionRepository; + private DireccionValidator validator; + + public DireccionSearchController(DireccionSearchPanel view, LaunchController parent) { + super(parent); + this.view = view; + this.direccionRepository = new DireccionRepository(); + this.validator = new DireccionValidator(this.direccionRepository); + this.setupListeners(); + } + + @Override + public void show() { + this.reload(); + } + + @Override + public BasePanel getView() { + return view; + } + + public void setTrabajador(Trabajador trabajador) { + this.trabajador = trabajador; + } + + public void reload() { + this.loadDireccionsTable(); + this.view.getDireccionesTable().clearSelection(); + } + + private void setupListeners() { + this.view.getCrearButton().addActionListener(e -> this.create()); + this.view.getSearchField().addActionListener(e -> this.search()); + this.view.getBuscarButton().addActionListener(e -> this.search()); + this.view.getVerButton().addActionListener(e -> this.view()); + this.view.getEditarButton().addActionListener(e -> this.edit()); + this.view.getEliminarButton().addActionListener(e -> this.delete()); + this.view.getVolverButton().addActionListener(e -> this.volver()); + } + + private void create() { + DireccionCreateController controller = (DireccionCreateController) this.getParentController().getCard(PanelName.DIRECCION_CREATE); + controller.setTrabajador(trabajador); + this.getParentController().showCard(PanelName.DIRECCION_CREATE); + } + + private void edit() { + Direccion direccion = this.getSelectedDireccion(); + if (direccion != null) { + DireccionUpdateController controller = (DireccionUpdateController) this.getParentController().getCard(PanelName.DIRECCION_UPDATE); + controller.setTrabajador(trabajador); + controller.setDireccion(direccion); + this.getParentController().showCard(PanelName.DIRECCION_UPDATE); + } + } + + private void delete() { + Direccion direccion = this.getSelectedDireccion(); + if (direccion == null) + return; + + int option = JOptionPane.showConfirmDialog( + null, + "¿Estas seguro de que deseas eliminar la direccion?", + "Confirmacion", + JOptionPane.YES_NO_OPTION, + JOptionPane.QUESTION_MESSAGE + ); + if (option == JOptionPane.NO_OPTION) + return; + + this.direccionRepository.delete(direccion); + this.trabajador.getDirecciones().remove(direccion); + this.reload(); + } + + private void view() { + Direccion direccion = this.getSelectedDireccion(); + if (direccion != null) { + DireccionViewController controller = (DireccionViewController) this.getParentController().getCard(PanelName.DIRECCION_VIEW); + controller.setDireccion(direccion); + controller.setTrabajador(trabajador); + this.getParentController().showCard(PanelName.DIRECCION_VIEW); + } + } + + private void search() { + String term = this.view.getSearchField().getText(); + List direccion = this.direccionRepository.search(term, trabajador); + this.loadDireccionsTable(direccion); + } + + private void volver() { + TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW); + controller.setTrabajador(this.trabajador); + this.getParentController().showCard(PanelName.TRABAJADOR_VIEW); + } + + private void loadDireccionsTable() { + List direccions = this.trabajador.getDirecciones(); + loadDireccionsTable(direccions); + } + + private void loadDireccionsTable(List direccions) { + BaseTableModel model = this.view.getDireccionModel(); + model.setRows(direccions); + } + + private Direccion getSelectedDireccion() { + int selectedRow = this.view.getDireccionesTable().getSelectedRow(); + if (selectedRow == -1) { + JOptionPane.showMessageDialog( + null, + "No hay direccion seleccionado", + "Error", + JOptionPane.ERROR_MESSAGE + ); + return null; + } + + return this.view.getDireccionModel().getRow(selectedRow); + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/direccion/DireccionUpdateController.java b/src/main/java/xyz/danielcortes/controllers/direccion/DireccionUpdateController.java new file mode 100644 index 0000000..8105ccd --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/direccion/DireccionUpdateController.java @@ -0,0 +1,98 @@ +package xyz.danielcortes.controllers.direccion; + +import xyz.danielcortes.controllers.LaunchController; +import xyz.danielcortes.framework.BaseController; +import xyz.danielcortes.framework.BasePanel; +import xyz.danielcortes.framework.PanelName; +import xyz.danielcortes.framework.ValidationResult; +import xyz.danielcortes.models.Direccion; +import xyz.danielcortes.models.Trabajador; +import xyz.danielcortes.repository.DireccionRepository; +import xyz.danielcortes.validator.DireccionValidator; +import xyz.danielcortes.views.direccion.DireccionUpdatePanel; + +public class DireccionUpdateController extends BaseController { + + private Trabajador trabajador; + private Direccion direccion; + private DireccionUpdatePanel view; + private DireccionRepository repository; + private DireccionValidator validator; + + public DireccionUpdateController(DireccionUpdatePanel view, LaunchController parentController) { + super(parentController); + this.view = view; + this.repository = new DireccionRepository(); + this.validator = new DireccionValidator(this.repository); + this.setupListeners(); + } + + @Override + public LaunchController getParentController() { + return this.parentController; + } + + @Override + public void show() { + this.view.getCalleField().requestFocus(); + this.fillDireccion(); + } + + @Override + public BasePanel getView() { + return this.view; + } + + public void setTrabajador(Trabajador trabajador) { + this.trabajador = trabajador; + } + + public void setDireccion(Direccion direccion) { + this.direccion = direccion; + } + + public void fillDireccion() { + this.view.getCalleField().setText(this.direccion.getCalle()); + this.view.getNumeroField().setText(this.direccion.getNumero()); + } + + private void setupListeners() { + this.view.getActualizarButton().addActionListener(e -> update()); + this.view.getVolverButton().addActionListener(e -> volver()); + } + + private void update() { + String calle = this.view.getCalleField().getText(); + String numero = this.view.getNumeroField().getText(); + + ValidationResult originalValidation = this.validator.validateOriginal(this.direccion); + if (originalValidation.hasError()) { + originalValidation.showErrorDialog(); + return; + } + + ValidationResult direccionValidation = validator.validateCalle(calle); + if (direccionValidation.hasError()) { + direccionValidation.showErrorDialog(); + return; + } + + ValidationResult numeroValidation = validator.validateNumero(numero); + if (numeroValidation.hasError()) { + numeroValidation.showErrorDialog(); + return; + } + + this.direccion.setCalle(calle); + this.direccion.setNumero(numero); + this.repository.update(this.direccion); + + this.volver(); + } + + private void volver() { + DireccionSearchController controller = (DireccionSearchController) this.getParentController().getCard(PanelName.DIRECCION_SEARCH); + controller.setTrabajador(this.trabajador); + this.getParentController().showCard(PanelName.DIRECCION_SEARCH); + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/direccion/DireccionViewController.java b/src/main/java/xyz/danielcortes/controllers/direccion/DireccionViewController.java new file mode 100644 index 0000000..bba5739 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/direccion/DireccionViewController.java @@ -0,0 +1,61 @@ +package xyz.danielcortes.controllers.direccion; + +import xyz.danielcortes.controllers.LaunchController; +import xyz.danielcortes.framework.BaseController; +import xyz.danielcortes.framework.BasePanel; +import xyz.danielcortes.framework.PanelName; +import xyz.danielcortes.models.Direccion; +import xyz.danielcortes.models.Trabajador; +import xyz.danielcortes.views.direccion.DireccionViewPanel; + +public class DireccionViewController extends BaseController { + + private Trabajador trabajador; + private Direccion direccion; + private DireccionViewPanel view; + + public DireccionViewController(DireccionViewPanel view, LaunchController parentController) { + super(parentController); + this.view = view; + this.setupListeners(); + } + + @Override + public LaunchController getParentController() { + return this.parentController; + } + + @Override + public void show() { + this.fillDireccion(); + } + + @Override + public BasePanel getView() { + return this.view; + } + + public void setTrabajador(Trabajador trabajador) { + this.trabajador = trabajador; + } + + public void setDireccion(Direccion direccion) { + this.direccion = direccion; + } + + public void fillDireccion() { + this.view.getCalleField().setText(this.direccion.getCalle()); + this.view.getNumeroField().setText(this.direccion.getNumero()); + } + + private void setupListeners() { + this.view.getVolverButton().addActionListener(e -> volver()); + } + + private void volver() { + DireccionSearchController controller = (DireccionSearchController) this.getParentController().getCard(PanelName.DIRECCION_SEARCH); + controller.setTrabajador(trabajador); + this.getParentController().showCard(PanelName.DIRECCION_SEARCH); + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/trabajador/TrabajadorViewController.java b/src/main/java/xyz/danielcortes/controllers/trabajador/TrabajadorViewController.java index 3d90a46..c049472 100644 --- a/src/main/java/xyz/danielcortes/controllers/trabajador/TrabajadorViewController.java +++ b/src/main/java/xyz/danielcortes/controllers/trabajador/TrabajadorViewController.java @@ -3,6 +3,7 @@ package xyz.danielcortes.controllers.trabajador; import javax.swing.JOptionPane; import xyz.danielcortes.controllers.LaunchController; import xyz.danielcortes.controllers.correo.CorreoSearchController; +import xyz.danielcortes.controllers.direccion.DireccionSearchController; import xyz.danielcortes.controllers.telefono.TelefonoSearchController; import xyz.danielcortes.controllers.usuario.UsuarioCreateController; import xyz.danielcortes.controllers.usuario.UsuarioViewController; @@ -36,6 +37,13 @@ public class TrabajadorViewController extends BaseController { this.view.getCorreosButton().addActionListener(e -> this.gotoCorreosView()); this.view.getUsuarioButton().addActionListener(e -> this.gotoUsuarioView()); this.view.getTelefonosButton().addActionListener(e -> this.gotoTelefonoView()); + this.view.getDireccionesButton().addActionListener(e -> this.gotoDireccionView()); + } + + private void gotoDireccionView() { + DireccionSearchController controller = (DireccionSearchController) this.getParentController().getCard(PanelName.DIRECCION_SEARCH); + controller.setTrabajador(trabajador); + this.getParentController().showCard(PanelName.DIRECCION_SEARCH); } private void gotoTelefonoView() { diff --git a/src/main/java/xyz/danielcortes/framework/PanelName.java b/src/main/java/xyz/danielcortes/framework/PanelName.java index 9a9337b..c2bba23 100644 --- a/src/main/java/xyz/danielcortes/framework/PanelName.java +++ b/src/main/java/xyz/danielcortes/framework/PanelName.java @@ -47,5 +47,10 @@ public enum PanelName { TELEFONO_CREATE, TELEFONO_UPDATE, + DIRECCION_VIEW, + DIRECCION_SEARCH, + DIRECCION_CREATE, + DIRECCION_UPDATE, + COMPRAR_LIBRO, } diff --git a/src/main/java/xyz/danielcortes/models/Direccion.java b/src/main/java/xyz/danielcortes/models/Direccion.java new file mode 100644 index 0000000..49bccf2 --- /dev/null +++ b/src/main/java/xyz/danielcortes/models/Direccion.java @@ -0,0 +1,84 @@ +package xyz.danielcortes.models; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.ManyToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "direccion") +public class Direccion { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "calle") + private String calle; + + @Column(name = "numero") + private String numero; + + @ManyToMany(mappedBy = "direcciones") + private List trabajadores; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getCalle() { + return calle; + } + + public void setCalle(String calle) { + this.calle = calle; + } + + public String getNumero() { + return numero; + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public List getTrabajadores() { + if (trabajadores == null) { + this.trabajadores = new ArrayList<>(); + } + return trabajadores; + } + + public void setTrabajadores(List trabajador) { + this.trabajadores = trabajador; + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (!(o instanceof Direccion)) + return false; + Direccion direccion = (Direccion) o; + return Objects.equals(id, direccion.id) && + Objects.equals(calle, direccion.calle) && + Objects.equals(numero, direccion.numero) && + Objects.equals(trabajadores, direccion.trabajadores); + } + + @Override + public int hashCode() { + return Objects.hash(id, calle, numero, trabajadores); + } +} diff --git a/src/main/java/xyz/danielcortes/models/Trabajador.java b/src/main/java/xyz/danielcortes/models/Trabajador.java index 6989e83..ead7487 100644 --- a/src/main/java/xyz/danielcortes/models/Trabajador.java +++ b/src/main/java/xyz/danielcortes/models/Trabajador.java @@ -57,6 +57,14 @@ public class Trabajador { ) private List telefonos; + @ManyToMany + @JoinTable( + name = "trabajador_direccion", + joinColumns = @JoinColumn(name = "trabajador_id", referencedColumnName = "id"), + inverseJoinColumns = @JoinColumn(name = "direccion_id", referencedColumnName = "id") + ) + private List direcciones; + public Integer getId() { return id; } @@ -133,6 +141,16 @@ public class Trabajador { this.telefonos = telefonos; } + public List getDirecciones() { + if(direcciones == null) + direcciones = new ArrayList<>(); + return direcciones; + } + + public void setDirecciones(List direcciones) { + this.direcciones = direcciones; + } + @Override public boolean equals(Object o) { if (this == o) diff --git a/src/main/java/xyz/danielcortes/repository/DireccionRepository.java b/src/main/java/xyz/danielcortes/repository/DireccionRepository.java new file mode 100644 index 0000000..7c41d30 --- /dev/null +++ b/src/main/java/xyz/danielcortes/repository/DireccionRepository.java @@ -0,0 +1,49 @@ +package xyz.danielcortes.repository; + +import java.util.List; +import javax.persistence.TypedQuery; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Root; +import xyz.danielcortes.framework.BaseRepository; +import xyz.danielcortes.models.Direccion; +import xyz.danielcortes.models.Trabajador; + +public class DireccionRepository extends BaseRepository { + + public List getAll() { + TypedQuery query = em.createQuery("SELECT t FROM Direccion t", Direccion.class); + return query.getResultList(); + } + + public List search(String term) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery query = cb.createQuery(Direccion.class); + Root r = query.from(Direccion.class); + query.where( + cb.or( + cb.like(cb.lower(r.get("calle")), '%' + term.toLowerCase() + "%"), + cb.like(cb.lower(r.get("numero")), '%' + term.toLowerCase() + "%") + ) + ); + + return em.createQuery(query).getResultList(); + } + + public List search(String term, Trabajador trabajador) { + CriteriaBuilder cb = em.getCriteriaBuilder(); + CriteriaQuery query = cb.createQuery(Direccion.class); + Root r = query.from(Direccion.class); + query.where( + cb.and( + cb.equal(r.get("trabajador_id"), trabajador.getId()), + cb.or( + cb.like(cb.lower(r.get("calle")), '%' + term.toLowerCase() + "%"), + cb.like(cb.lower(r.get("numero")), '%' + term.toLowerCase() + "%") + ) + ) + ); + + return em.createQuery(query).getResultList(); + } +} diff --git a/src/main/java/xyz/danielcortes/validator/DireccionValidator.java b/src/main/java/xyz/danielcortes/validator/DireccionValidator.java new file mode 100644 index 0000000..c8aa7cf --- /dev/null +++ b/src/main/java/xyz/danielcortes/validator/DireccionValidator.java @@ -0,0 +1,39 @@ +package xyz.danielcortes.validator; + +import xyz.danielcortes.framework.ValidationResult; +import xyz.danielcortes.models.Direccion; +import xyz.danielcortes.repository.DireccionRepository; + +public class DireccionValidator { + private DireccionRepository direccionRepository; + + public DireccionValidator(DireccionRepository direccionRepository) { + this.direccionRepository = direccionRepository; + } + + public ValidationResult validateCalle(String calle) { + if(calle == null) { + return new ValidationResult("La calle es nula"); + } else if (calle.isEmpty()) { + return new ValidationResult("La calle esta vacia"); + } + return ValidationResult.NON_ERROR; + } + + public ValidationResult validateNumero(String numero) { + if(numero == null) { + return new ValidationResult("La calle es nula"); + } else if (numero.isEmpty()) { + return new ValidationResult("La calle esta vacia"); + } + return ValidationResult.NON_ERROR; + } + + public ValidationResult validateOriginal(Direccion original) { + if(original == null) { + return new ValidationResult("El direccion seleccionada no existe"); + } + return ValidationResult.NON_ERROR; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/direccion/DireccionCreatePanel.form b/src/main/java/xyz/danielcortes/views/direccion/DireccionCreatePanel.form new file mode 100644 index 0000000..60dc032 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/direccion/DireccionCreatePanel.form @@ -0,0 +1,90 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/direccion/DireccionCreatePanel.java b/src/main/java/xyz/danielcortes/views/direccion/DireccionCreatePanel.java new file mode 100644 index 0000000..34d25d7 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/direccion/DireccionCreatePanel.java @@ -0,0 +1,110 @@ +package xyz.danielcortes.views.direccion; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import xyz.danielcortes.framework.BasePanel; + +public class DireccionCreatePanel extends BasePanel { + + private JButton guardarButton; + private JPanel contentPane; + private JButton volverButton; + private JTextField calleField; + private JTextField numeroField; + + public JButton getGuardarButton() { + return guardarButton; + } + + public JPanel getContentPane() { + return contentPane; + } + + public JButton getVolverButton() { + return volverButton; + } + + public JTextField getCalleField() { + return calleField; + } + + public JTextField getNumeroField() { + return numeroField; + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(6, 3, new Insets(20, 20, 20, 20), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + guardarButton = new JButton(); + guardarButton.setText("Guardar"); + panel1.add(guardarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + volverButton = new JButton(); + volverButton.setText("Volver"); + panel1.add(volverButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Calle:"); + contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + calleField = new JTextField(); + contentPane.add(calleField, + new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, + new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, + null, null, 0, false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, + new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + final Spacer spacer3 = new Spacer(); + contentPane.add(spacer3, + new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + numeroField = new JTextField(); + contentPane.add(numeroField, + new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Numero:"); + contentPane.add(label2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/direccion/DireccionSearchPanel.form b/src/main/java/xyz/danielcortes/views/direccion/DireccionSearchPanel.form new file mode 100644 index 0000000..1606060 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/direccion/DireccionSearchPanel.form @@ -0,0 +1,116 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/direccion/DireccionSearchPanel.java b/src/main/java/xyz/danielcortes/views/direccion/DireccionSearchPanel.java new file mode 100644 index 0000000..67cba82 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/direccion/DireccionSearchPanel.java @@ -0,0 +1,166 @@ +package xyz.danielcortes.views.direccion; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import xyz.danielcortes.framework.BasePanel; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Direccion; + +public class DireccionSearchPanel extends BasePanel { + + private JPanel contentPane; + private JTable direccionesTable; + private JTextField searchField; + private JButton buscarButton; + private JButton verButton; + private JButton eliminarButton; + private JButton editarButton; + private JButton crearButton; + private JButton volverButton; + private BaseTableModel direccionModel; + + public JPanel getContentPane() { + return contentPane; + } + + public JTable getDireccionesTable() { + return direccionesTable; + } + + public JTextField getSearchField() { + return searchField; + } + + public JButton getBuscarButton() { + return buscarButton; + } + + public JButton getVerButton() { + return verButton; + } + + public JButton getEliminarButton() { + return eliminarButton; + } + + public JButton getEditarButton() { + return editarButton; + } + + public JButton getCrearButton() { + return crearButton; + } + + public JButton getVolverButton() { + return volverButton; + } + + public BaseTableModel getDireccionModel() { + return direccionModel; + } + + private void createUIComponents() { + this.creatDireccionTable(); + } + + private void creatDireccionTable() { + // @formatter:off + this.direccionModel = new BaseTableModel<>( + new String[]{"Calle", "Numero"}, + (row, rowIndex, colIndex) -> { + switch (colIndex) { + case 0: return row.get(rowIndex).getCalle(); + case 1: return row.get(rowIndex).getNumero(); + default: return null; + } + } + ); + // @formatter:on + this.direccionesTable = new JTable(this.direccionModel); + this.direccionesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + createUIComponents(); + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(4, 1, new Insets(20, 20, 20, 20), -1, -1)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(direccionesTable); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 4, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + verButton = new JButton(); + verButton.setText("Ver"); + panel1.add(verButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + eliminarButton = new JButton(); + eliminarButton.setText("Eliminar"); + panel1.add(eliminarButton, new GridConstraints(0, 3, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + editarButton = new JButton(); + editarButton.setText("Editar"); + panel1.add(editarButton, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + crearButton = new JButton(); + crearButton.setText("Crear"); + panel1.add(crearButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + volverButton = new JButton(); + volverButton.setText("Volver"); + contentPane.add(volverButton, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel2, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + buscarButton = new JButton(); + buscarButton.setText("Buscar"); + panel2.add(buscarButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + searchField = new JTextField(); + panel2.add(searchField, + new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/direccion/DireccionUpdatePanel.form b/src/main/java/xyz/danielcortes/views/direccion/DireccionUpdatePanel.form new file mode 100644 index 0000000..ecdd463 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/direccion/DireccionUpdatePanel.form @@ -0,0 +1,90 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/direccion/DireccionUpdatePanel.java b/src/main/java/xyz/danielcortes/views/direccion/DireccionUpdatePanel.java new file mode 100644 index 0000000..0d4cef9 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/direccion/DireccionUpdatePanel.java @@ -0,0 +1,110 @@ +package xyz.danielcortes.views.direccion; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import xyz.danielcortes.framework.BasePanel; + +public class DireccionUpdatePanel extends BasePanel { + + private JButton actualizarButton; + private JPanel contentPane; + private JButton volverButton; + private JTextField calleField; + private JTextField numeroField; + + public JButton getActualizarButton() { + return actualizarButton; + } + + public JPanel getContentPane() { + return contentPane; + } + + public JButton getVolverButton() { + return volverButton; + } + + public JTextField getCalleField() { + return calleField; + } + + public JTextField getNumeroField() { + return numeroField; + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(6, 3, new Insets(20, 20, 20, 20), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + actualizarButton = new JButton(); + actualizarButton.setText("Actualizar"); + panel1.add(actualizarButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + volverButton = new JButton(); + volverButton.setText("Volver"); + panel1.add(volverButton, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Calle:"); + contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + calleField = new JTextField(); + contentPane.add(calleField, + new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, + new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, + null, null, 0, false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, + new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + final Spacer spacer3 = new Spacer(); + contentPane.add(spacer3, + new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Numero:"); + contentPane.add(label2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + numeroField = new JTextField(); + contentPane.add(numeroField, + new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/direccion/DireccionViewPanel.form b/src/main/java/xyz/danielcortes/views/direccion/DireccionViewPanel.form new file mode 100644 index 0000000..a2a7b25 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/direccion/DireccionViewPanel.form @@ -0,0 +1,84 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/direccion/DireccionViewPanel.java b/src/main/java/xyz/danielcortes/views/direccion/DireccionViewPanel.java new file mode 100644 index 0000000..204011d --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/direccion/DireccionViewPanel.java @@ -0,0 +1,102 @@ +package xyz.danielcortes.views.direccion; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import xyz.danielcortes.framework.BasePanel; + +public class DireccionViewPanel extends BasePanel { + + private JPanel contentPane; + private JButton volverButton; + private JTextField direccionField; + private JTextField numeroField; + + public JPanel getContentPane() { + return contentPane; + } + + public JButton getVolverButton() { + return volverButton; + } + + public JTextField getCalleField() { + return direccionField; + } + + public JTextField getNumeroField() { + return numeroField; + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(6, 3, new Insets(20, 20, 20, 20), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + volverButton = new JButton(); + volverButton.setText("Volver"); + panel1.add(volverButton, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), + null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Calle:"); + contentPane.add(label1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + direccionField = new JTextField(); + direccionField.setEditable(false); + contentPane.add(direccionField, + new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, + new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, + null, null, 0, false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, + new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + final Spacer spacer3 = new Spacer(); + contentPane.add(spacer3, + new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, + null, null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Numero:"); + contentPane.add(label2, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + numeroField = new JTextField(); + numeroField.setEditable(false); + contentPane.add(numeroField, + new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +}