Primer commit del sistema como tal <3

Esta wonito pero cambiare las ventanas y su funcionalidad
This commit is contained in:
Daniel Cortés
2019-05-06 16:30:32 -04:00
parent c016899035
commit dd3908517d
238 changed files with 9239 additions and 0 deletions

1
.gitignore vendored
View File

@@ -87,3 +87,4 @@ fabric.properties
# Visual paradigm thing # Visual paradigm thing
*.bak* *.bak*
*.lck

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="GoogleStyle" />
</state>
</component>

13
.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="biblioteca" />
</profile>
</annotationProcessing>
</component>
</project>

19
.idea/dataSources.xml generated Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="manual" uuid="98426945-c0ab-4cf0-98ad-b51c8ffcd61d">
<driver-ref>mysql</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://localhost:3306/biblioteca_manual</jdbc-url>
<driver-properties>
<property name="autoReconnect" value="true" />
<property name="zeroDateTimeBehavior" value="convertToNull" />
<property name="tinyInt1isBit" value="false" />
<property name="characterEncoding" value="utf8" />
<property name="characterSetResults" value="utf8" />
<property name="yearIsDateType" value="false" />
</driver-properties>
</data-source>
</component>
</project>

6
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>

View File

@@ -0,0 +1,11 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="Duplicates" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="false" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
</profile>
</component>

14
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

6
.idea/sqldialects.xml generated Normal file
View File

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

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

17
biblioteca.iml Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="jpa" name="JPA">
<configuration>
<setting name="validation-enabled" value="true" />
<setting name="provider-name" value="Hibernate" />
<datasource-mapping>
<factory-entry name="PERSISTENCE" />
<factory-entry name="jpa" value="98426945-c0ab-4cf0-98ad-b51c8ffcd61d" />
</datasource-mapping>
<naming-strategy-map />
<deploymentDescriptor name="persistence.xml" url="file://$MODULE_DIR$/src/main/resources/META-INF/persistence.xml" />
</configuration>
</facet>
</component>
</module>

BIN
biblioteca.vpp Normal file

Binary file not shown.

123
info.md Normal file
View File

@@ -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.

77
pom.xml Normal file
View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>xyz.danielcortes</groupId>
<artifactId>biblioteca</artifactId>
<version>1</version>
<name>biblioteca</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.2.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.15</version>
</dependency>
<dependency>
<groupId>com.intellij</groupId>
<artifactId>forms_rt</artifactId>
<version>7.0.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>xyz.danielcortes.App</mainClass>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

312
script.sql Normal file
View File

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

View File

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

View File

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

View File

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

View File

@@ -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<Autor> autores = this.autorRepository.getAll();
JComboBox<Autor> combobox = this.view.getAutorCombo();
combobox.removeAllItems();
for(Autor autor: autores) {
combobox.addItem(autor);
}
}
public AutorDeletePanel getView() {
return view;
}
}

View File

@@ -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<Autor> autores = this.autorRepository.getAll();
BaseTableModel<Autor> model = this.view.getAutorModel();
model.addRows(autores);
}
public AutorListPanel getView() {
return view;
}
}

View File

@@ -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<Autor> autores = this.autorRepository.getAll();
JComboBox<Autor> combobox = this.view.getAutorCombo();
combobox.removeAllItems();
for (Autor autor : autores) {
combobox.addItem(autor);
}
}
public AutorUpdatePanel getView() {
return view;
}
}

View File

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

View File

@@ -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<Categoria> categorias = this.categoriaRepository.getAll();
JComboBox<Categoria> combobox = this.view.getCategoriaCombo();
combobox.removeAllItems();
for (Categoria categoria : categorias) {
combobox.addItem(categoria);
}
}
public CategoriaDeletePanel getView() {
return view;
}
}

View File

@@ -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<Categoria> categorias = this.categoriaRepository.getAll();
BaseTableModel<Categoria> model = this.view.getCategoriaModel();
model.addRows(categorias);
}
public CategoriaListPanel getView() { return view; }
}

View File

@@ -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<Categoria> categorias = this.categoriaRepository.getAll();
JComboBox<Categoria> combobox = this.view.getCategoriaCombo();
combobox.removeAllItems();
for (Categoria categoria : categorias) {
combobox.addItem(categoria);
}
}
public CategoriaUpdatePanel getView() {
return view;
}
}

View File

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

View File

@@ -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<Editorial> editoriales = this.editorialRepository.getAll();
JComboBox<Editorial> comboBox = this.view.getEditorialCombo();
comboBox.removeAllItems();
for(Editorial editorial: editoriales){
comboBox.addItem(editorial);
}
}
public EditorialDeletePanel getView() {
return view;
}
}

View File

@@ -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<Editorial> editoriales = this.editorialRepository.getAll();
BaseTableModel<Editorial> model = this.view.getEditorialModel();
model.addRows(editoriales);
}
public EditorialListPanel getView() {
return view;
}
}

View File

@@ -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<Editorial> editoriales = this.editorialRepository.getAll();
JComboBox<Editorial> combobox = this.view.getEditorialCombo();
combobox.removeAllItems();
for(Editorial editorial: editoriales) {
combobox.addItem(editorial);
}
}
public EditorialUpdatePanel getView() {
return view;
}
}

View File

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

View File

@@ -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<Idioma> idiomas = this.idiomaRepository.getAll();
JComboBox<Idioma> combobox = this.view.getIdiomaCombo();
combobox.removeAllItems();
for (Idioma idioma : idiomas) {
combobox.addItem(idioma);
}
}
public IdiomaDeletePanel getView() {
return view;
}
}

View File

@@ -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<Idioma> idiomas = this.idiomaRepository.getAll();
BaseTableModel<Idioma> model = this.view.getIdiomaTableModel();
model.addRows(idiomas);
}
public IdiomaListPanel getView() {
return view;
}
}

View File

@@ -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<Idioma> idiomas = this.idiomaRepository.getAll();
JComboBox<Idioma> combobox = this.view.getIdiomaCombo();
combobox.removeAllItems();
for (Idioma idioma : idiomas) {
combobox.addItem(idioma);
}
}
public IdiomaUpdatePanel getView() {
return view;
}
}

View File

@@ -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<Idioma> idiomas = this.view.getIdiomasList().getSelectedValuesList();
if(!validator.validateIdiomas(idiomas)) return;
List<Autor> autores = this.view.getAutoresList().getSelectedValuesList();
if(!validator.validateAutores(autores)) return;
List<Categoria> 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<Idioma> idiomas = idiomaRepository.getAll();
DefaultListModel<Idioma> model = this.view.getIdiomasModel();
model.clear();
for (Idioma idioma : idiomas) {
model.addElement(idioma);
}
}
private void loadCategoriasList() {
List<Categoria> categorias = categoriaRepository.getAll();
DefaultListModel<Categoria> model = this.view.getCategoriasModel();
model.clear();
for (Categoria categoria: categorias) {
model.addElement(categoria);
}
}
private void loadAutorList() {
List<Autor> autores = autorRepository.getAll();
DefaultListModel<Autor> model = this.view.getAutoresModel();
model.clear();
for (Autor autor: autores) {
model.addElement(autor);
}
}
private void loadEditorialCombo(){
List<Editorial> editoriales = this.editorialRepository.getAll();
JComboBox<Editorial> combobox = this.view.getEditorialCombo();
combobox.removeAllItems();
for(Editorial editorial: editoriales) {
combobox.addItem(editorial);
}
}
public LibroCreatePanel getView() {
return view;
}
}

View File

@@ -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<Libro> libros = this.libroRepository.getAll();
JComboBox<Libro> combobox = this.view.getLibroCombo();
combobox.removeAllItems();
for(Libro libro: libros){
combobox.addItem(libro);
}
}
public LibroDeletePanel getView() {
return view;
}
}

View File

@@ -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<Libro> libros = this.libroRepository.getAll();
BaseTableModel<Libro> model = this.view.getLibrosModel();
model.addRows(libros);
}
public LibroListPanel getView() {
return view;
}
}

View File

@@ -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<Idioma> idiomas = this.view.getIdiomasList().getSelectedValuesList();
if(!validator.validateIdiomas(idiomas)) return;
List<Autor> autores = this.view.getAutoresList().getSelectedValuesList();
if(!validator.validateAutores(autores)) return;
List<Categoria> 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<Libro> libros = libroRepository.getAll();
JComboBox<Libro> model = this.view.getLibroCombo();
model.removeAllItems();
for (Libro libro : libros) {
model.addItem(libro);
}
}
private void loadIdiomasList() {
List<Idioma> idiomas = idiomaRepository.getAll();
DefaultListModel<Idioma> model = this.view.getIdiomasModel();
model.clear();
for (Idioma idioma : idiomas) {
model.addElement(idioma);
}
}
private void loadCategoriasList() {
List<Categoria> categorias = categoriaRepository.getAll();
DefaultListModel<Categoria> model = this.view.getCategoriasModel();
model.clear();
for (Categoria categoria : categorias) {
model.addElement(categoria);
}
}
private void loadAutorList() {
List<Autor> autores = autorRepository.getAll();
DefaultListModel<Autor> model = this.view.getAutoresModel();
model.clear();
for (Autor autor : autores) {
model.addElement(autor);
}
}
private void loadEditorialCombo() {
List<Editorial> editoriales = this.editorialRepository.getAll();
JComboBox<Editorial> combobox = this.view.getEditorialCombo();
combobox.removeAllItems();
for (Editorial editorial : editoriales) {
combobox.addItem(editorial);
}
}
public LibroUpdatePanel getView() {
return view;
}
}

View File

@@ -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<Idioma> 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<Autor> 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<Categoria> 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');
}
}

View File

@@ -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<T> extends AbstractTableModel {
private String[] columns;
private List<T> rows;
private TriFunction<List<T>, 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<List<T>, 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<T> 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);
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
package xyz.danielcortes.framework;
public interface TriFunction<A, B, C, D> {
D apply(A a, B b, C c);
}

View File

@@ -0,0 +1,24 @@
package xyz.danielcortes.framework;
import java.time.Year;
import javax.persistence.AttributeConverter;
public class YearAttributeConverter implements AttributeConverter<Year, Integer> {
@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;
}
}

View File

@@ -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<Libro> 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<Libro> getLibros() {
return libros;
}
public void setLibros(Set<Libro> libros) {
this.libros = libros;
}
@Override
public String toString() {
return this.nombre + " " + this.apellidoPaterno + " " + this.apellidoMaterno;
}
}

View File

@@ -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<Libro> 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<Libro> getLibros() {
return libros;
}
public void setLibros(Set<Libro> libros) {
this.libros = libros;
}
@Override
public String toString() {
return this.nombre;
}
}

View File

@@ -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<Libro> 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<Libro> getLibros() {
return libros;
}
public void setLibros(Set<Libro> libros) {
this.libros = libros;
}
@Override
public String toString() {
return this.nombre;
}
}

View File

@@ -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<Libro> 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<Libro> getLibros() {
return libros;
}
public void setLibros(Set<Libro> libros) {
this.libros = libros;
}
@Override
public String toString() {
return this.nombre;
}
}

View File

@@ -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<Libro> 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<Libro> getLibros() {
return libros;
}
public void setLibros(Set<Libro> libros) {
this.libros = libros;
}
@Override
public String toString() {
return this.nombre;
}
}

View File

@@ -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<Idioma> idiomas;
@ManyToMany
@JoinTable(
name = "libro_autor",
joinColumns = @JoinColumn(name = "libro_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "autor_id", referencedColumnName = "id")
)
private Set<Autor> autores;
@ManyToMany
@JoinTable(
name = "libro_categoria",
joinColumns = @JoinColumn(name = "libro_id", referencedColumnName = "id"),
inverseJoinColumns = @JoinColumn(name = "categoria_id", referencedColumnName = "id")
)
private Set<Categoria> 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<Idioma> getIdiomas() {
return idiomas;
}
public void setIdiomas(Set<Idioma> idiomas) {
this.idiomas = idiomas;
}
public Set<Autor> getAutores() {
return autores;
}
public void setAutores(Set<Autor> autores) {
this.autores = autores;
}
public Set<Categoria> getCategorias() {
return categorias;
}
public void setCategorias(Set<Categoria> 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;
}
}

View File

@@ -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<Autor> getAll() {
TypedQuery<Autor> 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();
}
}

View File

@@ -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<Categoria> getAll() {
TypedQuery<Categoria> 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();
}
}

View File

@@ -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<Editorial> getAll() {
TypedQuery<Editorial> 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();
}
}

View File

@@ -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<Estado> getAll() {
TypedQuery<Estado> query = em.createQuery("SELECT e FROM Estado e", Estado.class);
return query.getResultList();
}
public Estado getByNombre(String nombre) {
TypedQuery<Estado> 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();
}
}

View File

@@ -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<Idioma> getAll() {
TypedQuery<Idioma> query = em.createQuery("SELECT i FROM Idioma i", Idioma.class);
List<Idioma> 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();
}
}

View File

@@ -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<Libro> getAll() {
TypedQuery<Libro> 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;
}
}

View File

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

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.autor.AutorCreatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="8" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e1d53" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre:"/>
</properties>
</component>
<component id="a56da" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="b0057" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Apellido Paterno:"/>
</properties>
</component>
<component id="dfe9b" class="javax.swing.JTextField" binding="apellidoPaternoField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="196df" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Apellido Materno:"/>
</properties>
</component>
<component id="cd6a6" class="javax.swing.JTextField" binding="apellidoMaternoField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="a11e3" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Guardar"/>
</properties>
</component>
<vspacer id="8d91b">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="a8101">
<constraints>
<grid row="7" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="f2d12">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

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

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.autor.AutorDeletePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="a766b" class="javax.swing.JComboBox" binding="autorCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="19f2d" class="javax.swing.JLabel" binding="autorField">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Autor:"/>
</properties>
</component>
<component id="8d497" class="javax.swing.JButton" binding="eliminarButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Eliminar"/>
</properties>
</component>
<vspacer id="63378">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="3d741">
<constraints>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="1c5a8">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

@@ -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<Autor> autorCombo;
private DefaultComboBoxModel<Autor> autorModel;
private JButton eliminarButton;
private JLabel autorField;
private JPanel contentPane;
public JComboBox<Autor> getAutorCombo() {
return autorCombo;
}
public JButton getEliminarButton() {
return eliminarButton;
}
public JLabel getAutorField() {
return autorField;
}
public DefaultComboBoxModel<Autor> 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);
}
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.autor.AutorListPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="501" height="443"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="4cd2">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c98c0" class="javax.swing.JTable" binding="autorTable" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
</children>
</grid>
</form>

View File

@@ -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<Autor> autorModel;
public JPanel getContentPane() {
return contentPane;
}
public JTable getAutorTable() {
return autorTable;
}
public BaseTableModel<Autor> 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;
}
}

View File

@@ -0,0 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.autor.AutorUpdatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="10" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="4ebd9" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Autor:"/>
</properties>
</component>
<component id="a8128" class="javax.swing.JComboBox" binding="autorCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="c24c2" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre:"/>
</properties>
</component>
<component id="c6a4b" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="48e89" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Apellido Paterno:"/>
</properties>
</component>
<component id="294b" class="javax.swing.JTextField" binding="apellidoPaternoField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="c0a2b" class="javax.swing.JTextField" binding="apellidoMaternoField">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="a4360" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Apellido Materno:"/>
</properties>
</component>
<component id="482e0" class="javax.swing.JButton" binding="actualizarButton" default-binding="true">
<constraints>
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Actualizar"/>
</properties>
</component>
<vspacer id="29de9">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="4e68">
<constraints>
<grid row="9" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="1cc6d">
<constraints>
<grid row="9" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

@@ -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<Autor> autorCombo;
private DefaultComboBoxModel<Autor> autorModel;
private JTextField nombreField;
private JTextField apellidoPaternoField;
private JTextField apellidoMaternoField;
private JButton actualizarButton;
private JPanel contentPane;
public JComboBox<Autor> getAutorCombo() {
return autorCombo;
}
public DefaultComboBoxModel<Autor> 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;
}
}

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.categoria.CategoriaCreatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="e85e9" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Guardar"/>
</properties>
</component>
<component id="1b807" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre:"/>
</properties>
</component>
<component id="46da5" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<vspacer id="8538f">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="3214d">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="e47b1">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

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

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.categoria.CategoriaDeletePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="504" height="154"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c9fc7" class="javax.swing.JComboBox" binding="categoriaCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="8fa01" class="javax.swing.JButton" binding="eliminarButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Eliminar"/>
</properties>
</component>
<component id="8c3f8" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Categoria:"/>
</properties>
</component>
<vspacer id="ceef0">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="55d28">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="8640e">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

@@ -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<Categoria> categoriaCombo;
private DefaultComboBoxModel<Categoria> categoriaModel;
private JButton eliminarButton;
private JPanel contentPane;
public JComboBox<Categoria> 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;
}
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.categoria.CategoriaListPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="cac09">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="85378" class="javax.swing.JTable" binding="categoriaTable" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
</children>
</grid>
</form>

View File

@@ -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<Categoria> categoriaModel;
public JPanel getContentPane() {
return contentPane;
}
public JTable getCategoriaTable() {
return categoriaTable;
}
public BaseTableModel<Categoria> 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;
}
}

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.categoria.CategoriaUpdatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="214"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="ecc19" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Categoria:"/>
</properties>
</component>
<component id="8461f" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre:"/>
</properties>
</component>
<component id="bc042" class="javax.swing.JButton" binding="updateButton">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Actualizar"/>
</properties>
</component>
<vspacer id="e4bef">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="4860e" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="7136a" class="javax.swing.JComboBox" binding="categoriaCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<hspacer id="bef66">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="12110">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

@@ -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<Categoria> categoriaCombo;
private DefaultComboBoxModel<Categoria> categoriaModel;
private JButton updateButton;
public JPanel getContentPane() {
return contentPane;
}
public JTextField getNombreField() {
return nombreField;
}
public JComboBox<Categoria> 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;
}
}

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.editorial.EditorialCreatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="45fe9" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<vspacer id="ff24d">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="1cefe" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre:"/>
</properties>
</component>
<component id="360a" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Guardar"/>
</properties>
</component>
<hspacer id="ae074">
<constraints>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="8a871">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

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

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.editorial.EditorialDeletePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="154"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="cd284" class="javax.swing.JComboBox" binding="editorialCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="36ce" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Editorial:"/>
</properties>
</component>
<component id="9e3eb" class="javax.swing.JButton" binding="eliminarButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Eliminar"/>
</properties>
</component>
<vspacer id="c8547">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="f20bb">
<constraints>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="fb8bc">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

@@ -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<Editorial> editorialCombo;
private DefaultComboBoxModel<Editorial> editorialModel;
private JButton eliminarButton;
public JPanel getContentPane() {
return contentPane;
}
public JComboBox<Editorial> getEditorialCombo() {
return editorialCombo;
}
public DefaultComboBoxModel<Editorial> 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;
}
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.editorial.EditorialListPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="5e7a3">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="285b9" class="javax.swing.JTable" binding="editorialTable" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
</children>
</grid>
</form>

View File

@@ -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<Editorial> editorialModel;
public JPanel getContentPane() {
return contentPane;
}
public JTable getEditorialTable() {
return editorialTable;
}
public BaseTableModel<Editorial> 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;
}
}

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.editorial.EditorialUpdatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="214"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="faf3" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="e88f4" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre:"/>
</properties>
</component>
<component id="4c101" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Editorial:"/>
</properties>
</component>
<component id="fbcb4" class="javax.swing.JComboBox" binding="editorialCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<vspacer id="d3329">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="76a13">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="1d353">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="84fc7" class="javax.swing.JButton" binding="actualizarButton" default-binding="true">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Actualizar"/>
</properties>
</component>
</children>
</grid>
</form>

View File

@@ -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<Editorial> editorialCombo;
private DefaultComboBoxModel<Editorial> editorialModel;
private JButton actualizarButton;
public JPanel getContentPane() {
return contentPane;
}
public JTextField getNombreField() {
return nombreField;
}
public JComboBox<Editorial> getEditorialCombo() {
return editorialCombo;
}
public DefaultComboBoxModel<Editorial> 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;
}
}

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.idioma.IdiomaCreatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="154"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="f3982" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="dbfd0" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Guardar"/>
</properties>
</component>
<vspacer id="201a">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="161a4">
<constraints>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="dcac6">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="4b0e5" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre:"/>
</properties>
</component>
</children>
</grid>
</form>

View File

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

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.idioma.IdiomaDeletePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="154"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="94347" class="javax.swing.JComboBox" binding="idiomaCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties>
<model/>
</properties>
</component>
<component id="612b7" class="javax.swing.JButton" binding="eliminarButton" default-binding="true">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Eliminar"/>
</properties>
</component>
<vspacer id="afb60">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="e303d">
<constraints>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="aad96">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="56c2" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Idioma:"/>
</properties>
</component>
</children>
</grid>
</form>

View File

@@ -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<Idioma> idiomaCombo;
private DefaultComboBoxModel<Idioma> idiomaModel;
public JPanel getContentPane() {
return contentPane;
}
public JButton getEliminarButton() {
return eliminarButton;
}
public JComboBox<Idioma> getIdiomaCombo() {
return idiomaCombo;
}
public DefaultComboBoxModel<Idioma> 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);
}
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.idioma.IdiomaListPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="ec841">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="71e3b" class="javax.swing.JTable" binding="idiomaTable" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
</children>
</grid>
</form>

View File

@@ -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<Idioma> idiomaTableModel;
public JPanel getContentPane() {
return contentPane;
}
public JTable getIdiomaTable() {
return idiomaTable;
}
public BaseTableModel<Idioma> 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);
}
}

View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.idioma.IdiomaUpdatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="6" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="20" left="20" bottom="20" right="20"/>
<constraints>
<xy x="20" y="20" width="484" height="214"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="44830" class="javax.swing.JTextField" binding="nombreField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="d39d0" class="javax.swing.JComboBox" binding="idiomaCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<vspacer id="510ce">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="244db">
<constraints>
<grid row="5" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="f5ea0">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="e80d1" class="javax.swing.JButton" binding="actualizarButton" default-binding="true">
<constraints>
<grid row="4" column="0" row-span="1" col-span="3" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Actualizar"/>
</properties>
</component>
<component id="3713c" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Original:"/>
</properties>
</component>
<component id="5cc79" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nombre:"/>
</properties>
</component>
</children>
</grid>
</form>

View File

@@ -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<Idioma> idiomaCombo;
private DefaultComboBoxModel<Idioma> idiomaModel;
private JButton actualizarButton;
public JPanel getContentPane() {
return contentPane;
}
public JTextField getNombreField() {
return nombreField;
}
public JComboBox<Idioma> getIdiomaCombo() {
return idiomaCombo;
}
public DefaultComboBoxModel<Idioma> 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);
}
}

View File

@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.libro.LibroCreatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="22" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="20" y="20" width="500" height="644"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="7dfd" class="javax.swing.JTextField" binding="serieField">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="f3244" class="javax.swing.JTextField" binding="isbnField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="49da" class="javax.swing.JTextField" binding="tituloField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
<component id="a5f4c" class="javax.swing.JTextField" binding="paginasField">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="1bb31" class="javax.swing.JTextField" binding="anoPublicacionField">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="f8b93" class="javax.swing.JComboBox" binding="editorialCombo" custom-create="true">
<constraints>
<grid row="19" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="b355b" class="javax.swing.JButton" binding="guardarButton" default-binding="true">
<constraints>
<grid row="20" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Guardar"/>
</properties>
</component>
<scrollpane id="ff034">
<constraints>
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="edd72" class="javax.swing.JList" binding="idiomasList" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<scrollpane id="47272">
<constraints>
<grid row="15" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="8875f" class="javax.swing.JList" binding="autoresList" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<scrollpane id="5b4f1">
<constraints>
<grid row="17" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="66610" class="javax.swing.JList" binding="categoriasList" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<component id="10e24" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nº Serie:"/>
</properties>
</component>
<component id="15" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="ISBN:"/>
</properties>
</component>
<component id="61c2f" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Titulo:"/>
</properties>
</component>
<component id="72cc4" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nº Paginas:"/>
</properties>
</component>
<component id="725bf" class="javax.swing.JLabel">
<constraints>
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Año Publicacion:"/>
</properties>
</component>
<component id="3c2eb" class="javax.swing.JLabel">
<constraints>
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Idiomas:"/>
</properties>
</component>
<component id="f7906" class="javax.swing.JLabel">
<constraints>
<grid row="14" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Autores:"/>
</properties>
</component>
<component id="5981d" class="javax.swing.JLabel">
<constraints>
<grid row="16" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Categorias:"/>
</properties>
</component>
<component id="dc81" class="javax.swing.JLabel">
<constraints>
<grid row="18" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Editorial:"/>
</properties>
</component>
<hspacer id="a5b67">
<constraints>
<grid row="7" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="8c06a">
<constraints>
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<vspacer id="7f6dd">
<constraints>
<grid row="21" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="cd3f9" class="javax.swing.JLabel">
<constraints>
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Precio Referencia:"/>
</properties>
</component>
<component id="a406" class="javax.swing.JTextField" binding="precioReferenciaField">
<constraints>
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>

View File

@@ -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<Idioma> idiomasList;
private DefaultListModel<Idioma> idiomasModel;
private JList<Autor> autoresList;
private DefaultListModel<Autor> autoresModel;
private JList<Categoria> categoriasList;
private DefaultListModel<Categoria> categoriasModel;
private JComboBox<Editorial> editorialCombo;
private DefaultComboBoxModel<Editorial> 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<Idioma> getIdiomasList() {
return idiomasList;
}
public DefaultListModel<Idioma> getIdiomasModel() {
return idiomasModel;
}
public JList<Autor> getAutoresList() {
return autoresList;
}
public DefaultListModel<Autor> getAutoresModel() {
return autoresModel;
}
public JList<Categoria> getCategoriasList() {
return categoriasList;
}
public DefaultListModel<Categoria> getCategoriasModel() {
return categoriasModel;
}
public JComboBox<Editorial> getEditorialCombo() {
return editorialCombo;
}
public DefaultComboBoxModel<Editorial> 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);
}
}

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.libro.LibroDeletePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="4" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="a3d30" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Libro:"/>
</properties>
</component>
<vspacer id="86e32">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="d7688" class="javax.swing.JButton" binding="eliminarButton">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Eliminar"/>
</properties>
</component>
<component id="28e5d" class="javax.swing.JComboBox" binding="libroCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<hspacer id="9f536">
<constraints>
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="508ff">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

@@ -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<Libro> libroCombo;
private JPanel contentPane;
private DefaultComboBoxModel<Libro> libroModel;
public JPanel getContentPane() {
return contentPane;
}
public JButton getEliminarButton() {
return eliminarButton;
}
public JComboBox<Libro> getLibroCombo() {
return libroCombo;
}
public DefaultComboBoxModel<Libro> 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);
}
}

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.libro.LibroListPanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<scrollpane id="7bcd9">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="c50ab" class="javax.swing.JTable" binding="librosTable" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
</children>
</grid>
</form>

View File

@@ -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<Libro> librosModel;
private JPanel contentPane;
public JTable getLibrosTable() {
return librosTable;
}
public BaseTableModel<Libro> 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;
}
}

View File

@@ -0,0 +1,233 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="xyz.danielcortes.views.libro.LibroUpdatePanel">
<grid id="27dc6" binding="contentPane" layout-manager="GridLayoutManager" row-count="24" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="10" left="10" bottom="10" right="10"/>
<constraints>
<xy x="20" y="20" width="500" height="704"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="7a42e" class="javax.swing.JLabel">
<constraints>
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Libro:"/>
</properties>
</component>
<component id="a52cd" class="javax.swing.JComboBox" binding="libroCombo" custom-create="true">
<constraints>
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="512df" class="javax.swing.JLabel">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nº Serie:"/>
</properties>
</component>
<component id="498b6" class="javax.swing.JTextField" binding="serieField">
<constraints>
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="ff327" class="javax.swing.JLabel">
<constraints>
<grid row="4" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="ISBN:"/>
</properties>
</component>
<component id="3af48" class="javax.swing.JTextField" binding="isbnField">
<constraints>
<grid row="5" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="d8528" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Titulo:"/>
</properties>
</component>
<component id="d2cef" class="javax.swing.JTextField" binding="tituloField">
<constraints>
<grid row="7" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="ba291" class="javax.swing.JLabel">
<constraints>
<grid row="8" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Nº Paginas:"/>
</properties>
</component>
<component id="7585e" class="javax.swing.JTextField" binding="paginasField">
<constraints>
<grid row="9" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="858e6" class="javax.swing.JLabel">
<constraints>
<grid row="10" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Año Publicacion:"/>
</properties>
</component>
<component id="9113f" class="javax.swing.JTextField" binding="anoPublicacionField">
<constraints>
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="f24b8" class="javax.swing.JLabel">
<constraints>
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Precio Referencia:"/>
</properties>
</component>
<component id="9e50c" class="javax.swing.JTextField" binding="precioReferenciaField">
<constraints>
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="ecff" class="javax.swing.JLabel">
<constraints>
<grid row="14" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Idiomas:"/>
</properties>
</component>
<scrollpane id="3454d">
<constraints>
<grid row="15" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="97b16" class="javax.swing.JList" binding="idiomasList" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<component id="1f092" class="javax.swing.JLabel">
<constraints>
<grid row="16" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Autores:"/>
</properties>
</component>
<scrollpane id="db428">
<constraints>
<grid row="17" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="5d0da" class="javax.swing.JList" binding="autoresList" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<component id="9e933" class="javax.swing.JLabel">
<constraints>
<grid row="18" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Categorias:"/>
</properties>
</component>
<scrollpane id="76cca">
<constraints>
<grid row="19" column="1" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="aec88" class="javax.swing.JList" binding="categoriasList" custom-create="true">
<constraints/>
<properties/>
</component>
</children>
</scrollpane>
<component id="8b4b1" class="javax.swing.JLabel">
<constraints>
<grid row="20" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Editorial:"/>
</properties>
</component>
<component id="d3b68" class="javax.swing.JComboBox" binding="editorialCombo" custom-create="true">
<constraints>
<grid row="21" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="400" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="16ee1" class="javax.swing.JButton" binding="actualizarButton" default-binding="true">
<constraints>
<grid row="22" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Actualizar"/>
</properties>
</component>
<vspacer id="f08c">
<constraints>
<grid row="23" column="1" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<hspacer id="dbf95">
<constraints>
<grid row="23" column="0" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<hspacer id="c8afd">
<constraints>
<grid row="23" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
</children>
</grid>
</form>

View File

@@ -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<Libro> libroCombo;
private DefaultComboBoxModel<Libro> libroModel;
private JTextField serieField;
private JTextField isbnField;
private JTextField tituloField;
private JTextField paginasField;
private JTextField anoPublicacionField;
private JTextField precioReferenciaField;
private JList<Idioma> idiomasList;
private DefaultListModel<Idioma> idiomasModel;
private JList<Autor> autoresList;
private DefaultListModel<Autor> autoresModel;
private JList<Categoria> categoriasList;
private DefaultListModel<Categoria> categoriasModel;
private JComboBox<Editorial> editorialCombo;
private DefaultComboBoxModel<Editorial> editorialModel;
private JButton actualizarButton;
public JPanel getContentPane() {
return contentPane;
}
public JComboBox<Libro> getLibroCombo() {
return libroCombo;
}
public DefaultComboBoxModel<Libro> 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<Idioma> getIdiomasList() {
return idiomasList;
}
public DefaultListModel<Idioma> getIdiomasModel() {
return idiomasModel;
}
public JList<Autor> getAutoresList() {
return autoresList;
}
public DefaultListModel<Autor> getAutoresModel() {
return autoresModel;
}
public JList<Categoria> getCategoriasList() {
return categoriasList;
}
public DefaultListModel<Categoria> getCategoriasModel() {
return categoriasModel;
}
public JComboBox<Editorial> getEditorialCombo() {
return editorialCombo;
}
public DefaultComboBoxModel<Editorial> 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;
}
}

View File

@@ -0,0 +1,20 @@
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="jpa">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/biblioteca_manual"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.password" value="ff9800s_a_d"/>
<!--<property name="hibernate.hbm2ddl.auto" value="create"/>-->
</properties>
</persistence-unit>
</persistence>

BIN
target/biblioteca-1.jar Normal file

Binary file not shown.

View File

@@ -0,0 +1,20 @@
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="jpa">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="javax.persistence.jdbc.driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/biblioteca_manual"/>
<property name="javax.persistence.jdbc.user" value="root"/>
<property name="javax.persistence.jdbc.password" value="ff9800s_a_d"/>
<!--<property name="hibernate.hbm2ddl.auto" value="create"/>-->
</properties>
</persistence-unit>
</persistence>

Some files were not shown because too many files have changed in this diff Show More