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

18
.idea/saveactions_settings.xml generated Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SaveActionSettings">
<option name="actions">
<set>
<option value="activate" />
<option value="activateOnBatch" />
<option value="noActionIfCompileErrors" />
<option value="organizeImports" />
<option value="reformat" />
<option value="unqualifiedFieldAccess" />
<option value="unqualifiedMethodAccess" />
<option value="missingOverrideAnnotation" />
</set>
</option>
<option name="configurationPath" value="" />
</component>
</project>

6
.idea/sqldialects.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/script.sql" dialect="MySQL" />
</component>
</project>

View File

@@ -366,82 +366,3 @@ create table usuario
foreign key (trabajador_id) references trabajador (id) on delete cascade on update cascade, foreign key (trabajador_id) references trabajador (id) on delete cascade on update cascade,
inserted_at timestamp default current_timestamp inserted_at timestamp default current_timestamp
); );
#--------------------------------------------------------------------------------#
#------------------------Poblar con datos iniciales------------------------------#
#--------------------------------------------------------------------------------#
insert into estado (nombre)
values ('Vendido'),
('Arrendado'),
('Disponible');
insert into idioma (nombre)
values ('Español'),
('Ingles'),
('Portuges'),
('Aleman'),
('Ruso'),
('Japones');
insert into editorial (nombre)
values ('Editorial N1'),
('Editorial N2'),
('Editorial N3');
insert into categoria (nombre)
values ('Terror'),
('Aventura'),
('Fantasia');
insert into autor(nombre, apellido_paterno, apellido_materno)
values ('Howard Philips', 'Lovecraft', NULL),
('Stephen', 'King', NULL),
('Brandon', 'Sanderson', NULL);
insert into libro (editorial_id, isbn, ano_publicacion, numero_paginas, titulo, precio_referencia)
values (1, '0-765-31178-X', 2006, 541, 'Mistborn: The Final Empire', 10000),
(1, '0-765-31688-9', 2007, 590, 'Mistborn: The Well of Ascension', 10000),
(1, '978-0-7653-1689-9', 2008, 572, 'Mistborn: The Hero of Ages', 10000),
(2, '1231231231232', 1931, 100, 'The Shadow over Innsmouth', 10000),
(2, '1231231231232', 1933, 100, 'The Dreams in the Witch House', 10000),
(2, '1231231231232', 1936, 100, 'At the Mountains of Madness', 10000),
(3, '0385086954', 1974, 199, 'Carrie', 10000),
(3, '978-0-670-26077-5', 1979, 428, 'The Dead Zone', 10000),
(3, '0-670-81302-8', 1986, 1138, 'It', 10000);
insert into libro_autor(libro_id, autor_id)
values (1, 3),
(2, 3),
(3, 3),
(4, 1),
(5, 1),
(6, 1),
(7, 2),
(8, 2),
(9, 2);
insert into libro_categoria(libro_id, categoria_id)
values (1, 3),
(2, 3),
(3, 3),
(4, 1),
(5, 1),
(6, 1),
(7, 1),
(8, 1),
(9, 1);
insert into libro_idioma(libro_id, idioma_id)
values (1, 2),
(2, 2),
(3, 2),
(4, 2),
(5, 2),
(6, 2),
(7, 2),
(8, 2),
(9, 2);
INSERT INTO trabajador
VALUES (1, '197638990', 'Daniel', 'Cortes', 'Pincheira', '2019-06-04', '2019-06-04 18:12:55');

354
data.sql Normal file
View File

@@ -0,0 +1,354 @@
-- MySQL dump 10.17 Distrib 10.3.15-MariaDB, for Linux (x86_64)
--
-- Host: localhost Database: biblioteca
-- ------------------------------------------------------
-- Server version 10.3.15-MariaDB
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Dumping data for table `arriendo`
--
LOCK TABLES `arriendo` WRITE;
/*!40000 ALTER TABLE `arriendo` DISABLE KEYS */;
/*!40000 ALTER TABLE `arriendo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `autor`
--
LOCK TABLES `autor` WRITE;
/*!40000 ALTER TABLE `autor` DISABLE KEYS */;
INSERT INTO `autor` VALUES (1,'Howard Philips','Lovecraft',NULL,'2019-06-12 16:18:57'),(2,'Stephen','King',NULL,'2019-06-12 16:18:57'),(3,'Brandon','Sanderson',NULL,'2019-06-12 16:18:57');
/*!40000 ALTER TABLE `autor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `boleta`
--
LOCK TABLES `boleta` WRITE;
/*!40000 ALTER TABLE `boleta` DISABLE KEYS */;
/*!40000 ALTER TABLE `boleta` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `categoria`
--
LOCK TABLES `categoria` WRITE;
/*!40000 ALTER TABLE `categoria` DISABLE KEYS */;
INSERT INTO `categoria` VALUES (1,'Terror','2019-06-12 16:18:57'),(2,'Aventura','2019-06-12 16:18:57'),(3,'Fantasia','2019-06-12 16:18:57');
/*!40000 ALTER TABLE `categoria` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `cliente`
--
LOCK TABLES `cliente` WRITE;
/*!40000 ALTER TABLE `cliente` DISABLE KEYS */;
INSERT INTO `cliente` VALUES (1,'21786653-7','Cliente','1','1','2019-06-17','2019-06-13 16:01:33'),(2,'17181388-3','Cliente','2','2','2019-06-13','2019-06-13 16:04:02');
/*!40000 ALTER TABLE `cliente` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `cliente_correo`
--
LOCK TABLES `cliente_correo` WRITE;
/*!40000 ALTER TABLE `cliente_correo` DISABLE KEYS */;
/*!40000 ALTER TABLE `cliente_correo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `cliente_direccion`
--
LOCK TABLES `cliente_direccion` WRITE;
/*!40000 ALTER TABLE `cliente_direccion` DISABLE KEYS */;
/*!40000 ALTER TABLE `cliente_direccion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `cliente_telefono`
--
LOCK TABLES `cliente_telefono` WRITE;
/*!40000 ALTER TABLE `cliente_telefono` DISABLE KEYS */;
/*!40000 ALTER TABLE `cliente_telefono` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `compra`
--
LOCK TABLES `compra` WRITE;
/*!40000 ALTER TABLE `compra` DISABLE KEYS */;
/*!40000 ALTER TABLE `compra` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `correo`
--
LOCK TABLES `correo` WRITE;
/*!40000 ALTER TABLE `correo` DISABLE KEYS */;
/*!40000 ALTER TABLE `correo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `direccion`
--
LOCK TABLES `direccion` WRITE;
/*!40000 ALTER TABLE `direccion` DISABLE KEYS */;
/*!40000 ALTER TABLE `direccion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `distribuidor`
--
LOCK TABLES `distribuidor` WRITE;
/*!40000 ALTER TABLE `distribuidor` DISABLE KEYS */;
INSERT INTO `distribuidor` VALUES (2,1,'19763899-0','2019-06-13 03:08:17'),(3,2,'19763899-0','2019-06-13 03:08:23'),(4,1,'19763899-0','2019-06-13 03:08:25'),(5,1,'19763899-0','2019-06-13 03:08:27');
/*!40000 ALTER TABLE `distribuidor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `distribuidor_correo`
--
LOCK TABLES `distribuidor_correo` WRITE;
/*!40000 ALTER TABLE `distribuidor_correo` DISABLE KEYS */;
/*!40000 ALTER TABLE `distribuidor_correo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `distribuidor_direccion`
--
LOCK TABLES `distribuidor_direccion` WRITE;
/*!40000 ALTER TABLE `distribuidor_direccion` DISABLE KEYS */;
/*!40000 ALTER TABLE `distribuidor_direccion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `distribuidor_telefono`
--
LOCK TABLES `distribuidor_telefono` WRITE;
/*!40000 ALTER TABLE `distribuidor_telefono` DISABLE KEYS */;
/*!40000 ALTER TABLE `distribuidor_telefono` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `editorial`
--
LOCK TABLES `editorial` WRITE;
/*!40000 ALTER TABLE `editorial` DISABLE KEYS */;
INSERT INTO `editorial` VALUES (1,'Editorial N1','2019-06-12 16:18:57'),(2,'Editorial N2','2019-06-12 16:18:57'),(3,'Editorial N3','2019-06-12 16:18:57');
/*!40000 ALTER TABLE `editorial` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `ejemplar`
--
LOCK TABLES `ejemplar` WRITE;
/*!40000 ALTER TABLE `ejemplar` DISABLE KEYS */;
/*!40000 ALTER TABLE `ejemplar` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `empresa`
--
LOCK TABLES `empresa` WRITE;
/*!40000 ALTER TABLE `empresa` DISABLE KEYS */;
INSERT INTO `empresa` VALUES (1,'Empresa 1','2019-06-13 00:39:50'),(2,'Empresa 2','2019-06-13 00:39:52');
/*!40000 ALTER TABLE `empresa` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `estado`
--
LOCK TABLES `estado` WRITE;
/*!40000 ALTER TABLE `estado` DISABLE KEYS */;
INSERT INTO `estado` VALUES (1,'Vendido','2019-06-12 16:18:57'),(2,'Arrendado','2019-06-12 16:18:57'),(3,'Disponible','2019-06-12 16:18:57');
/*!40000 ALTER TABLE `estado` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `factura`
--
LOCK TABLES `factura` WRITE;
/*!40000 ALTER TABLE `factura` DISABLE KEYS */;
/*!40000 ALTER TABLE `factura` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `idioma`
--
LOCK TABLES `idioma` WRITE;
/*!40000 ALTER TABLE `idioma` DISABLE KEYS */;
INSERT INTO `idioma` VALUES (1,'Español','2019-06-12 16:18:57'),(2,'Ingles','2019-06-12 16:18:57'),(3,'Portuges','2019-06-12 16:18:57'),(4,'Aleman','2019-06-12 16:18:57'),(5,'Ruso','2019-06-12 16:18:57'),(6,'Japones','2019-06-12 16:18:57');
/*!40000 ALTER TABLE `idioma` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro`
--
LOCK TABLES `libro` WRITE;
/*!40000 ALTER TABLE `libro` DISABLE KEYS */;
INSERT INTO `libro` VALUES (1,1,'0-765-31178-X',2006,541,'Mistborn: The Final Empire',10000,'2019-06-12 16:18:57'),(2,1,'0-765-31688-9',2007,590,'Mistborn: The Well of Ascension',10000,'2019-06-12 16:18:57'),(3,1,'978-0-7653-1689-9',2008,572,'Mistborn: The Hero of Ages',10000,'2019-06-12 16:18:57'),(4,2,'1231231231232',1931,100,'The Shadow over Innsmouth',10000,'2019-06-12 16:18:57'),(5,2,'1231231231232',1933,100,'The Dreams in the Witch House',10000,'2019-06-12 16:18:57'),(6,2,'1231231231232',1936,100,'At the Mountains of Madness',10000,'2019-06-12 16:18:57'),(7,3,'0385086954',1974,199,'Carrie',10000,'2019-06-12 16:18:57'),(8,3,'978-0-670-26077-5',1979,428,'The Dead Zone',10000,'2019-06-12 16:18:57'),(9,3,'0-670-81302-8',1986,1138,'It',10000,'2019-06-12 16:18:57');
/*!40000 ALTER TABLE `libro` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_arriendo`
--
LOCK TABLES `libro_arriendo` WRITE;
/*!40000 ALTER TABLE `libro_arriendo` DISABLE KEYS */;
/*!40000 ALTER TABLE `libro_arriendo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_autor`
--
LOCK TABLES `libro_autor` WRITE;
/*!40000 ALTER TABLE `libro_autor` DISABLE KEYS */;
INSERT INTO `libro_autor` VALUES (1,3),(2,3),(3,3),(4,1),(5,1),(6,1),(7,2),(8,2),(9,2);
/*!40000 ALTER TABLE `libro_autor` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_categoria`
--
LOCK TABLES `libro_categoria` WRITE;
/*!40000 ALTER TABLE `libro_categoria` DISABLE KEYS */;
INSERT INTO `libro_categoria` VALUES (1,3),(2,3),(3,3),(4,1),(5,1),(6,1),(7,1),(8,1),(9,1);
/*!40000 ALTER TABLE `libro_categoria` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_compra`
--
LOCK TABLES `libro_compra` WRITE;
/*!40000 ALTER TABLE `libro_compra` DISABLE KEYS */;
/*!40000 ALTER TABLE `libro_compra` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_idioma`
--
LOCK TABLES `libro_idioma` WRITE;
/*!40000 ALTER TABLE `libro_idioma` DISABLE KEYS */;
INSERT INTO `libro_idioma` VALUES (1,2),(2,2),(3,2),(4,2),(5,2),(6,2),(7,2),(8,2),(9,2);
/*!40000 ALTER TABLE `libro_idioma` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `libro_venta`
--
LOCK TABLES `libro_venta` WRITE;
/*!40000 ALTER TABLE `libro_venta` DISABLE KEYS */;
/*!40000 ALTER TABLE `libro_venta` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `telefono`
--
LOCK TABLES `telefono` WRITE;
/*!40000 ALTER TABLE `telefono` DISABLE KEYS */;
/*!40000 ALTER TABLE `telefono` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `trabajador`
--
LOCK TABLES `trabajador` WRITE;
/*!40000 ALTER TABLE `trabajador` DISABLE KEYS */;
INSERT INTO `trabajador` VALUES (2,'19763899-0','Daniel','Cortes','Pincheira','2019-06-13','2019-06-13 16:04:42'),(3,'10768789-0','Trabajador','N','2','2019-06-13','2019-06-13 16:05:17'),(4,'9717478-4','Trabajador','N','3','2019-06-13','2019-06-13 16:05:27');
/*!40000 ALTER TABLE `trabajador` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `trabajador_correo`
--
LOCK TABLES `trabajador_correo` WRITE;
/*!40000 ALTER TABLE `trabajador_correo` DISABLE KEYS */;
/*!40000 ALTER TABLE `trabajador_correo` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `trabajador_direccion`
--
LOCK TABLES `trabajador_direccion` WRITE;
/*!40000 ALTER TABLE `trabajador_direccion` DISABLE KEYS */;
/*!40000 ALTER TABLE `trabajador_direccion` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `trabajador_telefono`
--
LOCK TABLES `trabajador_telefono` WRITE;
/*!40000 ALTER TABLE `trabajador_telefono` DISABLE KEYS */;
/*!40000 ALTER TABLE `trabajador_telefono` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `usuario`
--
LOCK TABLES `usuario` WRITE;
/*!40000 ALTER TABLE `usuario` DISABLE KEYS */;
INSERT INTO `usuario` VALUES (2,'admin',0x243168097E0BA82B896F348BABCEB600A8DCA30488C6F238F97FD8737BD00B27,0x3564ECCCD85CF0583F9C090602E998B7,2,'2019-06-13 16:04:53');
/*!40000 ALTER TABLE `usuario` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Dumping data for table `venta`
--
LOCK TABLES `venta` WRITE;
/*!40000 ALTER TABLE `venta` DISABLE KEYS */;
/*!40000 ALTER TABLE `venta` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2019-06-13 12:10:44

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.CategoriaSearchController;
import xyz.danielcortes.controllers.mantenedores.categoria.CategoriaUpdateController; import xyz.danielcortes.controllers.mantenedores.categoria.CategoriaUpdateController;
import xyz.danielcortes.controllers.mantenedores.categoria.CategoriaViewController; 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.DistribuidorCreateController;
import xyz.danielcortes.controllers.mantenedores.distribuidor.DistribuidorSearchController; import xyz.danielcortes.controllers.mantenedores.distribuidor.DistribuidorSearchController;
import xyz.danielcortes.controllers.mantenedores.distribuidor.DistribuidorUpdateController; 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.CategoriaSearchPanel;
import xyz.danielcortes.views.mantenedores.categoria.CategoriaUpdatePanel; import xyz.danielcortes.views.mantenedores.categoria.CategoriaUpdatePanel;
import xyz.danielcortes.views.mantenedores.categoria.CategoriaViewPanel; 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.CorreoCreatePanel;
import xyz.danielcortes.views.mantenedores.correo.CorreoSearchPanel; import xyz.danielcortes.views.mantenedores.correo.CorreoSearchPanel;
import xyz.danielcortes.views.mantenedores.correo.CorreoUpdatePanel; import xyz.danielcortes.views.mantenedores.correo.CorreoUpdatePanel;
@@ -117,7 +125,7 @@ public class LaunchController {
} }
private void create() { private void create() {
frame = new LaunchFrame(); this.frame = new LaunchFrame();
this.createCards(); this.createCards();
this.createMenuBar(); 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_CREATE, new DistribuidorCreateController(new DistribuidorCreatePanel(), this));
this.controllers.put(PanelName.DISTRIBUIDOR_UPDATE, new DistribuidorUpdateController(new DistribuidorUpdatePanel(), 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_VIEW, new EmpresaViewController(new EmpresaViewPanel(), this));
this.controllers.put(PanelName.EMPRESA_SEARCH, new EmpresaSearchController(new EmpresaSearchPanel(), this)); this.controllers.put(PanelName.EMPRESA_SEARCH, new EmpresaSearchController(new EmpresaSearchPanel(), this));
this.controllers.put(PanelName.EMPRESA_CREATE, new EmpresaCreateController(new EmpresaCreatePanel(), this)); this.controllers.put(PanelName.EMPRESA_CREATE, new EmpresaCreateController(new EmpresaCreatePanel(), this));
@@ -194,8 +207,8 @@ public class LaunchController {
private void createMenuBar() { private void createMenuBar() {
JMenuBar menuBar = new JMenuBar(); JMenuBar menuBar = new JMenuBar();
menuBar.add(createMantenedoresMenu()); menuBar.add(this.createMantenedoresMenu());
menuBar.add(createComprarMenu()); menuBar.add(this.createComprarMenu());
this.frame.setJMenuBar(menuBar); this.frame.setJMenuBar(menuBar);
} }
@@ -211,6 +224,7 @@ public class LaunchController {
JMenuItem trabajadoresItem = new JMenuItem("Trabajadores"); JMenuItem trabajadoresItem = new JMenuItem("Trabajadores");
JMenuItem empresasItem = new JMenuItem("Empresas"); JMenuItem empresasItem = new JMenuItem("Empresas");
JMenuItem distribuidoresItem = new JMenuItem("Distribuidores"); JMenuItem distribuidoresItem = new JMenuItem("Distribuidores");
JMenuItem clientesItem = new JMenuItem("Clientes");
autoresItem.addActionListener(e -> this.showCard(PanelName.AUTOR_SEARCH)); autoresItem.addActionListener(e -> this.showCard(PanelName.AUTOR_SEARCH));
idiomasItem.addActionListener(e -> this.showCard(PanelName.IDIOMA_SEARCH)); idiomasItem.addActionListener(e -> this.showCard(PanelName.IDIOMA_SEARCH));
@@ -218,8 +232,9 @@ public class LaunchController {
categoriasItem.addActionListener(e -> this.showCard(PanelName.CATEGORIA_SEARCH)); categoriasItem.addActionListener(e -> this.showCard(PanelName.CATEGORIA_SEARCH));
editorialesItem.addActionListener(e -> this.showCard(PanelName.EDITORIAL_SEARCH)); editorialesItem.addActionListener(e -> this.showCard(PanelName.EDITORIAL_SEARCH));
trabajadoresItem.addActionListener(e -> this.showCard(PanelName.TRABAJADOR_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)); 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(autoresItem);
@@ -227,8 +242,9 @@ public class LaunchController {
mantenedoresMenu.add(categoriasItem); mantenedoresMenu.add(categoriasItem);
mantenedoresMenu.add(editorialesItem); mantenedoresMenu.add(editorialesItem);
mantenedoresMenu.add(trabajadoresItem); mantenedoresMenu.add(trabajadoresItem);
mantenedoresMenu.add(empresasItem);
mantenedoresMenu.add(distribuidoresItem); mantenedoresMenu.add(distribuidoresItem);
mantenedoresMenu.add(clientesItem);
mantenedoresMenu.add(empresasItem);
return mantenedoresMenu; 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 @Override
public BasePanel getView() { public BasePanel getView() {
return view; return this.view;
} }
public void setTrabajador(Trabajador trabajador) { public void setTrabajador(Trabajador trabajador) {
@@ -60,7 +60,7 @@ public class CorreoSearchController extends BaseController {
private void create() { private void create() {
CorreoCreateController controller = (CorreoCreateController) this.getParentController().getCard(PanelName.CORREO_CREATE); CorreoCreateController controller = (CorreoCreateController) this.getParentController().getCard(PanelName.CORREO_CREATE);
controller.setTrabajador(trabajador); controller.setTrabajador(this.trabajador);
this.getParentController().showCard(PanelName.CORREO_CREATE); this.getParentController().showCard(PanelName.CORREO_CREATE);
} }
@@ -68,14 +68,14 @@ public class CorreoSearchController extends BaseController {
Correo correo = this.getSelectedCorreo(); Correo correo = this.getSelectedCorreo();
if (correo != null) { if (correo != null) {
CorreoUpdateController controller = (CorreoUpdateController) this.getParentController().getCard(PanelName.CORREO_UPDATE); CorreoUpdateController controller = (CorreoUpdateController) this.getParentController().getCard(PanelName.CORREO_UPDATE);
controller.setTrabajador(trabajador); controller.setTrabajador(this.trabajador);
controller.setCorreo(correo); controller.setCorreo(correo);
this.getParentController().showCard(PanelName.CORREO_UPDATE); this.getParentController().showCard(PanelName.CORREO_UPDATE);
} }
} }
private void delete() { private void delete() {
Correo correo = this.getSelectedCorreo(); Correo correo = this.getSelecztedCorreo();
if (correo == null) if (correo == null)
return; return;
@@ -99,14 +99,14 @@ public class CorreoSearchController extends BaseController {
if (correo != null) { if (correo != null) {
CorreoViewController controller = (CorreoViewController) this.getParentController().getCard(PanelName.CORREO_VIEW); CorreoViewController controller = (CorreoViewController) this.getParentController().getCard(PanelName.CORREO_VIEW);
controller.setCorreo(correo); controller.setCorreo(correo);
controller.setTrabajador(trabajador); controller.setTrabajador(this.trabajador);
this.getParentController().showCard(PanelName.CORREO_VIEW); this.getParentController().showCard(PanelName.CORREO_VIEW);
} }
} }
private void search() { private void search() {
String term = this.view.getSearchField().getText(); 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); this.loadCorreosTable(correo);
} }
@@ -118,7 +118,7 @@ public class CorreoSearchController extends BaseController {
private void loadCorreosTable() { private void loadCorreosTable() {
List<Correo> correos = this.trabajador.getCorreos(); List<Correo> correos = this.trabajador.getCorreos();
loadCorreosTable(correos); this.loadCorreosTable(correos);
} }
private void loadCorreosTable(List<Correo> correos) { private void loadCorreosTable(List<Correo> correos) {

View File

@@ -43,6 +43,11 @@ public enum PanelName {
DISTRIBUIDOR_CREATE, DISTRIBUIDOR_CREATE,
DISTRIBUIDOR_UPDATE, DISTRIBUIDOR_UPDATE,
CLIENTE_VIEW,
CLIENTE_SEARCH,
CLIENTE_CREATE,
CLIENTE_UPDATE,
USUARIO_VIEW, USUARIO_VIEW,
USUARIO_CREATE, USUARIO_CREATE,
USUARIO_UPDATE, 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; 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() { public Integer getId() {
return id; return id;
} }
@@ -78,20 +86,13 @@ public class Correo {
this.distribuidores = distribuidores; this.distribuidores = distribuidores;
} }
@Override public List<Cliente> getClientes() {
public boolean equals(Object o) { if (clientes == null)
if (this == o) clientes = new ArrayList<>();
return true; return clientes;
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);
} }
@Override public void setClientes(List<Cliente> clientes) {
public int hashCode() { this.clientes = clientes;
return Objects.hash(id, correo, trabajadores);
} }
} }

View File

@@ -2,7 +2,6 @@ package xyz.danielcortes.models;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@@ -44,6 +43,14 @@ public class Direccion {
) )
private List<Distribuidor> distribuidores; 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() { public Integer getId() {
return id; return id;
} }
@@ -89,21 +96,13 @@ public class Direccion {
this.distribuidores = distribuidores; this.distribuidores = distribuidores;
} }
@Override public List<Cliente> getClientes() {
public boolean equals(Object o) { if (clientes == null)
if (this == o) clientes = new ArrayList<>();
return true; return clientes;
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 void setClientes(List<Cliente> clientes) {
public int hashCode() { this.clientes = clientes;
return Objects.hash(id, calle, numero, trabajadores);
} }
} }

View File

@@ -2,7 +2,6 @@ package xyz.danielcortes.models;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
@@ -16,6 +15,7 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "telefono") @Table(name = "telefono")
public class Telefono { public class Telefono {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", nullable = false) @Column(name = "id", nullable = false)
@@ -40,6 +40,14 @@ public class Telefono {
) )
private List<Distribuidor> distribuidores; 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() { public Integer getId() {
return id; return id;
} }
@@ -77,20 +85,13 @@ public class Telefono {
this.distribuidores = distribuidores; this.distribuidores = distribuidores;
} }
@Override public List<Cliente> getClientes() {
public boolean equals(Object o) { if(clientes == null)
if (this == o) clientes = new ArrayList<>();
return true; return clientes;
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);
} }
@Override public void setClientes(List<Cliente> clientes) {
public int hashCode() { this.clientes = clientes;
return Objects.hash(id, numero, trabajadores);
} }
} }

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; import xyz.danielcortes.framework.PanelName;
public class LaunchFrame extends JFrame { public class LaunchFrame extends JFrame {
private Dimension dimension; private Dimension dimension;
public LaunchFrame() { 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;
}
}