diff --git a/.gitignore b/.gitignore index d3c4eb8..2035d0f 100644 --- a/.gitignore +++ b/.gitignore @@ -87,3 +87,4 @@ fabric.properties # Visual paradigm thing *.bak* +*.lck diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml new file mode 100644 index 0000000..b9d18bf --- /dev/null +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..005b9eb --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml new file mode 100644 index 0000000..f907235 --- /dev/null +++ b/.idea/dataSources.xml @@ -0,0 +1,19 @@ + + + + + mysql + true + com.mysql.jdbc.Driver + jdbc:mysql://localhost:3306/biblioteca_manual + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e79da7e --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..5d68b46 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,11 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..d24ea8e --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..acd496b --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/biblioteca.iml b/biblioteca.iml new file mode 100644 index 0000000..a1f199a --- /dev/null +++ b/biblioteca.iml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/biblioteca.vpp b/biblioteca.vpp new file mode 100644 index 0000000..a756ad3 Binary files /dev/null and b/biblioteca.vpp differ diff --git a/info.md b/info.md new file mode 100644 index 0000000..70869ea --- /dev/null +++ b/info.md @@ -0,0 +1,123 @@ +#Libros +## Datos +- Número de serie +- ISBN +- Título +- Número de páginas +- Precio de referencia +- Año de publicación +- Idiomas +- Autores +- Categorías +- Editorial. + +## Información +- Un libro podrá tener el mismo ISBN que otro libro, pero distinto número de serie. +- Un libro puede ser escrito por uno o más autores +- Un libro puede tener una o más categorías +- Un libro puede tener uno o más idiomas +- Un libro debe tener asociada solo una editorial. +- El libro mantendrá un estado en la base de datos: vendido, arrendado o disponible. +- De los autores solo se necesita conocer su nombre, apellido paterno y apellido materno. +- De la editorial solo se debe almacenar el nombre. + +#Distribuidores: + +## Datos +- Rut +- nombre de empresa +- dirección +- teléfono +- año desde que vende libros a la biblioteca. + + + +# Clientes: + +## Datos +- Rut +- Nombre +- Apellido paterno +- Apellido materno +- Direcciones +- Teléfonos +- Correos electrónicos +- Fecha nacimiento. + +## Información +- Un cliente puede tener uno o mas direcciones +- Un cliente puede tener uno o mas teléfonos +- Un cliente puede tener uno o mas correos + +# Trabajadores + +## Datos +- Rut +- Nombre +- Apellido paterno +- Apellido materno +- Direcciones +- Teléfonos +- Correos electrónicos +- Fecha de contrato laboral. + +## Información +- Un trabajador puede tener una o más direcciones +- Un trabajador puede tener uno o más teléfonos +- Un trabajador puede tener uno o más correos + + + +# Compras + +## Datos +- Libros comprados +- distribuidor involucrado +- Factura. + +# Factura + +## Datos +- Folio +- Precio neto +- Precio con IVA +- Costo IVA +- Fecha de compra +- Hora de compra +- Distribuidor involucrado +- Método de pago. + + +# Ventas + +## Datos +- Libros vendidos +- Cliente involucrado +- Trabajador involucrado +- Boleta. + + +# Boleta + +## Datos +- Folio +- Precio neto +- Precio con IVA +- Costo IVA +- Fecha de venta +- Hora de venta +- Cliente involucrado +- Trabajador involucrado +- Método de pago. + +#Arriendos: +- Libros arrendados +- Costo total +- Fecha de arriendo +- Fecha de devolución estimada +- Fecha de entrega real +- Días de retraso +- Multa +- Costo de arriendo +- Cliente involucrado +- Trabajador involucrado. diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..ed3b8d9 --- /dev/null +++ b/pom.xml @@ -0,0 +1,77 @@ + + + + 4.0.0 + + xyz.danielcortes + biblioteca + 1 + + biblioteca + + + + junit + junit + 4.11 + test + + + org.hibernate + hibernate-core + 5.4.2.Final + + + org.hibernate + hibernate-entitymanager + 5.4.2.Final + + + mysql + mysql-connector-java + 8.0.15 + + + com.intellij + forms_rt + 7.0.3 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.0 + + 11 + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.1.1 + + ${project.build.directory}/lib + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.1 + + + + true + xyz.danielcortes.App + lib/ + + + + + + + diff --git a/script.sql b/script.sql new file mode 100644 index 0000000..cd4e236 --- /dev/null +++ b/script.sql @@ -0,0 +1,312 @@ +#--------------------------------------------------------------------------------# +#-----------------------------Eliminar todas las tablas--------------------------# +#--------------------------------------------------------------------------------# +set foreign_key_checks = 0; +drop table if exists libro_arriendo; +drop table if exists libro_venta; +drop table if exists libro_compra; +drop table if exists arriendo; +drop table if exists venta; +drop table if exists compra; +drop table if exists boleta; +drop table if exists factura; +drop table if exists trabajador_telefono; +drop table if exists trabajador_direccion; +drop table if exists cliente_telefono; +drop table if exists cliente_direccion; +drop table if exists distribuidor_telefono; +drop table if exists distribuidor_direccion; +drop table if exists trabajador; +drop table if exists cliente; +drop table if exists distribuidor; +drop table if exists empresa; +drop table if exists telefono; +drop table if exists direccion; +drop table if exists libro_idioma; +drop table if exists libro_categoria; +drop table if exists libro_autor; +drop table if exists libro; +drop table if exists editorial; +drop table if exists idioma; +drop table if exists categoria; +drop table if exists autor; +drop table if exists estado; +set foreign_key_checks = 1; + + +#--------------------------------------------------------------------------------# +#--------------Definicion de las tablas relacionadas a los libros----------------# +#--------------------------------------------------------------------------------# +create table editorial +( + id int unsigned primary key auto_increment, + nombre varchar(255) not null +); + +create table estado +( + id int unsigned primary key auto_increment, + nombre varchar(255) not null +); + +create table autor +( + id int unsigned primary key auto_increment, + nombre varchar(255) not null, + apellido_paterno varchar(255) not null, + apellido_materno varchar(255) not null +); + +create table categoria +( + id int unsigned primary key auto_increment, + nombre varchar(255) not null +); + +create table idioma +( + id int unsigned primary key auto_increment, + nombre varchar(255) not null +); + +create table libro +( + id int unsigned primary key auto_increment, + serie varchar(255) unique not null, + isbn varchar(255) not null, + titulo varchar(255) default null, + numero_paginas int not null, + precio_referencia int not null, + ano_publicacion int default null, + editorial_id int unsigned not null, + estado_id int unsigned default 1, + foreign key (editorial_id) references editorial (id) on delete restrict on update cascade, + foreign key (estado_id) references estado (id) on delete restrict on update cascade +); + +create table libro_autor +( + libro_id int unsigned not null, + autor_id int unsigned not null, + foreign key (libro_id) references libro (id) on delete restrict on update cascade, + foreign key (autor_id) references autor (id) on delete restrict on update cascade +); + +create table libro_categoria +( + libro_id int unsigned not null, + categoria_id int unsigned not null, + foreign key (libro_id) references libro (id) on delete restrict on update cascade, + foreign key (categoria_id) references categoria (id) on delete restrict on update cascade +); + +create table libro_idioma +( + libro_id int unsigned not null, + idioma_id int unsigned not null, + foreign key (libro_id) references libro (id) on delete restrict on update cascade, + foreign key (idioma_id) references idioma (id) on delete restrict on update cascade +); + + +#--------------------------------------------------------------------------------# +#------------Definicion de las tablas relacionadas a las personas----------------# +#--------------------------------------------------------------------------------# +create table direccion +( + id int unsigned primary key auto_increment, + calle varchar(255) not null, + numero varchar(255) not null +); + +create table telefono +( + id int unsigned primary key auto_increment, + numero varchar(255) not null +); + +create table empresa +( + id int unsigned primary key auto_increment, + nombre varchar(255) not null +); + +create table distribuidor +( + id int unsigned primary key auto_increment, + rut varchar(255) not null, + empresa_id int unsigned not null, + foreign key (empresa_id) references empresa (id) on delete restrict on update cascade +); + +create table cliente +( + id int unsigned primary key auto_increment, + rut varchar(255) not null, + nombre varchar(255) not null, + apellido_paterno varchar(255) not null, + apellido_materno varchar(255) not null, + fecha_nacimiento date not null +); + +create table trabajador +( + id int unsigned primary key auto_increment, + rut varchar(255) not null, + nombre varchar(255) not null, + apellido_paterno varchar(255) not null, + apellido_materno varchar(255) not null, + fecha_contrato date not null +); + +create table distribuidor_direccion +( + distribuidor_id int unsigned, + direccion_id int unsigned, + foreign key (distribuidor_id) references distribuidor (id) on delete restrict on update cascade, + foreign key (direccion_id) references direccion (id) on delete restrict on update cascade +); + +create table distribuidor_telefono +( + distribuidor_id int unsigned, + telefono_id int unsigned, + foreign key (distribuidor_id) references distribuidor (id) on delete restrict on update cascade, + foreign key (telefono_id) references telefono (id) on delete restrict on update cascade +); + +create table cliente_direccion +( + cliente_id int unsigned, + direccion_id int unsigned, + foreign key (cliente_id) references cliente (id) on delete restrict on update cascade, + foreign key (direccion_id) references direccion (id) on delete restrict on update cascade +); + +create table cliente_telefono +( + cliente_id int unsigned, + telefono_id int unsigned, + foreign key (cliente_id) references cliente (id) on delete restrict on update cascade, + foreign key (telefono_id) references telefono (id) on delete restrict on update cascade +); + +create table trabajador_direccion +( + trabajador_id int unsigned, + direccion_id int unsigned, + foreign key (trabajador_id) references trabajador (id) on delete restrict on update cascade, + foreign key (direccion_id) references direccion (id) on delete restrict on update cascade +); + +create table trabajador_telefono +( + trabajador_id int unsigned, + telefono_id int unsigned, + foreign key (trabajador_id) references trabajador (id) on delete restrict on update cascade, + foreign key (telefono_id) references telefono (id) on delete restrict on update cascade +); + +#--------------------------------------------------------------------------------# +#-------Definicion de las tablas relacionadas a la venta/compra/arriendo---------# +#--------------------------------------------------------------------------------# + +create table factura +( + id int unsigned primary key auto_increment, + folio varchar(255) not null, + precio_neto int not null, + precio_iva int not null, + costo_iva int not null, + fecha_compra datetime not null +); + +create table boleta +( + id int unsigned primary key auto_increment, + folio varchar(255) not null, + precio_neto int not null, + precio_iva int not null, + costo_iva int not null, + fecha_venta datetime not null +); + +create table compra +( + id int unsigned primary key auto_increment, + factura_id int unsigned not null, + distribuidor_id int unsigned not null, + foreign key (factura_id) references factura (id) on delete restrict on update cascade, + foreign key (distribuidor_id) references distribuidor (id) on delete restrict on update cascade +); + +create table venta +( + id int unsigned primary key auto_increment, + cliente_id int unsigned not null, + trabajador_id int unsigned not null, + boleta_id int unsigned not null, + foreign key (cliente_id) references cliente (id) on delete restrict on update cascade, + foreign key (trabajador_id) references trabajador (id) on delete restrict on update cascade, + foreign key (boleta_id) references boleta (id) on delete restrict on update cascade +); + +create table arriendo +( + id int unsigned primary key auto_increment, + costo_arriendo int not null, + multa int, + costo_total int, + fecha_arriendo date not null, + fecha_devolucion_estimada date not null, + fecha_devolucion_real date, + trabajador_id int unsigned not null, + cliente_id int unsigned not null +); + +create table libro_compra +( + libro_id int unsigned, + compra_id int unsigned, + foreign key (libro_id) references libro (id) on delete restrict on update cascade, + foreign key (compra_id) references compra (id) on delete restrict on update cascade +); + +create table libro_venta +( + libro_id int unsigned, + venta_id int unsigned, + foreign key (libro_id) references libro (id) on delete restrict on update cascade, + foreign key (venta_id) references venta (id) on delete restrict on update cascade +); + +create table libro_arriendo +( + libro_id int unsigned, + arriendo_id int unsigned, + foreign key (libro_id) references libro (id) on delete restrict on update cascade, + foreign key (arriendo_id) references arriendo (id) on delete restrict on update cascade +); + +#--------------------------------------------------------------------------------# +#------------------------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 ('The Pragmatic Bookshelf'), + ('O\'Reilly Media'), + ('Manning Publications'); + diff --git a/src/main/java/xyz/danielcortes/App.java b/src/main/java/xyz/danielcortes/App.java new file mode 100644 index 0000000..f199e31 --- /dev/null +++ b/src/main/java/xyz/danielcortes/App.java @@ -0,0 +1,24 @@ +package xyz.danielcortes; + +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; +import xyz.danielcortes.controllers.LaunchController; + +public class App { + + public static void main(String[] args) { + setupLookAndFeel(); + LaunchController launchController = new LaunchController(); + launchController.run(); + } + + private static void setupLookAndFeel(){ + try { + //UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel"); + //UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/LaunchController.java b/src/main/java/xyz/danielcortes/controllers/LaunchController.java new file mode 100644 index 0000000..57db497 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/LaunchController.java @@ -0,0 +1,369 @@ +package xyz.danielcortes.controllers; + +import java.awt.event.KeyEvent; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import xyz.danielcortes.controllers.autor.AutorCreateController; +import xyz.danielcortes.controllers.autor.AutorDeleteController; +import xyz.danielcortes.controllers.autor.AutorListController; +import xyz.danielcortes.controllers.autor.AutorUpdateController; +import xyz.danielcortes.controllers.categoria.CategoriaCreateController; +import xyz.danielcortes.controllers.categoria.CategoriaDeleteController; +import xyz.danielcortes.controllers.categoria.CategoriaListController; +import xyz.danielcortes.controllers.categoria.CategoriaUpdateController; +import xyz.danielcortes.controllers.editorial.EditorialCreateController; +import xyz.danielcortes.controllers.editorial.EditorialDeleteController; +import xyz.danielcortes.controllers.editorial.EditorialListController; +import xyz.danielcortes.controllers.editorial.EditorialUpdateController; +import xyz.danielcortes.controllers.idioma.IdiomaCreateController; +import xyz.danielcortes.controllers.idioma.IdiomaDeleteController; +import xyz.danielcortes.controllers.idioma.IdiomaListController; +import xyz.danielcortes.controllers.idioma.IdiomaUpdateController; +import xyz.danielcortes.controllers.libro.LibroCreateController; +import xyz.danielcortes.controllers.libro.LibroDeleteController; +import xyz.danielcortes.controllers.libro.LibroListController; +import xyz.danielcortes.controllers.libro.LibroUpdateController; +import xyz.danielcortes.framework.PanelName; +import xyz.danielcortes.views.LaunchFrame; +import xyz.danielcortes.views.autor.AutorCreatePanel; +import xyz.danielcortes.views.autor.AutorDeletePanel; +import xyz.danielcortes.views.autor.AutorListPanel; +import xyz.danielcortes.views.autor.AutorUpdatePanel; +import xyz.danielcortes.views.categoria.CategoriaCreatePanel; +import xyz.danielcortes.views.categoria.CategoriaDeletePanel; +import xyz.danielcortes.views.categoria.CategoriaListPanel; +import xyz.danielcortes.views.categoria.CategoriaUpdatePanel; +import xyz.danielcortes.views.editorial.EditorialCreatePanel; +import xyz.danielcortes.views.editorial.EditorialDeletePanel; +import xyz.danielcortes.views.editorial.EditorialListPanel; +import xyz.danielcortes.views.editorial.EditorialUpdatePanel; +import xyz.danielcortes.views.idioma.IdiomaCreatePanel; +import xyz.danielcortes.views.idioma.IdiomaDeletePanel; +import xyz.danielcortes.views.idioma.IdiomaListPanel; +import xyz.danielcortes.views.idioma.IdiomaUpdatePanel; +import xyz.danielcortes.views.libro.LibroCreatePanel; +import xyz.danielcortes.views.libro.LibroDeletePanel; +import xyz.danielcortes.views.libro.LibroListPanel; +import xyz.danielcortes.views.libro.LibroUpdatePanel; + +public class LaunchController { + + private LaunchFrame frame; + + private LibroListController libroListController; + private LibroCreateController libroCreateController; + private LibroUpdateController libroUpdateController; + private LibroDeleteController libroDeleteController; + + private AutorListController autorListController; + private AutorCreateController autorCreateController; + private AutorUpdateController autorUpdateController; + private AutorDeleteController autorDeleteController; + + private IdiomaListController idiomaListController; + private IdiomaCreateController idiomaCreateController; + private IdiomaUpdateController idiomaUpdateController; + private IdiomaDeleteController idiomaDeleteController; + + private CategoriaListController categoriaListController; + private CategoriaCreateController categoriaCreateController; + private CategoriaUpdateController categoriaUpdateController; + private CategoriaDeleteController categoriaDeleteController; + + private EditorialListController editorialListController; + private EditorialCreateController editorialCreateController; + private EditorialUpdateController editorialUpdateController; + private EditorialDeleteController editorialDeleteController; + + private void create() { + frame = new LaunchFrame(); + this.createCards(); + this.createMenuBar(); + } + + private void createCards() { + this.frame.addCard(new JPanel(), PanelName.EMPTY); + + this.libroListController = new LibroListController(new LibroListPanel()); + this.libroCreateController = new LibroCreateController(new LibroCreatePanel()); + this.libroUpdateController = new LibroUpdateController(new LibroUpdatePanel()); + this.libroDeleteController = new LibroDeleteController(new LibroDeletePanel()); + + this.frame.addCard( + this.libroListController.getView().getContentPane(), + PanelName.LIBRO_LIST + ); + this.frame.addCard( + this.libroCreateController.getView().getContentPane(), + PanelName.LIBRO_CREATE + ); + this.frame.addCard( + this.libroUpdateController.getView().getContentPane(), + PanelName.LIBRO_UPDATE + ); + this.frame.addCard( + this.libroDeleteController.getView().getContentPane(), + PanelName.LIBRO_DELETE + ); + + this.autorListController = new AutorListController(new AutorListPanel()); + this.autorCreateController = new AutorCreateController(new AutorCreatePanel()); + this.autorUpdateController = new AutorUpdateController(new AutorUpdatePanel()); + this.autorDeleteController = new AutorDeleteController(new AutorDeletePanel()); + this.frame.addCard( + this.autorListController.getView().getContentPane(), + PanelName.AUTOR_LIST + ); + this.frame.addCard( + this.autorCreateController.getView().getContentPane(), + PanelName.AUTOR_CREATE + ); + this.frame.addCard( + this.autorUpdateController.getView().getContentPane(), + PanelName.AUTOR_UPDATE + ); + this.frame.addCard( + this.autorDeleteController.getView().getContentPane(), + PanelName.AUTOR_DELETE + ); + + this.idiomaListController = new IdiomaListController(new IdiomaListPanel()); + this.idiomaCreateController = new IdiomaCreateController(new IdiomaCreatePanel()); + this.idiomaUpdateController = new IdiomaUpdateController(new IdiomaUpdatePanel()); + this.idiomaDeleteController = new IdiomaDeleteController(new IdiomaDeletePanel()); + this.frame.addCard( + this.idiomaListController.getView().getContentPane(), + PanelName.IDIOMA_LIST + ); + this.frame.addCard( + this.idiomaCreateController.getView().getContentPane(), + PanelName.IDIOMA_CREATE + ); + this.frame.addCard( + this.idiomaUpdateController.getView().getContentPane(), + PanelName.IDIOMA_UPDATE + ); + this.frame.addCard( + this.idiomaDeleteController.getView().getContentPane(), + PanelName.IDIOMA_DELETE + ); + + this.categoriaListController = new CategoriaListController(new CategoriaListPanel()); + this.categoriaCreateController = new CategoriaCreateController(new CategoriaCreatePanel()); + this.categoriaDeleteController = new CategoriaDeleteController(new CategoriaDeletePanel()); + this.categoriaUpdateController = new CategoriaUpdateController(new CategoriaUpdatePanel()); + + this.frame.addCard( + this.categoriaListController.getView().getContentPane(), + PanelName.CATEGORIA_LIST + ); + this.frame.addCard( + this.categoriaUpdateController.getView().getContentPane(), + PanelName.CATEGORIA_UPDATE + ); + this.frame.addCard( + this.categoriaCreateController.getView().getContentPane(), + PanelName.CATEGORIA_CREATE + ); + this.frame.addCard( + this.categoriaDeleteController.getView().getContentPane(), + PanelName.CATEGORIA_DELETE + ); + + this.editorialListController = new EditorialListController(new EditorialListPanel()); + this.editorialCreateController= new EditorialCreateController(new EditorialCreatePanel()); + this.editorialUpdateController= new EditorialUpdateController(new EditorialUpdatePanel()); + this.editorialDeleteController= new EditorialDeleteController(new EditorialDeletePanel()); + + this.frame.addCard( + this.editorialListController.getView().getContentPane(), + PanelName.EDITORIAL_LIST + ); + this.frame.addCard( + this.editorialCreateController.getView().getContentPane(), + PanelName.EDITORIAL_CREATE + ); + this.frame.addCard( + this.editorialUpdateController.getView().getContentPane(), + PanelName.EDITORIAL_UPDATE + ); + this.frame.addCard( + this.editorialDeleteController.getView().getContentPane(), + PanelName.EDITORIAL_DELETE + ); + } + + private void createMenuBar() { + JMenuBar menuBar = new JMenuBar(); + + //Si, los estoy poniendo en una linea en vez de las 2 que corresponden, + //Lo hago porque se ve mas claramente a que Menu/MenuItem pertenece el mnemonic. + //Es una especie de... Builder pobre :3 + // @formatter:off + JMenu librosMenu = new JMenu("Libros"); librosMenu.setMnemonic(KeyEvent.VK_L); + JMenuItem libroList = new JMenuItem("Listar"); libroList.setMnemonic(KeyEvent.VK_L); + JMenuItem libroCreate = new JMenuItem("Crear"); libroCreate.setMnemonic(KeyEvent.VK_C); + JMenuItem libroUpdate= new JMenuItem("Actualizar"); libroUpdate.setMnemonic(KeyEvent.VK_U); + JMenuItem libroDelete = new JMenuItem("Eliminar"); libroDelete.setMnemonic(KeyEvent.VK_E); + + JMenu autoresMenu = new JMenu("Autores"); autoresMenu.setMnemonic(KeyEvent.VK_A); + JMenuItem autorList = new JMenuItem("Listar"); autorList.setMnemonic(KeyEvent.VK_L); + JMenuItem autorCreate = new JMenuItem("Crear"); autorCreate.setMnemonic(KeyEvent.VK_C); + JMenuItem autorUpdate = new JMenuItem("Actualizar"); autorUpdate.setMnemonic(KeyEvent.VK_A); + JMenuItem autorDelete = new JMenuItem("Eliminar"); autorDelete.setMnemonic(KeyEvent.VK_E); + + JMenu idiomasMenu = new JMenu("Idiomas"); idiomasMenu.setMnemonic(KeyEvent.VK_I); + JMenuItem idiomaList = new JMenuItem("Listar"); idiomaList.setMnemonic(KeyEvent.VK_L); + JMenuItem idiomaCreate = new JMenuItem("Crear"); idiomaCreate.setMnemonic(KeyEvent.VK_C); + JMenuItem idiomaUpdate = new JMenuItem("Actualizar"); idiomaUpdate.setMnemonic(KeyEvent.VK_A); + JMenuItem idiomaDelete = new JMenuItem("Eliminar"); idiomaDelete.setMnemonic(KeyEvent.VK_E); + + JMenu categoriasMenu = new JMenu("Categorias"); categoriasMenu.setMnemonic(KeyEvent.VK_C); + JMenuItem categoriaList = new JMenuItem("Listar"); categoriaList.setMnemonic(KeyEvent.VK_L); + JMenuItem categoriaCreate = new JMenuItem("Crear"); categoriaCreate.setMnemonic(KeyEvent.VK_C); + JMenuItem categoriaUpdate = new JMenuItem("Actualizar"); categoriaUpdate.setMnemonic(KeyEvent.VK_A); + JMenuItem categoriaDelete = new JMenuItem("Eliminar"); categoriaDelete.setMnemonic(KeyEvent.VK_E); + + JMenu editorialesMenu = new JMenu("Editoriales"); editorialesMenu.setMnemonic(KeyEvent.VK_E); + JMenuItem editorialList= new JMenuItem("Listar"); editorialList.setMnemonic(KeyEvent.VK_L); + JMenuItem editorialCreate= new JMenuItem("Crear"); editorialCreate.setMnemonic(KeyEvent.VK_C); + JMenuItem editorialUpdate = new JMenuItem("Actualizar"); editorialUpdate.setMnemonic(KeyEvent.VK_A); + JMenuItem editorialDelete = new JMenuItem("Eliminar"); editorialDelete.setMnemonic(KeyEvent.VK_E); + // @formatter:on + + autorList.addActionListener(e -> { + this.autorListController.reload(); + this.frame.showCard(PanelName.AUTOR_LIST); + }); + autorCreate.addActionListener(e -> { + this.frame.showCard(PanelName.AUTOR_CREATE); + this.autorCreateController.getView().getNombreField().requestFocus(); + }); + autorUpdate.addActionListener(e -> { + this.autorUpdateController.reload(); + this.frame.showCard(PanelName.AUTOR_UPDATE); + this.autorUpdateController.getView().getAutorCombo().requestFocus(); + }); + autorDelete.addActionListener(e -> { + this.autorDeleteController.reload(); + this.frame.showCard(PanelName.AUTOR_DELETE); + this.autorDeleteController.getView().getAutorCombo().requestFocus(); + }); + + idiomaList.addActionListener(e -> { + this.idiomaListController.reload(); + this.frame.showCard(PanelName.IDIOMA_LIST); + }); + idiomaCreate.addActionListener(e -> { + this.frame.showCard(PanelName.IDIOMA_CREATE); + this.idiomaCreateController.getView().getNombreField().requestFocus(); + }); + idiomaUpdate.addActionListener(e -> { + this.idiomaUpdateController.reload(); + this.frame.showCard(PanelName.IDIOMA_UPDATE); + this.idiomaUpdateController.getView().getIdiomaCombo().requestFocus(); + }); + idiomaDelete.addActionListener(e -> { + this.idiomaDeleteController.reload(); + this.frame.showCard(PanelName.IDIOMA_DELETE); + this.idiomaDeleteController.getView().getIdiomaCombo().requestFocus(); + }); + + libroList.addActionListener(e -> { + this.libroListController.reload(); + this.frame.showCard(PanelName.LIBRO_LIST); + }); + libroCreate.addActionListener(e -> { + this.libroCreateController.reload(); + this.frame.showCard(PanelName.LIBRO_CREATE); + this.libroCreateController.getView().getSerieField().requestFocus(); + }); + libroUpdate.addActionListener(e -> { + this.libroUpdateController.reload(); + this.frame.showCard(PanelName.LIBRO_UPDATE); + this.libroUpdateController.getView().getSerieField().requestFocus(); + }); + libroDelete.addActionListener(e -> { + this.libroDeleteController.reload(); + this.frame.showCard(PanelName.LIBRO_DELETE); + }); + + categoriaList.addActionListener(e -> { + this.categoriaListController.reload(); + this.frame.showCard(PanelName.CATEGORIA_LIST); + }); + categoriaCreate.addActionListener(e -> { + this.frame.showCard(PanelName.CATEGORIA_CREATE); + this.categoriaCreateController.getView().getNombreField().requestFocus(); + }); + categoriaUpdate.addActionListener(e -> { + this.categoriaUpdateController.reload(); + this.frame.showCard(PanelName.CATEGORIA_UPDATE); + this.categoriaUpdateController.getView().getCategoriaCombo().requestFocus(); + }); + categoriaDelete.addActionListener(e -> { + this.categoriaDeleteController.reload(); + this.frame.showCard(PanelName.CATEGORIA_DELETE); + this.categoriaDeleteController.getView().getCategoriaCombo().requestFocus(); + }); + + editorialList.addActionListener(e -> { + this.editorialListController.reload(); + this.frame.showCard(PanelName.EDITORIAL_LIST); + }); + editorialCreate.addActionListener(e -> { + this.frame.showCard(PanelName.EDITORIAL_CREATE); + this.editorialCreateController.getView().getNombreField().requestFocus(); + }); + editorialUpdate.addActionListener(e -> { + this.editorialUpdateController.reload(); + this.frame.showCard(PanelName.EDITORIAL_UPDATE); + this.editorialUpdateController.getView().getEditorialCombo().requestFocus(); + }); + editorialDelete.addActionListener(e -> { + this.editorialDeleteController.reload(); + this.frame.showCard(PanelName.EDITORIAL_DELETE); + this.editorialDeleteController.getView().getEditorialCombo().requestFocus(); + }); + + menuBar.add(librosMenu); + librosMenu.add(libroList); + librosMenu.add(libroCreate); + librosMenu.add(libroUpdate); + librosMenu.add(libroDelete); + + menuBar.add(autoresMenu); + autoresMenu.add(autorList); + autoresMenu.add(autorCreate); + autoresMenu.add(autorUpdate); + autoresMenu.add(autorDelete); + + menuBar.add(idiomasMenu); + idiomasMenu.add(idiomaList); + idiomasMenu.add(idiomaCreate); + idiomasMenu.add(idiomaUpdate); + idiomasMenu.add(idiomaDelete); + + menuBar.add(categoriasMenu); + categoriasMenu.add(categoriaList); + categoriasMenu.add(categoriaCreate); + categoriasMenu.add(categoriaUpdate); + categoriasMenu.add(categoriaDelete); + + menuBar.add(editorialesMenu); + editorialesMenu.add(editorialList); + editorialesMenu.add(editorialCreate); + editorialesMenu.add(editorialUpdate); + editorialesMenu.add(editorialDelete); + + this.frame.setJMenuBar(menuBar); + } + + public void run() { + this.create(); + this.frame.setVisible(true); + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/autor/AutorCreateController.java b/src/main/java/xyz/danielcortes/controllers/autor/AutorCreateController.java new file mode 100644 index 0000000..31f52eb --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/autor/AutorCreateController.java @@ -0,0 +1,105 @@ +package xyz.danielcortes.controllers.autor; + +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.repository.AutorRepository; +import xyz.danielcortes.views.autor.AutorCreatePanel; + +public class AutorCreateController { + + private AutorCreatePanel view; + private AutorRepository autorRepository; + + public AutorCreateController(AutorCreatePanel view) { + this.view = view; + this.autorRepository = new AutorRepository(); + this.setupListeners(); + } + + private void setupListeners() { + this.view.getApellidoMaternoField().addActionListener(e -> save()); + this.view.getGuardarButton().addActionListener(e -> save()); + } + + private void save() { + String nombre = view.getNombreField().getText(); + if (!validateNombre(nombre)) return; + String apellidoPaterno = view.getApellidoPaternoField().getText(); + if (!validateApellidoPaterno(apellidoPaterno)) return; + String apellidoMaterno = view.getApellidoMaternoField().getText(); + if (!validateApellidoMaterno(apellidoMaterno)) return; + + Autor autor = new Autor(); + autor.setNombre(nombre); + autor.setApellidoPaterno(apellidoPaterno); + autor.setApellidoMaterno(apellidoMaterno); + + autorRepository.save(autor); + + this.view.getNombreField().setText(""); + this.view.getApellidoPaternoField().setText(""); + this.view.getApellidoMaternoField().setText(""); + this.view.getNombreField().requestFocus(); + } + + private boolean validateNombre(String nombre) { + if (nombre == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (nombre.isEmpty()) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + private boolean validateApellidoPaterno(String apellidoPaterno) { + if (apellidoPaterno == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El apellido paterno es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (apellidoPaterno.isEmpty()) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El apellido paterno esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + private boolean validateApellidoMaterno(String apellidoMaterno) { + if (apellidoMaterno == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El apellido materno es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (apellidoMaterno.isEmpty()) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El apellido materno esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public AutorCreatePanel getView() { + return this.view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/autor/AutorDeleteController.java b/src/main/java/xyz/danielcortes/controllers/autor/AutorDeleteController.java new file mode 100644 index 0000000..8abaa4a --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/autor/AutorDeleteController.java @@ -0,0 +1,62 @@ +package xyz.danielcortes.controllers.autor; + +import java.util.List; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.repository.AutorRepository; +import xyz.danielcortes.views.autor.AutorDeletePanel; + +public class AutorDeleteController { + private AutorDeletePanel view; + private AutorRepository autorRepository; + + public AutorDeleteController(AutorDeletePanel view){ + this.view = view; + this.autorRepository = new AutorRepository(); + this.setupListeners(); + this.loadAutorCombo(); + } + + private void setupListeners() { + view.getEliminarButton().addActionListener(e -> delete()); + } + + private void delete() { + Autor selected = (Autor) this.view.getAutorCombo().getSelectedItem(); + if(!validateAutor(selected)) return; + + this.autorRepository.delete(selected); + this.reload(); + } + + private boolean validateAutor(Autor autor) { + if (autor == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "No hay autor seleccionado", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public void reload(){ + loadAutorCombo(); + } + + private void loadAutorCombo(){ + List autores = this.autorRepository.getAll(); + JComboBox combobox = this.view.getAutorCombo(); + combobox.removeAllItems(); + for(Autor autor: autores) { + combobox.addItem(autor); + } + } + + public AutorDeletePanel getView() { + return view; + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/autor/AutorListController.java b/src/main/java/xyz/danielcortes/controllers/autor/AutorListController.java new file mode 100644 index 0000000..499dae4 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/autor/AutorListController.java @@ -0,0 +1,32 @@ +package xyz.danielcortes.controllers.autor; + +import java.util.List; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.repository.AutorRepository; +import xyz.danielcortes.views.autor.AutorListPanel; + +public class AutorListController { + + private AutorListPanel view; + private AutorRepository autorRepository; + + public AutorListController(AutorListPanel view) { + this.view = view; + this.autorRepository = new AutorRepository(); + } + + public void reload() { + this.loadAutorTable(); + } + + private void loadAutorTable() { + List autores = this.autorRepository.getAll(); + BaseTableModel model = this.view.getAutorModel(); + model.addRows(autores); + } + + public AutorListPanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/autor/AutorUpdateController.java b/src/main/java/xyz/danielcortes/controllers/autor/AutorUpdateController.java new file mode 100644 index 0000000..f790bcf --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/autor/AutorUpdateController.java @@ -0,0 +1,142 @@ +package xyz.danielcortes.controllers.autor; + +import java.util.List; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.repository.AutorRepository; +import xyz.danielcortes.views.autor.AutorUpdatePanel; + +public class AutorUpdateController { + + private AutorUpdatePanel view; + private AutorRepository autorRepository; + + public AutorUpdateController(AutorUpdatePanel view) { + this.view = view; + this.autorRepository = new AutorRepository(); + this.setupListeners(); + this.loadAutorCombo(); + } + + private void setupListeners() { + this.view.getAutorCombo().addActionListener(e -> { + Autor selected = (Autor) view.getAutorCombo().getSelectedItem(); + if (selected != null) { + this.view.getNombreField().setText(selected.getNombre()); + this.view.getApellidoPaternoField().setText(selected.getApellidoPaterno()); + this.view.getApellidoMaternoField().setText(selected.getApellidoMaterno()); + } + }); + this.view.getApellidoPaternoField().addActionListener(e -> update()); + this.view.getActualizarButton().addActionListener(e -> update()); + } + + private void update() { + Autor original = (Autor) this.view.getAutorCombo().getSelectedItem(); + if(!validateOriginal(original)) return; + + String nombre = this.view.getNombreField().getText(); + if(!validateNombre(nombre)) return; + + String apellidoPaterno = this.view.getApellidoPaternoField().getText(); + if(!validateApellidoPaterno(apellidoPaterno)) return; + + String apellidoMaterno = this.view.getApellidoMaternoField().getText(); + if(!validateApellidoMaterno(apellidoMaterno)) return; + + assert original != null; + original.setNombre(nombre); + original.setApellidoPaterno(apellidoPaterno); + original.setApellidoMaterno(apellidoMaterno); + + this.autorRepository.update(original); + + this.loadAutorCombo(); + this.view.getNombreField().requestFocus(); + } + + private boolean validateOriginal(Autor original) { + if (original == null) { + JOptionPane.showMessageDialog( + null, + "No hay Autor seleccionado", + "Error", + JOptionPane.ERROR_MESSAGE + ); + return false; + } + return true; + } + + private boolean validateNombre(String nombre) { + if (nombre == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (nombre.isEmpty()) { + JOptionPane.showMessageDialog(this.view.getContentPane(), + "El nombre esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + private boolean validateApellidoPaterno(String apellidoPaterno) { + if (apellidoPaterno == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El apellido paterno es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (apellidoPaterno.isEmpty()) { + JOptionPane.showMessageDialog(this.view.getContentPane(), + "El apellido paterno esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + private boolean validateApellidoMaterno(String apellidoMaterno) { + if (apellidoMaterno == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El apellido materno es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (apellidoMaterno.isEmpty()) { + JOptionPane.showMessageDialog(this.view.getContentPane(), + "El apellido materno esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public void reload() { + this.loadAutorCombo(); + } + + private void loadAutorCombo() { + List autores = this.autorRepository.getAll(); + JComboBox combobox = this.view.getAutorCombo(); + combobox.removeAllItems(); + for (Autor autor : autores) { + combobox.addItem(autor); + } + } + + public AutorUpdatePanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaCreateController.java b/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaCreateController.java new file mode 100644 index 0000000..0f2d355 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaCreateController.java @@ -0,0 +1,59 @@ +package xyz.danielcortes.controllers.categoria; + +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.repository.CategoriaRepository; +import xyz.danielcortes.views.categoria.CategoriaCreatePanel; + +public class CategoriaCreateController { + private CategoriaRepository categoriaRepository; + private CategoriaCreatePanel view; + + public CategoriaCreateController(CategoriaCreatePanel view) { + this.view = view; + categoriaRepository = new CategoriaRepository(); + this.setupListeners(); + } + + private void setupListeners() { + view.getNombreField().addActionListener(e -> save()); + view.getGuardarButton().addActionListener(e -> save()); + } + + private void save() { + String nombre = view.getNombreField().getText(); + if(!validateNombre(nombre)) return; + + Categoria categoria = new Categoria(); + categoria.setNombre(nombre); + + categoriaRepository.save(categoria); + + this.view.getNombreField().setText(""); + this.view.getNombreField().requestFocus(); + } + + private boolean validateNombre(String nombre) { + if (nombre == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (nombre.isEmpty()) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public CategoriaCreatePanel getView() { + return view; + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaDeleteController.java b/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaDeleteController.java new file mode 100644 index 0000000..a622622 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaDeleteController.java @@ -0,0 +1,62 @@ +package xyz.danielcortes.controllers.categoria; + +import java.util.List; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.repository.CategoriaRepository; +import xyz.danielcortes.views.categoria.CategoriaDeletePanel; + +public class CategoriaDeleteController { + + private CategoriaRepository categoriaRepository; + private CategoriaDeletePanel view; + + public CategoriaDeleteController(CategoriaDeletePanel view) { + this.view = view; + this.categoriaRepository = new CategoriaRepository(); + this.setupListeners(); + } + + private void setupListeners() { + view.getEliminarButton().addActionListener(e -> delete()); + } + + private void delete() { + Categoria selected = (Categoria) this.view.getCategoriaCombo().getSelectedItem(); + if (!validateCategoria(selected)) return; + + this.categoriaRepository.delete(selected); + this.reload(); + } + + private boolean validateCategoria(Categoria categoria) { + if (categoria == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "No hay categoria seleccionada", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public void reload() { + this.loadCategoriaCombo(); + } + + private void loadCategoriaCombo() { + List categorias = this.categoriaRepository.getAll(); + JComboBox combobox = this.view.getCategoriaCombo(); + combobox.removeAllItems(); + for (Categoria categoria : categorias) { + combobox.addItem(categoria); + } + } + + public CategoriaDeletePanel getView() { + return view; + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaListController.java b/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaListController.java new file mode 100644 index 0000000..7d253dc --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaListController.java @@ -0,0 +1,28 @@ +package xyz.danielcortes.controllers.categoria; + +import java.util.List; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.repository.CategoriaRepository; +import xyz.danielcortes.views.categoria.CategoriaListPanel; + +public class CategoriaListController { + private CategoriaRepository categoriaRepository; + private CategoriaListPanel view; + + public CategoriaListController (CategoriaListPanel view) { + this.view = view; + this.categoriaRepository = new CategoriaRepository(); + this.loadCategoriaTable(); + } + + public void reload() {this.loadCategoriaTable();} + + private void loadCategoriaTable() { + List categorias = this.categoriaRepository.getAll(); + BaseTableModel model = this.view.getCategoriaModel(); + model.addRows(categorias); + } + + public CategoriaListPanel getView() { return view; } +} diff --git a/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaUpdateController.java b/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaUpdateController.java new file mode 100644 index 0000000..53eb401 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaUpdateController.java @@ -0,0 +1,94 @@ +package xyz.danielcortes.controllers.categoria; + +import java.util.List; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.repository.CategoriaRepository; +import xyz.danielcortes.views.categoria.CategoriaUpdatePanel; + +public class CategoriaUpdateController { + + private CategoriaUpdatePanel view; + private CategoriaRepository categoriaRepository; + + public CategoriaUpdateController(CategoriaUpdatePanel view) { + this.view = view; + this.categoriaRepository = new CategoriaRepository(); + + this.setupListeners(); + } + + private void setupListeners() { + this.view.getCategoriaCombo().addActionListener(e -> { + Categoria selected = (Categoria) view.getCategoriaCombo().getSelectedItem(); + if(selected != null) + this.view.getNombreField().setText(selected.getNombre()); + }); + this.view.getNombreField().addActionListener(e -> this.update()); + this.view.getUpdateButton().addActionListener(e -> this.update()); + } + + private void update() { + Categoria original = (Categoria) this.view.getCategoriaCombo().getSelectedItem(); + if (!validateOriginal(original)) return; + + String nombre = this.view.getNombreField().getText(); + if (!validateNombre(nombre)) return; + + assert original != null; + original.setNombre(nombre); + categoriaRepository.update(original); + + this.loadCategoriaCombo(); + this.view.getNombreField().requestFocus(); + } + + private boolean validateOriginal(Categoria original) { + if (original == null) { + JOptionPane.showMessageDialog( + null, + "No hay categoria seleccionada", + "Error", + JOptionPane.ERROR_MESSAGE + ); + return false; + } + return true; + } + + private boolean validateNombre(String nombre) { + if (nombre == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (nombre.isEmpty()) { + JOptionPane.showMessageDialog(this.view.getContentPane(), + "El nombre esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public void reload() { + this.loadCategoriaCombo(); + } + + private void loadCategoriaCombo() { + List categorias = this.categoriaRepository.getAll(); + JComboBox combobox = this.view.getCategoriaCombo(); + combobox.removeAllItems(); + for (Categoria categoria : categorias) { + combobox.addItem(categoria); + } + } + + public CategoriaUpdatePanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/editorial/EditorialCreateController.java b/src/main/java/xyz/danielcortes/controllers/editorial/EditorialCreateController.java new file mode 100644 index 0000000..6d60922 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/editorial/EditorialCreateController.java @@ -0,0 +1,60 @@ +package xyz.danielcortes.controllers.editorial; + +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.repository.EditorialRepository; +import xyz.danielcortes.views.editorial.EditorialCreatePanel; + +public class EditorialCreateController { + + private EditorialRepository editorialRepository; + private EditorialCreatePanel view; + + public EditorialCreateController(EditorialCreatePanel view) { + this.view = view; + this.editorialRepository = new EditorialRepository(); + + this.setupListeners(); + } + + private void setupListeners() { + this.view.getGuardarButton().addActionListener(e -> save()); + this.view.getNombreField().addActionListener(e -> save()); + } + + private void save() { + String nombre = this.view.getNombreField().getText(); + if(!validateNombre(nombre)) return; + + Editorial editorial = new Editorial(); + editorial.setNombre(nombre); + + editorialRepository.save(editorial); + + this.view.getNombreField().setText(""); + this.view.getNombreField().requestFocus(); + } + + private boolean validateNombre(String nombre) { + if (nombre == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (nombre.isEmpty()) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public EditorialCreatePanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/editorial/EditorialDeleteController.java b/src/main/java/xyz/danielcortes/controllers/editorial/EditorialDeleteController.java new file mode 100644 index 0000000..461ae33 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/editorial/EditorialDeleteController.java @@ -0,0 +1,62 @@ +package xyz.danielcortes.controllers.editorial; + +import java.util.List; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.repository.EditorialRepository; +import xyz.danielcortes.views.editorial.EditorialDeletePanel; + +public class EditorialDeleteController { + private EditorialDeletePanel view; + private EditorialRepository editorialRepository; + + public EditorialDeleteController(EditorialDeletePanel view) { + this.view = view; + this.editorialRepository = new EditorialRepository(); + + this.setupListeners(); + this.loadEditorialCombo(); + } + + private void setupListeners(){ + this.view.getEliminarButton().addActionListener(e -> this.delete()); + } + + private void delete(){ + Editorial selected = (Editorial) this.view.getEditorialCombo().getSelectedItem(); + if(!validateEditorial(selected)) return; + + this.editorialRepository.delete(selected); + this.reload(); + } + + private boolean validateEditorial(Editorial editorial){ + if (editorial== null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "No hay editorial seleccionada", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public void reload() { + this.loadEditorialCombo(); + } + + private void loadEditorialCombo(){ + List editoriales = this.editorialRepository.getAll(); + JComboBox comboBox = this.view.getEditorialCombo(); + comboBox.removeAllItems(); + for(Editorial editorial: editoriales){ + comboBox.addItem(editorial); + } + } + + public EditorialDeletePanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/editorial/EditorialListController.java b/src/main/java/xyz/danielcortes/controllers/editorial/EditorialListController.java new file mode 100644 index 0000000..e5f5519 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/editorial/EditorialListController.java @@ -0,0 +1,32 @@ +package xyz.danielcortes.controllers.editorial; + +import java.util.List; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.repository.EditorialRepository; +import xyz.danielcortes.views.editorial.EditorialListPanel; + +public class EditorialListController { + private EditorialListPanel view; + private EditorialRepository editorialRepository; + + public EditorialListController(EditorialListPanel view) { + this.view = view; + this.editorialRepository = new EditorialRepository(); + this.loadEditorialTable(); + } + + public void reload() { + this.loadEditorialTable(); + } + + private void loadEditorialTable(){ + List editoriales = this.editorialRepository.getAll(); + BaseTableModel model = this.view.getEditorialModel(); + model.addRows(editoriales); + } + + public EditorialListPanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/editorial/EditorialUpdateController.java b/src/main/java/xyz/danielcortes/controllers/editorial/EditorialUpdateController.java new file mode 100644 index 0000000..d68a5e1 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/editorial/EditorialUpdateController.java @@ -0,0 +1,97 @@ +package xyz.danielcortes.controllers.editorial; + +import java.util.List; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.repository.EditorialRepository; +import xyz.danielcortes.views.editorial.EditorialUpdatePanel; + +public class EditorialUpdateController { + + private EditorialUpdatePanel view; + private EditorialRepository editorialRepository; + + public EditorialUpdateController(EditorialUpdatePanel view) { + this.view = view; + this.editorialRepository = new EditorialRepository(); + this.setupListeners(); + } + + private void setupListeners() { + this.view.getEditorialCombo().addActionListener(e -> { + Editorial selected = (Editorial) this.view.getEditorialCombo().getSelectedItem(); + if (selected != null) + this.view.getNombreField().setText(selected.getNombre()); + }); + this.view.getNombreField().addActionListener(e -> this.update()); + this.view.getActualizarButton().addActionListener(e -> this.update()); + } + + private void update() { + Editorial original = (Editorial) this.view.getEditorialCombo().getSelectedItem(); + if (!validateOriginal(original)) + return; + + String nombre = this.view.getNombreField().getText(); + if (!validateNombre(nombre)) + return; + + assert original != null; + original.setNombre(nombre); + this.editorialRepository.update(original); + + this.view.getNombreField().setText(""); + this.loadEditorialCombo(); + this.view.getNombreField().requestFocus(); + } + + private boolean validateOriginal(Editorial original) { + if (original == null) { + JOptionPane.showMessageDialog( + null, + "No hay Editorial seleccionada", + "Error", + JOptionPane.ERROR_MESSAGE + ); + return false; + } + return true; + } + + private boolean validateNombre(String nombre) { + if (nombre == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (nombre.isEmpty()) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public void reload() { + this.loadEditorialCombo(); + } + + private void loadEditorialCombo() { + List editoriales = this.editorialRepository.getAll(); + JComboBox combobox = this.view.getEditorialCombo(); + combobox.removeAllItems(); + for(Editorial editorial: editoriales) { + combobox.addItem(editorial); + } + } + + public EditorialUpdatePanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaCreateController.java b/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaCreateController.java new file mode 100644 index 0000000..1ef2032 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaCreateController.java @@ -0,0 +1,61 @@ +package xyz.danielcortes.controllers.idioma; + +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.repository.IdiomaRepository; +import xyz.danielcortes.views.idioma.IdiomaCreatePanel; + +public class IdiomaCreateController { + + private IdiomaRepository idiomaRepository; + private IdiomaCreatePanel view; + + public IdiomaCreateController(IdiomaCreatePanel view) { + this.idiomaRepository = new IdiomaRepository(); + this.view = view; + + this.setupListeners(); + } + + private void setupListeners() { + view.getNombreField().addActionListener(e -> save()); + view.getGuardarButton().addActionListener(e -> save()); + } + + private void save() { + String nombre = view.getNombreField().getText(); + if (!validateNombre(nombre)) return; + + Idioma idioma = new Idioma(); + idioma.setNombre(nombre); + + idiomaRepository.save(idioma); + + this.view.getNombreField().setText(""); + this.view.getNombreField().requestFocus(); + } + + private boolean validateNombre(String nombre) { + if (nombre == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (nombre.isEmpty()) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public IdiomaCreatePanel getView() { + return view; + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaDeleteController.java b/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaDeleteController.java new file mode 100644 index 0000000..de18d61 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaDeleteController.java @@ -0,0 +1,63 @@ +package xyz.danielcortes.controllers.idioma; + +import java.util.List; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.repository.IdiomaRepository; +import xyz.danielcortes.views.idioma.IdiomaDeletePanel; + +public class IdiomaDeleteController { + + private IdiomaDeletePanel view; + private IdiomaRepository idiomaRepository; + + public IdiomaDeleteController(IdiomaDeletePanel view) { + this.view = view; + this.idiomaRepository = new IdiomaRepository(); + this.loadIdiomaCombo(); + this.setupListeners(); + } + + private void setupListeners() { + this.view.getEliminarButton().addActionListener(e -> this.delete()); + } + + private void delete() { + Idioma selected = (Idioma) this.view.getIdiomaCombo().getSelectedItem(); + if (!validateIdioma(selected)) return; + + this.idiomaRepository.delete(selected); + this.reload(); + } + + private boolean validateIdioma(Idioma idioma) { + if (idioma == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "No hay idioma seleccionado", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public void reload() { + this.loadIdiomaCombo(); + } + + private void loadIdiomaCombo() { + List idiomas = this.idiomaRepository.getAll(); + JComboBox combobox = this.view.getIdiomaCombo(); + combobox.removeAllItems(); + for (Idioma idioma : idiomas) { + combobox.addItem(idioma); + } + } + + public IdiomaDeletePanel getView() { + return view; + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaListController.java b/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaListController.java new file mode 100644 index 0000000..7558ec0 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaListController.java @@ -0,0 +1,34 @@ +package xyz.danielcortes.controllers.idioma; + +import java.util.List; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.repository.IdiomaRepository; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.views.idioma.IdiomaListPanel; + +public class IdiomaListController { + + private IdiomaListPanel view; + private IdiomaRepository idiomaRepository; + + public IdiomaListController(IdiomaListPanel view) { + this.view = view; + this.idiomaRepository = new IdiomaRepository(); + this.loadIdiomaTable(); + } + + public void reload() { + this.loadIdiomaTable(); + } + + private void loadIdiomaTable() { + List idiomas = this.idiomaRepository.getAll(); + BaseTableModel model = this.view.getIdiomaTableModel(); + model.addRows(idiomas); + } + + public IdiomaListPanel getView() { + return view; + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaUpdateController.java b/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaUpdateController.java new file mode 100644 index 0000000..eac38f0 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaUpdateController.java @@ -0,0 +1,96 @@ +package xyz.danielcortes.controllers.idioma; + +import java.util.List; +import javax.swing.JComboBox; +import javax.swing.JOptionPane; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.repository.IdiomaRepository; +import xyz.danielcortes.views.idioma.IdiomaUpdatePanel; + +public class IdiomaUpdateController { + + private IdiomaUpdatePanel view; + private IdiomaRepository idiomaRepository; + + public IdiomaUpdateController(IdiomaUpdatePanel view) { + this.view = view; + this.idiomaRepository = new IdiomaRepository(); + this.setupListeners(); + } + + private void setupListeners() { + this.view.getIdiomaCombo().addActionListener(e -> { + Idioma selected = (Idioma) this.view.getIdiomaCombo().getSelectedItem(); + if(selected != null) + this.view.getNombreField().setText(selected.getNombre()); + }); + this.view.getNombreField().addActionListener(e -> this.update()); + this.view.getActualizarButton().addActionListener(e -> this.update()); + } + + private void update() { + Idioma original = (Idioma) this.view.getIdiomaCombo().getSelectedItem(); + if (!validateOriginal(original)) return; + + String nombre = this.view.getNombreField().getText(); + if (!validateNombre(nombre)) return; + + assert original != null; + original.setNombre(nombre); + idiomaRepository.update(original); + + this.view.getNombreField().setText(""); + this.loadIdiomaCombo(); + this.view.getNombreField().requestFocus(); + } + + private boolean validateOriginal(Idioma original) { + if (original == null) { + JOptionPane.showMessageDialog( + null, + "No hay Idioma seleccionado", + "Error", + JOptionPane.ERROR_MESSAGE + ); + return false; + } + return true; + } + + private boolean validateNombre(String nombre) { + if (nombre == null) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } else if (nombre.isEmpty()) { + JOptionPane.showMessageDialog( + this.view.getContentPane(), + "El nombre esta vacío", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + public void reload() { + this.loadIdiomaCombo(); + } + + private void loadIdiomaCombo() { + List idiomas = this.idiomaRepository.getAll(); + JComboBox combobox = this.view.getIdiomaCombo(); + combobox.removeAllItems(); + for (Idioma idioma : idiomas) { + combobox.addItem(idioma); + } + } + + public IdiomaUpdatePanel getView() { + return view; + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/libro/LibroCreateController.java b/src/main/java/xyz/danielcortes/controllers/libro/LibroCreateController.java new file mode 100644 index 0000000..45091fd --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/libro/LibroCreateController.java @@ -0,0 +1,159 @@ +package xyz.danielcortes.controllers.libro; + +import java.time.Year; +import java.util.HashSet; +import java.util.List; +import javax.swing.DefaultListModel; +import javax.swing.JComboBox; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.models.Libro; +import xyz.danielcortes.repository.AutorRepository; +import xyz.danielcortes.repository.CategoriaRepository; +import xyz.danielcortes.repository.EditorialRepository; +import xyz.danielcortes.repository.IdiomaRepository; +import xyz.danielcortes.repository.LibroRepository; +import xyz.danielcortes.views.libro.LibroCreatePanel; + +public class LibroCreateController { + private IdiomaRepository idiomaRepository; + private CategoriaRepository categoriaRepository; + private AutorRepository autorRepository; + private EditorialRepository editorialRepository; + + private LibroRepository libroRepository; + + private LibroCreatePanel view; + private LibroValidator validator; + + public LibroCreateController(LibroCreatePanel view) { + this.idiomaRepository = new IdiomaRepository(); + this.categoriaRepository = new CategoriaRepository(); + this.autorRepository = new AutorRepository(); + this.editorialRepository = new EditorialRepository(); + + this.libroRepository = new LibroRepository(); + this.validator = new LibroValidator(this.libroRepository); + this.view = view; + + this.loadIdiomasList(); + this.loadCategoriasList(); + this.loadAutorList(); + this.loadEditorialCombo(); + + this.setupListeners(); + } + + private void setupListeners() { + this.view.getGuardarButton().addActionListener(e -> save()); + } + + private void save() { + String serie = this.view.getSerieField().getText(); + if(!validator.validateSerie(serie)) return; + + String isbn = this.view.getIsbnField().getText(); + if(!validator.validateISBN(isbn)) return; + isbn = isbn.replaceAll("[^\\d]", ""); + + String titulo = this.view.getTituloField().getText(); + if(!validator.validateTitulo(titulo)) return; + + String numeroPaginas = this.view.getPaginasField().getText(); + if(!validator.validateNumeroPaginas(numeroPaginas)) return; + + String anoPublicacion = this.view.getAnoPublicacionField().getText(); + if(!validator.validateAnoPublicacion(anoPublicacion)) return; + + String precioReferencial = this.view.getPrecioReferenciaField().getText(); + if(!validator.validatePrecioReferencia(precioReferencial)) return; + + List idiomas = this.view.getIdiomasList().getSelectedValuesList(); + if(!validator.validateIdiomas(idiomas)) return; + + List autores = this.view.getAutoresList().getSelectedValuesList(); + if(!validator.validateAutores(autores)) return; + + List categorias = this.view.getCategoriasList().getSelectedValuesList(); + if(!validator.validateCategorias(categorias)) return; + + Editorial editorial = (Editorial) this.view.getEditorialCombo().getSelectedItem(); + if(!validator.validateEditorial(editorial)) return; + + Libro libro = new Libro(); + libro.setSerie(serie); + libro.setIsbn(isbn); + libro.setTitulo(titulo); + libro.setNumeroPaginas(Integer.parseInt(numeroPaginas)); + libro.setAnoPublicacion(Year.of(Integer.parseInt(anoPublicacion))); + libro.setPrecioReferencia(Integer.parseInt(precioReferencial)); + libro.setIdiomas(new HashSet<>(idiomas)); + libro.setAutores(new HashSet<>(autores)); + libro.setCategorias(new HashSet<>(categorias)); + libro.setEditorial(editorial); + + this.libroRepository.save(libro); + + this.view.getSerieField().setText(""); + this.view.getIsbnField().setText(""); + this.view.getTituloField().setText(""); + this.view.getPaginasField().setText(""); + this.view.getAnoPublicacionField().setText(""); + this.view.getPrecioReferenciaField().setText(""); + this.view.getIdiomasList().setSelectedIndices(new int[]{}); + this.view.getAutoresList().setSelectedIndices(new int[]{}); + this.view.getCategoriasList().setSelectedIndices(new int[]{}); + this.view.getEditorialCombo().setSelectedIndex(0); + this.view.getSerieField().requestFocus(); + } + + public void reload() { + loadIdiomasList(); + loadCategoriasList(); + loadAutorList(); + loadEditorialCombo(); + } + + private void loadIdiomasList() { + List idiomas = idiomaRepository.getAll(); + DefaultListModel model = this.view.getIdiomasModel(); + model.clear(); + for (Idioma idioma : idiomas) { + model.addElement(idioma); + } + } + + private void loadCategoriasList() { + List categorias = categoriaRepository.getAll(); + DefaultListModel model = this.view.getCategoriasModel(); + model.clear(); + for (Categoria categoria: categorias) { + model.addElement(categoria); + } + } + + private void loadAutorList() { + List autores = autorRepository.getAll(); + DefaultListModel model = this.view.getAutoresModel(); + model.clear(); + for (Autor autor: autores) { + model.addElement(autor); + } + } + + private void loadEditorialCombo(){ + List editoriales = this.editorialRepository.getAll(); + JComboBox combobox = this.view.getEditorialCombo(); + combobox.removeAllItems(); + for(Editorial editorial: editoriales) { + combobox.addItem(editorial); + } + } + + public LibroCreatePanel getView() { + return view; + } + +} diff --git a/src/main/java/xyz/danielcortes/controllers/libro/LibroDeleteController.java b/src/main/java/xyz/danielcortes/controllers/libro/LibroDeleteController.java new file mode 100644 index 0000000..4247ebf --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/libro/LibroDeleteController.java @@ -0,0 +1,51 @@ +package xyz.danielcortes.controllers.libro; + +import java.util.List; +import javax.swing.JComboBox; +import xyz.danielcortes.models.Libro; +import xyz.danielcortes.repository.LibroRepository; +import xyz.danielcortes.views.libro.LibroDeletePanel; + +public class LibroDeleteController { + + private LibroDeletePanel view; + private LibroValidator validator; + private LibroRepository libroRepository; + + public LibroDeleteController(LibroDeletePanel view) { + this.view = view; + this.libroRepository = new LibroRepository(); + this.validator = new LibroValidator(this.libroRepository); + this.loadLibroCombo(); + this.setupListeners(); + } + + private void setupListeners() { + this.view.getEliminarButton().addActionListener(e -> this.delete()); + } + + private void delete() { + Libro selected = (Libro) this.view.getLibroCombo().getSelectedItem(); + if(!validator.validateLibro(selected)) return; + + this.libroRepository.delete(selected); + this.reload(); + } + + public void reload() { + this.loadLibroCombo(); + } + + private void loadLibroCombo() { + List libros = this.libroRepository.getAll(); + JComboBox combobox = this.view.getLibroCombo(); + combobox.removeAllItems(); + for(Libro libro: libros){ + combobox.addItem(libro); + } + } + + public LibroDeletePanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/libro/LibroListController.java b/src/main/java/xyz/danielcortes/controllers/libro/LibroListController.java new file mode 100644 index 0000000..20d3038 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/libro/LibroListController.java @@ -0,0 +1,33 @@ +package xyz.danielcortes.controllers.libro; + +import java.util.List; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Libro; +import xyz.danielcortes.repository.LibroRepository; +import xyz.danielcortes.views.libro.LibroListPanel; + +public class LibroListController { + + private LibroListPanel view; + private LibroRepository libroRepository; + + public LibroListController(LibroListPanel view) { + this.view = view; + this.libroRepository = new LibroRepository(); + this.loadLibroTable(); + } + + public void reload() { + this.loadLibroTable(); + } + + private void loadLibroTable() { + List libros = this.libroRepository.getAll(); + BaseTableModel model = this.view.getLibrosModel(); + model.addRows(libros); + } + + public LibroListPanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/libro/LibroUpdateController.java b/src/main/java/xyz/danielcortes/controllers/libro/LibroUpdateController.java new file mode 100644 index 0000000..b2cc911 --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/libro/LibroUpdateController.java @@ -0,0 +1,182 @@ +package xyz.danielcortes.controllers.libro; + +import java.time.Year; +import java.util.HashSet; +import java.util.List; +import javax.swing.DefaultListModel; +import javax.swing.JComboBox; +import xyz.danielcortes.framework.JListUtils; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.models.Libro; +import xyz.danielcortes.repository.AutorRepository; +import xyz.danielcortes.repository.CategoriaRepository; +import xyz.danielcortes.repository.EditorialRepository; +import xyz.danielcortes.repository.IdiomaRepository; +import xyz.danielcortes.repository.LibroRepository; +import xyz.danielcortes.views.libro.LibroUpdatePanel; + +public class LibroUpdateController { + + private LibroUpdatePanel view; + private LibroValidator validator; + private LibroRepository libroRepository; + + private IdiomaRepository idiomaRepository; + private CategoriaRepository categoriaRepository; + private AutorRepository autorRepository; + private EditorialRepository editorialRepository; + + public LibroUpdateController(LibroUpdatePanel view) { + this.view = view; + this.libroRepository = new LibroRepository(); + this.validator = new LibroValidator(this.libroRepository); + + this.idiomaRepository = new IdiomaRepository(); + this.categoriaRepository = new CategoriaRepository(); + this.autorRepository = new AutorRepository(); + this.editorialRepository = new EditorialRepository(); + this.setupListeners(); + } + + private void setupListeners() { + this.view.getLibroCombo().addActionListener(e -> { + Libro libro = (Libro) this.view.getLibroCombo().getSelectedItem(); + if (libro == null) + return; + this.view.getSerieField().setText(String.valueOf(libro.getSerie())); + this.view.getIsbnField().setText(libro.getIsbn()); + this.view.getTituloField().setText(libro.getTitulo()); + this.view.getPaginasField().setText(String.valueOf(libro.getNumeroPaginas())); + this.view.getAnoPublicacionField().setText(String.valueOf(libro.getAnoPublicacion())); + this.view.getPrecioReferenciaField().setText(String.valueOf(libro.getPrecioReferencia())); + JListUtils.setSelectedValues( + this.view.getIdiomasList(), + libro.getIdiomas() + ); + JListUtils.setSelectedValues( + this.view.getAutoresList(), + libro.getAutores() + ); + JListUtils.setSelectedValues( + this.view.getCategoriasList(), + libro.getCategorias() + ); + this.view.getEditorialCombo().setSelectedItem(libro.getEditorial()); + }); + this.view.getActualizarButton().addActionListener(e -> update()); + } + + private void update() { + // @formatter:off + Libro original = (Libro) this.view.getLibroCombo().getSelectedItem(); + if(!validator.validateLibro(original)) return; + + String serie = this.view.getSerieField().getText(); + if(!validator.validateSerie(serie, original)) return; + + String isbn = this.view.getIsbnField().getText(); + if(!validator.validateISBN(isbn)) return; + isbn = isbn.replaceAll("[^\\d]", ""); + + String titulo = this.view.getTituloField().getText(); + if(!validator.validateTitulo(titulo)) return; + + String numeroPaginas = this.view.getPaginasField().getText(); + if(!validator.validateNumeroPaginas(numeroPaginas)) return; + + String anoPublicacion = this.view.getAnoPublicacionField().getText(); + if(!validator.validateAnoPublicacion(anoPublicacion)) return; + + String precioReferencial = this.view.getPrecioReferenciaField().getText(); + if(!validator.validatePrecioReferencia(precioReferencial)) return; + + List idiomas = this.view.getIdiomasList().getSelectedValuesList(); + if(!validator.validateIdiomas(idiomas)) return; + + List autores = this.view.getAutoresList().getSelectedValuesList(); + if(!validator.validateAutores(autores)) return; + + List categorias = this.view.getCategoriasList().getSelectedValuesList(); + if(!validator.validateCategorias(categorias)) return; + + Editorial editorial = (Editorial) this.view.getEditorialCombo().getSelectedItem(); + if(!validator.validateEditorial(editorial)) return; + // @formatter:on + + assert original != null; + + original.setSerie(serie); + original.setIsbn(isbn); + original.setTitulo(titulo); + original.setNumeroPaginas(Integer.parseInt(numeroPaginas)); + original.setAnoPublicacion(Year.of(Integer.parseInt(anoPublicacion))); + original.setPrecioReferencia(Integer.parseInt(precioReferencial)); + original.setIdiomas(new HashSet<>(idiomas)); + original.setAutores(new HashSet<>(autores)); + original.setCategorias(new HashSet<>(categorias)); + original.setEditorial(editorial); + + this.libroRepository.update(original); + this.reload(); + } + + public void reload() { + this.loadLibrosCombo(); + this.loadAutorList(); + this.loadCategoriasList(); + this.loadEditorialCombo(); + this.loadIdiomasList(); + } + + private void loadLibrosCombo() { + List libros = libroRepository.getAll(); + JComboBox model = this.view.getLibroCombo(); + model.removeAllItems(); + for (Libro libro : libros) { + model.addItem(libro); + } + } + + private void loadIdiomasList() { + List idiomas = idiomaRepository.getAll(); + DefaultListModel model = this.view.getIdiomasModel(); + model.clear(); + for (Idioma idioma : idiomas) { + model.addElement(idioma); + } + } + + private void loadCategoriasList() { + List categorias = categoriaRepository.getAll(); + DefaultListModel model = this.view.getCategoriasModel(); + model.clear(); + for (Categoria categoria : categorias) { + model.addElement(categoria); + } + } + + private void loadAutorList() { + List autores = autorRepository.getAll(); + DefaultListModel model = this.view.getAutoresModel(); + model.clear(); + for (Autor autor : autores) { + model.addElement(autor); + } + } + + private void loadEditorialCombo() { + List editoriales = this.editorialRepository.getAll(); + JComboBox combobox = this.view.getEditorialCombo(); + combobox.removeAllItems(); + for (Editorial editorial : editoriales) { + combobox.addItem(editorial); + } + } + + public LibroUpdatePanel getView() { + return view; + } +} diff --git a/src/main/java/xyz/danielcortes/controllers/libro/LibroValidator.java b/src/main/java/xyz/danielcortes/controllers/libro/LibroValidator.java new file mode 100644 index 0000000..e6db6cb --- /dev/null +++ b/src/main/java/xyz/danielcortes/controllers/libro/LibroValidator.java @@ -0,0 +1,350 @@ +package xyz.danielcortes.controllers.libro; + +import java.util.List; +import java.util.Objects; +import javax.swing.JOptionPane; +import xyz.danielcortes.framework.GeneralValidator; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.models.Libro; +import xyz.danielcortes.repository.LibroRepository; + +public class LibroValidator { + + private LibroRepository libroRepository; + + LibroValidator(LibroRepository libroRepository) { + this.libroRepository = libroRepository; + } + + boolean validateLibro(Libro libro) { + if (libro == null) { + JOptionPane.showMessageDialog( + null, + "No hay Libro seleccionado", + "Error", + JOptionPane.ERROR_MESSAGE + ); + return false; + } + return true; + } + + boolean validateSerie(String serie) { + if (serie == null) { + JOptionPane.showMessageDialog( + null, + "La serie es nula", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (serie.isEmpty()) { + JOptionPane.showMessageDialog( + null, + "La serie esta vacia", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (!GeneralValidator.isLong(serie)) { + JOptionPane.showMessageDialog( + null, + "La serie no es numero valido", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } + + boolean validateSerie(String serie, Libro original) { + if (!validateSerie(serie)) + return false; + + Integer s = Integer.parseInt(serie); + if (libroRepository.exists(s, original.getId())) { + JOptionPane.showMessageDialog( + null, + "El numero de serie ya existe", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } + + boolean validateISBN(String isbn) { + if (isbn == null) { + JOptionPane.showMessageDialog( + null, + "El ISBN es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (isbn.isEmpty()) { + JOptionPane.showMessageDialog( + null, + "El ISBN esta vacio", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + isbn = isbn.replaceAll("[^\\d]", ""); + if ((isbn.length() == 13 && !ISBN13CheckSum(isbn)) + || (isbn.length() == 10 && !ISBN10CheckSum(isbn)) + || (isbn.length() != 10 && isbn.length() != 13)) { + JOptionPane.showMessageDialog( + null, + "El ISBN no es valido", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + boolean validateTitulo(String titulo) { + if (titulo == null) { + JOptionPane.showMessageDialog( + null, + "El titulo es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (titulo.isEmpty()) { + JOptionPane.showMessageDialog( + null, + "El titulo esta vacio", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + boolean validateNumeroPaginas(String numeroPaginas) { + if (numeroPaginas == null) { + JOptionPane.showMessageDialog( + null, + "El numero de paginas es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (numeroPaginas.isEmpty()) { + JOptionPane.showMessageDialog( + null, + "El numero de paginas esta vacio", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (!GeneralValidator.isInteger(numeroPaginas)) { + JOptionPane.showMessageDialog( + null, + "El numero de paginas no es un numero", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } + + boolean validatePrecioReferencia(String precioReferencia) { + if (precioReferencia == null) { + JOptionPane.showMessageDialog( + null, + "El precio referencial es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (precioReferencia.isEmpty()) { + JOptionPane.showMessageDialog( + null, + "El precio referencial esta vacio", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (!GeneralValidator.isInteger(precioReferencia)) { + JOptionPane.showMessageDialog( + null, + "El precio referencial no es un numero", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } + + boolean validateAnoPublicacion(String anoPublicacion) { + if (anoPublicacion == null) { + JOptionPane.showMessageDialog( + null, + "El año de publicacion es nulo", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (anoPublicacion.isEmpty()) { + JOptionPane.showMessageDialog( + null, + "El año de publicacion esta vacio", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (!GeneralValidator.isInteger(anoPublicacion)) { + JOptionPane.showMessageDialog( + null, + "El año de publicacion no es un numero", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (!GeneralValidator.isYear(anoPublicacion)) { + JOptionPane.showMessageDialog( + null, + "El año de publicacion no es un año valido", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + return true; + } + + boolean validateIdiomas(List idiomas) { + if (idiomas.size() == 0) { + JOptionPane.showMessageDialog( + null, + "No hay idiomas seleccionados", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (idiomas.stream().anyMatch(Objects::isNull)) { + JOptionPane.showMessageDialog( + null, + "Se selecciono un idioma no existente", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } + + boolean validateAutores(List autores) { + if (autores.size() == 0) { + JOptionPane.showMessageDialog( + null, + "No hay autores seleccionados", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (autores.stream().anyMatch(Objects::isNull)) { + JOptionPane.showMessageDialog( + null, + "Se selecciono un autor no existente", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } + + boolean validateCategorias(List categorias) { + if (categorias.size() == 0) { + JOptionPane.showMessageDialog( + null, + "No hay autores seleccionados", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + if (categorias.stream().anyMatch(Objects::isNull)) { + JOptionPane.showMessageDialog( + null, + "Se selecciono una categoria no existente", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } + + boolean validateEditorial(Editorial editorial) { + if (editorial == null) { + JOptionPane.showMessageDialog( + null, + "No hay editorial seleccionada", + "Error", + JOptionPane.ERROR_MESSAGE); + return false; + } + + return true; + } + + private boolean ISBN10CheckSum(String isbn) { + if (isbn.length() != 10) + return false; + + int sum = 0; + for (int i = 0; i < 9; i++) { + int digit = isbn.charAt(i) - '0'; + if (0 > digit || 9 < digit) + return false; + sum += (digit * (10 - i)); + } + + char last = isbn.charAt(9); + if ((last != 'X') && ((last < '0') || (last > '9'))) + return false; + + if (last == 'X') + sum += 10; + else + sum += last - '0'; + + return (sum % 11 == 0); + } + + private boolean ISBN13CheckSum(String isbn) { + if (isbn.length() != 13) + return false; + + int sum = 0; + for (int i = 0; i < 12; i++) { + int digit = isbn.charAt(i) - '0'; + if (0 > digit || 9 < digit) + return false; + if (i % 2 == 0) { + sum += digit; + } else { + sum += digit * 3; + } + } + + char last = isbn.charAt(12); + if (((last < '0') || (last > '9'))) + return false; + + return (10 - (sum % 10) == last - '0'); + } + +} diff --git a/src/main/java/xyz/danielcortes/framework/BaseTableModel.java b/src/main/java/xyz/danielcortes/framework/BaseTableModel.java new file mode 100644 index 0000000..21d028f --- /dev/null +++ b/src/main/java/xyz/danielcortes/framework/BaseTableModel.java @@ -0,0 +1,105 @@ +package xyz.danielcortes.framework; + +import java.util.ArrayList; +import java.util.List; +import javax.swing.table.AbstractTableModel; + +/** + * Este es el TableModel que usare para todas las tablas que creare en el sistema + * Esto es debido a la falta de metodos de edicion directa comoda que existe en el modelo default + * es por esto que se usa el generico, para poder entregar y recibir el objeto directamente + * sin embargo, debido a esto sera necesario otorgar una TriFunction la cual debe resolver cual es el valor + * que es entregado al momento de solicitar un valor en la tabla. + * Ademas de necesitar que se definan los nombres de las columnas para funcionar. + * Supongo que es mas bonito que definir todo aparte XD <3 + * + */ +public class BaseTableModel extends AbstractTableModel { + + private String[] columns; + private List rows; + private TriFunction, Integer, Integer, Object> valueAt; + + /** + * Crea un BaseModel, para esto sera necesario otorgar las columnas que tendra la tabla y una funcion + * que calcule que valor se mostrara en una posicion de la tabla. + * + * @param columns + * Lista de columnas que tendra la tabla de la forma: + * {"Columna 1", "Columna 2", "Columna 3"}; + * + * + * @param valueAt + * TriFunction la cual recibe por parametros: + * - La lista de filas de la tabla + * - Un Integer indicando la fila del que se necesita el valor + * - Un Integer indicando la columna de la que se necesita el valor + * Y esta debe retornar un objeto con toString para poder ser mostrado en la tabla + * + * Se sugiere el siguiente tipo de implementacion para la funcion + * (row, rowIndex, colIndex) -> { + * switch (colIndex) { + * case 0: + * return row.get(rowIndex).getColumn1(); + * case 1: + * return row.get(rowIndex).getColumn2(); + * case 2: + * return row.get(rowIndex).getColumn3(); + * case 3: + * return row.get(rowIndex).getColumn4(); + * } + * return null; + * } + * + */ + public BaseTableModel(String[] columns, TriFunction, Integer, Integer, Object> valueAt) { + super(); + this.columns = columns; + this.valueAt = valueAt; + this.rows = new ArrayList<>(); + } + + @Override + public String getColumnName(int index) { + return columns[index]; + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + return valueAt.apply(this.rows, rowIndex, columnIndex); + } + + @Override + public int getRowCount() { + return rows.size(); + } + + @Override + public int getColumnCount() { + return columns.length; + } + + public void addRow(T item) { + rows.add(item); + this.fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1); + } + + public void addRows(List items) { + rows.clear(); + rows.addAll(items); + this.fireTableRowsInserted(0, getRowCount() - 1); + } + + public void removeRow(int row) { + rows.remove(row); + this.fireTableRowsDeleted(row, row); + } + + public void removeRows() { + int rowCount = this.getRowCount(); + if (rowCount > 0) { + rows.clear(); + this.fireTableRowsDeleted(0, rowCount - 1); + } + } +} diff --git a/src/main/java/xyz/danielcortes/framework/GeneralValidator.java b/src/main/java/xyz/danielcortes/framework/GeneralValidator.java new file mode 100644 index 0000000..bed99fa --- /dev/null +++ b/src/main/java/xyz/danielcortes/framework/GeneralValidator.java @@ -0,0 +1,33 @@ +package xyz.danielcortes.framework; + +import java.time.DateTimeException; +import java.time.Year; + +public class GeneralValidator { + public static boolean isLong(String number) { + try { + Long.parseLong(number); + } catch (NumberFormatException e) { + return false; + } + return true; + } + + public static boolean isInteger(String number) { + try { + Integer.parseInt(number); + } catch (NumberFormatException e) { + return false; + } + return true; + } + + public static boolean isYear(String year) { + try { + Year.of(Integer.parseInt(year)); + } catch (NumberFormatException | DateTimeException e) { + return false; + } + return true; + } +} diff --git a/src/main/java/xyz/danielcortes/framework/JListUtils.java b/src/main/java/xyz/danielcortes/framework/JListUtils.java new file mode 100644 index 0000000..0445ada --- /dev/null +++ b/src/main/java/xyz/danielcortes/framework/JListUtils.java @@ -0,0 +1,29 @@ +package xyz.danielcortes.framework; + +import java.util.Set; +import javax.swing.JList; +import javax.swing.ListModel; + +public class JListUtils { + public static void setSelectedValues(JList list, Set values) { + list.clearSelection(); + for (Object value : values) { + int index = getIndex(list.getModel(), value); + if (index >= 0) { + list.addSelectionInterval(index, index); + } + } + list.ensureIndexIsVisible(list.getSelectedIndex()); + } + + private static int getIndex(ListModel model, Object value) { + if (value == null) { + return -1; + } + for (int i = 0; i < model.getSize(); i++) { + if (value.equals(model.getElementAt(i))) + return i; + } + return -1; + } +} diff --git a/src/main/java/xyz/danielcortes/framework/PanelName.java b/src/main/java/xyz/danielcortes/framework/PanelName.java new file mode 100644 index 0000000..8f5e97b --- /dev/null +++ b/src/main/java/xyz/danielcortes/framework/PanelName.java @@ -0,0 +1,30 @@ +package xyz.danielcortes.framework; + +public enum PanelName { + EMPTY, + + LIBRO_LIST, + LIBRO_CREATE, + LIBRO_UPDATE, + LIBRO_DELETE, + + IDIOMA_LIST, + IDIOMA_CREATE, + IDIOMA_UPDATE, + IDIOMA_DELETE, + + CATEGORIA_LIST, + CATEGORIA_CREATE, + CATEGORIA_UPDATE, + CATEGORIA_DELETE, + + EDITORIAL_LIST, + EDITORIAL_CREATE, + EDITORIAL_UPDATE, + EDITORIAL_DELETE, + + AUTOR_LIST, + AUTOR_CREATE, + AUTOR_UPDATE, + AUTOR_DELETE +} diff --git a/src/main/java/xyz/danielcortes/framework/PersistenceManager.java b/src/main/java/xyz/danielcortes/framework/PersistenceManager.java new file mode 100644 index 0000000..4fcd5ae --- /dev/null +++ b/src/main/java/xyz/danielcortes/framework/PersistenceManager.java @@ -0,0 +1,31 @@ +package xyz.danielcortes.framework; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.Persistence; + +public class PersistenceManager { + + private static EntityManagerFactory factory; + private static EntityManager em; + + static { + factory = Persistence.createEntityManagerFactory("jpa"); + em = factory.createEntityManager(); + } + + + public static EntityManager getEntityManager() { + return em; + } + + public static void close() { + if (factory != null) { + factory.close(); + } + + if (em != null) { + em.close(); + } + } +} diff --git a/src/main/java/xyz/danielcortes/framework/TriFunction.java b/src/main/java/xyz/danielcortes/framework/TriFunction.java new file mode 100644 index 0000000..df823a0 --- /dev/null +++ b/src/main/java/xyz/danielcortes/framework/TriFunction.java @@ -0,0 +1,5 @@ +package xyz.danielcortes.framework; + +public interface TriFunction { + D apply(A a, B b, C c); +} diff --git a/src/main/java/xyz/danielcortes/framework/YearAttributeConverter.java b/src/main/java/xyz/danielcortes/framework/YearAttributeConverter.java new file mode 100644 index 0000000..de5249b --- /dev/null +++ b/src/main/java/xyz/danielcortes/framework/YearAttributeConverter.java @@ -0,0 +1,24 @@ +package xyz.danielcortes.framework; + +import java.time.Year; +import javax.persistence.AttributeConverter; + +public class YearAttributeConverter implements AttributeConverter { + + + @Override + public Integer convertToDatabaseColumn(Year year) { + if (year != null) + return year.getValue(); + else + return null; + } + + @Override + public Year convertToEntityAttribute(Integer integer) { + if (integer != null) + return Year.of(integer); + else + return null; + } +} diff --git a/src/main/java/xyz/danielcortes/models/Autor.java b/src/main/java/xyz/danielcortes/models/Autor.java new file mode 100644 index 0000000..53e6e02 --- /dev/null +++ b/src/main/java/xyz/danielcortes/models/Autor.java @@ -0,0 +1,77 @@ +package xyz.danielcortes.models; + +import java.util.Set; +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 = "autor") +public class Autor { + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "nombre") + private String nombre; + + @Column(name = "apellido_paterno") + private String apellidoPaterno; + + @Column(name = "apellido_materno") + private String apellidoMaterno; + + @ManyToMany(mappedBy = "autores") + private Set libros; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + 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 Set getLibros() { + return libros; + } + + public void setLibros(Set libros) { + this.libros = libros; + } + + @Override + public String toString() { + return this.nombre + " " + this.apellidoPaterno + " " + this.apellidoMaterno; + } +} diff --git a/src/main/java/xyz/danielcortes/models/Categoria.java b/src/main/java/xyz/danielcortes/models/Categoria.java new file mode 100644 index 0000000..9b2a82c --- /dev/null +++ b/src/main/java/xyz/danielcortes/models/Categoria.java @@ -0,0 +1,55 @@ +package xyz.danielcortes.models; + +import java.util.Set; +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 = "categoria") +public class Categoria { + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "nombre") + private String nombre; + + @ManyToMany(mappedBy = "categorias") + private Set libros; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public Set getLibros() { + return libros; + } + + public void setLibros(Set libros) { + this.libros = libros; + } + + @Override + public String toString() { + return this.nombre; + } +} diff --git a/src/main/java/xyz/danielcortes/models/Editorial.java b/src/main/java/xyz/danielcortes/models/Editorial.java new file mode 100644 index 0000000..b76fd17 --- /dev/null +++ b/src/main/java/xyz/danielcortes/models/Editorial.java @@ -0,0 +1,55 @@ +package xyz.danielcortes.models; + +import java.util.Set; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "editorial") +public class Editorial { + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "nombre") + private String nombre; + + @OneToMany(mappedBy = "editorial") + private Set libros; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public Set getLibros() { + return libros; + } + + public void setLibros(Set libros) { + this.libros = libros; + } + + @Override + public String toString() { + return this.nombre; + } +} diff --git a/src/main/java/xyz/danielcortes/models/Estado.java b/src/main/java/xyz/danielcortes/models/Estado.java new file mode 100644 index 0000000..c7f9997 --- /dev/null +++ b/src/main/java/xyz/danielcortes/models/Estado.java @@ -0,0 +1,55 @@ +package xyz.danielcortes.models; + +import java.util.Set; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; + +@Entity +@Table(name = "estado") +public class Estado { + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "nombre") + private String nombre; + + @OneToMany(mappedBy = "estado") + private Set libros; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public Set getLibros() { + return libros; + } + + public void setLibros(Set libros) { + this.libros = libros; + } + + @Override + public String toString() { + return this.nombre; + } +} diff --git a/src/main/java/xyz/danielcortes/models/Idioma.java b/src/main/java/xyz/danielcortes/models/Idioma.java new file mode 100644 index 0000000..2d24d8d --- /dev/null +++ b/src/main/java/xyz/danielcortes/models/Idioma.java @@ -0,0 +1,55 @@ +package xyz.danielcortes.models; + +import java.util.Set; +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 = "idioma") +public class Idioma { + + @Id + @GeneratedValue(strategy= GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "nombre") + private String nombre; + + @ManyToMany(mappedBy = "idiomas") + private Set libros; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNombre() { + return nombre; + } + + public void setNombre(String nombre) { + this.nombre = nombre; + } + + public Set getLibros() { + return libros; + } + + public void setLibros(Set libros) { + this.libros = libros; + } + + @Override + public String toString() { + return this.nombre; + } +} diff --git a/src/main/java/xyz/danielcortes/models/Libro.java b/src/main/java/xyz/danielcortes/models/Libro.java new file mode 100644 index 0000000..a933a31 --- /dev/null +++ b/src/main/java/xyz/danielcortes/models/Libro.java @@ -0,0 +1,179 @@ +package xyz.danielcortes.models; + +import java.time.Year; +import java.util.Set; +import javax.persistence.Column; +import javax.persistence.Convert; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.JoinTable; +import javax.persistence.ManyToMany; +import javax.persistence.ManyToOne; +import javax.persistence.Table; +import xyz.danielcortes.framework.YearAttributeConverter; + +@Entity +@Table(name = "libro") +public class Libro { + + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name = "id", nullable = false) + private Integer id; + + @Column(name = "serie", unique = true) + private String serie; + + @Column(name = "isbn", nullable = false) + private String isbn; + + @Column(name = "titulo") + private String titulo; + + @Column(name = "numero_paginas", nullable = false) + private int numeroPaginas; + + @Column(name = "precio_referencia", nullable = false) + private int precioReferencia; + + @Column(name = "ano_publicacion", columnDefinition = "int") + @Convert(converter = YearAttributeConverter.class) + private Year anoPublicacion; + + @ManyToMany + @JoinTable( + name = "libro_idioma", + joinColumns = @JoinColumn(name = "libro_id", referencedColumnName = "id"), + inverseJoinColumns = @JoinColumn(name = "idioma_id", referencedColumnName = "id") + ) + private Set idiomas; + + @ManyToMany + @JoinTable( + name = "libro_autor", + joinColumns = @JoinColumn(name = "libro_id", referencedColumnName = "id"), + inverseJoinColumns = @JoinColumn(name = "autor_id", referencedColumnName = "id") + ) + private Set autores; + + @ManyToMany + @JoinTable( + name = "libro_categoria", + joinColumns = @JoinColumn(name = "libro_id", referencedColumnName = "id"), + inverseJoinColumns = @JoinColumn(name = "categoria_id", referencedColumnName = "id") + ) + private Set categorias; + + @ManyToOne + @JoinColumn(name = "editorial_id") + private Editorial editorial; + + @ManyToOne + @JoinColumn(name = "estado_id") + private Estado estado; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getSerie() { + return serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public String getIsbn() { + return isbn; + } + + public void setIsbn(String isbn) { + this.isbn = isbn; + } + + public String getTitulo() { + return titulo; + } + + public void setTitulo(String titulo) { + this.titulo = titulo; + } + + public int getNumeroPaginas() { + return numeroPaginas; + } + + public void setNumeroPaginas(int numeroPaginas) { + this.numeroPaginas = numeroPaginas; + } + + public int getPrecioReferencia() { + return precioReferencia; + } + + public void setPrecioReferencia(int precioReferencia) { + this.precioReferencia = precioReferencia; + } + + public Year getAnoPublicacion() { + return anoPublicacion; + } + + public void setAnoPublicacion(Year anoPublicacion) { + this.anoPublicacion = anoPublicacion; + } + + public Set getIdiomas() { + return idiomas; + } + + public void setIdiomas(Set idiomas) { + this.idiomas = idiomas; + } + + public Set getAutores() { + return autores; + } + + public void setAutores(Set autores) { + this.autores = autores; + } + + public Set getCategorias() { + return categorias; + } + + public void setCategorias(Set categorias) { + this.categorias = categorias; + } + + public Editorial getEditorial() { + return editorial; + } + + public void setEditorial(Editorial editorial) { + this.editorial = editorial; + } + + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado estado) { + this.estado = estado; + } + + @Override + public String toString() { + return this.serie + " " + this.isbn + " " + this.titulo; + } +} + diff --git a/src/main/java/xyz/danielcortes/repository/AutorRepository.java b/src/main/java/xyz/danielcortes/repository/AutorRepository.java new file mode 100644 index 0000000..02ea1b6 --- /dev/null +++ b/src/main/java/xyz/danielcortes/repository/AutorRepository.java @@ -0,0 +1,37 @@ +package xyz.danielcortes.repository; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import xyz.danielcortes.framework.PersistenceManager; +import xyz.danielcortes.models.Autor; + +public class AutorRepository { + private EntityManager em; + + public AutorRepository() { this.em = PersistenceManager.getEntityManager(); } + + public List getAll() { + TypedQuery query = em.createQuery("SELECT a FROM Autor a", Autor.class); + return query.getResultList(); + } + + public void save(Autor autor) { + em.getTransaction().begin(); + em.persist(autor); + em.getTransaction().commit(); + } + + public void update(Autor autor) { + em.getTransaction().begin(); + em.merge(autor); + em.getTransaction().commit(); + } + + public void delete(Autor autor) { + em.getTransaction().begin(); + em.remove(autor); + em.getTransaction().commit(); + } + +} diff --git a/src/main/java/xyz/danielcortes/repository/CategoriaRepository.java b/src/main/java/xyz/danielcortes/repository/CategoriaRepository.java new file mode 100644 index 0000000..41b6a0d --- /dev/null +++ b/src/main/java/xyz/danielcortes/repository/CategoriaRepository.java @@ -0,0 +1,37 @@ +package xyz.danielcortes.repository; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import xyz.danielcortes.framework.PersistenceManager; +import xyz.danielcortes.models.Categoria; + +public class CategoriaRepository { + private EntityManager em; + + public CategoriaRepository() { + this.em = PersistenceManager.getEntityManager(); + } + + public List getAll() { + TypedQuery query = em.createQuery("SELECT c from Categoria c", Categoria.class); + return query.getResultList(); + } + + public void save(Categoria categoria) { + em.getTransaction().begin(); + em.persist(categoria); + em.getTransaction().commit(); + } + + public void update(Categoria categoria) { + em.getTransaction().begin(); + em.merge(categoria); + em.getTransaction().commit(); + } + public void delete(Categoria categoria) { + em.getTransaction().begin(); + em.remove(categoria); + em.getTransaction().commit(); + } +} diff --git a/src/main/java/xyz/danielcortes/repository/EditorialRepository.java b/src/main/java/xyz/danielcortes/repository/EditorialRepository.java new file mode 100644 index 0000000..3891e5a --- /dev/null +++ b/src/main/java/xyz/danielcortes/repository/EditorialRepository.java @@ -0,0 +1,37 @@ +package xyz.danielcortes.repository; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import xyz.danielcortes.framework.PersistenceManager; +import xyz.danielcortes.models.Editorial; + +public class EditorialRepository { + private EntityManager em; + + public EditorialRepository() { + this.em = PersistenceManager.getEntityManager(); + } + + public List getAll() { + TypedQuery query = em.createQuery("SELECT e FROM Editorial e", Editorial.class); + return query.getResultList(); + } + + public void save(Editorial editorial) { + em.getTransaction().begin(); + em.persist(editorial); + em.getTransaction().commit(); + } + + public void update(Editorial editorial) { + em.getTransaction().begin(); + em.merge(editorial); + em.getTransaction().commit(); + } + public void delete(Editorial editorial) { + em.getTransaction().begin(); + em.remove(editorial); + em.getTransaction().commit(); + } +} diff --git a/src/main/java/xyz/danielcortes/repository/EstadoRepository.java b/src/main/java/xyz/danielcortes/repository/EstadoRepository.java new file mode 100644 index 0000000..335da54 --- /dev/null +++ b/src/main/java/xyz/danielcortes/repository/EstadoRepository.java @@ -0,0 +1,44 @@ +package xyz.danielcortes.repository; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import xyz.danielcortes.framework.PersistenceManager; +import xyz.danielcortes.models.Estado; + +public class EstadoRepository { + private EntityManager em; + + public EstadoRepository() { + this.em = PersistenceManager.getEntityManager(); + } + + public List getAll() { + TypedQuery query = em.createQuery("SELECT e FROM Estado e", Estado.class); + return query.getResultList(); + } + + public Estado getByNombre(String nombre) { + TypedQuery query = em.createQuery("SELECT e FROM Estado e WHERE nombre = :nombre", Estado.class); + query.setParameter("nombre", nombre); + return query.getSingleResult(); + } + + public void save(Estado estado) { + em.getTransaction().begin(); + em.persist(estado); + em.getTransaction().commit(); + } + + public void update(Estado estado) { + em.getTransaction().begin(); + em.merge(estado); + em.getTransaction().commit(); + } + public void delete(Estado estado) { + em.getTransaction().begin(); + em.remove(estado); + em.getTransaction().commit(); + } + +} diff --git a/src/main/java/xyz/danielcortes/repository/IdiomaRepository.java b/src/main/java/xyz/danielcortes/repository/IdiomaRepository.java new file mode 100644 index 0000000..a433a8e --- /dev/null +++ b/src/main/java/xyz/danielcortes/repository/IdiomaRepository.java @@ -0,0 +1,42 @@ +package xyz.danielcortes.repository; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.TypedQuery; +import xyz.danielcortes.framework.PersistenceManager; +import xyz.danielcortes.models.Idioma; + +public class IdiomaRepository { + + private EntityManager em; + + public IdiomaRepository() { + this.em = PersistenceManager.getEntityManager(); + } + + public List getAll() { + TypedQuery query = em.createQuery("SELECT i FROM Idioma i", Idioma.class); + + List idiomas = query.getResultList(); + return idiomas; + } + + public void save(Idioma idioma) { + em.getTransaction().begin(); + em.persist(idioma); + em.getTransaction().commit(); + } + + public void update(Idioma idioma) { + em.getTransaction().begin(); + em.merge(idioma); + em.getTransaction().commit(); + } + + public void delete(Idioma idioma) { + em.getTransaction().begin(); + em.remove(idioma); + em.getTransaction().commit(); + } + +} diff --git a/src/main/java/xyz/danielcortes/repository/LibroRepository.java b/src/main/java/xyz/danielcortes/repository/LibroRepository.java new file mode 100644 index 0000000..c75251f --- /dev/null +++ b/src/main/java/xyz/danielcortes/repository/LibroRepository.java @@ -0,0 +1,47 @@ +package xyz.danielcortes.repository; + +import java.util.List; +import javax.persistence.EntityManager; +import javax.persistence.Query; +import javax.persistence.TypedQuery; +import xyz.danielcortes.framework.PersistenceManager; +import xyz.danielcortes.models.Libro; + +public class LibroRepository { + + private EntityManager em; + + public LibroRepository() { + this.em = PersistenceManager.getEntityManager(); + } + + public List getAll() { + TypedQuery query = em.createQuery("SELECT l FROM Libro l", Libro.class); + return query.getResultList(); + } + + public void save(Libro libro) { + em.getTransaction().begin(); + em.persist(libro); + em.getTransaction().commit(); + } + + public void update(Libro libro) { + em.getTransaction().begin(); + em.merge(libro); + em.getTransaction().commit(); + } + + public void delete(Libro libro) { + em.getTransaction().begin(); + em.remove(libro); + em.getTransaction().commit(); + } + + public boolean exists(Integer serie, Integer id) { + Query query = em.createQuery("SELECT count(l) FROM Libro l WHERE serie = :serie and id != :id"); + query.setParameter("serie", serie); + query.setParameter("id", id); + return (Long) query.getResultList().get(0) == 1; + } +} diff --git a/src/main/java/xyz/danielcortes/views/LaunchFrame.java b/src/main/java/xyz/danielcortes/views/LaunchFrame.java new file mode 100644 index 0000000..3b20f79 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/LaunchFrame.java @@ -0,0 +1,33 @@ +package xyz.danielcortes.views; + +import java.awt.CardLayout; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.WindowConstants; +import xyz.danielcortes.framework.PanelName; + +public class LaunchFrame extends JFrame { + + public LaunchFrame() { + this.setSize(800, 600); + this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + this.setLocationRelativeTo(null); + this.setupCardPanel(); + } + + private void setupCardPanel() { + JPanel cards = new JPanel(); + cards.setLayout(new CardLayout()); + this.setContentPane(cards); + } + + public void addCard(JComponent component, PanelName name) { + this.getContentPane().add(component, name.name()); + } + + public void showCard(PanelName name) { + CardLayout layout = (CardLayout) this.getContentPane().getLayout(); + layout.show(this.getContentPane(), name.name()); + } +} diff --git a/src/main/java/xyz/danielcortes/views/autor/AutorCreatePanel.form b/src/main/java/xyz/danielcortes/views/autor/AutorCreatePanel.form new file mode 100644 index 0000000..995dc4d --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/autor/AutorCreatePanel.form @@ -0,0 +1,84 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/autor/AutorCreatePanel.java b/src/main/java/xyz/danielcortes/views/autor/AutorCreatePanel.java new file mode 100644 index 0000000..84f688b --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/autor/AutorCreatePanel.java @@ -0,0 +1,117 @@ +package xyz.danielcortes.views.autor; + +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; + +public class AutorCreatePanel { + + private JTextField nombreField; + private JTextField apellidoPaternoField; + private JTextField apellidoMaternoField; + private JButton guardarButton; + private JPanel contentPane; + + public JTextField getNombreField() { + return nombreField; + } + + public JTextField getApellidoPaternoField() { + return apellidoPaternoField; + } + + public JTextField getApellidoMaternoField() { + return apellidoMaternoField; + } + + public JButton getGuardarButton() { + return guardarButton; + } + + public JPanel getContentPane() { + return contentPane; + } + + { +// 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(8, 3, new Insets(20, 20, 20, 20), -1, -1)); + final JLabel label1 = new JLabel(); + label1.setText("Nombre:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + nombreField = new JTextField(); + contentPane.add(nombreField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Apellido Paterno:"); + contentPane.add(label2, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + apellidoPaternoField = new JTextField(); + contentPane.add(apellidoPaternoField, + 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 label3 = new JLabel(); + label3.setText("Apellido Materno:"); + contentPane.add(label3, + new GridConstraints(4, 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(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)); + guardarButton = new JButton(); + guardarButton.setText("Guardar"); + contentPane.add(guardarButton, + new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(7, 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(7, 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(7, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/autor/AutorDeletePanel.form b/src/main/java/xyz/danielcortes/views/autor/AutorDeletePanel.form new file mode 100644 index 0000000..ba3ae33 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/autor/AutorDeletePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/autor/AutorDeletePanel.java b/src/main/java/xyz/danielcortes/views/autor/AutorDeletePanel.java new file mode 100644 index 0000000..f62df34 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/autor/AutorDeletePanel.java @@ -0,0 +1,105 @@ +package xyz.danielcortes.views.autor; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import xyz.danielcortes.models.Autor; + +public class AutorDeletePanel { + + private JComboBox autorCombo; + private DefaultComboBoxModel autorModel; + private JButton eliminarButton; + private JLabel autorField; + private JPanel contentPane; + + public JComboBox getAutorCombo() { + return autorCombo; + } + + public JButton getEliminarButton() { + return eliminarButton; + } + + public JLabel getAutorField() { + return autorField; + } + + public DefaultComboBoxModel getAutorModel() { + return autorModel; + } + + public JPanel getContentPane() { + return contentPane; + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR + * call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + createUIComponents(); + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(4, 3, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(autorCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + autorField = new JLabel(); + autorField.setText("Autor:"); + contentPane.add(autorField, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + eliminarButton = new JButton(); + eliminarButton.setText("Eliminar"); + contentPane.add(eliminarButton, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(3, 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(3, 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(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + + private void createUIComponents() { + this.createAutorCombo(); + } + + private void createAutorCombo() { + this.autorModel = new DefaultComboBoxModel<>(); + this.autorCombo = new JComboBox<>(this.autorModel); + } +} diff --git a/src/main/java/xyz/danielcortes/views/autor/AutorListPanel.form b/src/main/java/xyz/danielcortes/views/autor/AutorListPanel.form new file mode 100644 index 0000000..2495914 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/autor/AutorListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/autor/AutorListPanel.java b/src/main/java/xyz/danielcortes/views/autor/AutorListPanel.java new file mode 100644 index 0000000..b7aac12 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/autor/AutorListPanel.java @@ -0,0 +1,87 @@ +package xyz.danielcortes.views.autor; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Autor; + +public class AutorListPanel { + + private JPanel contentPane; + private JTable autorTable; + private BaseTableModel autorModel; + + public JPanel getContentPane() { + return contentPane; + } + + public JTable getAutorTable() { + return autorTable; + } + + public BaseTableModel getAutorModel() { + return autorModel; + } + + private void createUIComponents() { + this.createAutorTable(); + } + + private void createAutorTable() { + // @formatter:off + this.autorModel = new BaseTableModel<>( + new String[]{"Nombre", "Apellido Paterno", "Apellido Materno", "Nº Libros"}, + (row, rowIndex, colIndex) -> { + switch (colIndex) { + case 0: return row.get(rowIndex).getNombre(); + case 1: return row.get(rowIndex).getApellidoPaterno(); + case 2: return row.get(rowIndex).getApellidoMaterno(); + case 3: return row.get(rowIndex).getLibros().size(); + default: return null; + } + } + ); + // @formatter:on + this.autorTable = new JTable(this.autorModel); + } + + { +// 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(1, 1, new Insets(20, 20, 20, 20), -1, -1)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, + new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(autorTable); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/autor/AutorUpdatePanel.form b/src/main/java/xyz/danielcortes/views/autor/AutorUpdatePanel.form new file mode 100644 index 0000000..d211ced --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/autor/AutorUpdatePanel.form @@ -0,0 +1,100 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/autor/AutorUpdatePanel.java b/src/main/java/xyz/danielcortes/views/autor/AutorUpdatePanel.java new file mode 100644 index 0000000..79d3372 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/autor/AutorUpdatePanel.java @@ -0,0 +1,149 @@ +package xyz.danielcortes.views.autor; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import xyz.danielcortes.models.Autor; + +public class AutorUpdatePanel { + + private JComboBox autorCombo; + private DefaultComboBoxModel autorModel; + private JTextField nombreField; + private JTextField apellidoPaternoField; + private JTextField apellidoMaternoField; + private JButton actualizarButton; + private JPanel contentPane; + + public JComboBox getAutorCombo() { + return autorCombo; + } + + public DefaultComboBoxModel getAutorModel() { + return autorModel; + } + + public JTextField getNombreField() { + return nombreField; + } + + public JTextField getApellidoPaternoField() { + return apellidoPaternoField; + } + + public JTextField getApellidoMaternoField() { + return apellidoMaternoField; + } + + public JButton getActualizarButton() { + return actualizarButton; + } + + public JPanel getContentPane() { + return contentPane; + } + + private void createUIComponents() { + this.createAutorCombo(); + } + + private void createAutorCombo() { + this.autorModel = new DefaultComboBoxModel<>(); + this.autorCombo = new JComboBox<>(autorModel); + } + + { +// 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(10, 3, new Insets(0, 0, 0, 0), -1, -1)); + final JLabel label1 = new JLabel(); + label1.setText("Autor:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + contentPane.add(autorCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Nombre:"); + contentPane.add(label2, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + 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 label3 = new JLabel(); + label3.setText("Apellido Paterno:"); + contentPane.add(label3, + 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 label4 = new JLabel(); + label4.setText("Apellido Materno:"); + contentPane.add(label4, + new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + actualizarButton = new JButton(); + actualizarButton.setText("Actualizar"); + contentPane.add(actualizarButton, + new GridConstraints(8, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(9, 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(9, 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(9, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/categoria/CategoriaCreatePanel.form b/src/main/java/xyz/danielcortes/views/categoria/CategoriaCreatePanel.form new file mode 100644 index 0000000..667b916 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/categoria/CategoriaCreatePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/categoria/CategoriaCreatePanel.java b/src/main/java/xyz/danielcortes/views/categoria/CategoriaCreatePanel.java new file mode 100644 index 0000000..4a70a1b --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/categoria/CategoriaCreatePanel.java @@ -0,0 +1,85 @@ +package xyz.danielcortes.views.categoria; + +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; + +public class CategoriaCreatePanel { + + private JButton guardarButton; + private JPanel contentPane; + private JTextField nombreField; + + public JButton getGuardarButton() { + return guardarButton; + } + + public JPanel getContentPane() { + return contentPane; + } + + public JTextField getNombreField() { + return nombreField; + } + + { +// 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(4, 3, new Insets(20, 20, 20, 20), -1, -1)); + guardarButton = new JButton(); + guardarButton.setText("Guardar"); + contentPane.add(guardarButton, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Nombre:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + nombreField = new JTextField(); + contentPane.add(nombreField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(3, 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(2, 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(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/categoria/CategoriaDeletePanel.form b/src/main/java/xyz/danielcortes/views/categoria/CategoriaDeletePanel.form new file mode 100644 index 0000000..68aab12 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/categoria/CategoriaDeletePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/categoria/CategoriaDeletePanel.java b/src/main/java/xyz/danielcortes/views/categoria/CategoriaDeletePanel.java new file mode 100644 index 0000000..9622c72 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/categoria/CategoriaDeletePanel.java @@ -0,0 +1,97 @@ +package xyz.danielcortes.views.categoria; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import xyz.danielcortes.models.Categoria; + +public class CategoriaDeletePanel { + + private JComboBox categoriaCombo; + private DefaultComboBoxModel categoriaModel; + private JButton eliminarButton; + private JPanel contentPane; + + public JComboBox getCategoriaCombo() { + return categoriaCombo; + } + + public JButton getEliminarButton() { + return eliminarButton; + } + + public JPanel getContentPane() { + return contentPane; + } + + private void createUIComponents() { + createCategoriaCombo(); + } + + private void createCategoriaCombo() { + categoriaModel = new DefaultComboBoxModel<>(); + categoriaCombo = new JComboBox<>(categoriaModel); + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR + * call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + createUIComponents(); + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(4, 3, new Insets(20, 20, 20, 20), -1, -1)); + contentPane.add(categoriaCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + eliminarButton = new JButton(); + eliminarButton.setText("Eliminar"); + contentPane.add(eliminarButton, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Categoria:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(3, 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(2, 0, 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(2, 2, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/categoria/CategoriaListPanel.form b/src/main/java/xyz/danielcortes/views/categoria/CategoriaListPanel.form new file mode 100644 index 0000000..7b2e698 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/categoria/CategoriaListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/categoria/CategoriaListPanel.java b/src/main/java/xyz/danielcortes/views/categoria/CategoriaListPanel.java new file mode 100644 index 0000000..3b938a9 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/categoria/CategoriaListPanel.java @@ -0,0 +1,84 @@ +package xyz.danielcortes.views.categoria; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Categoria; + +public class CategoriaListPanel { + + private JPanel contentPane; + private JTable categoriaTable; + private BaseTableModel categoriaModel; + + public JPanel getContentPane() { + return contentPane; + } + + public JTable getCategoriaTable() { + return categoriaTable; + } + + public BaseTableModel getCategoriaModel() { + return categoriaModel; + } + + private void createUIComponents() { + this.createCategoriaTable(); + } + + private void createCategoriaTable() { + // @formatter:off + this.categoriaModel = new BaseTableModel<>( + new String[]{"Nombre", "Nº Libros"}, + (row, rowIndex, colIndex) -> { + switch (colIndex) { + case 0: return row.get(rowIndex).getNombre(); + case 1: return row.get(rowIndex).getLibros().size(); + default: return null; + } + } + ); + // @formatter:on + this.categoriaTable = new JTable(this.categoriaModel); + } + + { +// 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(1, 1, new Insets(20, 20, 20, 20), -1, -1)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, + new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(categoriaTable); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } +} diff --git a/src/main/java/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.form b/src/main/java/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.form new file mode 100644 index 0000000..dd2231c --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.form @@ -0,0 +1,68 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.java b/src/main/java/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.java new file mode 100644 index 0000000..6f7d42d --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.java @@ -0,0 +1,112 @@ +package xyz.danielcortes.views.categoria; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import xyz.danielcortes.models.Categoria; + +public class CategoriaUpdatePanel { + + private JPanel contentPane; + private JTextField nombreField; + private JComboBox categoriaCombo; + private DefaultComboBoxModel categoriaModel; + private JButton updateButton; + + public JPanel getContentPane() { + return contentPane; + } + + public JTextField getNombreField() { + return nombreField; + } + + public JComboBox getCategoriaCombo() { + return categoriaCombo; + } + + public JButton getUpdateButton() { + return updateButton; + } + + private void createUIComponents() { + this.createCategoriaCombo(); + } + + private void createCategoriaCombo() { + this.categoriaModel = new DefaultComboBoxModel<>(); + this.categoriaCombo = new JComboBox<>(this.categoriaModel); + } + + { +// 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(6, 3, new Insets(20, 20, 20, 20), -1, -1)); + final JLabel label1 = new JLabel(); + label1.setText("Categoria:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JLabel label2 = new JLabel(); + label2.setText("Nombre:"); + contentPane.add(label2, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + updateButton = new JButton(); + updateButton.setText("Actualizar"); + contentPane.add(updateButton, + new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, + false)); + 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(150, -1), null, 0, false)); + contentPane.add(categoriaCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + final Spacer spacer3 = new Spacer(); + contentPane.add(spacer3, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } +} diff --git a/src/main/java/xyz/danielcortes/views/editorial/EditorialCreatePanel.form b/src/main/java/xyz/danielcortes/views/editorial/EditorialCreatePanel.form new file mode 100644 index 0000000..7249438 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/editorial/EditorialCreatePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/editorial/EditorialCreatePanel.java b/src/main/java/xyz/danielcortes/views/editorial/EditorialCreatePanel.java new file mode 100644 index 0000000..a169411 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/editorial/EditorialCreatePanel.java @@ -0,0 +1,84 @@ +package xyz.danielcortes.views.editorial; + +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; + +public class EditorialCreatePanel { + + private JPanel contentPane; + private JTextField nombreField; + private JButton guardarButton; + + public JPanel getContentPane() { + return contentPane; + } + + public JTextField getNombreField() { + return nombreField; + } + + public JButton getGuardarButton() { + return guardarButton; + } + + { +// 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(4, 3, new Insets(20, 20, 20, 20), -1, -1)); + nombreField = new JTextField(); + contentPane.add(nombreField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, + false)); + final JLabel label1 = new JLabel(); + label1.setText("Nombre:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + guardarButton = new JButton(); + guardarButton.setText("Guardar"); + contentPane.add(guardarButton, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, new GridConstraints(3, 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(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } +} diff --git a/src/main/java/xyz/danielcortes/views/editorial/EditorialDeletePanel.form b/src/main/java/xyz/danielcortes/views/editorial/EditorialDeletePanel.form new file mode 100644 index 0000000..ece1357 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/editorial/EditorialDeletePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/editorial/EditorialDeletePanel.java b/src/main/java/xyz/danielcortes/views/editorial/EditorialDeletePanel.java new file mode 100644 index 0000000..55da82f --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/editorial/EditorialDeletePanel.java @@ -0,0 +1,96 @@ +package xyz.danielcortes.views.editorial; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import xyz.danielcortes.models.Editorial; + +public class EditorialDeletePanel { + + private JPanel contentPane; + private JComboBox editorialCombo; + private DefaultComboBoxModel editorialModel; + private JButton eliminarButton; + + public JPanel getContentPane() { + return contentPane; + } + + public JComboBox getEditorialCombo() { + return editorialCombo; + } + + public DefaultComboBoxModel getEditorialModel() { + return editorialModel; + } + + public JButton getEliminarButton() { + return eliminarButton; + } + + private void createUIComponents() { + this.editorialModel = new DefaultComboBoxModel<>(); + this.editorialCombo = new JComboBox<>(this.editorialModel); + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR + * call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + createUIComponents(); + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(4, 3, new Insets(20, 20, 20, 20), -1, -1)); + contentPane.add(editorialCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Editorial:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + eliminarButton = new JButton(); + eliminarButton.setText("Eliminar"); + contentPane.add(eliminarButton, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(3, 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(3, 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(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } +} diff --git a/src/main/java/xyz/danielcortes/views/editorial/EditorialListPanel.form b/src/main/java/xyz/danielcortes/views/editorial/EditorialListPanel.form new file mode 100644 index 0000000..76a0d95 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/editorial/EditorialListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/editorial/EditorialListPanel.java b/src/main/java/xyz/danielcortes/views/editorial/EditorialListPanel.java new file mode 100644 index 0000000..9572d99 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/editorial/EditorialListPanel.java @@ -0,0 +1,86 @@ +package xyz.danielcortes.views.editorial; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Editorial; + +public class EditorialListPanel { + + private JPanel contentPane; + private JTable editorialTable; + private BaseTableModel editorialModel; + + public JPanel getContentPane() { + return contentPane; + } + + public JTable getEditorialTable() { + return editorialTable; + } + + public BaseTableModel getEditorialModel() { + return editorialModel; + } + + + private void createUIComponents() { + this.createEditorialTable(); + } + + + private void createEditorialTable() { + // @formatter:off + this.editorialModel = new BaseTableModel<>( + new String[]{"Nombre", "Nº Libros"}, + (row, rowIndex, colIndex) -> { + switch(colIndex) { + case 0: return row.get(rowIndex).getNombre(); + case 1: return row.get(rowIndex).getLibros().size(); + default: return null; + } + } + ); + this.editorialTable = new JTable(this.editorialModel); + // @formatter:on + } + + { +// 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(1, 1, new Insets(20, 20, 20, 20), -1, -1)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, + new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(editorialTable); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } +} diff --git a/src/main/java/xyz/danielcortes/views/editorial/EditorialUpdatePanel.form b/src/main/java/xyz/danielcortes/views/editorial/EditorialUpdatePanel.form new file mode 100644 index 0000000..f4c2189 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/editorial/EditorialUpdatePanel.form @@ -0,0 +1,68 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/editorial/EditorialUpdatePanel.java b/src/main/java/xyz/danielcortes/views/editorial/EditorialUpdatePanel.java new file mode 100644 index 0000000..2070cde --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/editorial/EditorialUpdatePanel.java @@ -0,0 +1,112 @@ +package xyz.danielcortes.views.editorial; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import xyz.danielcortes.models.Editorial; + +public class EditorialUpdatePanel { + + private JPanel contentPane; + private JTextField nombreField; + private JComboBox editorialCombo; + private DefaultComboBoxModel editorialModel; + private JButton actualizarButton; + + public JPanel getContentPane() { + return contentPane; + } + + public JTextField getNombreField() { + return nombreField; + } + + public JComboBox getEditorialCombo() { + return editorialCombo; + } + + public DefaultComboBoxModel getEditorialModel() { + return editorialModel; + } + + public JButton getActualizarButton() { + return actualizarButton; + } + + private void createUIComponents() { + this.editorialModel = new DefaultComboBoxModel<>(); + this.editorialCombo = new JComboBox<>(this.editorialModel); + } + + { +// 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(6, 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("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)); + final JLabel label2 = new JLabel(); + label2.setText("Editorial:"); + contentPane.add(label2, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + contentPane.add(editorialCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, + false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + final Spacer spacer3 = new Spacer(); + contentPane.add(spacer3, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + actualizarButton = new JButton(); + actualizarButton.setText("Actualizar"); + contentPane.add(actualizarButton, + new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } +} diff --git a/src/main/java/xyz/danielcortes/views/idioma/IdiomaCreatePanel.form b/src/main/java/xyz/danielcortes/views/idioma/IdiomaCreatePanel.form new file mode 100644 index 0000000..80fbd55 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/idioma/IdiomaCreatePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/idioma/IdiomaCreatePanel.java b/src/main/java/xyz/danielcortes/views/idioma/IdiomaCreatePanel.java new file mode 100644 index 0000000..08e5e19 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/idioma/IdiomaCreatePanel.java @@ -0,0 +1,85 @@ +package xyz.danielcortes.views.idioma; + +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; + +public class IdiomaCreatePanel { + + private JPanel contentPane; + private JTextField nombreField; + private JButton guardarButton; + + public JPanel getContentPane() { + return contentPane; + } + + public JTextField getNombreField() { + return nombreField; + } + + public JButton getGuardarButton() { + return guardarButton; + } + + { +// 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(4, 3, new Insets(20, 20, 20, 20), -1, -1)); + nombreField = new JTextField(); + contentPane.add(nombreField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + guardarButton = new JButton(); + guardarButton.setText("Guardar"); + contentPane.add(guardarButton, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(3, 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(3, 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(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Nombre:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/idioma/IdiomaDeletePanel.form b/src/main/java/xyz/danielcortes/views/idioma/IdiomaDeletePanel.form new file mode 100644 index 0000000..ab1d965 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/idioma/IdiomaDeletePanel.form @@ -0,0 +1,54 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/idioma/IdiomaDeletePanel.java b/src/main/java/xyz/danielcortes/views/idioma/IdiomaDeletePanel.java new file mode 100644 index 0000000..318cd61 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/idioma/IdiomaDeletePanel.java @@ -0,0 +1,102 @@ +package xyz.danielcortes.views.idioma; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import xyz.danielcortes.models.Idioma; + +public class IdiomaDeletePanel { + + private JPanel contentPane; + private JButton eliminarButton; + private JComboBox idiomaCombo; + private DefaultComboBoxModel idiomaModel; + + public JPanel getContentPane() { + return contentPane; + } + + public JButton getEliminarButton() { + return eliminarButton; + } + + public JComboBox getIdiomaCombo() { + return idiomaCombo; + } + + public DefaultComboBoxModel getIdiomaModel() { + return idiomaModel; + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR + * call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + createUIComponents(); + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(4, 3, new Insets(20, 20, 20, 20), -1, -1)); + final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); + idiomaCombo.setModel(defaultComboBoxModel1); + contentPane.add(idiomaCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + eliminarButton = new JButton(); + eliminarButton.setText("Eliminar"); + contentPane.add(eliminarButton, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(3, 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(3, 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(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Idioma:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + + private void createUIComponents() { + this.createIdiomaCombo(); + } + + private void createIdiomaCombo() { + idiomaModel = new DefaultComboBoxModel<>(); + idiomaCombo = new JComboBox<>(idiomaModel); + } +} diff --git a/src/main/java/xyz/danielcortes/views/idioma/IdiomaListPanel.form b/src/main/java/xyz/danielcortes/views/idioma/IdiomaListPanel.form new file mode 100644 index 0000000..c4fa0ea --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/idioma/IdiomaListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/idioma/IdiomaListPanel.java b/src/main/java/xyz/danielcortes/views/idioma/IdiomaListPanel.java new file mode 100644 index 0000000..c4fd827 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/idioma/IdiomaListPanel.java @@ -0,0 +1,84 @@ +package xyz.danielcortes.views.idioma; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.framework.BaseTableModel; + +public class IdiomaListPanel { + + private JPanel contentPane; + private JTable idiomaTable; + private BaseTableModel idiomaTableModel; + + public JPanel getContentPane() { + return contentPane; + } + + public JTable getIdiomaTable() { + return idiomaTable; + } + + public BaseTableModel getIdiomaTableModel() { + return idiomaTableModel; + } + + { +// 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(1, 1, new Insets(20, 20, 20, 20), -1, -1)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, + new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(idiomaTable); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + + private void createUIComponents() { + this.createIdiomaTable(); + } + + private void createIdiomaTable() { + // @formatter:off + this.idiomaTableModel = new BaseTableModel<>( + new String[]{"Nombre", "Nº Libros"}, + (row, rowIndex, colIndex) -> { + switch (colIndex) { + case 0: return row.get(rowIndex).getNombre(); + case 1: return row.get(rowIndex).getLibros().size(); + default: return null; + } + } + ); + // @formatter:on + this.idiomaTable = new JTable(this.idiomaTableModel); + } +} diff --git a/src/main/java/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.form b/src/main/java/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.form new file mode 100644 index 0000000..33a2a04 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.form @@ -0,0 +1,68 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.java b/src/main/java/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.java new file mode 100644 index 0000000..59f850b --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.java @@ -0,0 +1,116 @@ +package xyz.danielcortes.views.idioma; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTextField; +import xyz.danielcortes.models.Idioma; + +public class IdiomaUpdatePanel { + + private JPanel contentPane; + private JTextField nombreField; + private JComboBox idiomaCombo; + private DefaultComboBoxModel idiomaModel; + private JButton actualizarButton; + + public JPanel getContentPane() { + return contentPane; + } + + public JTextField getNombreField() { + return nombreField; + } + + public JComboBox getIdiomaCombo() { + return idiomaCombo; + } + + public DefaultComboBoxModel getIdiomaModel() { + return idiomaModel; + } + + public JButton getActualizarButton() { + return actualizarButton; + } + + { +// 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(6, 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)); + contentPane.add(idiomaCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, + false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, new GridConstraints(5, 2, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + final Spacer spacer3 = new Spacer(); + contentPane.add(spacer3, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + actualizarButton = new JButton(); + actualizarButton.setText("Actualizar"); + contentPane.add(actualizarButton, + new GridConstraints(4, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Original:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JLabel label2 = new JLabel(); + label2.setText("Nombre:"); + contentPane.add(label2, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + + private void createUIComponents() { + this.createIdiomaCombo(); + } + + private void createIdiomaCombo() { + idiomaModel = new DefaultComboBoxModel<>(); + idiomaCombo = new JComboBox<>(idiomaModel); + } +} diff --git a/src/main/java/xyz/danielcortes/views/libro/LibroCreatePanel.form b/src/main/java/xyz/danielcortes/views/libro/LibroCreatePanel.form new file mode 100644 index 0000000..da9c083 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/libro/LibroCreatePanel.form @@ -0,0 +1,219 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/libro/LibroCreatePanel.java b/src/main/java/xyz/danielcortes/views/libro/LibroCreatePanel.java new file mode 100644 index 0000000..1f3a2ff --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/libro/LibroCreatePanel.java @@ -0,0 +1,291 @@ +package xyz.danielcortes.views.libro; + +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.DefaultComboBoxModel; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.models.Idioma; + +public class LibroCreatePanel { + + private JPanel contentPane; + private JTextField serieField; + private JTextField isbnField; + private JTextField tituloField; + private JTextField paginasField; + private JTextField anoPublicacionField; + private JList idiomasList; + private DefaultListModel idiomasModel; + private JList autoresList; + private DefaultListModel autoresModel; + private JList categoriasList; + private DefaultListModel categoriasModel; + private JComboBox editorialCombo; + private DefaultComboBoxModel editorialModel; + private JButton guardarButton; + private JTextField precioReferenciaField; + + public JPanel getContentPane() { + return contentPane; + } + + public JTextField getSerieField() { + return serieField; + } + + public JTextField getIsbnField() { + return isbnField; + } + + public JTextField getTituloField() { + return tituloField; + } + + public JTextField getPaginasField() { + return paginasField; + } + + public JTextField getAnoPublicacionField() { + return anoPublicacionField; + } + + public JTextField getPrecioReferenciaField() { + return precioReferenciaField; + } + + public JList getIdiomasList() { + return idiomasList; + } + + public DefaultListModel getIdiomasModel() { + return idiomasModel; + } + + public JList getAutoresList() { + return autoresList; + } + + public DefaultListModel getAutoresModel() { + return autoresModel; + } + + public JList getCategoriasList() { + return categoriasList; + } + + public DefaultListModel getCategoriasModel() { + return categoriasModel; + } + + public JComboBox getEditorialCombo() { + return editorialCombo; + } + + public DefaultComboBoxModel getEditorialModel() { + return editorialModel; + } + + public JButton getGuardarButton() { + return guardarButton; + } + + { +// 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(22, 3, new Insets(10, 10, 10, 10), -1, -1)); + serieField = new JTextField(); + contentPane.add(serieField, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + isbnField = new JTextField(); + contentPane.add(isbnField, 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)); + tituloField = new JTextField(); + tituloField.setText(""); + contentPane.add(tituloField, 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)); + paginasField = new JTextField(); + contentPane.add(paginasField, 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)); + anoPublicacionField = new JTextField(); + contentPane.add(anoPublicacionField, + new GridConstraints(9, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + contentPane.add(editorialCombo, new GridConstraints(19, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + guardarButton = new JButton(); + guardarButton.setText("Guardar"); + contentPane.add(guardarButton, + new GridConstraints(20, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, + new GridConstraints(13, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(idiomasList); + final JScrollPane scrollPane2 = new JScrollPane(); + contentPane.add(scrollPane2, + new GridConstraints(15, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane2.setViewportView(autoresList); + final JScrollPane scrollPane3 = new JScrollPane(); + contentPane.add(scrollPane3, + new GridConstraints(17, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane3.setViewportView(categoriasList); + final JLabel label1 = new JLabel(); + label1.setText("Nº Serie:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JLabel label2 = new JLabel(); + label2.setText("ISBN:"); + contentPane.add(label2, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JLabel label3 = new JLabel(); + label3.setText("Titulo:"); + contentPane.add(label3, + new GridConstraints(4, 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("Nº Paginas:"); + contentPane.add(label4, + new GridConstraints(6, 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("Año Publicacion:"); + 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)); + final JLabel label6 = new JLabel(); + label6.setText("Idiomas:"); + contentPane.add(label6, + new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JLabel label7 = new JLabel(); + label7.setText("Autores:"); + contentPane.add(label7, + new GridConstraints(14, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JLabel label8 = new JLabel(); + label8.setText("Categorias:"); + contentPane.add(label8, + new GridConstraints(16, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JLabel label9 = new JLabel(); + label9.setText("Editorial:"); + contentPane.add(label9, + new GridConstraints(18, 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(7, 2, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, new GridConstraints(7, 0, 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(21, 1, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, + false)); + final JLabel label10 = new JLabel(); + label10.setText("Precio Referencia:"); + contentPane.add(label10, + new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + precioReferenciaField = new JTextField(); + contentPane.add(precioReferenciaField, + new GridConstraints(11, 1, 1, 1, GridConstraints.ANCHOR_WEST, + 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; + } + + private void createUIComponents() { + createIdiomasList(); + createAutoresList(); + createCategoriaList(); + createEditorialCombo(); + } + + private void createIdiomasList() { + this.idiomasModel = new DefaultListModel<>(); + this.idiomasList = new JList<>(this.idiomasModel); + this.idiomasList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + } + + private void createAutoresList() { + this.autoresModel = new DefaultListModel<>(); + this.autoresList = new JList<>(this.autoresModel); + this.autoresList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + } + + private void createCategoriaList() { + this.categoriasModel = new DefaultListModel<>(); + this.categoriasList = new JList<>(this.categoriasModel); + this.categoriasList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + } + + private void createEditorialCombo() { + this.editorialModel = new DefaultComboBoxModel<>(); + this.editorialCombo = new JComboBox<>(this.editorialModel); + } +} diff --git a/src/main/java/xyz/danielcortes/views/libro/LibroDeletePanel.form b/src/main/java/xyz/danielcortes/views/libro/LibroDeletePanel.form new file mode 100644 index 0000000..3d0018e --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/libro/LibroDeletePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/libro/LibroDeletePanel.java b/src/main/java/xyz/danielcortes/views/libro/LibroDeletePanel.java new file mode 100644 index 0000000..fceb5ba --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/libro/LibroDeletePanel.java @@ -0,0 +1,100 @@ +package xyz.danielcortes.views.libro; + +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.DefaultComboBoxModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import xyz.danielcortes.models.Libro; + +public class LibroDeletePanel { + + private JButton eliminarButton; + private JComboBox libroCombo; + private JPanel contentPane; + private DefaultComboBoxModel libroModel; + + public JPanel getContentPane() { + return contentPane; + } + + public JButton getEliminarButton() { + return eliminarButton; + } + + public JComboBox getLibroCombo() { + return libroCombo; + } + + public DefaultComboBoxModel getLibroModel() { + return libroModel; + } + + { +// GUI initializer generated by IntelliJ IDEA GUI Designer +// >>> IMPORTANT!! <<< +// DO NOT EDIT OR ADD ANY CODE HERE! + $$$setupUI$$$(); + } + + /** + * Method generated by IntelliJ IDEA GUI Designer >>> IMPORTANT!! <<< DO NOT edit this method OR + * call it in your code! + * + * @noinspection ALL + */ + private void $$$setupUI$$$() { + createUIComponents(); + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(4, 3, new Insets(10, 10, 10, 10), -1, -1)); + final JLabel label1 = new JLabel(); + label1.setText("Libro:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, + false)); + eliminarButton = new JButton(); + eliminarButton.setText("Eliminar"); + contentPane.add(eliminarButton, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + contentPane.add(libroCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final Spacer spacer2 = new Spacer(); + contentPane.add(spacer2, new GridConstraints(3, 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(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + + private void createUIComponents() { + this.createLibroCombo(); + } + + private void createLibroCombo() { + this.libroModel = new DefaultComboBoxModel<>(); + this.libroCombo = new JComboBox<>(this.libroModel); + } +} diff --git a/src/main/java/xyz/danielcortes/views/libro/LibroListPanel.form b/src/main/java/xyz/danielcortes/views/libro/LibroListPanel.form new file mode 100644 index 0000000..ed39471 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/libro/LibroListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/libro/LibroListPanel.java b/src/main/java/xyz/danielcortes/views/libro/LibroListPanel.java new file mode 100644 index 0000000..1891123 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/libro/LibroListPanel.java @@ -0,0 +1,87 @@ +package xyz.danielcortes.views.libro; + +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import java.awt.Dimension; +import java.awt.Insets; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import xyz.danielcortes.framework.BaseTableModel; +import xyz.danielcortes.models.Libro; + +public class LibroListPanel { + + private JTable librosTable; + private BaseTableModel librosModel; + private JPanel contentPane; + + public JTable getLibrosTable() { + return librosTable; + } + + public BaseTableModel getLibrosModel() { + return librosModel; + } + + public JPanel getContentPane() { + return contentPane; + } + + private void createUIComponents() { + this.createLibrosTable(); + } + + private void createLibrosTable() { + //@formatter:off + this.librosModel = new BaseTableModel<>( + new String[]{"Serie", "ISBN", "Titulo", "Precio Referencial"}, + (rows, rowIndex, colIndex) -> { + switch(colIndex) { + case 0: return rows.get(rowIndex).getSerie(); + case 1: return rows.get(rowIndex).getIsbn(); + case 2: return rows.get(rowIndex).getTitulo(); + case 3: return rows.get(rowIndex).getPrecioReferencia(); + default: return null; + } + } + ); + //@formatter:on + this.librosTable = new JTable(this.librosModel); + } + + { +// 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(1, 1, new Insets(10, 10, 10, 10), -1, -1)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, + new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(librosTable); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/java/xyz/danielcortes/views/libro/LibroUpdatePanel.form b/src/main/java/xyz/danielcortes/views/libro/LibroUpdatePanel.form new file mode 100644 index 0000000..3c63388 --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/libro/LibroUpdatePanel.form @@ -0,0 +1,233 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/src/main/java/xyz/danielcortes/views/libro/LibroUpdatePanel.java b/src/main/java/xyz/danielcortes/views/libro/LibroUpdatePanel.java new file mode 100644 index 0000000..04adfda --- /dev/null +++ b/src/main/java/xyz/danielcortes/views/libro/LibroUpdatePanel.java @@ -0,0 +1,317 @@ +package xyz.danielcortes.views.libro; + +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.DefaultComboBoxModel; +import javax.swing.DefaultListModel; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextField; +import javax.swing.ListSelectionModel; +import xyz.danielcortes.models.Autor; +import xyz.danielcortes.models.Categoria; +import xyz.danielcortes.models.Editorial; +import xyz.danielcortes.models.Idioma; +import xyz.danielcortes.models.Libro; + +public class LibroUpdatePanel { + + private JPanel contentPane; + private JComboBox libroCombo; + private DefaultComboBoxModel libroModel; + private JTextField serieField; + private JTextField isbnField; + private JTextField tituloField; + private JTextField paginasField; + private JTextField anoPublicacionField; + private JTextField precioReferenciaField; + private JList idiomasList; + private DefaultListModel idiomasModel; + private JList autoresList; + private DefaultListModel autoresModel; + private JList categoriasList; + private DefaultListModel categoriasModel; + private JComboBox editorialCombo; + private DefaultComboBoxModel editorialModel; + private JButton actualizarButton; + + public JPanel getContentPane() { + return contentPane; + } + + public JComboBox getLibroCombo() { + return libroCombo; + } + + public DefaultComboBoxModel getLibroModel() { + return libroModel; + } + + public JTextField getSerieField() { + return serieField; + } + + public JTextField getIsbnField() { + return isbnField; + } + + public JTextField getTituloField() { + return tituloField; + } + + public JTextField getPaginasField() { + return paginasField; + } + + public JTextField getAnoPublicacionField() { + return anoPublicacionField; + } + + public JTextField getPrecioReferenciaField() { + return precioReferenciaField; + } + + public JList getIdiomasList() { + return idiomasList; + } + + public DefaultListModel getIdiomasModel() { + return idiomasModel; + } + + public JList getAutoresList() { + return autoresList; + } + + public DefaultListModel getAutoresModel() { + return autoresModel; + } + + public JList getCategoriasList() { + return categoriasList; + } + + public DefaultListModel getCategoriasModel() { + return categoriasModel; + } + + public JComboBox getEditorialCombo() { + return editorialCombo; + } + + public DefaultComboBoxModel getEditorialModel() { + return editorialModel; + } + + public JButton getActualizarButton() { + return actualizarButton; + } + + private void createUIComponents() { + this.createLibroCombo(); + this.createAutoresList(); + this.createCategoriaList(); + this.createEditorialCombo(); + this.createIdiomasList(); + } + + private void createLibroCombo() { + this.libroModel = new DefaultComboBoxModel<>(); + this.libroCombo = new JComboBox<>(this.libroModel); + } + + private void createIdiomasList() { + this.idiomasModel = new DefaultListModel<>(); + this.idiomasList = new JList<>(this.idiomasModel); + this.idiomasList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + } + + private void createAutoresList() { + this.autoresModel = new DefaultListModel<>(); + this.autoresList = new JList<>(this.autoresModel); + this.autoresList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + } + + private void createCategoriaList() { + this.categoriasModel = new DefaultListModel<>(); + this.categoriasList = new JList<>(this.categoriasModel); + this.categoriasList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); + } + + private void createEditorialCombo() { + this.editorialModel = new DefaultComboBoxModel<>(); + this.editorialCombo = new JComboBox<>(this.editorialModel); + } + + { +// 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(24, 3, new Insets(10, 10, 10, 10), -1, -1)); + final JLabel label1 = new JLabel(); + label1.setText("Libro:"); + contentPane.add(label1, + new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + contentPane.add(libroCombo, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Nº Serie:"); + contentPane.add(label2, + new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + serieField = new JTextField(); + contentPane.add(serieField, 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 label3 = new JLabel(); + label3.setText("ISBN:"); + contentPane.add(label3, + new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + isbnField = new JTextField(); + contentPane.add(isbnField, 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 label4 = new JLabel(); + label4.setText("Titulo:"); + contentPane.add(label4, + new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + tituloField = new JTextField(); + contentPane.add(tituloField, 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 label5 = new JLabel(); + label5.setText("Nº Paginas:"); + 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)); + paginasField = new JTextField(); + contentPane.add(paginasField, new GridConstraints(9, 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 label6 = new JLabel(); + label6.setText("Año Publicacion:"); + contentPane.add(label6, + new GridConstraints(10, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + anoPublicacionField = new JTextField(); + contentPane.add(anoPublicacionField, + new GridConstraints(11, 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 label7 = new JLabel(); + label7.setText("Precio Referencia:"); + contentPane.add(label7, + new GridConstraints(12, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + precioReferenciaField = new JTextField(); + contentPane.add(precioReferenciaField, + new GridConstraints(13, 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 label8 = new JLabel(); + label8.setText("Idiomas:"); + contentPane.add(label8, + new GridConstraints(14, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JScrollPane scrollPane1 = new JScrollPane(); + contentPane.add(scrollPane1, + new GridConstraints(15, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane1.setViewportView(idiomasList); + final JLabel label9 = new JLabel(); + label9.setText("Autores:"); + contentPane.add(label9, + new GridConstraints(16, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JScrollPane scrollPane2 = new JScrollPane(); + contentPane.add(scrollPane2, + new GridConstraints(17, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane2.setViewportView(autoresList); + final JLabel label10 = new JLabel(); + label10.setText("Categorias:"); + contentPane.add(label10, + new GridConstraints(18, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + final JScrollPane scrollPane3 = new JScrollPane(); + contentPane.add(scrollPane3, + new GridConstraints(19, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, + new Dimension(400, -1), null, 0, false)); + scrollPane3.setViewportView(categoriasList); + final JLabel label11 = new JLabel(); + label11.setText("Editorial:"); + contentPane.add(label11, + new GridConstraints(20, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, + false)); + contentPane.add(editorialCombo, new GridConstraints(21, 1, 1, 1, GridConstraints.ANCHOR_WEST, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(400, -1), null, 0, false)); + actualizarButton = new JButton(); + actualizarButton.setText("Actualizar"); + contentPane.add(actualizarButton, + new GridConstraints(22, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, + GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, + GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + contentPane.add(spacer1, new GridConstraints(23, 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(23, 0, 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(23, 2, 1, 1, GridConstraints.ANCHOR_CENTER, + GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, + 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + +} diff --git a/src/main/resources/META-INF/persistence.xml b/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000..02deffc --- /dev/null +++ b/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,20 @@ + + + + org.hibernate.jpa.HibernatePersistenceProvider + + + + + + + + + + + + \ No newline at end of file diff --git a/target/biblioteca-1.jar b/target/biblioteca-1.jar new file mode 100644 index 0000000..5f5d7f8 Binary files /dev/null and b/target/biblioteca-1.jar differ diff --git a/target/classes/META-INF/persistence.xml b/target/classes/META-INF/persistence.xml new file mode 100644 index 0000000..02deffc --- /dev/null +++ b/target/classes/META-INF/persistence.xml @@ -0,0 +1,20 @@ + + + + org.hibernate.jpa.HibernatePersistenceProvider + + + + + + + + + + + + \ No newline at end of file diff --git a/target/classes/com/intellij/uiDesigner/core/AbstractLayout.class b/target/classes/com/intellij/uiDesigner/core/AbstractLayout.class new file mode 100644 index 0000000..474957a Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/AbstractLayout.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/DimensionInfo.class b/target/classes/com/intellij/uiDesigner/core/DimensionInfo.class new file mode 100644 index 0000000..0db2f7d Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/DimensionInfo.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/GridConstraints.class b/target/classes/com/intellij/uiDesigner/core/GridConstraints.class new file mode 100644 index 0000000..2e1afcc Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/GridConstraints.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/GridLayoutManager.class b/target/classes/com/intellij/uiDesigner/core/GridLayoutManager.class new file mode 100644 index 0000000..94e3f41 Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/GridLayoutManager.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/HorizontalInfo.class b/target/classes/com/intellij/uiDesigner/core/HorizontalInfo.class new file mode 100644 index 0000000..bdc1fe3 Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/HorizontalInfo.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/LayoutState.class b/target/classes/com/intellij/uiDesigner/core/LayoutState.class new file mode 100644 index 0000000..61494df Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/LayoutState.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/Spacer.class b/target/classes/com/intellij/uiDesigner/core/Spacer.class new file mode 100644 index 0000000..e534880 Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/Spacer.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/SupportCode$TextWithMnemonic.class b/target/classes/com/intellij/uiDesigner/core/SupportCode$TextWithMnemonic.class new file mode 100644 index 0000000..67909c5 Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/SupportCode$TextWithMnemonic.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/SupportCode.class b/target/classes/com/intellij/uiDesigner/core/SupportCode.class new file mode 100644 index 0000000..4950c35 Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/SupportCode.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/Util.class b/target/classes/com/intellij/uiDesigner/core/Util.class new file mode 100644 index 0000000..4866582 Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/Util.class differ diff --git a/target/classes/com/intellij/uiDesigner/core/VerticalInfo.class b/target/classes/com/intellij/uiDesigner/core/VerticalInfo.class new file mode 100644 index 0000000..049e702 Binary files /dev/null and b/target/classes/com/intellij/uiDesigner/core/VerticalInfo.class differ diff --git a/target/classes/xyz/danielcortes/App.class b/target/classes/xyz/danielcortes/App.class new file mode 100644 index 0000000..a1c87f4 Binary files /dev/null and b/target/classes/xyz/danielcortes/App.class differ diff --git a/target/classes/xyz/danielcortes/controllers/LaunchController.class b/target/classes/xyz/danielcortes/controllers/LaunchController.class new file mode 100644 index 0000000..06051c0 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/LaunchController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/autor/AutorCreateController.class b/target/classes/xyz/danielcortes/controllers/autor/AutorCreateController.class new file mode 100644 index 0000000..89877d0 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/autor/AutorCreateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/autor/AutorDeleteController.class b/target/classes/xyz/danielcortes/controllers/autor/AutorDeleteController.class new file mode 100644 index 0000000..007b250 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/autor/AutorDeleteController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/autor/AutorListController.class b/target/classes/xyz/danielcortes/controllers/autor/AutorListController.class new file mode 100644 index 0000000..7ce8387 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/autor/AutorListController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/autor/AutorUpdateController.class b/target/classes/xyz/danielcortes/controllers/autor/AutorUpdateController.class new file mode 100644 index 0000000..f01fcf1 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/autor/AutorUpdateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/categoria/CategoriaCreateController.class b/target/classes/xyz/danielcortes/controllers/categoria/CategoriaCreateController.class new file mode 100644 index 0000000..be97cee Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/categoria/CategoriaCreateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/categoria/CategoriaDeleteController.class b/target/classes/xyz/danielcortes/controllers/categoria/CategoriaDeleteController.class new file mode 100644 index 0000000..7322b54 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/categoria/CategoriaDeleteController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/categoria/CategoriaListController.class b/target/classes/xyz/danielcortes/controllers/categoria/CategoriaListController.class new file mode 100644 index 0000000..4c956f4 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/categoria/CategoriaListController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/categoria/CategoriaUpdateController.class b/target/classes/xyz/danielcortes/controllers/categoria/CategoriaUpdateController.class new file mode 100644 index 0000000..0ddc724 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/categoria/CategoriaUpdateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/editorial/EditorialCreateController.class b/target/classes/xyz/danielcortes/controllers/editorial/EditorialCreateController.class new file mode 100644 index 0000000..4f420d3 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/editorial/EditorialCreateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/editorial/EditorialDeleteController.class b/target/classes/xyz/danielcortes/controllers/editorial/EditorialDeleteController.class new file mode 100644 index 0000000..644f4dd Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/editorial/EditorialDeleteController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/editorial/EditorialListController.class b/target/classes/xyz/danielcortes/controllers/editorial/EditorialListController.class new file mode 100644 index 0000000..b35e612 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/editorial/EditorialListController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/editorial/EditorialUpdateController.class b/target/classes/xyz/danielcortes/controllers/editorial/EditorialUpdateController.class new file mode 100644 index 0000000..cc332e9 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/editorial/EditorialUpdateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/idioma/IdiomaCreateController.class b/target/classes/xyz/danielcortes/controllers/idioma/IdiomaCreateController.class new file mode 100644 index 0000000..b221bf6 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/idioma/IdiomaCreateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/idioma/IdiomaDeleteController.class b/target/classes/xyz/danielcortes/controllers/idioma/IdiomaDeleteController.class new file mode 100644 index 0000000..1bfd186 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/idioma/IdiomaDeleteController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/idioma/IdiomaListController.class b/target/classes/xyz/danielcortes/controllers/idioma/IdiomaListController.class new file mode 100644 index 0000000..f8e26d1 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/idioma/IdiomaListController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/idioma/IdiomaUpdateController.class b/target/classes/xyz/danielcortes/controllers/idioma/IdiomaUpdateController.class new file mode 100644 index 0000000..d7ff2e7 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/idioma/IdiomaUpdateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/libro/LibroCreateController.class b/target/classes/xyz/danielcortes/controllers/libro/LibroCreateController.class new file mode 100644 index 0000000..e6b7f84 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/libro/LibroCreateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/libro/LibroDeleteController.class b/target/classes/xyz/danielcortes/controllers/libro/LibroDeleteController.class new file mode 100644 index 0000000..2d6c5b9 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/libro/LibroDeleteController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/libro/LibroListController.class b/target/classes/xyz/danielcortes/controllers/libro/LibroListController.class new file mode 100644 index 0000000..e2d3ff9 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/libro/LibroListController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/libro/LibroUpdateController.class b/target/classes/xyz/danielcortes/controllers/libro/LibroUpdateController.class new file mode 100644 index 0000000..3cb91b1 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/libro/LibroUpdateController.class differ diff --git a/target/classes/xyz/danielcortes/controllers/libro/LibroValidator.class b/target/classes/xyz/danielcortes/controllers/libro/LibroValidator.class new file mode 100644 index 0000000..bdb2be4 Binary files /dev/null and b/target/classes/xyz/danielcortes/controllers/libro/LibroValidator.class differ diff --git a/target/classes/xyz/danielcortes/framework/BaseTableModel.class b/target/classes/xyz/danielcortes/framework/BaseTableModel.class new file mode 100644 index 0000000..9f3d39a Binary files /dev/null and b/target/classes/xyz/danielcortes/framework/BaseTableModel.class differ diff --git a/target/classes/xyz/danielcortes/framework/GeneralValidator.class b/target/classes/xyz/danielcortes/framework/GeneralValidator.class new file mode 100644 index 0000000..b222275 Binary files /dev/null and b/target/classes/xyz/danielcortes/framework/GeneralValidator.class differ diff --git a/target/classes/xyz/danielcortes/framework/JListUtils.class b/target/classes/xyz/danielcortes/framework/JListUtils.class new file mode 100644 index 0000000..c612a73 Binary files /dev/null and b/target/classes/xyz/danielcortes/framework/JListUtils.class differ diff --git a/target/classes/xyz/danielcortes/framework/PanelName.class b/target/classes/xyz/danielcortes/framework/PanelName.class new file mode 100644 index 0000000..b3ed86e Binary files /dev/null and b/target/classes/xyz/danielcortes/framework/PanelName.class differ diff --git a/target/classes/xyz/danielcortes/framework/PersistenceManager.class b/target/classes/xyz/danielcortes/framework/PersistenceManager.class new file mode 100644 index 0000000..0cb6e7b Binary files /dev/null and b/target/classes/xyz/danielcortes/framework/PersistenceManager.class differ diff --git a/target/classes/xyz/danielcortes/framework/TriFunction.class b/target/classes/xyz/danielcortes/framework/TriFunction.class new file mode 100644 index 0000000..9f1bf6b Binary files /dev/null and b/target/classes/xyz/danielcortes/framework/TriFunction.class differ diff --git a/target/classes/xyz/danielcortes/framework/YearAttributeConverter.class b/target/classes/xyz/danielcortes/framework/YearAttributeConverter.class new file mode 100644 index 0000000..7612a27 Binary files /dev/null and b/target/classes/xyz/danielcortes/framework/YearAttributeConverter.class differ diff --git a/target/classes/xyz/danielcortes/models/Autor.class b/target/classes/xyz/danielcortes/models/Autor.class new file mode 100644 index 0000000..e3cd81b Binary files /dev/null and b/target/classes/xyz/danielcortes/models/Autor.class differ diff --git a/target/classes/xyz/danielcortes/models/Categoria.class b/target/classes/xyz/danielcortes/models/Categoria.class new file mode 100644 index 0000000..08dcc67 Binary files /dev/null and b/target/classes/xyz/danielcortes/models/Categoria.class differ diff --git a/target/classes/xyz/danielcortes/models/Editorial.class b/target/classes/xyz/danielcortes/models/Editorial.class new file mode 100644 index 0000000..1fcf04a Binary files /dev/null and b/target/classes/xyz/danielcortes/models/Editorial.class differ diff --git a/target/classes/xyz/danielcortes/models/Estado.class b/target/classes/xyz/danielcortes/models/Estado.class new file mode 100644 index 0000000..02565d5 Binary files /dev/null and b/target/classes/xyz/danielcortes/models/Estado.class differ diff --git a/target/classes/xyz/danielcortes/models/Idioma.class b/target/classes/xyz/danielcortes/models/Idioma.class new file mode 100644 index 0000000..b9d1732 Binary files /dev/null and b/target/classes/xyz/danielcortes/models/Idioma.class differ diff --git a/target/classes/xyz/danielcortes/models/Libro.class b/target/classes/xyz/danielcortes/models/Libro.class new file mode 100644 index 0000000..2ed4e9a Binary files /dev/null and b/target/classes/xyz/danielcortes/models/Libro.class differ diff --git a/target/classes/xyz/danielcortes/repository/AutorRepository.class b/target/classes/xyz/danielcortes/repository/AutorRepository.class new file mode 100644 index 0000000..2f9aa0d Binary files /dev/null and b/target/classes/xyz/danielcortes/repository/AutorRepository.class differ diff --git a/target/classes/xyz/danielcortes/repository/CategoriaRepository.class b/target/classes/xyz/danielcortes/repository/CategoriaRepository.class new file mode 100644 index 0000000..3c6b7d3 Binary files /dev/null and b/target/classes/xyz/danielcortes/repository/CategoriaRepository.class differ diff --git a/target/classes/xyz/danielcortes/repository/EditorialRepository.class b/target/classes/xyz/danielcortes/repository/EditorialRepository.class new file mode 100644 index 0000000..0a87b4c Binary files /dev/null and b/target/classes/xyz/danielcortes/repository/EditorialRepository.class differ diff --git a/target/classes/xyz/danielcortes/repository/EstadoRepository.class b/target/classes/xyz/danielcortes/repository/EstadoRepository.class new file mode 100644 index 0000000..50b1a7d Binary files /dev/null and b/target/classes/xyz/danielcortes/repository/EstadoRepository.class differ diff --git a/target/classes/xyz/danielcortes/repository/IdiomaRepository.class b/target/classes/xyz/danielcortes/repository/IdiomaRepository.class new file mode 100644 index 0000000..6d99359 Binary files /dev/null and b/target/classes/xyz/danielcortes/repository/IdiomaRepository.class differ diff --git a/target/classes/xyz/danielcortes/repository/LibroRepository.class b/target/classes/xyz/danielcortes/repository/LibroRepository.class new file mode 100644 index 0000000..fae5227 Binary files /dev/null and b/target/classes/xyz/danielcortes/repository/LibroRepository.class differ diff --git a/target/classes/xyz/danielcortes/views/LaunchFrame.class b/target/classes/xyz/danielcortes/views/LaunchFrame.class new file mode 100644 index 0000000..96b6c51 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/LaunchFrame.class differ diff --git a/target/classes/xyz/danielcortes/views/autor/AutorCreatePanel.class b/target/classes/xyz/danielcortes/views/autor/AutorCreatePanel.class new file mode 100644 index 0000000..7a62107 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/autor/AutorCreatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/autor/AutorCreatePanel.form b/target/classes/xyz/danielcortes/views/autor/AutorCreatePanel.form new file mode 100644 index 0000000..995dc4d --- /dev/null +++ b/target/classes/xyz/danielcortes/views/autor/AutorCreatePanel.form @@ -0,0 +1,84 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/autor/AutorDeletePanel.class b/target/classes/xyz/danielcortes/views/autor/AutorDeletePanel.class new file mode 100644 index 0000000..ef70a7d Binary files /dev/null and b/target/classes/xyz/danielcortes/views/autor/AutorDeletePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/autor/AutorDeletePanel.form b/target/classes/xyz/danielcortes/views/autor/AutorDeletePanel.form new file mode 100644 index 0000000..ba3ae33 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/autor/AutorDeletePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/autor/AutorListPanel.class b/target/classes/xyz/danielcortes/views/autor/AutorListPanel.class new file mode 100644 index 0000000..ef6ff89 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/autor/AutorListPanel.class differ diff --git a/target/classes/xyz/danielcortes/views/autor/AutorListPanel.form b/target/classes/xyz/danielcortes/views/autor/AutorListPanel.form new file mode 100644 index 0000000..2495914 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/autor/AutorListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/autor/AutorUpdatePanel.class b/target/classes/xyz/danielcortes/views/autor/AutorUpdatePanel.class new file mode 100644 index 0000000..48533fc Binary files /dev/null and b/target/classes/xyz/danielcortes/views/autor/AutorUpdatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/autor/AutorUpdatePanel.form b/target/classes/xyz/danielcortes/views/autor/AutorUpdatePanel.form new file mode 100644 index 0000000..d211ced --- /dev/null +++ b/target/classes/xyz/danielcortes/views/autor/AutorUpdatePanel.form @@ -0,0 +1,100 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/categoria/CategoriaCreatePanel.class b/target/classes/xyz/danielcortes/views/categoria/CategoriaCreatePanel.class new file mode 100644 index 0000000..69a526d Binary files /dev/null and b/target/classes/xyz/danielcortes/views/categoria/CategoriaCreatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/categoria/CategoriaCreatePanel.form b/target/classes/xyz/danielcortes/views/categoria/CategoriaCreatePanel.form new file mode 100644 index 0000000..667b916 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/categoria/CategoriaCreatePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/categoria/CategoriaDeletePanel.class b/target/classes/xyz/danielcortes/views/categoria/CategoriaDeletePanel.class new file mode 100644 index 0000000..1224733 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/categoria/CategoriaDeletePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/categoria/CategoriaDeletePanel.form b/target/classes/xyz/danielcortes/views/categoria/CategoriaDeletePanel.form new file mode 100644 index 0000000..68aab12 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/categoria/CategoriaDeletePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/categoria/CategoriaListPanel.class b/target/classes/xyz/danielcortes/views/categoria/CategoriaListPanel.class new file mode 100644 index 0000000..8b207b7 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/categoria/CategoriaListPanel.class differ diff --git a/target/classes/xyz/danielcortes/views/categoria/CategoriaListPanel.form b/target/classes/xyz/danielcortes/views/categoria/CategoriaListPanel.form new file mode 100644 index 0000000..7b2e698 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/categoria/CategoriaListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.class b/target/classes/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.class new file mode 100644 index 0000000..0eb7046 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.form b/target/classes/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.form new file mode 100644 index 0000000..dd2231c --- /dev/null +++ b/target/classes/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.form @@ -0,0 +1,68 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/editorial/EditorialCreatePanel.class b/target/classes/xyz/danielcortes/views/editorial/EditorialCreatePanel.class new file mode 100644 index 0000000..59ce09f Binary files /dev/null and b/target/classes/xyz/danielcortes/views/editorial/EditorialCreatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/editorial/EditorialCreatePanel.form b/target/classes/xyz/danielcortes/views/editorial/EditorialCreatePanel.form new file mode 100644 index 0000000..7249438 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/editorial/EditorialCreatePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/editorial/EditorialDeletePanel.class b/target/classes/xyz/danielcortes/views/editorial/EditorialDeletePanel.class new file mode 100644 index 0000000..d101bc3 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/editorial/EditorialDeletePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/editorial/EditorialDeletePanel.form b/target/classes/xyz/danielcortes/views/editorial/EditorialDeletePanel.form new file mode 100644 index 0000000..ece1357 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/editorial/EditorialDeletePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/editorial/EditorialListPanel.class b/target/classes/xyz/danielcortes/views/editorial/EditorialListPanel.class new file mode 100644 index 0000000..da757e2 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/editorial/EditorialListPanel.class differ diff --git a/target/classes/xyz/danielcortes/views/editorial/EditorialListPanel.form b/target/classes/xyz/danielcortes/views/editorial/EditorialListPanel.form new file mode 100644 index 0000000..76a0d95 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/editorial/EditorialListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/editorial/EditorialUpdatePanel.class b/target/classes/xyz/danielcortes/views/editorial/EditorialUpdatePanel.class new file mode 100644 index 0000000..09e18a1 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/editorial/EditorialUpdatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/editorial/EditorialUpdatePanel.form b/target/classes/xyz/danielcortes/views/editorial/EditorialUpdatePanel.form new file mode 100644 index 0000000..f4c2189 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/editorial/EditorialUpdatePanel.form @@ -0,0 +1,68 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/idioma/IdiomaCreatePanel.class b/target/classes/xyz/danielcortes/views/idioma/IdiomaCreatePanel.class new file mode 100644 index 0000000..157b427 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/idioma/IdiomaCreatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/idioma/IdiomaCreatePanel.form b/target/classes/xyz/danielcortes/views/idioma/IdiomaCreatePanel.form new file mode 100644 index 0000000..80fbd55 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/idioma/IdiomaCreatePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/idioma/IdiomaDeletePanel.class b/target/classes/xyz/danielcortes/views/idioma/IdiomaDeletePanel.class new file mode 100644 index 0000000..f418041 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/idioma/IdiomaDeletePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/idioma/IdiomaDeletePanel.form b/target/classes/xyz/danielcortes/views/idioma/IdiomaDeletePanel.form new file mode 100644 index 0000000..ab1d965 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/idioma/IdiomaDeletePanel.form @@ -0,0 +1,54 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/idioma/IdiomaListPanel.class b/target/classes/xyz/danielcortes/views/idioma/IdiomaListPanel.class new file mode 100644 index 0000000..154d0c7 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/idioma/IdiomaListPanel.class differ diff --git a/target/classes/xyz/danielcortes/views/idioma/IdiomaListPanel.form b/target/classes/xyz/danielcortes/views/idioma/IdiomaListPanel.form new file mode 100644 index 0000000..c4fa0ea --- /dev/null +++ b/target/classes/xyz/danielcortes/views/idioma/IdiomaListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.class b/target/classes/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.class new file mode 100644 index 0000000..2abbce6 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.form b/target/classes/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.form new file mode 100644 index 0000000..33a2a04 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.form @@ -0,0 +1,68 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/libro/LibroCreatePanel.class b/target/classes/xyz/danielcortes/views/libro/LibroCreatePanel.class new file mode 100644 index 0000000..8407b94 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/libro/LibroCreatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/libro/LibroCreatePanel.form b/target/classes/xyz/danielcortes/views/libro/LibroCreatePanel.form new file mode 100644 index 0000000..da9c083 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/libro/LibroCreatePanel.form @@ -0,0 +1,219 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/libro/LibroDeletePanel.class b/target/classes/xyz/danielcortes/views/libro/LibroDeletePanel.class new file mode 100644 index 0000000..ec5601a Binary files /dev/null and b/target/classes/xyz/danielcortes/views/libro/LibroDeletePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/libro/LibroDeletePanel.form b/target/classes/xyz/danielcortes/views/libro/LibroDeletePanel.form new file mode 100644 index 0000000..3d0018e --- /dev/null +++ b/target/classes/xyz/danielcortes/views/libro/LibroDeletePanel.form @@ -0,0 +1,52 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/libro/LibroListPanel.class b/target/classes/xyz/danielcortes/views/libro/LibroListPanel.class new file mode 100644 index 0000000..c88c63c Binary files /dev/null and b/target/classes/xyz/danielcortes/views/libro/LibroListPanel.class differ diff --git a/target/classes/xyz/danielcortes/views/libro/LibroListPanel.form b/target/classes/xyz/danielcortes/views/libro/LibroListPanel.form new file mode 100644 index 0000000..ed39471 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/libro/LibroListPanel.form @@ -0,0 +1,28 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/classes/xyz/danielcortes/views/libro/LibroUpdatePanel.class b/target/classes/xyz/danielcortes/views/libro/LibroUpdatePanel.class new file mode 100644 index 0000000..609bde8 Binary files /dev/null and b/target/classes/xyz/danielcortes/views/libro/LibroUpdatePanel.class differ diff --git a/target/classes/xyz/danielcortes/views/libro/LibroUpdatePanel.form b/target/classes/xyz/danielcortes/views/libro/LibroUpdatePanel.form new file mode 100644 index 0000000..3c63388 --- /dev/null +++ b/target/classes/xyz/danielcortes/views/libro/LibroUpdatePanel.form @@ -0,0 +1,233 @@ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/target/lib/FastInfoset-1.2.15.jar b/target/lib/FastInfoset-1.2.15.jar new file mode 100644 index 0000000..2671209 Binary files /dev/null and b/target/lib/FastInfoset-1.2.15.jar differ diff --git a/target/lib/antlr-2.7.7.jar b/target/lib/antlr-2.7.7.jar new file mode 100644 index 0000000..5e5f14b Binary files /dev/null and b/target/lib/antlr-2.7.7.jar differ diff --git a/target/lib/asm-3.0.jar b/target/lib/asm-3.0.jar new file mode 100644 index 0000000..112f5bd Binary files /dev/null and b/target/lib/asm-3.0.jar differ diff --git a/target/lib/asm-commons-3.0.jar b/target/lib/asm-commons-3.0.jar new file mode 100644 index 0000000..3fd0842 Binary files /dev/null and b/target/lib/asm-commons-3.0.jar differ diff --git a/target/lib/asm-tree-3.0.jar b/target/lib/asm-tree-3.0.jar new file mode 100644 index 0000000..2a4b208 Binary files /dev/null and b/target/lib/asm-tree-3.0.jar differ diff --git a/target/lib/byte-buddy-1.9.10.jar b/target/lib/byte-buddy-1.9.10.jar new file mode 100644 index 0000000..239fc80 Binary files /dev/null and b/target/lib/byte-buddy-1.9.10.jar differ diff --git a/target/lib/classmate-1.3.4.jar b/target/lib/classmate-1.3.4.jar new file mode 100644 index 0000000..5be6d99 Binary files /dev/null and b/target/lib/classmate-1.3.4.jar differ diff --git a/target/lib/dom4j-2.1.1.jar b/target/lib/dom4j-2.1.1.jar new file mode 100644 index 0000000..cda47db Binary files /dev/null and b/target/lib/dom4j-2.1.1.jar differ diff --git a/target/lib/forms-1.1-preview.jar b/target/lib/forms-1.1-preview.jar new file mode 100644 index 0000000..bbd3215 Binary files /dev/null and b/target/lib/forms-1.1-preview.jar differ diff --git a/target/lib/forms_rt-7.0.3.jar b/target/lib/forms_rt-7.0.3.jar new file mode 100644 index 0000000..367599b Binary files /dev/null and b/target/lib/forms_rt-7.0.3.jar differ diff --git a/target/lib/hamcrest-core-1.3.jar b/target/lib/hamcrest-core-1.3.jar new file mode 100644 index 0000000..9d5fe16 Binary files /dev/null and b/target/lib/hamcrest-core-1.3.jar differ diff --git a/target/lib/hibernate-commons-annotations-5.1.0.Final.jar b/target/lib/hibernate-commons-annotations-5.1.0.Final.jar new file mode 100644 index 0000000..9a9d5b7 Binary files /dev/null and b/target/lib/hibernate-commons-annotations-5.1.0.Final.jar differ diff --git a/target/lib/hibernate-core-5.4.2.Final.jar b/target/lib/hibernate-core-5.4.2.Final.jar new file mode 100644 index 0000000..ae9e260 Binary files /dev/null and b/target/lib/hibernate-core-5.4.2.Final.jar differ diff --git a/target/lib/hibernate-entitymanager-5.4.2.Final.jar b/target/lib/hibernate-entitymanager-5.4.2.Final.jar new file mode 100644 index 0000000..82df45f Binary files /dev/null and b/target/lib/hibernate-entitymanager-5.4.2.Final.jar differ diff --git a/target/lib/istack-commons-runtime-3.0.7.jar b/target/lib/istack-commons-runtime-3.0.7.jar new file mode 100644 index 0000000..2fe5b82 Binary files /dev/null and b/target/lib/istack-commons-runtime-3.0.7.jar differ diff --git a/target/lib/jandex-2.0.5.Final.jar b/target/lib/jandex-2.0.5.Final.jar new file mode 100644 index 0000000..fb9c235 Binary files /dev/null and b/target/lib/jandex-2.0.5.Final.jar differ diff --git a/target/lib/javassist-3.24.0-GA.jar b/target/lib/javassist-3.24.0-GA.jar new file mode 100644 index 0000000..977a081 Binary files /dev/null and b/target/lib/javassist-3.24.0-GA.jar differ diff --git a/target/lib/javax.activation-api-1.2.0.jar b/target/lib/javax.activation-api-1.2.0.jar new file mode 100644 index 0000000..986c365 Binary files /dev/null and b/target/lib/javax.activation-api-1.2.0.jar differ diff --git a/target/lib/javax.persistence-api-2.2.jar b/target/lib/javax.persistence-api-2.2.jar new file mode 100644 index 0000000..164ef3a Binary files /dev/null and b/target/lib/javax.persistence-api-2.2.jar differ diff --git a/target/lib/jaxb-api-2.3.1.jar b/target/lib/jaxb-api-2.3.1.jar new file mode 100644 index 0000000..4565865 Binary files /dev/null and b/target/lib/jaxb-api-2.3.1.jar differ diff --git a/target/lib/jaxb-runtime-2.3.1.jar b/target/lib/jaxb-runtime-2.3.1.jar new file mode 100644 index 0000000..0b9ef67 Binary files /dev/null and b/target/lib/jaxb-runtime-2.3.1.jar differ diff --git a/target/lib/jboss-logging-3.3.2.Final.jar b/target/lib/jboss-logging-3.3.2.Final.jar new file mode 100644 index 0000000..67cde71 Binary files /dev/null and b/target/lib/jboss-logging-3.3.2.Final.jar differ diff --git a/target/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar b/target/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar new file mode 100644 index 0000000..627f7ce Binary files /dev/null and b/target/lib/jboss-transaction-api_1.2_spec-1.1.1.Final.jar differ diff --git a/target/lib/jdom-1.0.jar b/target/lib/jdom-1.0.jar new file mode 100644 index 0000000..288e64c Binary files /dev/null and b/target/lib/jdom-1.0.jar differ diff --git a/target/lib/junit-4.11.jar b/target/lib/junit-4.11.jar new file mode 100644 index 0000000..aaf7444 Binary files /dev/null and b/target/lib/junit-4.11.jar differ diff --git a/target/lib/mysql-connector-java-8.0.15.jar b/target/lib/mysql-connector-java-8.0.15.jar new file mode 100644 index 0000000..fa0979f Binary files /dev/null and b/target/lib/mysql-connector-java-8.0.15.jar differ diff --git a/target/lib/protobuf-java-3.6.1.jar b/target/lib/protobuf-java-3.6.1.jar new file mode 100644 index 0000000..8a18789 Binary files /dev/null and b/target/lib/protobuf-java-3.6.1.jar differ diff --git a/target/lib/stax-ex-1.8.jar b/target/lib/stax-ex-1.8.jar new file mode 100644 index 0000000..5e60637 Binary files /dev/null and b/target/lib/stax-ex-1.8.jar differ diff --git a/target/lib/txw2-2.3.1.jar b/target/lib/txw2-2.3.1.jar new file mode 100644 index 0000000..75ed519 Binary files /dev/null and b/target/lib/txw2-2.3.1.jar differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties new file mode 100644 index 0000000..8381b8c --- /dev/null +++ b/target/maven-archiver/pom.properties @@ -0,0 +1,4 @@ +#Created by Apache Maven 3.3.9 +groupId=xyz.danielcortes +artifactId=biblioteca +version=1 diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file mode 100644 index 0000000..0b3e70a --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -0,0 +1,63 @@ +xyz/danielcortes/controllers/autor/AutorDeleteController.class +xyz/danielcortes/repository/AutorRepository.class +xyz/danielcortes/views/idioma/IdiomaDeletePanel.class +xyz/danielcortes/App.class +xyz/danielcortes/models/Autor.class +xyz/danielcortes/controllers/idioma/IdiomaListController.class +xyz/danielcortes/controllers/editorial/EditorialListController.class +xyz/danielcortes/views/categoria/CategoriaCreatePanel.class +xyz/danielcortes/framework/GeneralValidator.class +xyz/danielcortes/framework/PanelName.class +xyz/danielcortes/repository/LibroRepository.class +xyz/danielcortes/models/Libro.class +xyz/danielcortes/views/autor/AutorListPanel.class +xyz/danielcortes/controllers/libro/LibroCreateController.class +xyz/danielcortes/controllers/categoria/CategoriaUpdateController.class +xyz/danielcortes/views/autor/AutorCreatePanel.class +xyz/danielcortes/views/categoria/CategoriaDeletePanel.class +xyz/danielcortes/controllers/libro/LibroDeleteController.class +xyz/danielcortes/controllers/editorial/EditorialDeleteController.class +xyz/danielcortes/views/editorial/EditorialCreatePanel.class +xyz/danielcortes/views/editorial/EditorialUpdatePanel.class +xyz/danielcortes/views/editorial/EditorialListPanel.class +xyz/danielcortes/controllers/editorial/EditorialCreateController.class +xyz/danielcortes/framework/YearAttributeConverter.class +xyz/danielcortes/views/idioma/IdiomaCreatePanel.class +xyz/danielcortes/framework/BaseTableModel.class +xyz/danielcortes/controllers/autor/AutorListController.class +xyz/danielcortes/repository/EstadoRepository.class +xyz/danielcortes/controllers/libro/LibroValidator.class +xyz/danielcortes/views/autor/AutorUpdatePanel.class +xyz/danielcortes/controllers/idioma/IdiomaDeleteController.class +xyz/danielcortes/controllers/libro/LibroUpdateController.class +xyz/danielcortes/controllers/editorial/EditorialUpdateController.class +xyz/danielcortes/framework/TriFunction.class +xyz/danielcortes/views/libro/LibroDeletePanel.class +xyz/danielcortes/models/Categoria.class +xyz/danielcortes/controllers/libro/LibroListController.class +xyz/danielcortes/views/categoria/CategoriaUpdatePanel.class +xyz/danielcortes/views/idioma/IdiomaListPanel.class +xyz/danielcortes/controllers/autor/AutorCreateController.class +xyz/danielcortes/views/categoria/CategoriaListPanel.class +xyz/danielcortes/views/idioma/IdiomaUpdatePanel.class +xyz/danielcortes/repository/EditorialRepository.class +xyz/danielcortes/views/editorial/EditorialDeletePanel.class +xyz/danielcortes/views/autor/AutorDeletePanel.class +xyz/danielcortes/models/Editorial.class +xyz/danielcortes/controllers/categoria/CategoriaCreateController.class +xyz/danielcortes/controllers/idioma/IdiomaUpdateController.class +xyz/danielcortes/repository/IdiomaRepository.class +xyz/danielcortes/repository/CategoriaRepository.class +xyz/danielcortes/controllers/categoria/CategoriaDeleteController.class +xyz/danielcortes/views/libro/LibroListPanel.class +xyz/danielcortes/controllers/categoria/CategoriaListController.class +xyz/danielcortes/controllers/idioma/IdiomaCreateController.class +xyz/danielcortes/views/LaunchFrame.class +xyz/danielcortes/framework/PersistenceManager.class +xyz/danielcortes/models/Estado.class +xyz/danielcortes/views/libro/LibroUpdatePanel.class +xyz/danielcortes/framework/JListUtils.class +xyz/danielcortes/models/Idioma.class +xyz/danielcortes/views/libro/LibroCreatePanel.class +xyz/danielcortes/controllers/LaunchController.class +xyz/danielcortes/controllers/autor/AutorUpdateController.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file mode 100644 index 0000000..44d56a4 --- /dev/null +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -0,0 +1,63 @@ +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/models/Autor.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaCreateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/LaunchController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/libro/LibroValidator.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/categoria/CategoriaDeletePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/models/Idioma.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/repository/CategoriaRepository.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/framework/PersistenceManager.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/idioma/IdiomaListPanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/editorial/EditorialDeletePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/framework/TriFunction.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/editorial/EditorialCreateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/editorial/EditorialUpdatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/categoria/CategoriaCreatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/categoria/CategoriaUpdatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/framework/BaseTableModel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaUpdateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/autor/AutorDeleteController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/categoria/CategoriaListPanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/models/Estado.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/idioma/IdiomaCreatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaDeleteController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/framework/PanelName.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/autor/AutorCreatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/repository/AutorRepository.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/autor/AutorListPanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/framework/GeneralValidator.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/autor/AutorDeletePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaCreateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/repository/EstadoRepository.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/autor/AutorUpdateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/libro/LibroListPanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/idioma/IdiomaDeletePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaListController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/libro/LibroDeleteController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/libro/LibroDeletePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/models/Editorial.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaUpdateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/autor/AutorListController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/repository/EditorialRepository.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/editorial/EditorialListPanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/autor/AutorUpdatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/categoria/CategoriaListController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/framework/YearAttributeConverter.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/libro/LibroUpdatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/models/Libro.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/autor/AutorCreateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/editorial/EditorialCreatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/models/Categoria.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/libro/LibroCreatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/editorial/EditorialDeleteController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/repository/LibroRepository.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/libro/LibroUpdateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/libro/LibroCreateController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/libro/LibroListController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/idioma/IdiomaDeleteController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/LaunchFrame.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/App.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/repository/IdiomaRepository.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/editorial/EditorialListController.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/views/idioma/IdiomaUpdatePanel.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/framework/JListUtils.java +/home/data/src/biblioteca/src/main/java/xyz/danielcortes/controllers/editorial/EditorialUpdateController.java diff --git a/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst new file mode 100644 index 0000000..e69de29 diff --git a/target/test-classes/com/intellij/uiDesigner/core/AbstractLayout.class b/target/test-classes/com/intellij/uiDesigner/core/AbstractLayout.class new file mode 100644 index 0000000..474957a Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/AbstractLayout.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/DimensionInfo.class b/target/test-classes/com/intellij/uiDesigner/core/DimensionInfo.class new file mode 100644 index 0000000..0db2f7d Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/DimensionInfo.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/GridConstraints.class b/target/test-classes/com/intellij/uiDesigner/core/GridConstraints.class new file mode 100644 index 0000000..2e1afcc Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/GridConstraints.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/GridLayoutManager.class b/target/test-classes/com/intellij/uiDesigner/core/GridLayoutManager.class new file mode 100644 index 0000000..94e3f41 Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/GridLayoutManager.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/HorizontalInfo.class b/target/test-classes/com/intellij/uiDesigner/core/HorizontalInfo.class new file mode 100644 index 0000000..bdc1fe3 Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/HorizontalInfo.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/LayoutState.class b/target/test-classes/com/intellij/uiDesigner/core/LayoutState.class new file mode 100644 index 0000000..61494df Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/LayoutState.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/Spacer.class b/target/test-classes/com/intellij/uiDesigner/core/Spacer.class new file mode 100644 index 0000000..e534880 Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/Spacer.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/SupportCode$TextWithMnemonic.class b/target/test-classes/com/intellij/uiDesigner/core/SupportCode$TextWithMnemonic.class new file mode 100644 index 0000000..67909c5 Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/SupportCode$TextWithMnemonic.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/SupportCode.class b/target/test-classes/com/intellij/uiDesigner/core/SupportCode.class new file mode 100644 index 0000000..4950c35 Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/SupportCode.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/Util.class b/target/test-classes/com/intellij/uiDesigner/core/Util.class new file mode 100644 index 0000000..4866582 Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/Util.class differ diff --git a/target/test-classes/com/intellij/uiDesigner/core/VerticalInfo.class b/target/test-classes/com/intellij/uiDesigner/core/VerticalInfo.class new file mode 100644 index 0000000..049e702 Binary files /dev/null and b/target/test-classes/com/intellij/uiDesigner/core/VerticalInfo.class differ