Clientes <3

This commit is contained in:
Daniel Cortés
2019-06-13 13:05:58 -04:00
parent b196a180bc
commit 9d86f75991
26 changed files with 2257 additions and 144 deletions

View File

@@ -14,6 +14,10 @@ import xyz.danielcortes.controllers.mantenedores.categoria.CategoriaCreateContro
import xyz.danielcortes.controllers.mantenedores.categoria.CategoriaSearchController;
import xyz.danielcortes.controllers.mantenedores.categoria.CategoriaUpdateController;
import xyz.danielcortes.controllers.mantenedores.categoria.CategoriaViewController;
import xyz.danielcortes.controllers.mantenedores.cliente.ClienteCreateController;
import xyz.danielcortes.controllers.mantenedores.cliente.ClienteSearchController;
import xyz.danielcortes.controllers.mantenedores.cliente.ClienteUpdateController;
import xyz.danielcortes.controllers.mantenedores.cliente.ClienteViewController;
import xyz.danielcortes.controllers.mantenedores.distribuidor.DistribuidorCreateController;
import xyz.danielcortes.controllers.mantenedores.distribuidor.DistribuidorSearchController;
import xyz.danielcortes.controllers.mantenedores.distribuidor.DistribuidorUpdateController;
@@ -65,6 +69,10 @@ import xyz.danielcortes.views.mantenedores.categoria.CategoriaCreatePanel;
import xyz.danielcortes.views.mantenedores.categoria.CategoriaSearchPanel;
import xyz.danielcortes.views.mantenedores.categoria.CategoriaUpdatePanel;
import xyz.danielcortes.views.mantenedores.categoria.CategoriaViewPanel;
import xyz.danielcortes.views.mantenedores.cliente.ClienteCreatePanel;
import xyz.danielcortes.views.mantenedores.cliente.ClienteSearchPanel;
import xyz.danielcortes.views.mantenedores.cliente.ClienteUpdatePanel;
import xyz.danielcortes.views.mantenedores.cliente.ClienteViewPanel;
import xyz.danielcortes.views.mantenedores.correo.CorreoCreatePanel;
import xyz.danielcortes.views.mantenedores.correo.CorreoSearchPanel;
import xyz.danielcortes.views.mantenedores.correo.CorreoUpdatePanel;
@@ -117,7 +125,7 @@ public class LaunchController {
}
private void create() {
frame = new LaunchFrame();
this.frame = new LaunchFrame();
this.createCards();
this.createMenuBar();
}
@@ -160,6 +168,11 @@ public class LaunchController {
this.controllers.put(PanelName.DISTRIBUIDOR_CREATE, new DistribuidorCreateController(new DistribuidorCreatePanel(), this));
this.controllers.put(PanelName.DISTRIBUIDOR_UPDATE, new DistribuidorUpdateController(new DistribuidorUpdatePanel(), this));
this.controllers.put(PanelName.CLIENTE_VIEW, new ClienteViewController(new ClienteViewPanel(), this));
this.controllers.put(PanelName.CLIENTE_SEARCH, new ClienteSearchController(new ClienteSearchPanel(), this));
this.controllers.put(PanelName.CLIENTE_CREATE, new ClienteCreateController(new ClienteCreatePanel(), this));
this.controllers.put(PanelName.CLIENTE_UPDATE, new ClienteUpdateController(new ClienteUpdatePanel(), this));
this.controllers.put(PanelName.EMPRESA_VIEW, new EmpresaViewController(new EmpresaViewPanel(), this));
this.controllers.put(PanelName.EMPRESA_SEARCH, new EmpresaSearchController(new EmpresaSearchPanel(), this));
this.controllers.put(PanelName.EMPRESA_CREATE, new EmpresaCreateController(new EmpresaCreatePanel(), this));
@@ -194,8 +207,8 @@ public class LaunchController {
private void createMenuBar() {
JMenuBar menuBar = new JMenuBar();
menuBar.add(createMantenedoresMenu());
menuBar.add(createComprarMenu());
menuBar.add(this.createMantenedoresMenu());
menuBar.add(this.createComprarMenu());
this.frame.setJMenuBar(menuBar);
}
@@ -211,6 +224,7 @@ public class LaunchController {
JMenuItem trabajadoresItem = new JMenuItem("Trabajadores");
JMenuItem empresasItem = new JMenuItem("Empresas");
JMenuItem distribuidoresItem = new JMenuItem("Distribuidores");
JMenuItem clientesItem = new JMenuItem("Clientes");
autoresItem.addActionListener(e -> this.showCard(PanelName.AUTOR_SEARCH));
idiomasItem.addActionListener(e -> this.showCard(PanelName.IDIOMA_SEARCH));
@@ -218,17 +232,19 @@ public class LaunchController {
categoriasItem.addActionListener(e -> this.showCard(PanelName.CATEGORIA_SEARCH));
editorialesItem.addActionListener(e -> this.showCard(PanelName.EDITORIAL_SEARCH));
trabajadoresItem.addActionListener(e -> this.showCard(PanelName.TRABAJADOR_SEARCH));
empresasItem.addActionListener(e -> this.showCard(PanelName.EMPRESA_SEARCH));
distribuidoresItem.addActionListener(e -> this.showCard(PanelName.DISTRIBUIDOR_SEARCH));
clientesItem.addActionListener(e -> this.showCard(PanelName.CLIENTE_SEARCH));
empresasItem.addActionListener(e -> this.showCard(PanelName.EMPRESA_SEARCH));
mantenedoresMenu.add(librosItem );
mantenedoresMenu.add(librosItem);
mantenedoresMenu.add(autoresItem);
mantenedoresMenu.add(idiomasItem);
mantenedoresMenu.add(categoriasItem);
mantenedoresMenu.add(editorialesItem);
mantenedoresMenu.add(trabajadoresItem);
mantenedoresMenu.add(empresasItem);
mantenedoresMenu.add(distribuidoresItem);
mantenedoresMenu.add(clientesItem);
mantenedoresMenu.add(empresasItem);
return mantenedoresMenu;
}

View File

@@ -0,0 +1,90 @@
package xyz.danielcortes.controllers.mantenedores.cliente;
import java.time.LocalDate;
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.Cliente;
import xyz.danielcortes.repository.ClienteRespository;
import xyz.danielcortes.validator.ClienteValidator;
import xyz.danielcortes.views.mantenedores.cliente.ClienteCreatePanel;
public class ClienteCreateController extends BaseController {
private ClienteCreatePanel view;
private ClienteRespository respository;
private ClienteValidator validator;
public ClienteCreateController(ClienteCreatePanel view, LaunchController parent) {
super(parent);
this.view = view;
this.respository = new ClienteRespository();
this.validator = new ClienteValidator(this.respository);
this.setupListeners();
}
@Override
public void show() {
this.view.getRutField().requestFocus();
}
private void setupListeners() {
this.view.getGuardarButton().addActionListener(e -> this.save());
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CLIENTE_SEARCH));
}
private void save() {
String rut = this.view.getRutField().getText();
ValidationResult rutValidation = this.validator.validateRut(rut);
if (rutValidation.hasError()) {
rutValidation.showErrorDialog();
return;
}
String nombre = this.view.getNombreField().getText();
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
if (nombreValidation.hasError()) {
nombreValidation.showErrorDialog();
return;
}
String apellidoPaterno = this.view.getApellidoPaternoField().getText();
ValidationResult apellidoPaternoValidation = this.validator.validateApellidoPaterno(apellidoPaterno);
if (apellidoPaternoValidation.hasError()) {
apellidoPaternoValidation.showErrorDialog();
return;
}
String apellidoMaterno = this.view.getApellidoMaternoField().getText();
ValidationResult apellidoMaternoValidation = this.validator.validateApellidoMaterno(apellidoMaterno);
if (apellidoMaternoValidation.hasError()) {
apellidoMaternoValidation.showErrorDialog();
return;
}
LocalDate fechaNacimiento = this.view.getFechaNacimientoPicker().getDate();
ValidationResult fechaContratoValidation = this.validator.validateFechaNacimiento(fechaNacimiento);
if (fechaContratoValidation.hasError()) {
fechaContratoValidation.showErrorDialog();
return;
}
Cliente cliente = new Cliente();
cliente.setRut(rut);
cliente.setNombre(nombre);
cliente.setApellidoPaterno(apellidoPaterno);
cliente.setApellidoMaterno(apellidoMaterno);
cliente.setFechaNacimiento(fechaNacimiento);
this.respository.save(cliente);
this.getParentController().showCard(PanelName.CLIENTE_SEARCH);
}
@Override
public BasePanel getView() {
return this.view;
}
}

View File

@@ -0,0 +1,121 @@
package xyz.danielcortes.controllers.mantenedores.cliente;
import java.util.List;
import javax.swing.JOptionPane;
import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.framework.BaseController;
import xyz.danielcortes.framework.BasePanel;
import xyz.danielcortes.framework.BaseTableModel;
import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.models.Cliente;
import xyz.danielcortes.repository.ClienteRespository;
import xyz.danielcortes.validator.ClienteValidator;
import xyz.danielcortes.views.mantenedores.cliente.ClienteSearchPanel;
public class ClienteSearchController extends BaseController {
private ClienteSearchPanel view;
private ClienteRespository clienteRespository;
private ClienteValidator clienteValidator;
public ClienteSearchController(ClienteSearchPanel view, LaunchController parent) {
super(parent);
this.view = view;
this.clienteRespository = new ClienteRespository();
this.clienteValidator = new ClienteValidator(this.clienteRespository);
this.setupListeners();
}
@Override
public void show() {
this.reload();
this.view.getClienteTable().clearSelection();
}
private void reload() {
this.loadClienteTable();
}
private void setupListeners() {
this.view.getCrearButton().addActionListener(e -> this.getParentController().showCard(PanelName.CLIENTE_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());
}
private void edit() {
Cliente cliente = this.getSelectedCliente();
if (cliente != null) {
ClienteUpdateController controller = (ClienteUpdateController) this.getParentController().getCard(PanelName.CLIENTE_UPDATE);
controller.setCliente(cliente);
this.getParentController().showCard(PanelName.CLIENTE_UPDATE);
}
}
private void delete() {
Cliente cliente = this.getSelectedCliente();
if (cliente == null)
return;
int option = JOptionPane.showConfirmDialog(
null,
"¿Estas seguro de que deseas eliminar el cliente?",
"Confirmacion",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE
);
if (option == JOptionPane.NO_OPTION)
return;
this.clienteRespository.delete(cliente);
this.reload();
}
private void view() {
Cliente cliente = this.getSelectedCliente();
if (cliente != null) {
ClienteViewController controller = (ClienteViewController) this.getParentController().getCard(PanelName.CLIENTE_VIEW);
controller.setCliente(cliente);
this.getParentController().showCard(PanelName.CLIENTE_VIEW);
}
}
private void search() {
String term = this.view.getSearchField().getText();
List<Cliente> clientees = this.clienteRespository.search(term);
this.loadClienteTable(clientees);
}
private void loadClienteTable() {
List<Cliente> clientees = this.clienteRespository.getAll();
this.loadClienteTable(clientees);
}
private void loadClienteTable(List<Cliente> clientees) {
BaseTableModel<Cliente> model = this.view.getClienteModel();
model.setRows(clientees);
}
private Cliente getSelectedCliente() {
int selectedRow = this.view.getClienteTable().getSelectedRow();
if (selectedRow == -1) {
JOptionPane.showMessageDialog(
null,
"No hay cliente seleccionado",
"Error",
JOptionPane.ERROR_MESSAGE
);
return null;
}
return this.view.getClienteModel().getRow(selectedRow);
}
@Override
public BasePanel getView() {
return this.view;
}
}

View File

@@ -0,0 +1,107 @@
package xyz.danielcortes.controllers.mantenedores.cliente;
import java.time.LocalDate;
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.Cliente;
import xyz.danielcortes.repository.ClienteRespository;
import xyz.danielcortes.validator.ClienteValidator;
import xyz.danielcortes.views.mantenedores.cliente.ClienteUpdatePanel;
public class ClienteUpdateController extends BaseController {
private Cliente cliente;
private ClienteUpdatePanel view;
private ClienteRespository clienteRespository;
private ClienteValidator clienteValidator;
public ClienteUpdateController(ClienteUpdatePanel view, LaunchController parent) {
super(parent);
this.view = view;
this.clienteRespository = new ClienteRespository();
this.clienteValidator = new ClienteValidator(this.clienteRespository);
this.setupListeners();
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
@Override
public void show() {
this.fillCliente();
this.view.getRutField().requestFocus();
}
private void fillCliente() {
if (this.clienteRespository == null)
return;
this.view.getRutField().setText(this.cliente.getRut());
this.view.getNombreField().setText(this.cliente.getNombre());
this.view.getApellidoPaternoField().setText(this.cliente.getApellidoPaterno());
this.view.getApellidoMaternoField().setText(this.cliente.getApellidoMaterno());
this.view.getFechaNacimientoField().setDate(this.cliente.getFechaNacimiento());
}
private void setupListeners() {
this.view.getActualizarButton().addActionListener(e -> this.update());
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CLIENTE_SEARCH));
}
private void update() {
String rut = this.view.getRutField().getText();
ValidationResult rutValidation = this.clienteValidator.validateRut(rut);
if (rutValidation.hasError()) {
rutValidation.showErrorDialog();
return;
}
String nombre = this.view.getNombreField().getText();
ValidationResult nombreValidation = this.clienteValidator.validateNombre(nombre);
if (nombreValidation.hasError()) {
nombreValidation.showErrorDialog();
return;
}
String apellidoPaterno = this.view.getApellidoPaternoField().getText();
ValidationResult apellidoPaternoValidation = this.clienteValidator.validateApellidoPaterno(apellidoPaterno);
if (apellidoPaternoValidation.hasError()) {
apellidoPaternoValidation.showErrorDialog();
return;
}
String apellidoMaterno = this.view.getApellidoMaternoField().getText();
ValidationResult apellidoMaternoValidation = this.clienteValidator.validateApellidoMaterno(apellidoMaterno);
if (apellidoMaternoValidation.hasError()) {
apellidoMaternoValidation.showErrorDialog();
return;
}
LocalDate fechaNacimiento = this.view.getFechaNacimientoField().getDate();
ValidationResult fechaContratoValidation = this.clienteValidator.validateFechaNacimiento(fechaNacimiento);
if (fechaContratoValidation.hasError()) {
fechaContratoValidation.showErrorDialog();
return;
}
assert this.cliente != null;
this.cliente.setNombre(nombre);
this.cliente.setApellidoPaterno(apellidoPaterno);
this.cliente.setApellidoMaterno(apellidoMaterno);
this.cliente.setFechaNacimiento(fechaNacimiento);
this.cliente.setRut(rut);
this.clienteRespository.update(this.cliente);
this.getParentController().showCard(PanelName.CLIENTE_SEARCH);
}
@Override
public BasePanel getView() {
return this.view;
}
}

View File

@@ -0,0 +1,71 @@
package xyz.danielcortes.controllers.mantenedores.cliente;
import java.time.format.DateTimeFormatter;
import xyz.danielcortes.controllers.LaunchController;
import xyz.danielcortes.framework.BaseController;
import xyz.danielcortes.framework.BasePanel;
import xyz.danielcortes.framework.PanelName;
import xyz.danielcortes.models.Cliente;
import xyz.danielcortes.views.mantenedores.cliente.ClienteViewPanel;
public class ClienteViewController extends BaseController {
private Cliente cliente;
private ClienteViewPanel view;
public ClienteViewController(ClienteViewPanel view, LaunchController parent) {
super(parent);
this.view = view;
this.setupListeners();
}
@Override
public void show() {
this.fillCliente();
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
private void setupListeners() {
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CLIENTE_SEARCH));
// this.view.getCorreosButton().addActionListener(e -> this.gotoCorreosView());
// 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.setCliente(cliente);
// this.getParentController().showCard(PanelName.DIRECCION_SEARCH);
// }
//
// private void gotoTelefonoView() {
// TelefonoSearchController controller = (TelefonoSearchController) this.getParentController().getCard(PanelName.TELEFONO_SEARCH);
// controller.setCliente(cliente);
// this.getParentController().showCard(PanelName.TELEFONO_SEARCH);
// }
//
// private void gotoCorreosView() {
// CorreoSearchController controller = (CorreoSearchController) this.getParentController().getCard(PanelName.CORREO_SEARCH);
// controller.setCliente(cliente);
// this.getParentController().showCard(PanelName.CORREO_SEARCH);
// }
private void fillCliente() {
if (this.cliente == null)
return;
this.view.getRutField().setText(this.cliente.getRut());
this.view.getNombreField().setText(this.cliente.getNombre());
this.view.getApellidoPaternoField().setText(this.cliente.getApellidoPaterno());
this.view.getApellidoMaternoField().setText(this.cliente.getApellidoMaterno());
this.view.getFechaNacimientoField().setText(this.cliente.getFechaNacimiento().format(DateTimeFormatter.ofPattern("dd/MM/YYYY")));
}
@Override
public BasePanel getView() {
return this.view;
}
}

View File

@@ -36,7 +36,7 @@ public class CorreoSearchController extends BaseController {
@Override
public BasePanel getView() {
return view;
return this.view;
}
public void setTrabajador(Trabajador trabajador) {
@@ -60,7 +60,7 @@ public class CorreoSearchController extends BaseController {
private void create() {
CorreoCreateController controller = (CorreoCreateController) this.getParentController().getCard(PanelName.CORREO_CREATE);
controller.setTrabajador(trabajador);
controller.setTrabajador(this.trabajador);
this.getParentController().showCard(PanelName.CORREO_CREATE);
}
@@ -68,14 +68,14 @@ public class CorreoSearchController extends BaseController {
Correo correo = this.getSelectedCorreo();
if (correo != null) {
CorreoUpdateController controller = (CorreoUpdateController) this.getParentController().getCard(PanelName.CORREO_UPDATE);
controller.setTrabajador(trabajador);
controller.setTrabajador(this.trabajador);
controller.setCorreo(correo);
this.getParentController().showCard(PanelName.CORREO_UPDATE);
}
}
private void delete() {
Correo correo = this.getSelectedCorreo();
Correo correo = this.getSelecztedCorreo();
if (correo == null)
return;
@@ -99,14 +99,14 @@ public class CorreoSearchController extends BaseController {
if (correo != null) {
CorreoViewController controller = (CorreoViewController) this.getParentController().getCard(PanelName.CORREO_VIEW);
controller.setCorreo(correo);
controller.setTrabajador(trabajador);
controller.setTrabajador(this.trabajador);
this.getParentController().showCard(PanelName.CORREO_VIEW);
}
}
private void search() {
String term = this.view.getSearchField().getText();
List<Correo> correo = this.correoRepository.search(term, trabajador);
List<Correo> correo = this.correoRepository.search(term, this.trabajador);
this.loadCorreosTable(correo);
}
@@ -118,7 +118,7 @@ public class CorreoSearchController extends BaseController {
private void loadCorreosTable() {
List<Correo> correos = this.trabajador.getCorreos();
loadCorreosTable(correos);
this.loadCorreosTable(correos);
}
private void loadCorreosTable(List<Correo> correos) {

View File

@@ -43,6 +43,11 @@ public enum PanelName {
DISTRIBUIDOR_CREATE,
DISTRIBUIDOR_UPDATE,
CLIENTE_VIEW,
CLIENTE_SEARCH,
CLIENTE_CREATE,
CLIENTE_UPDATE,
USUARIO_VIEW,
USUARIO_CREATE,
USUARIO_UPDATE,

View File

@@ -0,0 +1,123 @@
package xyz.danielcortes.models;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
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 = "cliente")
public class Cliente {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
private Integer id;
@Column(name = "rut")
private String rut;
@Column(name = "nombre")
private String nombre;
@Column(name = "apellido_paterno")
private String apellidoPaterno;
@Column(name = "apellido_materno")
private String apellidoMaterno;
@Column(name = "fecha_nacimiento")
private LocalDate fechaNacimiento;
@ManyToMany(mappedBy = "clientes")
private List<Correo> correos;
@ManyToMany(mappedBy = "clientes")
private List<Telefono> telefonos;
@ManyToMany(mappedBy = "clientes")
private List<Direccion> direcciones;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getRut() {
return rut;
}
public void setRut(String rut) {
this.rut = rut;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellidoPaterno() {
return apellidoPaterno;
}
public void setApellidoPaterno(String apellidoPaterno) {
this.apellidoPaterno = apellidoPaterno;
}
public String getApellidoMaterno() {
return apellidoMaterno;
}
public void setApellidoMaterno(String apellidoMaterno) {
this.apellidoMaterno = apellidoMaterno;
}
public LocalDate getFechaNacimiento() {
return fechaNacimiento;
}
public void setFechaNacimiento(LocalDate fechaNacimiento) {
this.fechaNacimiento = fechaNacimiento;
}
public List<Correo> getCorreos() {
if(correos == null)
correos = new ArrayList<>();
return correos;
}
public void setCorreos(List<Correo> correos) {
this.correos = correos;
}
public List<Telefono> getTelefonos() {
if(telefonos == null)
telefonos = new ArrayList<>();
return telefonos;
}
public void setTelefonos(List<Telefono> 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;
}
}

View File

@@ -41,6 +41,14 @@ public class Correo {
)
private List<Distribuidor> distribuidores;
@ManyToMany
@JoinTable(
name = "cliente_direccion",
joinColumns = @JoinColumn(name = "direccion_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "cliente_id", referencedColumnName = "id")
)
private List<Cliente> clientes;
public Integer getId() {
return id;
}
@@ -69,7 +77,7 @@ public class Correo {
}
public List<Distribuidor> getDistribuidores() {
if(distribuidores == null)
if (distribuidores == null)
distribuidores = new ArrayList<>();
return distribuidores;
}
@@ -78,20 +86,13 @@ public class Correo {
this.distribuidores = distribuidores;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof Correo))
return false;
Correo correo1 = (Correo) o;
return Objects.equals(id, correo1.id) &&
Objects.equals(correo, correo1.correo) &&
Objects.equals(trabajadores, correo1.trabajadores);
public List<Cliente> getClientes() {
if (clientes == null)
clientes = new ArrayList<>();
return clientes;
}
@Override
public int hashCode() {
return Objects.hash(id, correo, trabajadores);
public void setClientes(List<Cliente> clientes) {
this.clientes = clientes;
}
}

View File

@@ -2,7 +2,6 @@ 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;
@@ -44,6 +43,14 @@ public class Direccion {
)
private List<Distribuidor> distribuidores;
@ManyToMany
@JoinTable(
name = "cliente_direccion",
joinColumns = @JoinColumn(name = "direccion_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "cliente_id", referencedColumnName = "id")
)
private List<Cliente> clientes;
public Integer getId() {
return id;
}
@@ -80,7 +87,7 @@ public class Direccion {
}
public List<Distribuidor> getDistribuidores() {
if(distribuidores == null)
if (distribuidores == null)
distribuidores = new ArrayList<>();
return distribuidores;
}
@@ -89,21 +96,13 @@ public class Direccion {
this.distribuidores = distribuidores;
}
@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);
public List<Cliente> getClientes() {
if (clientes == null)
clientes = new ArrayList<>();
return clientes;
}
@Override
public int hashCode() {
return Objects.hash(id, calle, numero, trabajadores);
public void setClientes(List<Cliente> clientes) {
this.clientes = clientes;
}
}

View File

@@ -2,7 +2,6 @@ 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;
@@ -16,6 +15,7 @@ import javax.persistence.Table;
@Entity
@Table(name = "telefono")
public class Telefono {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false)
@@ -40,6 +40,14 @@ public class Telefono {
)
private List<Distribuidor> distribuidores;
@ManyToMany
@JoinTable(
name = "cliente_direccion",
joinColumns = @JoinColumn(name = "direccion_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "cliente_id", referencedColumnName = "id")
)
private List<Cliente> clientes;
public Integer getId() {
return id;
}
@@ -57,7 +65,7 @@ public class Telefono {
}
public List<Trabajador> getTrabajadores() {
if(trabajadores == null) {
if (trabajadores == null) {
trabajadores = new ArrayList<>();
}
return trabajadores;
@@ -68,7 +76,7 @@ public class Telefono {
}
public List<Distribuidor> getDistribuidores() {
if(distribuidores == null)
if (distribuidores == null)
distribuidores = new ArrayList<>();
return distribuidores;
}
@@ -77,20 +85,13 @@ public class Telefono {
this.distribuidores = distribuidores;
}
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (!(o instanceof Telefono))
return false;
Telefono telefono = (Telefono) o;
return Objects.equals(id, telefono.id) &&
Objects.equals(numero, telefono.numero) &&
Objects.equals(trabajadores, telefono.trabajadores);
public List<Cliente> getClientes() {
if(clientes == null)
clientes = new ArrayList<>();
return clientes;
}
@Override
public int hashCode() {
return Objects.hash(id, numero, trabajadores);
public void setClientes(List<Cliente> clientes) {
this.clientes = clientes;
}
}

View File

@@ -0,0 +1,29 @@
package xyz.danielcortes.repository;
import java.util.List;
import javax.persistence.TypedQuery;
import xyz.danielcortes.framework.BaseRepository;
import xyz.danielcortes.models.Cliente;
public class ClienteRespository extends BaseRepository<Cliente> {
public List<Cliente> getAll() {
TypedQuery<Cliente> query = em.createQuery("SELECT c FROM Cliente c", Cliente.class);
return query.getResultList();
}
public List<Cliente> search(String term) {
TypedQuery<Cliente> query = em.createQuery(
"SELECT c FROM Cliente c WHERE "
+ " LOWER(c.rut) LIKE :term OR "
+ " LOWER(c.nombre) LIKE :term OR "
+ " LOWER(c.apellidoPaterno) LIKE :term OR "
+ " LOWER(c.apellidoPaterno) LIKE :term OR "
+ " LOWER(c.fechaNacimiento) LIKE :term",
Cliente.class
);
return query.getResultList();
}
}

View File

@@ -0,0 +1,88 @@
package xyz.danielcortes.validator;
import java.time.LocalDate;
import xyz.danielcortes.framework.ValidationResult;
import xyz.danielcortes.repository.ClienteRespository;
public class ClienteValidator {
private ClienteRespository clienteRespository;
public ClienteValidator(ClienteRespository clienteRespository) {
this.clienteRespository = clienteRespository;
}
public ValidationResult validateNombre(String nombre) {
if (nombre == null) {
return new ValidationResult("El nombre es nulo");
} else if (nombre.isEmpty()) {
return new ValidationResult("El nombre esta vacío");
}
return ValidationResult.NON_ERROR;
}
public ValidationResult validateApellidoPaterno(String apellidoPaterno) {
if (apellidoPaterno == null) {
return new ValidationResult("El apellido paterno es nulo");
} else if (apellidoPaterno.isEmpty()) {
return new ValidationResult("El apellido paterno esta vacío");
}
return ValidationResult.NON_ERROR;
}
public ValidationResult validateApellidoMaterno(String apellidoMaterno) {
if (apellidoMaterno == null) {
return new ValidationResult("El apellido materno es nulo");
} else if (apellidoMaterno.isEmpty()) {
return new ValidationResult("El apellido materno esta vacío");
}
return ValidationResult.NON_ERROR;
}
public ValidationResult validateRut(String rut) {
if (rut == null) {
return new ValidationResult("El rut es nulo");
} else if (rut.isEmpty()) {
return new ValidationResult("El rut esta vacío");
} else if (rut.length() < 4) {
return new ValidationResult("El rut es muy corto");
}
if (!this.rutChecksum(rut)) {
return new ValidationResult("El rut es invalido");
}
return ValidationResult.NON_ERROR;
}
public ValidationResult validateFechaNacimiento(LocalDate fecha) {
if (fecha == null) {
return new ValidationResult("La fecha es nula");
}
return ValidationResult.NON_ERROR;
}
private boolean rutChecksum(String rut) {
char lastchar = rut.charAt(rut.length() - 1);
rut = rut.toLowerCase().replaceAll("[^\\dkK]", "");
int sum = 0;
for (int i = rut.length() - 2, j = 2; i >= 0; i--, j++) {
int digit = rut.charAt(i) - '0';
if (j == 8)
j = 2;
sum += digit * j;
}
int mod11 = 11 - (sum % 11);
char digitoVerificador = (char) (mod11 + '0');
if (mod11 == 11)
digitoVerificador = '0';
if (mod11 == 10)
digitoVerificador = 'k';
return lastchar == digitoVerificador;
}
}

View File

@@ -9,6 +9,7 @@ import javax.swing.WindowConstants;
import xyz.danielcortes.framework.PanelName;
public class LaunchFrame extends JFrame {
private Dimension dimension;
public LaunchFrame() {

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.mantenedores.cliente.ClienteCreatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="12" 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="518" height="398"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e1d53" 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="Nombre:"/>
</properties>
</component>
<component id="a56da" class="javax.swing.JTextField" binding="nombreField">
<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="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="b0057" class="javax.swing.JLabel">
<constraints>
<grid row="4" 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="Apellido Paterno:"/>
</properties>
</component>
<component id="dfe9b" class="javax.swing.JTextField" binding="apellidoPaternoField">
<constraints>
<grid row="5" 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>
<component id="196df" class="javax.swing.JLabel">
<constraints>
<grid row="6" 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="Apellido Materno:"/>
</properties>
</component>
<component id="cd6a6" class="javax.swing.JTextField" binding="apellidoMaternoField">
<constraints>
<grid row="7" 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="8d91b">
<constraints>
<grid row="11" 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="a8101">
<constraints>
<grid row="11" 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="f2d12">
<constraints>
<grid row="11" 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>
<grid id="4b9e5" 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="10" 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="a11e3" class="javax.swing.JButton" binding="guardarButton" 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="Guardar"/>
</properties>
</component>
<component id="ef3e2" 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="8fb77" class="javax.swing.JTextField" binding="rutField">
<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="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="23030" 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="Rut:"/>
</properties>
</component>
<component id="17778" class="javax.swing.JLabel">
<constraints>
<grid row="8" 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="Fecha Nacimiento:"/>
</properties>
</component>
<component id="17515" class="com.github.lgooddatepicker.components.DatePicker" binding="fechaNacimientoPicker">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>

View File

@@ -0,0 +1,151 @@
package xyz.danielcortes.views.mantenedores.cliente;
import com.github.lgooddatepicker.components.DatePicker;
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 ClienteCreatePanel extends BasePanel {
private JTextField nombreField;
private JTextField apellidoPaternoField;
private JTextField apellidoMaternoField;
private JButton guardarButton;
private JPanel contentPane;
private JButton volverButton;
private JTextField rutField;
private DatePicker fechaNacimientoPicker;
@Override
public JPanel getContentPane() {
return contentPane;
}
public JTextField getNombreField() {
return nombreField;
}
public JTextField getApellidoPaternoField() {
return apellidoPaternoField;
}
public JTextField getApellidoMaternoField() {
return apellidoMaternoField;
}
public JButton getGuardarButton() {
return guardarButton;
}
public JButton getVolverButton() {
return volverButton;
}
public JTextField getRutField() {
return rutField;
}
public DatePicker getFechaNacimientoPicker() {
return fechaNacimientoPicker;
}
{
// 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(12, 3, new Insets(20, 20, 20, 20), -1, -1));
final JLabel label1 = new JLabel();
label1.setText("Nombre:");
contentPane.add(label1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
nombreField = new JTextField();
contentPane.add(nombreField,
new GridConstraints(3, 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 JLabel label2 = new JLabel();
label2.setText("Apellido Paterno:");
contentPane.add(label2, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
apellidoPaternoField = new JTextField();
contentPane.add(apellidoPaternoField,
new GridConstraints(5, 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 JLabel label3 = new JLabel();
label3.setText("Apellido Materno:");
contentPane.add(label3, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
apellidoMaternoField = new JTextField();
contentPane.add(apellidoMaternoField,
new GridConstraints(7, 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(11, 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(11, 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(11, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
null, null, null, 0, false));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, new GridConstraints(10, 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));
rutField = new JTextField();
contentPane.add(rutField,
new GridConstraints(1, 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 label4 = new JLabel();
label4.setText("Rut:");
contentPane.add(label4, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label5 = new JLabel();
label5.setText("Fecha Nacimiento:");
contentPane.add(label5, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
fechaNacimientoPicker = new DatePicker();
contentPane.add(fechaNacimientoPicker,
new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPane;
}
}

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.mantenedores.cliente.ClienteSearchPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="3" column-count="2" 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="2" 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="clienteTable" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<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>
<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>
<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="2" 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>
</children>
</grid>
</form>

View File

@@ -0,0 +1,154 @@
package xyz.danielcortes.views.mantenedores.cliente;
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.Cliente;
public class ClienteSearchPanel extends BasePanel {
private JPanel contentPane;
private JTable clienteTable;
private JTextField searchField;
private JButton buscarButton;
private JButton verButton;
private JButton eliminarButton;
private JButton editarButton;
private JButton crearButton;
private BaseTableModel<Cliente> clienteModel;
public JPanel getContentPane() {
return contentPane;
}
public JTable getClienteTable() {
return clienteTable;
}
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 BaseTableModel<Cliente> getClienteModel() {
return clienteModel;
}
private void createUIComponents() {
this.createClienteTable();
}
private void createClienteTable() {
// @formatter:off
this.clienteModel= new BaseTableModel<>(
new String[]{"Rut", "Nombre", "Apellido Paterno", "Apellido Materno", "Fecha Nacimiento"},
(row, rowIndex, colIndex) -> {
switch (colIndex) {
case 0: return row.get(rowIndex).getRut();
case 1: return row.get(rowIndex).getNombre();
case 2: return row.get(rowIndex).getApellidoPaterno();
case 3: return row.get(rowIndex).getApellidoMaterno();
case 4: return row.get(rowIndex).getFechaNacimiento();
default: return null;
}
}
);
// @formatter:on
this.clienteTable = new JTable(this.clienteModel);
this.clienteTable.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(3, 2, new Insets(20, 20, 20, 20), -1, -1));
final JScrollPane scrollPane1 = new JScrollPane();
contentPane.add(scrollPane1, new GridConstraints(1, 0, 1, 2, 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(clienteTable);
searchField = new JTextField();
contentPane.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));
buscarButton = new JButton();
buscarButton.setText("Buscar");
contentPane.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));
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, 2, 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));
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPane;
}
}

View File

@@ -0,0 +1,138 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.mantenedores.cliente.ClienteUpdatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="12" 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="532" height="398"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c6a4b" class="javax.swing.JTextField" binding="nombreField">
<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="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="48e89" class="javax.swing.JLabel">
<constraints>
<grid row="4" 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="Apellido Paterno:"/>
</properties>
</component>
<component id="294b" class="javax.swing.JTextField" binding="apellidoPaternoField">
<constraints>
<grid row="5" 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>
<component id="c0a2b" class="javax.swing.JTextField" binding="apellidoMaternoField">
<constraints>
<grid row="7" 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>
<component id="a4360" class="javax.swing.JLabel">
<constraints>
<grid row="6" 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="Apellido Materno:"/>
</properties>
</component>
<vspacer id="29de9">
<constraints>
<grid row="11" 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="4e68">
<constraints>
<grid row="11" 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="1cc6d">
<constraints>
<grid row="11" 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>
<grid id="30754" 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="10" 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="125a5" 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>
<component id="482e0" class="javax.swing.JButton" binding="actualizarButton" 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="Actualizar"/>
</properties>
</component>
</children>
</grid>
<component id="c24c2" 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="Nombre:"/>
</properties>
</component>
<component id="c684" 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="Rut:"/>
</properties>
</component>
<component id="c1340" class="javax.swing.JLabel">
<constraints>
<grid row="8" 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="Fecha Nacimiento:"/>
</properties>
</component>
<component id="b319e" class="com.github.lgooddatepicker.components.DatePicker" binding="fechaNacimientoField">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="a68a1" class="javax.swing.JTextField" binding="rutField">
<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="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>

View File

@@ -0,0 +1,151 @@
package xyz.danielcortes.views.mantenedores.cliente;
import com.github.lgooddatepicker.components.DatePicker;
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 ClienteUpdatePanel extends BasePanel {
private JTextField nombreField;
private JTextField apellidoPaternoField;
private JTextField apellidoMaternoField;
private JButton actualizarButton;
private JPanel contentPane;
private JButton volverButton;
private JTextField rutField;
private DatePicker fechaNacimientoField;
public JTextField getNombreField() {
return nombreField;
}
public JTextField getApellidoPaternoField() {
return apellidoPaternoField;
}
public JTextField getApellidoMaternoField() {
return apellidoMaternoField;
}
public JButton getActualizarButton() {
return actualizarButton;
}
@Override
public JPanel getContentPane() {
return contentPane;
}
public JButton getVolverButton() {
return volverButton;
}
public JTextField getRutField() {
return rutField;
}
public DatePicker getFechaNacimientoField() {
return fechaNacimientoField;
}
{
// 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(12, 3, new Insets(20, 20, 20, 20), -1, -1));
nombreField = new JTextField();
contentPane.add(nombreField,
new GridConstraints(3, 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 JLabel label1 = new JLabel();
label1.setText("Apellido Paterno:");
contentPane.add(label1, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
apellidoPaternoField = new JTextField();
contentPane.add(apellidoPaternoField,
new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
apellidoMaternoField = new JTextField();
contentPane.add(apellidoMaternoField,
new GridConstraints(7, 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 JLabel label2 = new JLabel();
label2.setText("Apellido Materno:");
contentPane.add(label2, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final Spacer spacer1 = new Spacer();
contentPane.add(spacer1,
new GridConstraints(11, 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(11, 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(11, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
null, null, null, 0, false));
final JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, new GridConstraints(10, 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, 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));
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));
final JLabel label3 = new JLabel();
label3.setText("Nombre:");
contentPane.add(label3, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label4 = new JLabel();
label4.setText("Rut:");
contentPane.add(label4, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label5 = new JLabel();
label5.setText("Fecha Nacimiento:");
contentPane.add(label5, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
fechaNacimientoField = new DatePicker();
contentPane.add(fechaNacimientoField,
new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW,
GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false));
rutField = new JTextField();
contentPane.add(rutField,
new GridConstraints(1, 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,169 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.mantenedores.cliente.ClienteViewPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="13" 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="500" height="468"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="7a2da" 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="Nombre:"/>
</properties>
</component>
<component id="7e150" class="javax.swing.JTextField" binding="nombreField">
<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="400" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
<enabled value="true"/>
</properties>
</component>
<component id="8b4b2" class="javax.swing.JLabel">
<constraints>
<grid row="4" 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="Apellido Paterno:"/>
</properties>
</component>
<component id="7e46d" class="javax.swing.JTextField" binding="apellidoPaternoField">
<constraints>
<grid row="5" 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"/>
<enabled value="true"/>
</properties>
</component>
<component id="e4aeb" class="javax.swing.JLabel">
<constraints>
<grid row="6" 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="Apellido Materno:"/>
</properties>
</component>
<component id="67fe6" class="javax.swing.JTextField" binding="apellidoMaternoField">
<constraints>
<grid row="7" 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"/>
<enabled value="true"/>
</properties>
</component>
<vspacer id="31a4">
<constraints>
<grid row="12" 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="28129">
<constraints>
<grid row="12" 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="69f08">
<constraints>
<grid row="12" 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="7d83d" class="javax.swing.JButton" binding="volverButton" default-binding="true">
<constraints>
<grid row="11" 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>
<component id="8e275" 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="Rut:"/>
</properties>
</component>
<component id="90a52" class="javax.swing.JLabel">
<constraints>
<grid row="8" 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="Fecha Nacimiento:"/>
</properties>
</component>
<component id="b9ea8" class="javax.swing.JTextField" binding="rutField">
<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="150" height="-1"/>
</grid>
</constraints>
<properties>
<editable value="false"/>
</properties>
</component>
<grid id="21544" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="10" 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="8a01b" class="javax.swing.JButton" binding="direccionesButton" 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="Direcciones"/>
</properties>
</component>
<component id="5f09d" class="javax.swing.JButton" binding="correosButton" 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="Correos"/>
</properties>
</component>
<component id="e9b39" class="javax.swing.JButton" binding="telefonosButton" 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="Telefonos"/>
</properties>
</component>
</children>
</grid>
<component id="2c2bf" class="javax.swing.JTextField" binding="fechaNacimientoField">
<constraints>
<grid row="9" 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,177 @@
package xyz.danielcortes.views.mantenedores.cliente;
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 ClienteViewPanel extends BasePanel {
private JTextField nombreField;
private JTextField apellidoPaternoField;
private JTextField apellidoMaternoField;
private JButton volverButton;
private JPanel contentPane;
private JTextField rutField;
private JButton direccionesButton;
private JButton correosButton;
private JButton telefonosButton;
private JTextField fechaNacimientoField;
public JTextField getNombreField() {
return nombreField;
}
public JTextField getApellidoPaternoField() {
return apellidoPaternoField;
}
public JTextField getApellidoMaternoField() {
return apellidoMaternoField;
}
public JButton getVolverButton() {
return volverButton;
}
@Override
public JPanel getContentPane() {
return contentPane;
}
public JTextField getRutField() {
return rutField;
}
public JTextField getFechaNacimientoField() {
return fechaNacimientoField;
}
public JButton getDireccionesButton() {
return direccionesButton;
}
public JButton getCorreosButton() {
return correosButton;
}
public JButton getTelefonosButton() {
return telefonosButton;
}
{
// 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(13, 3, new Insets(20, 20, 20, 20), -1, -1));
final JLabel label1 = new JLabel();
label1.setText("Nombre:");
contentPane.add(label1, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
nombreField = new JTextField();
nombreField.setEditable(false);
nombreField.setEnabled(true);
contentPane.add(nombreField,
new GridConstraints(3, 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 JLabel label2 = new JLabel();
label2.setText("Apellido Paterno:");
contentPane.add(label2, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
apellidoPaternoField = new JTextField();
apellidoPaternoField.setEditable(false);
apellidoPaternoField.setEnabled(true);
contentPane.add(apellidoPaternoField,
new GridConstraints(5, 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 JLabel label3 = new JLabel();
label3.setText("Apellido Materno:");
contentPane.add(label3, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
apellidoMaternoField = new JTextField();
apellidoMaternoField.setEditable(false);
apellidoMaternoField.setEnabled(true);
contentPane.add(apellidoMaternoField,
new GridConstraints(7, 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(12, 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(12, 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(12, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1,
null, null, null, 0, false));
volverButton = new JButton();
volverButton.setText("Volver");
contentPane.add(volverButton, new GridConstraints(11, 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 label4 = new JLabel();
label4.setText("Rut:");
contentPane.add(label4, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
final JLabel label5 = new JLabel();
label5.setText("Fecha Nacimiento:");
contentPane.add(label5, new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
rutField = new JTextField();
rutField.setEditable(false);
contentPane.add(rutField,
new GridConstraints(1, 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 JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));
contentPane.add(panel1, new GridConstraints(10, 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));
direccionesButton = new JButton();
direccionesButton.setText("Direcciones");
panel1.add(direccionesButton, 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));
correosButton = new JButton();
correosButton.setText("Correos");
panel1.add(correosButton, 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));
telefonosButton = new JButton();
telefonosButton.setText("Telefonos");
panel1.add(telefonosButton, 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));
fechaNacimientoField = new JTextField();
contentPane.add(fechaNacimientoField,
new GridConstraints(9, 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;
}
}