Agrege el asunto de direccion a los trabajadores <3

This commit is contained in:
Daniel Cortés
2019-06-06 13:42:21 -04:00
parent a4ddd12913
commit 1cd5d4703e
19 changed files with 1473 additions and 0 deletions

View File

@@ -19,6 +19,10 @@ import xyz.danielcortes.controllers.correo.CorreoCreateController;
import xyz.danielcortes.controllers.correo.CorreoSearchController; import xyz.danielcortes.controllers.correo.CorreoSearchController;
import xyz.danielcortes.controllers.correo.CorreoUpdateController; import xyz.danielcortes.controllers.correo.CorreoUpdateController;
import xyz.danielcortes.controllers.correo.CorreoViewController; 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.EditorialCreateController;
import xyz.danielcortes.controllers.editorial.EditorialSearchController; import xyz.danielcortes.controllers.editorial.EditorialSearchController;
import xyz.danielcortes.controllers.editorial.EditorialUpdateController; 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.CorreoSearchPanel;
import xyz.danielcortes.views.correo.CorreoUpdatePanel; import xyz.danielcortes.views.correo.CorreoUpdatePanel;
import xyz.danielcortes.views.correo.CorreoViewPanel; 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.EditorialCreatePanel;
import xyz.danielcortes.views.editorial.EditorialSearchPanel; import xyz.danielcortes.views.editorial.EditorialSearchPanel;
import xyz.danielcortes.views.editorial.EditorialUpdatePanel; 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_CREATE, new TelefonoCreateController(new TelefonoCreatePanel(), this));
this.controllers.put(PanelName.TELEFONO_UPDATE, new TelefonoUpdateController(new TelefonoUpdatePanel(), 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()) { for (PanelName name : this.controllers.keySet()) {
BaseController controller = this.controllers.get(name); BaseController controller = this.controllers.get(name);
this.frame.addCard(controller.getView().getContentPane(), name); this.frame.addCard(controller.getView().getContentPane(), name);

View File

@@ -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);
}
}

View File

@@ -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> 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<Direccion> direccions = this.trabajador.getDirecciones();
loadDireccionsTable(direccions);
}
private void loadDireccionsTable(List<Direccion> direccions) {
BaseTableModel<Direccion> 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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -3,6 +3,7 @@ package xyz.danielcortes.controllers.trabajador;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import xyz.danielcortes.controllers.LaunchController; import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.controllers.correo.CorreoSearchController; import xyz.danielcortes.controllers.correo.CorreoSearchController;
import xyz.danielcortes.controllers.direccion.DireccionSearchController;
import xyz.danielcortes.controllers.telefono.TelefonoSearchController; import xyz.danielcortes.controllers.telefono.TelefonoSearchController;
import xyz.danielcortes.controllers.usuario.UsuarioCreateController; import xyz.danielcortes.controllers.usuario.UsuarioCreateController;
import xyz.danielcortes.controllers.usuario.UsuarioViewController; import xyz.danielcortes.controllers.usuario.UsuarioViewController;
@@ -36,6 +37,13 @@ public class TrabajadorViewController extends BaseController {
this.view.getCorreosButton().addActionListener(e -> this.gotoCorreosView()); this.view.getCorreosButton().addActionListener(e -> this.gotoCorreosView());
this.view.getUsuarioButton().addActionListener(e -> this.gotoUsuarioView()); this.view.getUsuarioButton().addActionListener(e -> this.gotoUsuarioView());
this.view.getTelefonosButton().addActionListener(e -> this.gotoTelefonoView()); 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() { private void gotoTelefonoView() {

View File

@@ -47,5 +47,10 @@ public enum PanelName {
TELEFONO_CREATE, TELEFONO_CREATE,
TELEFONO_UPDATE, TELEFONO_UPDATE,
DIRECCION_VIEW,
DIRECCION_SEARCH,
DIRECCION_CREATE,
DIRECCION_UPDATE,
COMPRAR_LIBRO, COMPRAR_LIBRO,
} }

View File

@@ -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<Trabajador> 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<Trabajador> getTrabajadores() {
if (trabajadores == null) {
this.trabajadores = new ArrayList<>();
}
return trabajadores;
}
public void setTrabajadores(List<Trabajador> 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);
}
}

View File

@@ -57,6 +57,14 @@ public class Trabajador {
) )
private List<Telefono> telefonos; private List<Telefono> telefonos;
@ManyToMany
@JoinTable(
name = "trabajador_direccion",
joinColumns = @JoinColumn(name = "trabajador_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "direccion_id", referencedColumnName = "id")
)
private List<Direccion> direcciones;
public Integer getId() { public Integer getId() {
return id; return id;
} }
@@ -133,6 +141,16 @@ public class Trabajador {
this.telefonos = telefonos; this.telefonos = telefonos;
} }
public List<Direccion> getDirecciones() {
if(direcciones == null)
direcciones = new ArrayList<>();
return direcciones;
}
public void setDirecciones(List<Direccion> direcciones) {
this.direcciones = direcciones;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@@ -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<Direccion> {
public List<Direccion> getAll() {
TypedQuery<Direccion> query = em.createQuery("SELECT t FROM Direccion t", Direccion.class);
return query.getResultList();
}
public List<Direccion> search(String term) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Direccion> query = cb.createQuery(Direccion.class);
Root<Direccion> 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<Direccion> search(String term, Trabajador trabajador) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Direccion> query = cb.createQuery(Direccion.class);
Root<Direccion> 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();
}
}

View File

@@ -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;
}
}

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.direccion.DireccionCreatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="218"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="da18d" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="dd27f" class="javax.swing.JButton" binding="guardarButton">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Guardar"/>
</properties>
</component>
<component id="5841b" class="javax.swing.JButton" binding="volverButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Volver"/>
</properties>
</component>
</children>
</grid>
<component id="b661c" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Calle:"/>
</properties>
</component>
<component id="d65b2" class="javax.swing.JTextField" binding="calleField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<vspacer id="38cf5">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="40fa1">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="f3ec4">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="34b54" class="javax.swing.JTextField" binding="numeroField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="e8d7b" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Numero:"/>
</properties>
</component>
</children>
</grid>
</form>

View File

@@ -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;
}
}

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.direccion.DireccionSearchPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="501" height="443"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="4cd2">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c98c0" class="javax.swing.JTable" binding="direccionesTable" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<grid id="6e1ed" layout-manager="GridLayoutManager" row-count="1" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="23e34" class="javax.swing.JButton" binding="verButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Ver"/>
</properties>
</component>
<component id="40732" class="javax.swing.JButton" binding="eliminarButton" default-binding="true">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Eliminar"/>
</properties>
</component>
<component id="99cf5" class="javax.swing.JButton" binding="editarButton" default-binding="true">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Editar"/>
</properties>
</component>
<component id="bdc48" class="javax.swing.JButton" binding="crearButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Crear"/>
</properties>
</component>
</children>
</grid>
<component id="cd99c" class="javax.swing.JButton" binding="volverButton" default-binding="true">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Volver"/>
</properties>
</component>
<grid id="1db23" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="d89c0" class="javax.swing.JButton" binding="buscarButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Buscar"/>
</properties>
</component>
<component id="ced19" class="javax.swing.JTextField" binding="searchField" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</children>
</grid>
</form>

View File

@@ -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<Direccion> 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<Direccion> 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;
}
}

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.direccion.DireccionUpdatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="218"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="da18d" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="dd27f" class="javax.swing.JButton" binding="actualizarButton">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Actualizar"/>
</properties>
</component>
<component id="5841b" class="javax.swing.JButton" binding="volverButton" default-binding="true">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Volver"/>
</properties>
</component>
</children>
</grid>
<component id="b661c" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Calle:"/>
</properties>
</component>
<component id="d65b2" class="javax.swing.JTextField" binding="calleField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<vspacer id="38cf5">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="40fa1">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="f3ec4">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="888c8" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Numero:"/>
</properties>
</component>
<component id="c5c7c" class="javax.swing.JTextField" binding="numeroField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>

View File

@@ -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;
}
}

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.direccion.DireccionViewPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="218"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="da18d" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="5841b" class="javax.swing.JButton" binding="volverButton" default-binding="true">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<text value="Volver"/>
</properties>
</component>
</children>
</grid>
<component id="b661c" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Calle:"/>
</properties>
</component>
<component id="d65b2" class="javax.swing.JTextField" binding="direccionField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
<vspacer id="38cf5">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="40fa1">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="f3ec4">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="586f6" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Numero:"/>
</properties>
</component>
<component id="f84ec" class="javax.swing.JTextField" binding="numeroField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
</children>
</grid>
</form>

View File

@@ -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;
}
}