Cree un controlador abstracto de correo
La gracia es que pueda extender esa y especificarlo para trabajar con trabajadores, luego clientes y otro para distribuidores ADEMAS PARECE QUE FORMATEE TODO EL PUTO PROJECTO eso <3
This commit is contained in:
6
data.sql
6
data.sql
@@ -104,6 +104,7 @@ UNLOCK TABLES;
|
||||
|
||||
LOCK TABLES `correo` WRITE;
|
||||
/*!40000 ALTER TABLE `correo` DISABLE KEYS */;
|
||||
INSERT INTO `correo` VALUES (1,'HOOLA','2019-06-13 17:25:41'),(2,'skrd159@gmail.com','2019-06-13 17:32:13');
|
||||
/*!40000 ALTER TABLE `correo` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -122,7 +123,7 @@ UNLOCK TABLES;
|
||||
|
||||
LOCK TABLES `distribuidor` WRITE;
|
||||
/*!40000 ALTER TABLE `distribuidor` DISABLE KEYS */;
|
||||
INSERT INTO `distribuidor` VALUES (2,1,'19763899-0','2019-06-13 03:08:17'),(3,2,'19763899-0','2019-06-13 03:08:23'),(4,1,'19763899-0','2019-06-13 03:08:25'),(5,1,'19763899-0','2019-06-13 03:08:27');
|
||||
INSERT INTO `distribuidor` VALUES (2,1,'14166920-6','2019-06-13 03:08:17'),(3,2,'8425080-5','2019-06-13 03:08:23'),(4,1,'21629388-6','2019-06-13 03:08:25'),(5,1,'13510176-1','2019-06-13 03:08:27');
|
||||
/*!40000 ALTER TABLE `distribuidor` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -303,6 +304,7 @@ UNLOCK TABLES;
|
||||
|
||||
LOCK TABLES `trabajador_correo` WRITE;
|
||||
/*!40000 ALTER TABLE `trabajador_correo` DISABLE KEYS */;
|
||||
INSERT INTO `trabajador_correo` VALUES (4,1),(2,2);
|
||||
/*!40000 ALTER TABLE `trabajador_correo` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -351,4 +353,4 @@ UNLOCK TABLES;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2019-06-13 12:10:44
|
||||
-- Dump completed on 2019-06-13 13:47:52
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.abstract_correo;
|
||||
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.repository.CorreoRepository;
|
||||
import xyz.danielcortes.validator.CorreoValidator;
|
||||
import xyz.danielcortes.views.mantenedores.correo.CorreoCreatePanel;
|
||||
|
||||
public abstract class AbstractCorreoCreateController extends BaseController {
|
||||
|
||||
protected CorreoCreatePanel view;
|
||||
protected CorreoRepository repository;
|
||||
protected CorreoValidator validator;
|
||||
|
||||
public AbstractCorreoCreateController(CorreoCreatePanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.repository = new CorreoRepository();
|
||||
this.validator = new CorreoValidator(this.repository);
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getCorreoField().requestFocus();
|
||||
this.view.getCorreoField().setText("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCorreoField().addActionListener(e -> this.save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
protected abstract void save();
|
||||
|
||||
protected abstract void volver();
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.abstract_correo;
|
||||
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.models.Correo;
|
||||
import xyz.danielcortes.repository.CorreoRepository;
|
||||
import xyz.danielcortes.validator.CorreoValidator;
|
||||
import xyz.danielcortes.views.mantenedores.correo.CorreoSearchPanel;
|
||||
|
||||
public abstract class AbstractCorreoSearchController extends BaseController {
|
||||
|
||||
protected CorreoSearchPanel view;
|
||||
protected CorreoRepository correoRepository;
|
||||
protected CorreoValidator validator;
|
||||
|
||||
public AbstractCorreoSearchController(CorreoSearchPanel view, LaunchController parent) {
|
||||
super(parent);
|
||||
this.view = view;
|
||||
this.correoRepository = new CorreoRepository();
|
||||
this.validator = new CorreoValidator(this.correoRepository);
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadCorreosTable();
|
||||
this.view.getCorreosTable().clearSelection();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCrearButton().addActionListener(e -> this.create());
|
||||
this.view.getSearchField().addActionListener(e -> this.search());
|
||||
this.view.getBuscarButton().addActionListener(e -> this.search());
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
this.view.getEditarButton().addActionListener(e -> this.edit());
|
||||
this.view.getEliminarButton().addActionListener(e -> this.delete());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
protected abstract void create();
|
||||
|
||||
protected abstract void edit();
|
||||
|
||||
protected abstract void delete();
|
||||
|
||||
protected abstract void view();
|
||||
|
||||
protected abstract void search();
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
protected abstract void loadCorreosTable();
|
||||
|
||||
protected void loadCorreosTable(List<Correo> correos) {
|
||||
BaseTableModel<Correo> model = this.view.getCorreoModel();
|
||||
model.setRows(correos);
|
||||
}
|
||||
|
||||
protected Correo getSelectedCorreo() {
|
||||
int selectedRow = this.view.getCorreosTable().getSelectedRow();
|
||||
if (selectedRow == -1) {
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"No hay correo seleccionado",
|
||||
"Error",
|
||||
JOptionPane.ERROR_MESSAGE
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.view.getCorreoModel().getRow(selectedRow);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.abstract_correo;
|
||||
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Correo;
|
||||
import xyz.danielcortes.repository.CorreoRepository;
|
||||
import xyz.danielcortes.validator.CorreoValidator;
|
||||
import xyz.danielcortes.views.mantenedores.correo.CorreoUpdatePanel;
|
||||
|
||||
public abstract class AbstractCorreoUpdateController extends BaseController {
|
||||
|
||||
protected Correo correo;
|
||||
protected CorreoUpdatePanel view;
|
||||
protected CorreoRepository repository;
|
||||
protected CorreoValidator validator;
|
||||
|
||||
public AbstractCorreoUpdateController(CorreoUpdatePanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.repository = new CorreoRepository();
|
||||
this.validator = new CorreoValidator(this.repository);
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getCorreoField().requestFocus();
|
||||
this.fillCorreo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setCorreo(Correo correo) {
|
||||
this.correo = correo;
|
||||
}
|
||||
|
||||
protected void fillCorreo() {
|
||||
this.view.getCorreoField().setText(this.correo.getCorreo());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCorreoField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void update() {
|
||||
String sCorreo = this.view.getCorreoField().getText();
|
||||
|
||||
ValidationResult originalValidation = this.validator.validateOriginal(this.correo);
|
||||
if (originalValidation.hasError()) {
|
||||
originalValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
ValidationResult correoValidation = this.validator.validateCorreo(sCorreo);
|
||||
if (correoValidation.hasError()) {
|
||||
correoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
this.correo.setCorreo(sCorreo);
|
||||
this.repository.update(this.correo);
|
||||
|
||||
this.volver();
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.abstract_correo;
|
||||
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.models.Correo;
|
||||
import xyz.danielcortes.views.mantenedores.correo.CorreoViewPanel;
|
||||
|
||||
public abstract class AbstractCorreoViewController extends BaseController {
|
||||
|
||||
protected Correo correo;
|
||||
protected CorreoViewPanel view;
|
||||
|
||||
public AbstractCorreoViewController(CorreoViewPanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCorreo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setCorreo(Correo correo) {
|
||||
this.correo = correo;
|
||||
}
|
||||
|
||||
protected void fillCorreo() {
|
||||
this.view.getCorreoField().setText(this.correo.getCorreo());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.autor;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Autor;
|
||||
import xyz.danielcortes.repository.AutorRepository;
|
||||
import xyz.danielcortes.validator.AutorValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.autor.AutorCreatePanel;
|
||||
|
||||
public class AutorCreateController extends BaseController {
|
||||
@@ -30,28 +30,28 @@ public class AutorCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getApellidoMaternoField().addActionListener(e -> save());
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getApellidoMaternoField().addActionListener(e -> this.save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.AUTOR_SEARCH));
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String nombre = view.getNombreField().getText();
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
String apellidoPaterno = view.getApellidoPaternoField().getText();
|
||||
String apellidoPaterno = this.view.getApellidoPaternoField().getText();
|
||||
ValidationResult apellidoPaternoValidation = this.validator.validateApellidoPaterno(apellidoPaterno);
|
||||
if(apellidoPaternoValidation.hasError()){
|
||||
if (apellidoPaternoValidation.hasError()) {
|
||||
apellidoPaternoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String apellidoMaterno = view.getApellidoMaternoField().getText();
|
||||
String apellidoMaterno = this.view.getApellidoMaternoField().getText();
|
||||
ValidationResult apellidoMaternoValidation = this.validator.validateApellidoMaterno(apellidoMaterno);
|
||||
if(apellidoMaternoValidation.hasError()){
|
||||
if (apellidoMaternoValidation.hasError()) {
|
||||
apellidoMaternoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class AutorCreateController extends BaseController {
|
||||
autor.setApellidoPaterno(apellidoPaterno);
|
||||
autor.setApellidoMaterno(apellidoMaterno);
|
||||
|
||||
autorRepository.save(autor);
|
||||
this.autorRepository.save(autor);
|
||||
|
||||
this.view.getNombreField().setText("");
|
||||
this.view.getApellidoPaternoField().setText("");
|
||||
@@ -69,6 +69,7 @@ public class AutorCreateController extends BaseController {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@ package xyz.danielcortes.controllers.mantenedores.autor;
|
||||
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Autor;
|
||||
import xyz.danielcortes.repository.AutorRepository;
|
||||
import xyz.danielcortes.validator.AutorValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.autor.AutorSearchPanel;
|
||||
|
||||
public class AutorSearchController extends BaseController {
|
||||
@@ -97,7 +97,7 @@ public class AutorSearchController extends BaseController {
|
||||
|
||||
private void loadAutorTable() {
|
||||
List<Autor> autores = this.autorRepository.getAll();
|
||||
loadAutorTable(autores);
|
||||
this.loadAutorTable(autores);
|
||||
}
|
||||
|
||||
private void loadAutorTable(List<Autor> autores) {
|
||||
@@ -120,8 +120,9 @@ public class AutorSearchController extends BaseController {
|
||||
return this.view.getAutorModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.autor;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Autor;
|
||||
import xyz.danielcortes.repository.AutorRepository;
|
||||
import xyz.danielcortes.validator.AutorValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.autor.AutorUpdatePanel;
|
||||
|
||||
public class AutorUpdateController extends BaseController {
|
||||
@@ -31,12 +31,12 @@ public class AutorUpdateController extends BaseController {
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
fillAutor();
|
||||
this.fillAutor();
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillAutor() {
|
||||
if (autor == null)
|
||||
if (this.autor == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.autor.getNombre());
|
||||
@@ -45,35 +45,35 @@ public class AutorUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getApellidoPaternoField().addActionListener(e -> update());
|
||||
this.view.getActualizarButton().addActionListener(e -> update());
|
||||
this.view.getApellidoPaternoField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.AUTOR_SEARCH));
|
||||
}
|
||||
|
||||
private void update() {
|
||||
ValidationResult autorValidation = this.validator.validateOriginal(this.autor);
|
||||
if(autorValidation.hasError()){
|
||||
if (autorValidation.hasError()) {
|
||||
autorValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if (nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String apellidoPaterno = view.getApellidoPaternoField().getText();
|
||||
String apellidoPaterno = this.view.getApellidoPaternoField().getText();
|
||||
ValidationResult apellidoPaternoValidation = this.validator.validateApellidoPaterno(apellidoPaterno);
|
||||
if(apellidoPaternoValidation.hasError()){
|
||||
if (apellidoPaternoValidation.hasError()) {
|
||||
apellidoPaternoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String apellidoMaterno = view.getApellidoMaternoField().getText();
|
||||
String apellidoMaterno = this.view.getApellidoMaternoField().getText();
|
||||
ValidationResult apellidoMaternoValidation = this.validator.validateApellidoMaterno(apellidoMaterno);
|
||||
if(apellidoMaternoValidation.hasError()){
|
||||
if (apellidoMaternoValidation.hasError()) {
|
||||
apellidoMaternoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -88,7 +88,8 @@ public class AutorUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.AUTOR_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.autor;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Autor;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.autor.AutorViewPanel;
|
||||
|
||||
public class AutorViewController extends BaseController {
|
||||
@@ -23,7 +23,7 @@ public class AutorViewController extends BaseController {
|
||||
this.fillAutor();
|
||||
}
|
||||
|
||||
public void setAutor(Autor autor){
|
||||
public void setAutor(Autor autor) {
|
||||
this.autor = autor;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class AutorViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void fillAutor() {
|
||||
if (autor == null)
|
||||
if (this.autor == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.autor.getNombre());
|
||||
@@ -42,7 +42,8 @@ public class AutorViewController extends BaseController {
|
||||
this.view.getApellidoMaternoField().setText(this.autor.getApellidoMaterno());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.categoria;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Categoria;
|
||||
import xyz.danielcortes.repository.CategoriaRepository;
|
||||
import xyz.danielcortes.validator.CategoriaValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.categoria.CategoriaCreatePanel;
|
||||
|
||||
public class CategoriaCreateController extends BaseController {
|
||||
|
||||
private CategoriaRepository categoriaRepository;
|
||||
private CategoriaCreatePanel view;
|
||||
private CategoriaValidator validator;
|
||||
@@ -30,15 +31,15 @@ public class CategoriaCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
view.getNombreField().addActionListener(e -> save());
|
||||
view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getNombreField().addActionListener(e -> this.save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CATEGORIA_SEARCH));
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String nombre = view.getNombreField().getText();
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -46,14 +47,15 @@ public class CategoriaCreateController extends BaseController {
|
||||
Categoria categoria = new Categoria();
|
||||
categoria.setNombre(nombre);
|
||||
|
||||
categoriaRepository.save(categoria);
|
||||
this.categoriaRepository.save(categoria);
|
||||
|
||||
this.view.getNombreField().setText("");
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@ package xyz.danielcortes.controllers.mantenedores.categoria;
|
||||
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Categoria;
|
||||
import xyz.danielcortes.repository.CategoriaRepository;
|
||||
import xyz.danielcortes.validator.CategoriaValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.categoria.CategoriaSearchPanel;
|
||||
|
||||
public class CategoriaSearchController extends BaseController {
|
||||
@@ -59,7 +59,7 @@ public class CategoriaSearchController extends BaseController {
|
||||
return;
|
||||
|
||||
ValidationResult deleteableValidation = this.validator.isDeleteable(categoria);
|
||||
if(deleteableValidation.hasError()){
|
||||
if (deleteableValidation.hasError()) {
|
||||
deleteableValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -122,7 +122,8 @@ public class CategoriaSearchController extends BaseController {
|
||||
return this.view.getCategoriaModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.categoria;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Categoria;
|
||||
import xyz.danielcortes.repository.CategoriaRepository;
|
||||
import xyz.danielcortes.validator.CategoriaValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.categoria.CategoriaUpdatePanel;
|
||||
|
||||
public class CategoriaUpdateController extends BaseController {
|
||||
@@ -32,7 +32,7 @@ public class CategoriaUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void fillCategoria() {
|
||||
if(categoria != null)
|
||||
if (this.categoria != null)
|
||||
this.view.getNombreField().setText(this.categoria.getNombre());
|
||||
}
|
||||
|
||||
@@ -44,27 +44,28 @@ public class CategoriaUpdateController extends BaseController {
|
||||
|
||||
private void update() {
|
||||
ValidationResult originalValidation = this.validator.validateOriginal(this.categoria);
|
||||
if(originalValidation.hasError()){
|
||||
if (originalValidation.hasError()) {
|
||||
originalValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
assert this.categoria != null;
|
||||
this.categoria.setNombre(nombre);
|
||||
categoriaRepository.update(this.categoria);
|
||||
this.categoriaRepository.update(this.categoria);
|
||||
|
||||
this.getParentController().showCard(PanelName.CATEGORIA_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setCategoria(Categoria categoria) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.categoria;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Categoria;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.categoria.CategoriaViewPanel;
|
||||
|
||||
public class CategoriaViewController extends BaseController {
|
||||
@@ -27,8 +27,8 @@ public class CategoriaViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void fillCategoria() {
|
||||
if(this.categoria != null)
|
||||
this.view.getNombreField().setText(categoria.getNombre());
|
||||
if (this.categoria != null)
|
||||
this.view.getNombreField().setText(this.categoria.getNombre());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -28,32 +28,33 @@ public class DistribuidorCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEmpresasCombobox();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH));
|
||||
}
|
||||
|
||||
private void fillEmpresasCombobox() {
|
||||
this.view.getEmpresaModel().removeAllElements();
|
||||
this.view.getEmpresaModel().addAll(empresaRepository.getAll());
|
||||
this.view.getEmpresaModel().addAll(this.empresaRepository.getAll());
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String rut = this.view.getRutField().getText();
|
||||
ValidationResult rutValidation = this.validator.validateRut(rut);
|
||||
if(rutValidation.hasError()){
|
||||
if (rutValidation.hasError()) {
|
||||
rutValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
Empresa empresa = (Empresa) this.view.getEmpresaCombobox().getSelectedItem();
|
||||
ValidationResult empresaValidation = this.validator.validateEmpresa(empresa);
|
||||
if(empresaValidation.hasError()){
|
||||
if (empresaValidation.hasError()) {
|
||||
empresaValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -62,11 +63,12 @@ public class DistribuidorCreateController extends BaseController {
|
||||
distribuidor.setRut(rut);
|
||||
distribuidor.setEmpresa(empresa);
|
||||
|
||||
respository.save(distribuidor);
|
||||
this.respository.save(distribuidor);
|
||||
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public class DistribuidorSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
this.view.getDistribuidorTable().clearSelection();
|
||||
@@ -90,7 +91,7 @@ public class DistribuidorSearchController extends BaseController {
|
||||
|
||||
private void loadDistribuidorTable() {
|
||||
List<Distribuidor> distribuidores = this.distribuidorRepository.getAll();
|
||||
loadDistribuidorTable(distribuidores);
|
||||
this.loadDistribuidorTable(distribuidores);
|
||||
}
|
||||
|
||||
private void loadDistribuidorTable(List<Distribuidor> distribuidores) {
|
||||
@@ -112,6 +113,7 @@ public class DistribuidorSearchController extends BaseController {
|
||||
return this.view.getDistribuidorModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,14 @@ import xyz.danielcortes.validator.DistribuidorValidator;
|
||||
import xyz.danielcortes.views.mantenedores.distribuidor.DistribuidorUpdatePanel;
|
||||
|
||||
public class DistribuidorUpdateController extends BaseController {
|
||||
|
||||
private Distribuidor distribuidor;
|
||||
private DistribuidorUpdatePanel view;
|
||||
private DistribuidorRepository distribuidorRepository;
|
||||
private EmpresaRepository empresaRepository;
|
||||
private DistribuidorValidator distribuidorValidator;
|
||||
|
||||
public DistribuidorUpdateController(DistribuidorUpdatePanel view, LaunchController parent){
|
||||
public DistribuidorUpdateController(DistribuidorUpdatePanel view, LaunchController parent) {
|
||||
super(parent);
|
||||
this.view = view;
|
||||
this.distribuidorRepository = new DistribuidorRepository();
|
||||
@@ -32,6 +33,7 @@ public class DistribuidorUpdateController extends BaseController {
|
||||
this.distribuidor = distribuidor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEmpresaCombobox();
|
||||
this.fillDistribuidor();
|
||||
@@ -44,7 +46,7 @@ public class DistribuidorUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void fillDistribuidor() {
|
||||
if(distribuidorRepository == null)
|
||||
if (this.distribuidorRepository == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.distribuidor.getRut());
|
||||
@@ -52,32 +54,31 @@ public class DistribuidorUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getActualizarButton().addActionListener(e -> update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH));
|
||||
}
|
||||
|
||||
private void update() {
|
||||
ValidationResult originalValidation = this.distribuidorValidator.validateOriginal(this.distribuidor);
|
||||
if(originalValidation.hasError()){
|
||||
if (originalValidation.hasError()) {
|
||||
originalValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String rut = this.view.getRutField().getText();
|
||||
ValidationResult rutValidation = this.distribuidorValidator.validateRut(rut);
|
||||
if(rutValidation.hasError()){
|
||||
if (rutValidation.hasError()) {
|
||||
rutValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
Empresa empresa = (Empresa) this.view.getEmpresaCombobox().getSelectedItem();
|
||||
ValidationResult empresaValidation = this.distribuidorValidator.validateEmpresa(empresa);
|
||||
if(empresaValidation.hasError()){
|
||||
if (empresaValidation.hasError()) {
|
||||
empresaValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
assert this.distribuidor != null;
|
||||
this.distribuidor.setRut(rut);
|
||||
this.distribuidor.setEmpresa(empresa);
|
||||
@@ -86,6 +87,9 @@ public class DistribuidorUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH);
|
||||
}
|
||||
|
||||
public BasePanel getView() { return view; }
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ public class DistribuidorViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillDistribuidor();
|
||||
}
|
||||
@@ -52,14 +53,15 @@ public class DistribuidorViewController extends BaseController {
|
||||
// }
|
||||
|
||||
private void fillDistribuidor() {
|
||||
if (distribuidor == null)
|
||||
if (this.distribuidor == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.distribuidor.getRut());
|
||||
this.view.getEmpresaField().setText(this.distribuidor.getEmpresa().getNombre());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.editorial;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Editorial;
|
||||
import xyz.danielcortes.repository.EditorialRepository;
|
||||
import xyz.danielcortes.validator.EditorialValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.editorial.EditorialCreatePanel;
|
||||
|
||||
public class EditorialCreateController extends BaseController {
|
||||
@@ -31,15 +31,15 @@ public class EditorialCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getNombreField().addActionListener(e -> save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getNombreField().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.EDITORIAL_SEARCH));
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -53,7 +53,8 @@ public class EditorialCreateController extends BaseController {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,18 +2,19 @@ package xyz.danielcortes.controllers.mantenedores.editorial;
|
||||
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Editorial;
|
||||
import xyz.danielcortes.repository.EditorialRepository;
|
||||
import xyz.danielcortes.validator.EditorialValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.editorial.EditorialSearchPanel;
|
||||
|
||||
public class EditorialSearchController extends BaseController {
|
||||
|
||||
private EditorialSearchPanel view;
|
||||
private EditorialRepository editorialRepository;
|
||||
private EditorialValidator validator;
|
||||
@@ -26,6 +27,7 @@ public class EditorialSearchController extends BaseController {
|
||||
this.loadEditorialTable();
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
@@ -35,18 +37,18 @@ public class EditorialSearchController extends BaseController {
|
||||
this.loadEditorialTable();
|
||||
}
|
||||
|
||||
private void setupListeners(){
|
||||
private void setupListeners() {
|
||||
this.view.getCrearButton().addActionListener(e -> this.getParentController().showCard(PanelName.EDITORIAL_CREATE));
|
||||
this.view.getBuscarButton().addActionListener(e -> search());
|
||||
this.view.getBuscarField().addActionListener(e -> search());
|
||||
this.view.getEliminarButton().addActionListener(e -> delete());
|
||||
this.view.getEditarButton().addActionListener(e -> edit());
|
||||
this.view.getVerButton().addActionListener(e -> view());
|
||||
this.view.getBuscarButton().addActionListener(e -> this.search());
|
||||
this.view.getBuscarField().addActionListener(e -> this.search());
|
||||
this.view.getEliminarButton().addActionListener(e -> this.delete());
|
||||
this.view.getEditarButton().addActionListener(e -> this.edit());
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Editorial editorial = this.getSelectedEditorial();
|
||||
if(editorial != null) {
|
||||
if (editorial != null) {
|
||||
EditorialViewController controller = (EditorialViewController) this.getParentController().getCard(PanelName.EDITORIAL_VIEW);
|
||||
controller.setEditorial(editorial);
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_VIEW);
|
||||
@@ -55,7 +57,7 @@ public class EditorialSearchController extends BaseController {
|
||||
|
||||
private void edit() {
|
||||
Editorial editorial = this.getSelectedEditorial();
|
||||
if(editorial != null) {
|
||||
if (editorial != null) {
|
||||
EditorialUpdateController controller = (EditorialUpdateController) this.getParentController().getCard(PanelName.EDITORIAL_UPDATE);
|
||||
controller.setEditorial(editorial);
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_UPDATE);
|
||||
@@ -67,7 +69,7 @@ public class EditorialSearchController extends BaseController {
|
||||
if (editorial == null)
|
||||
return;
|
||||
ValidationResult deleteableValidation = this.validator.isDeleteable(editorial);
|
||||
if(deleteableValidation.hasError()){
|
||||
if (deleteableValidation.hasError()) {
|
||||
deleteableValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -92,14 +94,14 @@ public class EditorialSearchController extends BaseController {
|
||||
this.loadEditorialTable(editoriales);
|
||||
}
|
||||
|
||||
private void loadEditorialTable(List<Editorial> editoriales){
|
||||
private void loadEditorialTable(List<Editorial> editoriales) {
|
||||
BaseTableModel<Editorial> model = this.view.getEditorialModel();
|
||||
model.setRows(editoriales);
|
||||
}
|
||||
|
||||
private void loadEditorialTable(){
|
||||
private void loadEditorialTable() {
|
||||
List<Editorial> editoriales = this.editorialRepository.getAll();
|
||||
loadEditorialTable(editoriales);
|
||||
this.loadEditorialTable(editoriales);
|
||||
}
|
||||
|
||||
private Editorial getSelectedEditorial() {
|
||||
@@ -117,7 +119,8 @@ public class EditorialSearchController extends BaseController {
|
||||
return this.view.getEditorialModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.editorial;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Editorial;
|
||||
import xyz.danielcortes.repository.EditorialRepository;
|
||||
import xyz.danielcortes.validator.EditorialValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.editorial.EditorialUpdatePanel;
|
||||
|
||||
public class EditorialUpdateController extends BaseController {
|
||||
@@ -27,7 +27,7 @@ public class EditorialUpdateController extends BaseController {
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if(this.editorial == null)
|
||||
if (this.editorial == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.editorial.getNombre());
|
||||
@@ -45,14 +45,14 @@ public class EditorialUpdateController extends BaseController {
|
||||
|
||||
private void update() {
|
||||
ValidationResult originalValidation = this.validator.validateOriginal(this.editorial);
|
||||
if(originalValidation.hasError()){
|
||||
if (originalValidation.hasError()) {
|
||||
originalValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -64,7 +64,8 @@ public class EditorialUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.editorial;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Editorial;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.editorial.EditorialViewPanel;
|
||||
|
||||
public class EditorialViewController extends BaseController {
|
||||
|
||||
private Editorial editorial;
|
||||
private EditorialViewPanel view;
|
||||
|
||||
@@ -22,18 +23,18 @@ public class EditorialViewController extends BaseController {
|
||||
this.fillEditorial();
|
||||
}
|
||||
|
||||
public void setEditorial(Editorial editorial){
|
||||
public void setEditorial(Editorial editorial) {
|
||||
this.editorial = editorial;
|
||||
}
|
||||
|
||||
private void setupListeners(){
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> {
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_SEARCH);
|
||||
});
|
||||
}
|
||||
|
||||
private void fillEditorial() {
|
||||
if(editorial == null)
|
||||
if (this.editorial == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.editorial.getNombre());
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.empresa;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Empresa;
|
||||
import xyz.danielcortes.repository.EmpresaRepository;
|
||||
import xyz.danielcortes.validator.EmpresaValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.empresa.EmpresaCreatePanel;
|
||||
|
||||
public class EmpresaCreateController extends BaseController {
|
||||
@@ -31,15 +31,15 @@ public class EmpresaCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getNombreField().addActionListener(e -> save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getNombreField().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.EMPRESA_SEARCH));
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -53,7 +53,8 @@ public class EmpresaCreateController extends BaseController {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import xyz.danielcortes.validator.EmpresaValidator;
|
||||
import xyz.danielcortes.views.mantenedores.empresa.EmpresaSearchPanel;
|
||||
|
||||
public class EmpresaSearchController extends BaseController {
|
||||
|
||||
private EmpresaSearchPanel view;
|
||||
private EmpresaRepository empresaRepository;
|
||||
private EmpresaValidator validator;
|
||||
@@ -35,18 +36,18 @@ public class EmpresaSearchController extends BaseController {
|
||||
this.loadEmpresaTable();
|
||||
}
|
||||
|
||||
private void setupListeners(){
|
||||
private void setupListeners() {
|
||||
this.view.getCrearButton().addActionListener(e -> this.getParentController().showCard(PanelName.EMPRESA_CREATE));
|
||||
this.view.getBuscarButton().addActionListener(e -> search());
|
||||
this.view.getBuscarField().addActionListener(e -> search());
|
||||
this.view.getEliminarButton().addActionListener(e -> delete());
|
||||
this.view.getEditarButton().addActionListener(e -> edit());
|
||||
this.view.getVerButton().addActionListener(e -> view());
|
||||
this.view.getBuscarButton().addActionListener(e -> this.search());
|
||||
this.view.getBuscarField().addActionListener(e -> this.search());
|
||||
this.view.getEliminarButton().addActionListener(e -> this.delete());
|
||||
this.view.getEditarButton().addActionListener(e -> this.edit());
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Empresa empresa = this.getSelectedEmpresa();
|
||||
if(empresa != null) {
|
||||
if (empresa != null) {
|
||||
EmpresaViewController controller = (EmpresaViewController) this.getParentController().getCard(PanelName.EMPRESA_VIEW);
|
||||
controller.setEmpresa(empresa);
|
||||
this.getParentController().showCard(PanelName.EMPRESA_VIEW);
|
||||
@@ -55,7 +56,7 @@ public class EmpresaSearchController extends BaseController {
|
||||
|
||||
private void edit() {
|
||||
Empresa empresa = this.getSelectedEmpresa();
|
||||
if(empresa != null) {
|
||||
if (empresa != null) {
|
||||
EmpresaUpdateController controller = (EmpresaUpdateController) this.getParentController().getCard(PanelName.EMPRESA_UPDATE);
|
||||
controller.setEmpresa(empresa);
|
||||
this.getParentController().showCard(PanelName.EMPRESA_UPDATE);
|
||||
@@ -87,14 +88,14 @@ public class EmpresaSearchController extends BaseController {
|
||||
this.loadEmpresaTable(empresaes);
|
||||
}
|
||||
|
||||
private void loadEmpresaTable(List<Empresa> empresas){
|
||||
private void loadEmpresaTable(List<Empresa> empresas) {
|
||||
BaseTableModel<Empresa> model = this.view.getEmpresaModel();
|
||||
model.setRows(empresas);
|
||||
}
|
||||
|
||||
private void loadEmpresaTable(){
|
||||
private void loadEmpresaTable() {
|
||||
List<Empresa> empresas = this.empresaRepository.getAll();
|
||||
loadEmpresaTable(empresas);
|
||||
this.loadEmpresaTable(empresas);
|
||||
}
|
||||
|
||||
private Empresa getSelectedEmpresa() {
|
||||
@@ -112,7 +113,8 @@ public class EmpresaSearchController extends BaseController {
|
||||
return this.view.getEmpresaModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.empresa;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Empresa;
|
||||
import xyz.danielcortes.repository.EmpresaRepository;
|
||||
import xyz.danielcortes.validator.EmpresaValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.empresa.EmpresaUpdatePanel;
|
||||
|
||||
public class EmpresaUpdateController extends BaseController {
|
||||
@@ -27,7 +27,7 @@ public class EmpresaUpdateController extends BaseController {
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if(this.empresa == null)
|
||||
if (this.empresa == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.empresa.getNombre());
|
||||
@@ -45,14 +45,14 @@ public class EmpresaUpdateController extends BaseController {
|
||||
|
||||
private void update() {
|
||||
ValidationResult originalValidation = this.validator.validateOriginal(this.empresa);
|
||||
if(originalValidation.hasError()){
|
||||
if (originalValidation.hasError()) {
|
||||
originalValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -64,7 +64,8 @@ public class EmpresaUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.EMPRESA_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.empresa;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Empresa;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.empresa.EmpresaViewPanel;
|
||||
|
||||
public class EmpresaViewController extends BaseController {
|
||||
|
||||
private Empresa empresa;
|
||||
private EmpresaViewPanel view;
|
||||
|
||||
@@ -22,18 +23,18 @@ public class EmpresaViewController extends BaseController {
|
||||
this.fillEmpresa();
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa){
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
private void setupListeners(){
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> {
|
||||
this.getParentController().showCard(PanelName.EMPRESA_SEARCH);
|
||||
});
|
||||
}
|
||||
|
||||
private void fillEmpresa() {
|
||||
if(empresa == null)
|
||||
if (this.empresa == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.empresa.getNombre());
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.idioma;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Idioma;
|
||||
import xyz.danielcortes.repository.IdiomaRepository;
|
||||
import xyz.danielcortes.validator.IdiomaValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.idioma.IdiomaCreatePanel;
|
||||
|
||||
public class IdiomaCreateController extends BaseController {
|
||||
@@ -31,15 +31,15 @@ public class IdiomaCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
view.getNombreField().addActionListener(e -> save());
|
||||
view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getNombreField().addActionListener(e -> this.save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.IDIOMA_SEARCH));
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String nombre = view.getNombreField().getText();
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -47,14 +47,15 @@ public class IdiomaCreateController extends BaseController {
|
||||
Idioma idioma = new Idioma();
|
||||
idioma.setNombre(nombre);
|
||||
|
||||
idiomaRepository.save(idioma);
|
||||
this.idiomaRepository.save(idioma);
|
||||
|
||||
this.view.getNombreField().setText("");
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,15 +2,15 @@ package xyz.danielcortes.controllers.mantenedores.idioma;
|
||||
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Idioma;
|
||||
import xyz.danielcortes.repository.IdiomaRepository;
|
||||
import xyz.danielcortes.validator.IdiomaValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.idioma.IdiomaSearchPanel;
|
||||
|
||||
public class IdiomaSearchController extends BaseController {
|
||||
@@ -39,16 +39,16 @@ public class IdiomaSearchController extends BaseController {
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCrearButton().addActionListener(e -> this.getParentController().showCard(PanelName.IDIOMA_CREATE));
|
||||
this.view.getBuscarButton().addActionListener(e -> search());
|
||||
this.view.getBuscarField().addActionListener(e -> search());
|
||||
this.view.getEliminarButton().addActionListener(e -> delete());
|
||||
this.view.getEditarButton().addActionListener(e -> edit());
|
||||
this.view.getVerButton().addActionListener(e -> view());
|
||||
this.view.getBuscarButton().addActionListener(e -> this.search());
|
||||
this.view.getBuscarField().addActionListener(e -> this.search());
|
||||
this.view.getEliminarButton().addActionListener(e -> this.delete());
|
||||
this.view.getEditarButton().addActionListener(e -> this.edit());
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Idioma idioma = this.getSelectedIdioma();
|
||||
if(idioma != null) {
|
||||
if (idioma != null) {
|
||||
IdiomaViewController controller = (IdiomaViewController) this.getParentController().getCard(PanelName.IDIOMA_VIEW);
|
||||
controller.setIdioma(idioma);
|
||||
this.getParentController().showCard(PanelName.IDIOMA_VIEW);
|
||||
@@ -57,7 +57,7 @@ public class IdiomaSearchController extends BaseController {
|
||||
|
||||
private void edit() {
|
||||
Idioma idioma = this.getSelectedIdioma();
|
||||
if(idioma != null){
|
||||
if (idioma != null) {
|
||||
IdiomaUpdateController controller = (IdiomaUpdateController) this.getParentController().getCard(PanelName.IDIOMA_UPDATE);
|
||||
controller.setIdioma(idioma);
|
||||
this.getParentController().showCard(PanelName.IDIOMA_UPDATE);
|
||||
@@ -66,11 +66,11 @@ public class IdiomaSearchController extends BaseController {
|
||||
|
||||
private void delete() {
|
||||
Idioma idioma = this.getSelectedIdioma();
|
||||
if(idioma == null)
|
||||
if (idioma == null)
|
||||
return;
|
||||
|
||||
ValidationResult deleteableValidation = this.validator.isDeleteable(idioma);
|
||||
if(deleteableValidation.hasError()){
|
||||
if (deleteableValidation.hasError()) {
|
||||
deleteableValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -89,24 +89,25 @@ public class IdiomaSearchController extends BaseController {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
private void search(){
|
||||
private void search() {
|
||||
String term = this.view.getBuscarField().getText();
|
||||
List<Idioma> idiomas = this.idiomaRepository.search(term);
|
||||
this.loadIdiomaTable(idiomas);
|
||||
}
|
||||
|
||||
private void loadIdiomaTable(List<Idioma> idiomas){
|
||||
private void loadIdiomaTable(List<Idioma> idiomas) {
|
||||
BaseTableModel<Idioma> model = this.view.getIdiomaTableModel();
|
||||
model.setRows(idiomas);
|
||||
}
|
||||
|
||||
private void loadIdiomaTable() {
|
||||
List<Idioma> idiomas = this.idiomaRepository.getAll();
|
||||
loadIdiomaTable(idiomas);
|
||||
this.loadIdiomaTable(idiomas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
private Idioma getSelectedIdioma() {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.idioma;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Idioma;
|
||||
import xyz.danielcortes.repository.IdiomaRepository;
|
||||
import xyz.danielcortes.validator.IdiomaValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.idioma.IdiomaUpdatePanel;
|
||||
|
||||
public class IdiomaUpdateController extends BaseController {
|
||||
@@ -27,13 +27,13 @@ public class IdiomaUpdateController extends BaseController {
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if(this.idioma == null)
|
||||
if (this.idioma == null)
|
||||
return;
|
||||
|
||||
this.fillIdioma();
|
||||
}
|
||||
|
||||
private void fillIdioma(){
|
||||
private void fillIdioma() {
|
||||
this.view.getNombreField().setText(this.idioma.getNombre());
|
||||
}
|
||||
|
||||
@@ -44,28 +44,29 @@ public class IdiomaUpdateController extends BaseController {
|
||||
|
||||
private void update() {
|
||||
ValidationResult originalValidation = this.validator.validateOriginal(this.idioma);
|
||||
if(originalValidation.hasError()){
|
||||
if (originalValidation.hasError()) {
|
||||
originalValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
assert this.idioma != null;
|
||||
this.idioma.setNombre(nombre);
|
||||
idiomaRepository.update(this.idioma);
|
||||
this.idiomaRepository.update(this.idioma);
|
||||
|
||||
this.view.getNombreField().setText("");
|
||||
this.getParentController().showCard(PanelName.IDIOMA_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setIdioma(Idioma idioma) {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.idioma;
|
||||
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Idioma;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.idioma.IdiomaViewPanel;
|
||||
|
||||
public class IdiomaViewController extends BaseController {
|
||||
@@ -34,7 +34,7 @@ public class IdiomaViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void fillIdioma() {
|
||||
if (idioma == null)
|
||||
if (this.idioma == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.idioma.getNombre());
|
||||
|
||||
@@ -5,8 +5,9 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JComboBox;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Autor;
|
||||
@@ -20,10 +21,10 @@ import xyz.danielcortes.repository.EditorialRepository;
|
||||
import xyz.danielcortes.repository.IdiomaRepository;
|
||||
import xyz.danielcortes.repository.LibroRepository;
|
||||
import xyz.danielcortes.validator.LibroValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.libro.LibroCreatePanel;
|
||||
|
||||
public class LibroCreateController extends BaseController {
|
||||
|
||||
private IdiomaRepository idiomaRepository;
|
||||
private CategoriaRepository categoriaRepository;
|
||||
private AutorRepository autorRepository;
|
||||
@@ -63,13 +64,13 @@ public class LibroCreateController extends BaseController {
|
||||
this.view.getVolverButton().addActionListener(e -> {
|
||||
this.getParentController().showCard(PanelName.LIBRO_SEARCH);
|
||||
});
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String isbn = this.view.getIsbnField().getText();
|
||||
ValidationResult isbnValidation = this.validator.validateISBN(isbn);
|
||||
if(isbnValidation.hasError()){
|
||||
if (isbnValidation.hasError()) {
|
||||
isbnValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -77,56 +78,56 @@ public class LibroCreateController extends BaseController {
|
||||
|
||||
String titulo = this.view.getTituloField().getText();
|
||||
ValidationResult tituloValidation = this.validator.validateTitulo(titulo);
|
||||
if(tituloValidation.hasError()){
|
||||
if (tituloValidation.hasError()) {
|
||||
tituloValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String numeroPaginas = this.view.getPaginasField().getText();
|
||||
ValidationResult numeroPaginasValidation = this.validator.validateNumeroPaginas(numeroPaginas);
|
||||
if(numeroPaginasValidation.hasError()){
|
||||
if (numeroPaginasValidation.hasError()) {
|
||||
numeroPaginasValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String anoPublicacion = this.view.getAnoPublicacionField().getText();
|
||||
ValidationResult anoPublicacionValidation = this.validator.validateAnoPublicacion(anoPublicacion);
|
||||
if(anoPublicacionValidation.hasError()){
|
||||
if (anoPublicacionValidation.hasError()) {
|
||||
anoPublicacionValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String precioReferencial = this.view.getPrecioReferenciaField().getText();
|
||||
ValidationResult precioReferencialValidation = this.validator.validatePrecioReferencia(precioReferencial);
|
||||
if(precioReferencialValidation.hasError()){
|
||||
if (precioReferencialValidation.hasError()) {
|
||||
precioReferencialValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Idioma> idiomas = this.view.getIdiomasList().getSelectedValuesList();
|
||||
ValidationResult idiomasValidation = this.validator.validateIdiomas(idiomas);
|
||||
if(idiomasValidation.hasError()){
|
||||
if (idiomasValidation.hasError()) {
|
||||
idiomasValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Autor> autores = this.view.getAutoresList().getSelectedValuesList();
|
||||
ValidationResult autoresValidation = this.validator.validateAutores(autores);
|
||||
if(autoresValidation.hasError()) {
|
||||
if (autoresValidation.hasError()) {
|
||||
autoresValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Categoria> categorias = this.view.getCategoriasList().getSelectedValuesList();
|
||||
ValidationResult categoriasValidation = this.validator.validateCategorias(categorias);
|
||||
if(categoriasValidation.hasError()){
|
||||
if (categoriasValidation.hasError()) {
|
||||
categoriasValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
Editorial editorial = (Editorial) this.view.getEditorialCombo().getSelectedItem();
|
||||
ValidationResult editorialValidation = this.validator.validateEditorial(editorial);
|
||||
if(editorialValidation.hasError()){
|
||||
if (editorialValidation.hasError()) {
|
||||
editorialValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -148,14 +149,14 @@ public class LibroCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void reload() {
|
||||
loadIdiomasList();
|
||||
loadCategoriasList();
|
||||
loadAutorList();
|
||||
loadEditorialCombo();
|
||||
this.loadIdiomasList();
|
||||
this.loadCategoriasList();
|
||||
this.loadAutorList();
|
||||
this.loadEditorialCombo();
|
||||
}
|
||||
|
||||
private void loadIdiomasList() {
|
||||
List<Idioma> idiomas = idiomaRepository.getAll();
|
||||
List<Idioma> idiomas = this.idiomaRepository.getAll();
|
||||
DefaultListModel<Idioma> model = this.view.getIdiomasModel();
|
||||
model.clear();
|
||||
for (Idioma idioma : idiomas) {
|
||||
@@ -164,34 +165,35 @@ public class LibroCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void loadCategoriasList() {
|
||||
List<Categoria> categorias = categoriaRepository.getAll();
|
||||
List<Categoria> categorias = this.categoriaRepository.getAll();
|
||||
DefaultListModel<Categoria> model = this.view.getCategoriasModel();
|
||||
model.clear();
|
||||
for (Categoria categoria: categorias) {
|
||||
for (Categoria categoria : categorias) {
|
||||
model.addElement(categoria);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadAutorList() {
|
||||
List<Autor> autores = autorRepository.getAll();
|
||||
List<Autor> autores = this.autorRepository.getAll();
|
||||
DefaultListModel<Autor> model = this.view.getAutoresModel();
|
||||
model.clear();
|
||||
for (Autor autor: autores) {
|
||||
for (Autor autor : autores) {
|
||||
model.addElement(autor);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadEditorialCombo(){
|
||||
private void loadEditorialCombo() {
|
||||
List<Editorial> editoriales = this.editorialRepository.getAll();
|
||||
JComboBox<Editorial> combobox = this.view.getEditorialCombo();
|
||||
combobox.removeAllItems();
|
||||
for(Editorial editorial: editoriales) {
|
||||
for (Editorial editorial : editoriales) {
|
||||
combobox.addItem(editorial);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ public class LibroSearchController extends BaseController {
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCrearButton().addActionListener(e -> this.getParentController().showCard(PanelName.LIBRO_CREATE));
|
||||
this.view.getBuscarButton().addActionListener(e -> search());
|
||||
this.view.getBuscarField().addActionListener(e -> search());
|
||||
this.view.getEliminarButton().addActionListener(e -> delete());
|
||||
this.view.getEditarButton().addActionListener(e -> edit());
|
||||
this.view.getVerButton().addActionListener(e -> view());
|
||||
this.view.getBuscarButton().addActionListener(e -> this.search());
|
||||
this.view.getBuscarField().addActionListener(e -> this.search());
|
||||
this.view.getEliminarButton().addActionListener(e -> this.delete());
|
||||
this.view.getEditarButton().addActionListener(e -> this.edit());
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
}
|
||||
|
||||
private void view() {
|
||||
@@ -95,11 +95,12 @@ public class LibroSearchController extends BaseController {
|
||||
|
||||
private void loadLibroTable() {
|
||||
List<Libro> libros = this.libroRepository.getAll();
|
||||
loadLibroTable(libros);
|
||||
this.loadLibroTable(libros);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
private Libro getSelectedLibro() {
|
||||
|
||||
@@ -5,8 +5,9 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JComboBox;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.JListUtils;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
@@ -21,7 +22,6 @@ import xyz.danielcortes.repository.EditorialRepository;
|
||||
import xyz.danielcortes.repository.IdiomaRepository;
|
||||
import xyz.danielcortes.repository.LibroRepository;
|
||||
import xyz.danielcortes.validator.LibroValidator;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.libro.LibroUpdatePanel;
|
||||
|
||||
public class LibroUpdateController extends BaseController {
|
||||
@@ -59,43 +59,43 @@ public class LibroUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getActualizarButton().addActionListener(e -> update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
}
|
||||
|
||||
private void fillLibro() {
|
||||
if (libro == null)
|
||||
if (this.libro == null)
|
||||
return;
|
||||
|
||||
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()));
|
||||
this.view.getIsbnField().setText(this.libro.getIsbn());
|
||||
this.view.getTituloField().setText(this.libro.getTitulo());
|
||||
this.view.getPaginasField().setText(String.valueOf(this.libro.getNumeroPaginas()));
|
||||
this.view.getAnoPublicacionField().setText(String.valueOf(this.libro.getAnoPublicacion()));
|
||||
this.view.getPrecioReferenciaField().setText(String.valueOf(this.libro.getPrecioReferencia()));
|
||||
JListUtils.setSelectedValues(
|
||||
this.view.getIdiomasList(),
|
||||
libro.getIdiomas()
|
||||
this.libro.getIdiomas()
|
||||
);
|
||||
JListUtils.setSelectedValues(
|
||||
this.view.getAutoresList(),
|
||||
libro.getAutores()
|
||||
this.libro.getAutores()
|
||||
);
|
||||
JListUtils.setSelectedValues(
|
||||
this.view.getCategoriasList(),
|
||||
libro.getCategorias()
|
||||
this.libro.getCategorias()
|
||||
);
|
||||
this.view.getEditorialCombo().setSelectedItem(libro.getEditorial());
|
||||
this.view.getEditorialCombo().setSelectedItem(this.libro.getEditorial());
|
||||
}
|
||||
|
||||
private void update() {
|
||||
ValidationResult libroValidation = this.validator.validateLibro(this.libro);
|
||||
if(libroValidation.hasError()){
|
||||
if (libroValidation.hasError()) {
|
||||
libroValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String isbn = this.view.getIsbnField().getText();
|
||||
ValidationResult isbnValidation = this.validator.validateISBN(isbn);
|
||||
if(isbnValidation.hasError()){
|
||||
if (isbnValidation.hasError()) {
|
||||
isbnValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -103,73 +103,73 @@ public class LibroUpdateController extends BaseController {
|
||||
|
||||
String titulo = this.view.getTituloField().getText();
|
||||
ValidationResult tituloValidation = this.validator.validateTitulo(titulo);
|
||||
if(tituloValidation.hasError()){
|
||||
if (tituloValidation.hasError()) {
|
||||
tituloValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String numeroPaginas = this.view.getPaginasField().getText();
|
||||
ValidationResult numeroPaginasValidation = this.validator.validateNumeroPaginas(numeroPaginas);
|
||||
if(numeroPaginasValidation.hasError()){
|
||||
if (numeroPaginasValidation.hasError()) {
|
||||
numeroPaginasValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String anoPublicacion = this.view.getAnoPublicacionField().getText();
|
||||
ValidationResult anoPublicacionValidation = this.validator.validateAnoPublicacion(anoPublicacion);
|
||||
if(anoPublicacionValidation.hasError()){
|
||||
if (anoPublicacionValidation.hasError()) {
|
||||
anoPublicacionValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String precioReferencial = this.view.getPrecioReferenciaField().getText();
|
||||
ValidationResult precioReferencialValidation = this.validator.validatePrecioReferencia(precioReferencial);
|
||||
if(precioReferencialValidation.hasError()){
|
||||
if (precioReferencialValidation.hasError()) {
|
||||
precioReferencialValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Idioma> idiomas = this.view.getIdiomasList().getSelectedValuesList();
|
||||
ValidationResult idiomasValidation = this.validator.validateIdiomas(idiomas);
|
||||
if(idiomasValidation.hasError()){
|
||||
if (idiomasValidation.hasError()) {
|
||||
idiomasValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Autor> autores = this.view.getAutoresList().getSelectedValuesList();
|
||||
ValidationResult autoresValidation = this.validator.validateAutores(autores);
|
||||
if(autoresValidation.hasError()) {
|
||||
if (autoresValidation.hasError()) {
|
||||
autoresValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
List<Categoria> categorias = this.view.getCategoriasList().getSelectedValuesList();
|
||||
ValidationResult categoriasValidation = this.validator.validateCategorias(categorias);
|
||||
if(categoriasValidation.hasError()){
|
||||
if (categoriasValidation.hasError()) {
|
||||
categoriasValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
Editorial editorial = (Editorial) this.view.getEditorialCombo().getSelectedItem();
|
||||
ValidationResult editorialValidation = this.validator.validateEditorial(editorial);
|
||||
if(editorialValidation.hasError()){
|
||||
if (editorialValidation.hasError()) {
|
||||
editorialValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
assert libro != null;
|
||||
assert this.libro != null;
|
||||
|
||||
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.libro.setIsbn(isbn);
|
||||
this.libro.setTitulo(titulo);
|
||||
this.libro.setNumeroPaginas(Integer.parseInt(numeroPaginas));
|
||||
this.libro.setAnoPublicacion(Year.of(Integer.parseInt(anoPublicacion)));
|
||||
this.libro.setPrecioReferencia(Integer.parseInt(precioReferencial));
|
||||
this.libro.setIdiomas(new HashSet<>(idiomas));
|
||||
this.libro.setAutores(new HashSet<>(autores));
|
||||
this.libro.setCategorias(new HashSet<>(categorias));
|
||||
this.libro.setEditorial(editorial);
|
||||
|
||||
this.libroRepository.update(libro);
|
||||
this.libroRepository.update(this.libro);
|
||||
this.getParentController().showCard(PanelName.LIBRO_SEARCH);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ public class LibroUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void loadIdiomasList() {
|
||||
List<Idioma> idiomas = idiomaRepository.getAll();
|
||||
List<Idioma> idiomas = this.idiomaRepository.getAll();
|
||||
DefaultListModel<Idioma> model = this.view.getIdiomasModel();
|
||||
model.clear();
|
||||
for (Idioma idioma : idiomas) {
|
||||
@@ -191,7 +191,7 @@ public class LibroUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void loadCategoriasList() {
|
||||
List<Categoria> categorias = categoriaRepository.getAll();
|
||||
List<Categoria> categorias = this.categoriaRepository.getAll();
|
||||
DefaultListModel<Categoria> model = this.view.getCategoriasModel();
|
||||
model.clear();
|
||||
for (Categoria categoria : categorias) {
|
||||
@@ -200,7 +200,7 @@ public class LibroUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void loadAutorList() {
|
||||
List<Autor> autores = autorRepository.getAll();
|
||||
List<Autor> autores = this.autorRepository.getAll();
|
||||
DefaultListModel<Autor> model = this.view.getAutoresModel();
|
||||
model.clear();
|
||||
for (Autor autor : autores) {
|
||||
@@ -217,7 +217,8 @@ public class LibroUpdateController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@ package xyz.danielcortes.controllers.mantenedores.libro;
|
||||
import java.util.List;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.JComboBox;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.JListUtils;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Autor;
|
||||
@@ -16,10 +17,10 @@ import xyz.danielcortes.repository.AutorRepository;
|
||||
import xyz.danielcortes.repository.CategoriaRepository;
|
||||
import xyz.danielcortes.repository.EditorialRepository;
|
||||
import xyz.danielcortes.repository.IdiomaRepository;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.views.mantenedores.libro.LibroViewPanel;
|
||||
|
||||
public class LibroViewController extends BaseController {
|
||||
|
||||
private Libro libro;
|
||||
private LibroViewPanel view;
|
||||
|
||||
@@ -28,7 +29,7 @@ public class LibroViewController extends BaseController {
|
||||
private AutorRepository autorRepository;
|
||||
private EditorialRepository editorialRepository;
|
||||
|
||||
public LibroViewController(LibroViewPanel view, LaunchController parent){
|
||||
public LibroViewController(LibroViewPanel view, LaunchController parent) {
|
||||
super(parent);
|
||||
this.view = view;
|
||||
|
||||
@@ -63,7 +64,7 @@ public class LibroViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void fillLibro() {
|
||||
if(libro == null)
|
||||
if (this.libro == null)
|
||||
return;
|
||||
|
||||
this.view.getIsbnField().setText(this.libro.getIsbn());
|
||||
@@ -78,7 +79,7 @@ public class LibroViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void loadIdiomasList() {
|
||||
List<Idioma> idiomas = idiomaRepository.getAll();
|
||||
List<Idioma> idiomas = this.idiomaRepository.getAll();
|
||||
DefaultListModel<Idioma> model = this.view.getIdiomasModel();
|
||||
model.clear();
|
||||
for (Idioma idioma : idiomas) {
|
||||
@@ -87,7 +88,7 @@ public class LibroViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void loadCategoriasList() {
|
||||
List<Categoria> categorias = categoriaRepository.getAll();
|
||||
List<Categoria> categorias = this.categoriaRepository.getAll();
|
||||
DefaultListModel<Categoria> model = this.view.getCategoriasModel();
|
||||
model.clear();
|
||||
for (Categoria categoria : categorias) {
|
||||
@@ -96,7 +97,7 @@ public class LibroViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void loadAutorList() {
|
||||
List<Autor> autores = autorRepository.getAll();
|
||||
List<Autor> autores = this.autorRepository.getAll();
|
||||
DefaultListModel<Autor> model = this.view.getAutoresModel();
|
||||
model.clear();
|
||||
for (Autor autor : autores) {
|
||||
|
||||
@@ -25,47 +25,48 @@ public class TrabajadorCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.TRABAJADOR_SEARCH));
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String rut = this.view.getRutField().getText();
|
||||
ValidationResult rutValidation = this.validator.validateRut(rut);
|
||||
if(rutValidation.hasError()){
|
||||
if (rutValidation.hasError()) {
|
||||
rutValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.validator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String apellidoPaterno = this.view.getApellidoPaternoField().getText();
|
||||
ValidationResult apellidoPaternoValidation = this.validator.validateApellidoPaterno(apellidoPaterno);
|
||||
if(apellidoPaternoValidation.hasError()){
|
||||
if (apellidoPaternoValidation.hasError()) {
|
||||
apellidoPaternoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String apellidoMaterno = this.view.getApellidoMaternoField().getText();
|
||||
ValidationResult apellidoMaternoValidation = this.validator.validateApellidoMaterno(apellidoMaterno);
|
||||
if(apellidoMaternoValidation.hasError()){
|
||||
if (apellidoMaternoValidation.hasError()) {
|
||||
apellidoMaternoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
LocalDate fechaContrato = this.view.getFechaContratoPicker().getDate();
|
||||
ValidationResult fechaContratoValidation = this.validator.validateFechaContrato(fechaContrato);
|
||||
if(fechaContratoValidation.hasError()){
|
||||
if (fechaContratoValidation.hasError()) {
|
||||
fechaContratoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -77,11 +78,12 @@ public class TrabajadorCreateController extends BaseController {
|
||||
trabajador.setFechaContrato(fechaContrato);
|
||||
trabajador.setRut(rut);
|
||||
|
||||
respository.save(trabajador);
|
||||
this.respository.save(trabajador);
|
||||
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ public class TrabajadorSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
this.view.getTrabajadorTable().clearSelection();
|
||||
@@ -96,7 +97,7 @@ public class TrabajadorSearchController extends BaseController {
|
||||
|
||||
private void loadTrabajadorTable() {
|
||||
List<Trabajador> trabajadores = this.trabajadorRespository.getAll();
|
||||
loadTrabajadorTable(trabajadores);
|
||||
this.loadTrabajadorTable(trabajadores);
|
||||
}
|
||||
|
||||
private void loadTrabajadorTable(List<Trabajador> trabajadores) {
|
||||
@@ -118,6 +119,7 @@ public class TrabajadorSearchController extends BaseController {
|
||||
return this.view.getTrabajadorModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,13 @@ import xyz.danielcortes.validator.TrabajadorValidator;
|
||||
import xyz.danielcortes.views.mantenedores.trabajador.TrabajadorUpdatePanel;
|
||||
|
||||
public class TrabajadorUpdateController extends BaseController {
|
||||
|
||||
private Trabajador trabajador;
|
||||
private TrabajadorUpdatePanel view;
|
||||
private TrabajadorRespository trabajadorRespository;
|
||||
private TrabajadorValidator trabajadorValidator;
|
||||
|
||||
public TrabajadorUpdateController(TrabajadorUpdatePanel view, LaunchController parent){
|
||||
public TrabajadorUpdateController(TrabajadorUpdatePanel view, LaunchController parent) {
|
||||
super(parent);
|
||||
this.view = view;
|
||||
this.trabajadorRespository = new TrabajadorRespository();
|
||||
@@ -29,13 +30,14 @@ public class TrabajadorUpdateController extends BaseController {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillTrabajador();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillTrabajador() {
|
||||
if(trabajadorRespository == null)
|
||||
if (this.trabajadorRespository == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.trabajador.getRut());
|
||||
@@ -46,42 +48,42 @@ public class TrabajadorUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getActualizarButton().addActionListener(e -> update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.TRABAJADOR_SEARCH));
|
||||
}
|
||||
|
||||
private void update() {
|
||||
String rut = this.view.getRutField().getText();
|
||||
ValidationResult rutValidation = this.trabajadorValidator.validateRut(rut);
|
||||
if(rutValidation.hasError()){
|
||||
if (rutValidation.hasError()) {
|
||||
rutValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String nombre = this.view.getNombreField().getText();
|
||||
ValidationResult nombreValidation = this.trabajadorValidator.validateNombre(nombre);
|
||||
if(nombreValidation.hasError()){
|
||||
if (nombreValidation.hasError()) {
|
||||
nombreValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String apellidoPaterno = this.view.getApellidoPaternoField().getText();
|
||||
ValidationResult apellidoPaternoValidation = this.trabajadorValidator.validateApellidoPaterno(apellidoPaterno);
|
||||
if(apellidoPaternoValidation.hasError()){
|
||||
if (apellidoPaternoValidation.hasError()) {
|
||||
apellidoPaternoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
String apellidoMaterno = this.view.getApellidoMaternoField().getText();
|
||||
ValidationResult apellidoMaternoValidation = this.trabajadorValidator.validateApellidoMaterno(apellidoMaterno);
|
||||
if(apellidoMaternoValidation.hasError()){
|
||||
if (apellidoMaternoValidation.hasError()) {
|
||||
apellidoMaternoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
LocalDate fechaContrato = this.view.getFechaContratoField().getDate();
|
||||
ValidationResult fechaContratoValidation = this.trabajadorValidator.validateFechaContrato(fechaContrato);
|
||||
if(fechaContratoValidation.hasError()){
|
||||
if (fechaContratoValidation.hasError()) {
|
||||
fechaContratoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -97,6 +99,9 @@ public class TrabajadorUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_SEARCH);
|
||||
}
|
||||
|
||||
public BasePanel getView() { return view; }
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ public class TrabajadorViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillTrabajador();
|
||||
}
|
||||
@@ -42,24 +43,24 @@ public class TrabajadorViewController extends BaseController {
|
||||
|
||||
private void gotoDireccionView() {
|
||||
DireccionSearchController controller = (DireccionSearchController) this.getParentController().getCard(PanelName.DIRECCION_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.DIRECCION_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoTelefonoView() {
|
||||
TelefonoSearchController controller = (TelefonoSearchController) this.getParentController().getCard(PanelName.TELEFONO_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TELEFONO_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoCorreosView() {
|
||||
CorreoSearchController controller = (CorreoSearchController) this.getParentController().getCard(PanelName.CORREO_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.CORREO_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoUsuarioView() {
|
||||
if(this.trabajador.getUsuario() == null) {
|
||||
if (this.trabajador.getUsuario() == null) {
|
||||
int result = JOptionPane.showConfirmDialog(
|
||||
null,
|
||||
"El trabajador no tiene un usuario, ¿Desea crear uno?",
|
||||
@@ -67,20 +68,20 @@ public class TrabajadorViewController extends BaseController {
|
||||
JOptionPane.YES_NO_OPTION,
|
||||
JOptionPane.QUESTION_MESSAGE
|
||||
);
|
||||
if(result == JOptionPane.YES_OPTION) {
|
||||
if (result == JOptionPane.YES_OPTION) {
|
||||
UsuarioCreateController controller = (UsuarioCreateController) this.getParentController().getCard(PanelName.USUARIO_CREATE);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.USUARIO_CREATE);
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
UsuarioViewController controller = (UsuarioViewController) this.getParentController().getCard(PanelName.USUARIO_VIEW);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.USUARIO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
private void fillTrabajador() {
|
||||
if (trabajador == null)
|
||||
if (this.trabajador == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.trabajador.getRut());
|
||||
@@ -90,7 +91,8 @@ public class TrabajadorViewController extends BaseController {
|
||||
this.view.getFechaContratoPicker().setDate(this.trabajador.getFechaContrato());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,61 +1,30 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.trabajador.correo;
|
||||
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.controllers.mantenedores.abstract_correo.AbstractCorreoCreateController;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Correo;
|
||||
import xyz.danielcortes.models.Trabajador;
|
||||
import xyz.danielcortes.repository.CorreoRepository;
|
||||
import xyz.danielcortes.validator.CorreoValidator;
|
||||
import xyz.danielcortes.views.mantenedores.correo.CorreoCreatePanel;
|
||||
|
||||
public class CorreoCreateController extends BaseController {
|
||||
public class CorreoCreateController extends AbstractCorreoCreateController {
|
||||
|
||||
private Trabajador trabajador;
|
||||
private CorreoCreatePanel view;
|
||||
private CorreoRepository repository;
|
||||
private CorreoValidator validator;
|
||||
|
||||
public CorreoCreateController(CorreoCreatePanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.repository = new CorreoRepository();
|
||||
this.validator = new CorreoValidator(this.repository);
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getCorreoField().requestFocus();
|
||||
this.view.getCorreoField().setText("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
super(view, parentController);
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCorreoField().addActionListener(e -> save());
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
}
|
||||
|
||||
private void save() {
|
||||
@Override
|
||||
protected void save() {
|
||||
String sCorreo = this.view.getCorreoField().getText();
|
||||
|
||||
ValidationResult correoValidation = validator.validateCorreo(sCorreo);
|
||||
ValidationResult correoValidation = this.validator.validateCorreo(sCorreo);
|
||||
if (correoValidation.hasError()) {
|
||||
correoValidation.showErrorDialog();
|
||||
return;
|
||||
@@ -63,7 +32,7 @@ public class CorreoCreateController extends BaseController {
|
||||
|
||||
Correo correo = new Correo();
|
||||
correo.setCorreo(sCorreo);
|
||||
correo.getTrabajadores().add(trabajador);
|
||||
correo.getTrabajadores().add(this.trabajador);
|
||||
|
||||
this.repository.save(correo);
|
||||
this.trabajador.getCorreos().add(correo);
|
||||
@@ -71,9 +40,10 @@ public class CorreoCreateController extends BaseController {
|
||||
this.volver();
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
@Override
|
||||
protected void volver() {
|
||||
CorreoSearchController controller = (CorreoSearchController) this.getParentController().getCard(PanelName.CORREO_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.CORREO_SEARCH);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,68 +3,34 @@ package xyz.danielcortes.controllers.mantenedores.trabajador.correo;
|
||||
import java.util.List;
|
||||
import javax.swing.JOptionPane;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.controllers.mantenedores.abstract_correo.AbstractCorreoSearchController;
|
||||
import xyz.danielcortes.controllers.mantenedores.trabajador.TrabajadorViewController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Correo;
|
||||
import xyz.danielcortes.models.Trabajador;
|
||||
import xyz.danielcortes.repository.CorreoRepository;
|
||||
import xyz.danielcortes.validator.CorreoValidator;
|
||||
import xyz.danielcortes.views.mantenedores.correo.CorreoSearchPanel;
|
||||
|
||||
public class CorreoSearchController extends BaseController {
|
||||
public class CorreoSearchController extends AbstractCorreoSearchController {
|
||||
|
||||
private Trabajador trabajador;
|
||||
private CorreoSearchPanel view;
|
||||
private CorreoRepository correoRepository;
|
||||
private CorreoValidator validator;
|
||||
|
||||
public CorreoSearchController(CorreoSearchPanel view, LaunchController parent) {
|
||||
super(parent);
|
||||
this.view = view;
|
||||
this.correoRepository = new CorreoRepository();
|
||||
this.validator = new CorreoValidator(this.correoRepository);
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
super(view, parent);
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadCorreosTable();
|
||||
this.view.getCorreosTable().clearSelection();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCrearButton().addActionListener(e -> this.create());
|
||||
this.view.getSearchField().addActionListener(e -> this.search());
|
||||
this.view.getBuscarButton().addActionListener(e -> this.search());
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
this.view.getEditarButton().addActionListener(e -> this.edit());
|
||||
this.view.getEliminarButton().addActionListener(e -> this.delete());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void create() {
|
||||
@Override
|
||||
protected void create() {
|
||||
CorreoCreateController controller = (CorreoCreateController) this.getParentController().getCard(PanelName.CORREO_CREATE);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.CORREO_CREATE);
|
||||
}
|
||||
|
||||
private void edit() {
|
||||
@Override
|
||||
protected void edit() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo != null) {
|
||||
CorreoUpdateController controller = (CorreoUpdateController) this.getParentController().getCard(PanelName.CORREO_UPDATE);
|
||||
@@ -74,8 +40,9 @@ public class CorreoSearchController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
private void delete() {
|
||||
Correo correo = this.getSelecztedCorreo();
|
||||
@Override
|
||||
protected void delete() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo == null)
|
||||
return;
|
||||
|
||||
@@ -94,7 +61,8 @@ public class CorreoSearchController extends BaseController {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
private void view() {
|
||||
@Override
|
||||
protected void view() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo != null) {
|
||||
CorreoViewController controller = (CorreoViewController) this.getParentController().getCard(PanelName.CORREO_VIEW);
|
||||
@@ -104,40 +72,23 @@ public class CorreoSearchController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
private void search() {
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Correo> correo = this.correoRepository.search(term, this.trabajador);
|
||||
this.loadCorreosTable(correo);
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
@Override
|
||||
protected void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_VIEW);
|
||||
}
|
||||
|
||||
private void loadCorreosTable() {
|
||||
@Override
|
||||
protected void loadCorreosTable() {
|
||||
List<Correo> correos = this.trabajador.getCorreos();
|
||||
this.loadCorreosTable(correos);
|
||||
}
|
||||
|
||||
private void loadCorreosTable(List<Correo> correos) {
|
||||
BaseTableModel<Correo> model = this.view.getCorreoModel();
|
||||
model.setRows(correos);
|
||||
}
|
||||
|
||||
private Correo getSelectedCorreo() {
|
||||
int selectedRow = this.view.getCorreosTable().getSelectedRow();
|
||||
if (selectedRow == -1) {
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
"No hay correo seleccionado",
|
||||
"Error",
|
||||
JOptionPane.ERROR_MESSAGE
|
||||
);
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.view.getCorreoModel().getRow(selectedRow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,87 +1,25 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.trabajador.correo;
|
||||
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.controllers.mantenedores.abstract_correo.AbstractCorreoUpdateController;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.framework.ValidationResult;
|
||||
import xyz.danielcortes.models.Correo;
|
||||
import xyz.danielcortes.models.Trabajador;
|
||||
import xyz.danielcortes.repository.CorreoRepository;
|
||||
import xyz.danielcortes.validator.CorreoValidator;
|
||||
import xyz.danielcortes.views.mantenedores.correo.CorreoUpdatePanel;
|
||||
|
||||
public class CorreoUpdateController extends BaseController {
|
||||
public class CorreoUpdateController extends AbstractCorreoUpdateController {
|
||||
|
||||
private Trabajador trabajador;
|
||||
private Correo correo;
|
||||
private CorreoUpdatePanel view;
|
||||
private CorreoRepository repository;
|
||||
private CorreoValidator validator;
|
||||
|
||||
public CorreoUpdateController(CorreoUpdatePanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.repository = new CorreoRepository();
|
||||
this.validator = new CorreoValidator(this.repository);
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getCorreoField().requestFocus();
|
||||
this.fillCorreo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
super(view, parentController);
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
public void setCorreo(Correo correo) {
|
||||
this.correo = correo;
|
||||
}
|
||||
|
||||
public void fillCorreo() {
|
||||
this.view.getCorreoField().setText(this.correo.getCorreo());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCorreoField().addActionListener(e -> update());
|
||||
this.view.getActualizarButton().addActionListener(e -> update());
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
}
|
||||
|
||||
private void update() {
|
||||
String sCorreo = this.view.getCorreoField().getText();
|
||||
|
||||
ValidationResult originalValidation = this.validator.validateOriginal(this.correo);
|
||||
if (originalValidation.hasError()) {
|
||||
originalValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
ValidationResult correoValidation = this.validator.validateCorreo(sCorreo);
|
||||
if(correoValidation.hasError()) {
|
||||
correoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
this.correo.setCorreo(sCorreo);
|
||||
this.repository.update(this.correo);
|
||||
|
||||
this.volver();
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
@Override
|
||||
protected void volver() {
|
||||
CorreoSearchController controller = (CorreoSearchController) this.getParentController().getCard(PanelName.CORREO_SEARCH);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.CORREO_SEARCH);
|
||||
|
||||
@@ -1,59 +1,27 @@
|
||||
package xyz.danielcortes.controllers.mantenedores.trabajador.correo;
|
||||
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
import xyz.danielcortes.framework.BaseController;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.controllers.mantenedores.abstract_correo.AbstractCorreoViewController;
|
||||
import xyz.danielcortes.framework.PanelName;
|
||||
import xyz.danielcortes.models.Correo;
|
||||
import xyz.danielcortes.models.Trabajador;
|
||||
import xyz.danielcortes.views.mantenedores.correo.CorreoViewPanel;
|
||||
|
||||
public class CorreoViewController extends BaseController {
|
||||
public class CorreoViewController extends AbstractCorreoViewController {
|
||||
|
||||
private Trabajador trabajador;
|
||||
private Correo correo;
|
||||
private CorreoViewPanel view;
|
||||
|
||||
public CorreoViewController(CorreoViewPanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCorreo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
super(view, parentController);
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
public void setCorreo(Correo correo) {
|
||||
this.correo = correo;
|
||||
}
|
||||
|
||||
public void fillCorreo() {
|
||||
this.view.getCorreoField().setText(this.correo.getCorreo());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
@Override
|
||||
protected void volver() {
|
||||
CorreoSearchController controller = (CorreoSearchController) this.getParentController().getCard(PanelName.CORREO_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.CORREO_SEARCH);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,22 +48,22 @@ public class DireccionCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getNumeroField().addActionListener(e -> save());
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getNumeroField().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String calle = this.view.getCalleField().getText();
|
||||
String numero = this.view.getNumeroField().getText();
|
||||
|
||||
ValidationResult direccionValidation = validator.validateCalle(calle);
|
||||
ValidationResult direccionValidation = this.validator.validateCalle(calle);
|
||||
if (direccionValidation.hasError()) {
|
||||
direccionValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
ValidationResult numeroValidation = validator.validateNumero(numero);
|
||||
ValidationResult numeroValidation = this.validator.validateNumero(numero);
|
||||
if (numeroValidation.hasError()) {
|
||||
numeroValidation.showErrorDialog();
|
||||
return;
|
||||
@@ -72,7 +72,7 @@ public class DireccionCreateController extends BaseController {
|
||||
Direccion direccion = new Direccion();
|
||||
direccion.setCalle(calle);
|
||||
direccion.setNumero(numero);
|
||||
direccion.getTrabajadores().add(trabajador);
|
||||
direccion.getTrabajadores().add(this.trabajador);
|
||||
|
||||
this.repository.save(direccion);
|
||||
this.trabajador.getDirecciones().add(direccion);
|
||||
@@ -82,7 +82,7 @@ public class DireccionCreateController extends BaseController {
|
||||
|
||||
private void volver() {
|
||||
DireccionSearchController controller = (DireccionSearchController) this.getParentController().getCard(PanelName.DIRECCION_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.DIRECCION_SEARCH);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class DireccionSearchController extends BaseController {
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
@@ -60,7 +60,7 @@ public class DireccionSearchController extends BaseController {
|
||||
|
||||
private void create() {
|
||||
DireccionCreateController controller = (DireccionCreateController) this.getParentController().getCard(PanelName.DIRECCION_CREATE);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.DIRECCION_CREATE);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class DireccionSearchController extends BaseController {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
if (direccion != null) {
|
||||
DireccionUpdateController controller = (DireccionUpdateController) this.getParentController().getCard(PanelName.DIRECCION_UPDATE);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
controller.setDireccion(direccion);
|
||||
this.getParentController().showCard(PanelName.DIRECCION_UPDATE);
|
||||
}
|
||||
@@ -99,14 +99,14 @@ public class DireccionSearchController extends BaseController {
|
||||
if (direccion != null) {
|
||||
DireccionViewController controller = (DireccionViewController) this.getParentController().getCard(PanelName.DIRECCION_VIEW);
|
||||
controller.setDireccion(direccion);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.DIRECCION_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Direccion> direccion = this.direccionRepository.search(term, trabajador);
|
||||
List<Direccion> direccion = this.direccionRepository.search(term, this.trabajador);
|
||||
this.loadDireccionesTable(direccion);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class DireccionSearchController extends BaseController {
|
||||
|
||||
private void loadDireccionesTable() {
|
||||
List<Direccion> direccions = this.trabajador.getDirecciones();
|
||||
loadDireccionesTable(direccions);
|
||||
this.loadDireccionesTable(direccions);
|
||||
}
|
||||
|
||||
private void loadDireccionesTable(List<Direccion> direccions) {
|
||||
|
||||
@@ -57,9 +57,9 @@ public class DireccionUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNumeroField().addActionListener(e -> update());
|
||||
this.view.getActualizarButton().addActionListener(e -> update());
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
this.view.getNumeroField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void update() {
|
||||
@@ -72,13 +72,13 @@ public class DireccionUpdateController extends BaseController {
|
||||
return;
|
||||
}
|
||||
|
||||
ValidationResult direccionValidation = validator.validateCalle(calle);
|
||||
ValidationResult direccionValidation = this.validator.validateCalle(calle);
|
||||
if (direccionValidation.hasError()) {
|
||||
direccionValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
ValidationResult numeroValidation = validator.validateNumero(numero);
|
||||
ValidationResult numeroValidation = this.validator.validateNumero(numero);
|
||||
if (numeroValidation.hasError()) {
|
||||
numeroValidation.showErrorDialog();
|
||||
return;
|
||||
|
||||
@@ -49,12 +49,12 @@ public class DireccionViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
DireccionSearchController controller = (DireccionSearchController) this.getParentController().getCard(PanelName.DIRECCION_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.DIRECCION_SEARCH);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,15 +47,15 @@ public class TelefonoCreateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNumeroField().addActionListener(e -> save());
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
this.view.getNumeroField().addActionListener(e -> this.save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String numero = this.view.getNumeroField().getText();
|
||||
|
||||
ValidationResult numeroValidation = validator.validateTelefono(numero);
|
||||
ValidationResult numeroValidation = this.validator.validateTelefono(numero);
|
||||
if (numeroValidation.hasError()) {
|
||||
numeroValidation.showErrorDialog();
|
||||
return;
|
||||
@@ -63,7 +63,7 @@ public class TelefonoCreateController extends BaseController {
|
||||
|
||||
Telefono telefono = new Telefono();
|
||||
telefono.setNumero(numero);
|
||||
telefono.getTrabajadores().add(trabajador);
|
||||
telefono.getTrabajadores().add(this.trabajador);
|
||||
|
||||
this.repository.save(telefono);
|
||||
this.trabajador.getTelefonos().add(telefono);
|
||||
@@ -72,7 +72,7 @@ public class TelefonoCreateController extends BaseController {
|
||||
|
||||
private void volver() {
|
||||
TelefonoSearchController controller = (TelefonoSearchController) this.getParentController().getCard(PanelName.TELEFONO_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TELEFONO_SEARCH);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class TelefonoSearchController extends BaseController {
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return view;
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
@@ -60,7 +60,7 @@ public class TelefonoSearchController extends BaseController {
|
||||
|
||||
private void create() {
|
||||
TelefonoCreateController controller = (TelefonoCreateController) this.getParentController().getCard(PanelName.TELEFONO_CREATE);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TELEFONO_CREATE);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ public class TelefonoSearchController extends BaseController {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
if (telefono != null) {
|
||||
TelefonoUpdateController controller = (TelefonoUpdateController) this.getParentController().getCard(PanelName.TELEFONO_UPDATE);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
controller.setTelefono(telefono);
|
||||
this.getParentController().showCard(PanelName.TELEFONO_UPDATE);
|
||||
}
|
||||
@@ -99,14 +99,14 @@ public class TelefonoSearchController extends BaseController {
|
||||
if (telefono != null) {
|
||||
TelefonoViewController controller = (TelefonoViewController) this.getParentController().getCard(PanelName.TELEFONO_VIEW);
|
||||
controller.setTelefono(telefono);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TELEFONO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Telefono> telefono = this.telefonoRepository.search(term, trabajador);
|
||||
List<Telefono> telefono = this.telefonoRepository.search(term, this.trabajador);
|
||||
this.loadTelefonosTable(telefono);
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class TelefonoSearchController extends BaseController {
|
||||
|
||||
private void loadTelefonosTable() {
|
||||
List<Telefono> telefonos = this.trabajador.getTelefonos();
|
||||
loadTelefonosTable(telefonos);
|
||||
this.loadTelefonosTable(telefonos);
|
||||
}
|
||||
|
||||
private void loadTelefonosTable(List<Telefono> telefonos) {
|
||||
|
||||
@@ -56,9 +56,9 @@ public class TelefonoUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getTelefonoField().addActionListener(e -> update());
|
||||
this.view.getActualizarButton().addActionListener(e -> update());
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
this.view.getTelefonoField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void update() {
|
||||
@@ -70,7 +70,7 @@ public class TelefonoUpdateController extends BaseController {
|
||||
return;
|
||||
}
|
||||
ValidationResult telefonoValidation = this.validator.validateTelefono(telefono);
|
||||
if(telefonoValidation.hasError()) {
|
||||
if (telefonoValidation.hasError()) {
|
||||
telefonoValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -48,12 +48,12 @@ public class TelefonoViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
TelefonoSearchController controller = (TelefonoSearchController) this.getParentController().getCard(PanelName.TELEFONO_SEARCH);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TELEFONO_SEARCH);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,17 +14,18 @@ import xyz.danielcortes.validator.UsuarioValidator;
|
||||
import xyz.danielcortes.views.mantenedores.usuario.UsuarioCreatePanel;
|
||||
|
||||
public class UsuarioCreateController extends BaseController {
|
||||
|
||||
private Trabajador trabajador;
|
||||
private UsuarioCreatePanel view;
|
||||
private UsuarioRepository repository;
|
||||
private UsuarioValidator validator;
|
||||
|
||||
public UsuarioCreateController(UsuarioCreatePanel view, LaunchController parentController){
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.repository = new UsuarioRepository();
|
||||
this.validator = new UsuarioValidator(this.repository);
|
||||
this.setupListeners();
|
||||
public UsuarioCreateController(UsuarioCreatePanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.repository = new UsuarioRepository();
|
||||
this.validator = new UsuarioValidator(this.repository);
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,25 +43,27 @@ public class UsuarioCreateController extends BaseController {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {this.trabajador = trabajador;}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> save());
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
private void save(){
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String user = this.view.getUserField().getText();
|
||||
char[] pass = this.view.getPassField().getPassword();
|
||||
|
||||
ValidationResult userValidation = this.validator.validateUsername(user);
|
||||
if(userValidation.hasError()){
|
||||
if (userValidation.hasError()) {
|
||||
userValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
ValidationResult passValidation = this.validator.validatePassword(pass);
|
||||
if(passValidation.hasError()){
|
||||
if (passValidation.hasError()) {
|
||||
passValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
@@ -69,7 +72,7 @@ public class UsuarioCreateController extends BaseController {
|
||||
usuario.setNombre(user);
|
||||
usuario.setSalt(Passwords.getNextSalt());
|
||||
usuario.setPassword(Passwords.hash(pass, usuario.getSalt()));
|
||||
usuario.setTrabajador(trabajador);
|
||||
usuario.setTrabajador(this.trabajador);
|
||||
|
||||
this.repository.save(usuario);
|
||||
this.trabajador.setUsuario(usuario);
|
||||
@@ -77,9 +80,9 @@ public class UsuarioCreateController extends BaseController {
|
||||
this.volver();
|
||||
}
|
||||
|
||||
private void volver(){
|
||||
private void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_VIEW);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,17 +13,18 @@ import xyz.danielcortes.validator.UsuarioValidator;
|
||||
import xyz.danielcortes.views.mantenedores.usuario.UsuarioUpdatePanel;
|
||||
|
||||
public class UsuarioUpdateController extends BaseController {
|
||||
|
||||
private Trabajador trabajador;
|
||||
private UsuarioUpdatePanel view;
|
||||
private UsuarioRepository repository;
|
||||
private UsuarioValidator validator;
|
||||
|
||||
public UsuarioUpdateController(UsuarioUpdatePanel view, LaunchController parentController){
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.repository = new UsuarioRepository();
|
||||
this.validator = new UsuarioValidator(this.repository);
|
||||
this.setupListeners();
|
||||
public UsuarioUpdateController(UsuarioUpdatePanel view, LaunchController parentController) {
|
||||
super(parentController);
|
||||
this.view = view;
|
||||
this.repository = new UsuarioRepository();
|
||||
this.validator = new UsuarioValidator(this.repository);
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -42,50 +43,52 @@ public class UsuarioUpdateController extends BaseController {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {this.trabajador = trabajador;}
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
public void fillUser() {
|
||||
this.view.getUserField().setText(this.trabajador.getUsuario().getNombre());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getActualizarButton().addActionListener(e -> update());
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
private void update(){
|
||||
private void update() {
|
||||
String user = this.view.getUserField().getText();
|
||||
char[] pass = this.view.getPassField().getPassword();
|
||||
|
||||
ValidationResult originalValidation = this.validator.validateOriginal(this.trabajador.getUsuario());
|
||||
if(originalValidation.hasError()){
|
||||
if (originalValidation.hasError()) {
|
||||
originalValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
ValidationResult userValidation = this.validator.validateUsername(user);
|
||||
if(userValidation.hasError()){
|
||||
if (userValidation.hasError()) {
|
||||
userValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
ValidationResult passValidation = this.validator.validatePassword(pass);
|
||||
if(passValidation.hasError()){
|
||||
if (passValidation.hasError()) {
|
||||
passValidation.showErrorDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
trabajador.getUsuario().setNombre(user);
|
||||
trabajador.getUsuario().setSalt(Passwords.getNextSalt());
|
||||
trabajador.getUsuario().setPassword(Passwords.hash(pass, trabajador.getUsuario().getSalt()));
|
||||
this.trabajador.getUsuario().setNombre(user);
|
||||
this.trabajador.getUsuario().setSalt(Passwords.getNextSalt());
|
||||
this.trabajador.getUsuario().setPassword(Passwords.hash(pass, this.trabajador.getUsuario().getSalt()));
|
||||
|
||||
this.repository.update(trabajador.getUsuario());
|
||||
this.repository.update(this.trabajador.getUsuario());
|
||||
this.volver();
|
||||
}
|
||||
|
||||
private void volver(){
|
||||
private void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,18 +49,18 @@ public class UsuarioViewController extends BaseController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> volver());
|
||||
this.view.getEditarButton().addActionListener(e -> editar());
|
||||
this.view.getEliminarButton().addActionListener(e -> eliminar());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
this.view.getEditarButton().addActionListener(e -> this.editar());
|
||||
this.view.getEliminarButton().addActionListener(e -> this.eliminar());
|
||||
}
|
||||
|
||||
private void editar() {
|
||||
UsuarioUpdateController controller = (UsuarioUpdateController) this.getParentController().getCard(PanelName.USUARIO_UPDATE);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.USUARIO_UPDATE);
|
||||
}
|
||||
|
||||
private void eliminar(){
|
||||
private void eliminar() {
|
||||
if (this.trabajador.getUsuario() == null)
|
||||
return;
|
||||
|
||||
@@ -81,7 +81,7 @@ public class UsuarioViewController extends BaseController {
|
||||
|
||||
private void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
controller.setTrabajador(trabajador);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_VIEW);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package xyz.danielcortes.framework;
|
||||
import xyz.danielcortes.controllers.LaunchController;
|
||||
|
||||
public abstract class BaseController {
|
||||
|
||||
protected LaunchController parentController;
|
||||
|
||||
public BaseController(LaunchController parentController) {
|
||||
@@ -10,12 +11,13 @@ public abstract class BaseController {
|
||||
}
|
||||
|
||||
public LaunchController getParentController() {
|
||||
return parentController;
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
/**
|
||||
* Este metodo sera llamado cada vez que se necesite mostrar la vista que contiene
|
||||
*/
|
||||
public abstract void show();
|
||||
|
||||
public abstract BasePanel getView();
|
||||
}
|
||||
|
||||
@@ -3,5 +3,6 @@ package xyz.danielcortes.framework;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public abstract class BasePanel {
|
||||
|
||||
public abstract JPanel getContentPane();
|
||||
}
|
||||
|
||||
@@ -12,41 +12,41 @@ public abstract class BaseRepository<E> {
|
||||
}
|
||||
|
||||
public void save(E entity) {
|
||||
em.getTransaction().begin();
|
||||
this.em.getTransaction().begin();
|
||||
|
||||
try {
|
||||
em.persist(entity);
|
||||
this.em.persist(entity);
|
||||
} catch (PersistenceException e) {
|
||||
e.printStackTrace();
|
||||
em.getTransaction().rollback();
|
||||
this.em.getTransaction().rollback();
|
||||
}
|
||||
|
||||
em.getTransaction().commit();
|
||||
this.em.getTransaction().commit();
|
||||
}
|
||||
|
||||
public void update(E entity) {
|
||||
em.getTransaction().begin();
|
||||
this.em.getTransaction().begin();
|
||||
|
||||
try {
|
||||
em.merge(entity);
|
||||
this.em.merge(entity);
|
||||
} catch (PersistenceException e) {
|
||||
e.printStackTrace();
|
||||
em.getTransaction().rollback();
|
||||
this.em.getTransaction().rollback();
|
||||
}
|
||||
|
||||
em.getTransaction().commit();
|
||||
this.em.getTransaction().commit();
|
||||
}
|
||||
|
||||
public void delete(E entity) {
|
||||
em.getTransaction().begin();
|
||||
this.em.getTransaction().begin();
|
||||
|
||||
try {
|
||||
em.remove(entity);
|
||||
this.em.remove(entity);
|
||||
} catch (PersistenceException e) {
|
||||
e.printStackTrace();
|
||||
em.getTransaction().rollback();
|
||||
this.em.getTransaction().rollback();
|
||||
}
|
||||
|
||||
em.getTransaction().commit();
|
||||
this.em.getTransaction().commit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,10 @@ 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
|
||||
*
|
||||
* 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 {
|
||||
|
||||
@@ -21,36 +17,17 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
||||
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.
|
||||
* 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;
|
||||
* }
|
||||
* @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();
|
||||
@@ -61,52 +38,52 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
||||
|
||||
@Override
|
||||
public String getColumnName(int index) {
|
||||
return columns[index];
|
||||
return this.columns[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
return valueAt.apply(this.rows, rowIndex, columnIndex);
|
||||
return this.valueAt.apply(this.rows, rowIndex, columnIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return rows.size();
|
||||
return this.rows.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColumnCount() {
|
||||
return columns.length;
|
||||
return this.columns.length;
|
||||
}
|
||||
|
||||
public void addRow(T item) {
|
||||
rows.add(item);
|
||||
this.fireTableRowsInserted(getRowCount() - 1, getRowCount() - 1);
|
||||
this.rows.add(item);
|
||||
this.fireTableRowsInserted(this.getRowCount() - 1, this.getRowCount() - 1);
|
||||
}
|
||||
|
||||
public void setRows(List<T> items) {
|
||||
this.removeRows();
|
||||
rows.addAll(items);
|
||||
this.fireTableRowsInserted(0, getRowCount() - 1);
|
||||
this.rows.addAll(items);
|
||||
this.fireTableRowsInserted(0, this.getRowCount() - 1);
|
||||
}
|
||||
|
||||
public void removeRow(int row) {
|
||||
rows.remove(row);
|
||||
this.rows.remove(row);
|
||||
this.fireTableRowsDeleted(row, row);
|
||||
}
|
||||
|
||||
public void removeRows() {
|
||||
int rowCount = this.getRowCount();
|
||||
if (rowCount > 0) {
|
||||
rows.clear();
|
||||
this.rows.clear();
|
||||
this.fireTableRowsDeleted(0, rowCount - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public T getRow(int row){
|
||||
if(row > -1 || row < this.getRowCount()) {
|
||||
return rows.get(row);
|
||||
}else{
|
||||
public T getRow(int row) {
|
||||
if (row > -1 || row < this.getRowCount()) {
|
||||
return this.rows.get(row);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public enum PanelName {
|
||||
CLIENTE_SEARCH,
|
||||
CLIENTE_CREATE,
|
||||
CLIENTE_UPDATE,
|
||||
|
||||
|
||||
USUARIO_VIEW,
|
||||
USUARIO_CREATE,
|
||||
USUARIO_UPDATE,
|
||||
|
||||
@@ -3,18 +3,19 @@ package xyz.danielcortes.framework;
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
public class ValidationResult {
|
||||
|
||||
public static ValidationResult NON_ERROR = new ValidationResult();
|
||||
private String message;
|
||||
private String title;
|
||||
private boolean hasError;
|
||||
|
||||
private ValidationResult(){
|
||||
private ValidationResult() {
|
||||
this.hasError = false;
|
||||
this.message = "No hubo error";
|
||||
this.title = "Info";
|
||||
}
|
||||
|
||||
public ValidationResult(String message){
|
||||
public ValidationResult(String message) {
|
||||
this.title = "Error";
|
||||
this.message = message;
|
||||
this.hasError = true;
|
||||
@@ -27,23 +28,23 @@ public class ValidationResult {
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
return this.message;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
return this.title;
|
||||
}
|
||||
|
||||
public boolean hasError() {
|
||||
return hasError;
|
||||
return this.hasError;
|
||||
}
|
||||
|
||||
public void showErrorDialog() {
|
||||
if(this.hasError)
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
this.message,
|
||||
this.title,
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
if (this.hasError)
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
this.message,
|
||||
this.title,
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Autor {
|
||||
private Set<Libro> libros;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -40,7 +40,7 @@ public class Autor {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
@@ -48,7 +48,7 @@ public class Autor {
|
||||
}
|
||||
|
||||
public String getApellidoPaterno() {
|
||||
return apellidoPaterno;
|
||||
return this.apellidoPaterno;
|
||||
}
|
||||
|
||||
public void setApellidoPaterno(String apellidoPaterno) {
|
||||
@@ -56,7 +56,7 @@ public class Autor {
|
||||
}
|
||||
|
||||
public String getApellidoMaterno() {
|
||||
return apellidoMaterno;
|
||||
return this.apellidoMaterno;
|
||||
}
|
||||
|
||||
public void setApellidoMaterno(String apellidoMaterno) {
|
||||
@@ -67,7 +67,7 @@ public class Autor {
|
||||
if (this.libros == null) {
|
||||
this.libros = new HashSet<>();
|
||||
}
|
||||
return libros;
|
||||
return this.libros;
|
||||
}
|
||||
|
||||
public void setLibros(Set<Libro> libros) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import javax.persistence.Table;
|
||||
public class Categoria {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Integer id;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Categoria {
|
||||
private Set<Libro> libros;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -34,7 +34,7 @@ public class Categoria {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
@@ -45,7 +45,7 @@ public class Categoria {
|
||||
if (this.libros == null) {
|
||||
this.libros = new HashSet<>();
|
||||
}
|
||||
return libros;
|
||||
return this.libros;
|
||||
}
|
||||
|
||||
public void setLibros(Set<Libro> libros) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import javax.persistence.Table;
|
||||
@Entity
|
||||
@Table(name = "cliente")
|
||||
public class Cliente {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
@@ -44,7 +45,7 @@ public class Cliente {
|
||||
private List<Direccion> direcciones;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -52,7 +53,7 @@ public class Cliente {
|
||||
}
|
||||
|
||||
public String getRut() {
|
||||
return rut;
|
||||
return this.rut;
|
||||
}
|
||||
|
||||
public void setRut(String rut) {
|
||||
@@ -60,7 +61,7 @@ public class Cliente {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
@@ -68,7 +69,7 @@ public class Cliente {
|
||||
}
|
||||
|
||||
public String getApellidoPaterno() {
|
||||
return apellidoPaterno;
|
||||
return this.apellidoPaterno;
|
||||
}
|
||||
|
||||
public void setApellidoPaterno(String apellidoPaterno) {
|
||||
@@ -76,7 +77,7 @@ public class Cliente {
|
||||
}
|
||||
|
||||
public String getApellidoMaterno() {
|
||||
return apellidoMaterno;
|
||||
return this.apellidoMaterno;
|
||||
}
|
||||
|
||||
public void setApellidoMaterno(String apellidoMaterno) {
|
||||
@@ -84,7 +85,7 @@ public class Cliente {
|
||||
}
|
||||
|
||||
public LocalDate getFechaNacimiento() {
|
||||
return fechaNacimiento;
|
||||
return this.fechaNacimiento;
|
||||
}
|
||||
|
||||
public void setFechaNacimiento(LocalDate fechaNacimiento) {
|
||||
@@ -92,9 +93,9 @@ public class Cliente {
|
||||
}
|
||||
|
||||
public List<Correo> getCorreos() {
|
||||
if(correos == null)
|
||||
correos = new ArrayList<>();
|
||||
return correos;
|
||||
if (this.correos == null)
|
||||
this.correos = new ArrayList<>();
|
||||
return this.correos;
|
||||
}
|
||||
|
||||
public void setCorreos(List<Correo> correos) {
|
||||
@@ -102,9 +103,9 @@ public class Cliente {
|
||||
}
|
||||
|
||||
public List<Telefono> getTelefonos() {
|
||||
if(telefonos == null)
|
||||
telefonos = new ArrayList<>();
|
||||
return telefonos;
|
||||
if (this.telefonos == null)
|
||||
this.telefonos = new ArrayList<>();
|
||||
return this.telefonos;
|
||||
}
|
||||
|
||||
public void setTelefonos(List<Telefono> telefonos) {
|
||||
@@ -112,9 +113,9 @@ public class Cliente {
|
||||
}
|
||||
|
||||
public List<Direccion> getDirecciones() {
|
||||
if(direcciones == null)
|
||||
direcciones = new ArrayList<>();
|
||||
return direcciones;
|
||||
if (this.direcciones == null)
|
||||
this.direcciones = new ArrayList<>();
|
||||
return this.direcciones;
|
||||
}
|
||||
|
||||
public void setDirecciones(List<Direccion> direcciones) {
|
||||
|
||||
@@ -2,7 +2,6 @@ package xyz.danielcortes.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
@@ -50,7 +49,7 @@ public class Correo {
|
||||
private List<Cliente> clientes;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -58,7 +57,7 @@ public class Correo {
|
||||
}
|
||||
|
||||
public String getCorreo() {
|
||||
return correo;
|
||||
return this.correo;
|
||||
}
|
||||
|
||||
public void setCorreo(String correo) {
|
||||
@@ -66,10 +65,10 @@ public class Correo {
|
||||
}
|
||||
|
||||
public List<Trabajador> getTrabajadores() {
|
||||
if (trabajadores == null) {
|
||||
if (this.trabajadores == null) {
|
||||
this.trabajadores = new ArrayList<>();
|
||||
}
|
||||
return trabajadores;
|
||||
return this.trabajadores;
|
||||
}
|
||||
|
||||
public void setTrabajadores(List<Trabajador> trabajador) {
|
||||
@@ -77,9 +76,9 @@ public class Correo {
|
||||
}
|
||||
|
||||
public List<Distribuidor> getDistribuidores() {
|
||||
if (distribuidores == null)
|
||||
distribuidores = new ArrayList<>();
|
||||
return distribuidores;
|
||||
if (this.distribuidores == null)
|
||||
this.distribuidores = new ArrayList<>();
|
||||
return this.distribuidores;
|
||||
}
|
||||
|
||||
public void setDistribuidores(List<Distribuidor> distribuidores) {
|
||||
@@ -87,9 +86,9 @@ public class Correo {
|
||||
}
|
||||
|
||||
public List<Cliente> getClientes() {
|
||||
if (clientes == null)
|
||||
clientes = new ArrayList<>();
|
||||
return clientes;
|
||||
if (this.clientes == null)
|
||||
this.clientes = new ArrayList<>();
|
||||
return this.clientes;
|
||||
}
|
||||
|
||||
public void setClientes(List<Cliente> clientes) {
|
||||
|
||||
@@ -52,7 +52,7 @@ public class Direccion {
|
||||
private List<Cliente> clientes;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -60,7 +60,7 @@ public class Direccion {
|
||||
}
|
||||
|
||||
public String getCalle() {
|
||||
return calle;
|
||||
return this.calle;
|
||||
}
|
||||
|
||||
public void setCalle(String calle) {
|
||||
@@ -68,7 +68,7 @@ public class Direccion {
|
||||
}
|
||||
|
||||
public String getNumero() {
|
||||
return numero;
|
||||
return this.numero;
|
||||
}
|
||||
|
||||
public void setNumero(String numero) {
|
||||
@@ -76,10 +76,10 @@ public class Direccion {
|
||||
}
|
||||
|
||||
public List<Trabajador> getTrabajadores() {
|
||||
if (trabajadores == null) {
|
||||
if (this.trabajadores == null) {
|
||||
this.trabajadores = new ArrayList<>();
|
||||
}
|
||||
return trabajadores;
|
||||
return this.trabajadores;
|
||||
}
|
||||
|
||||
public void setTrabajadores(List<Trabajador> trabajador) {
|
||||
@@ -87,9 +87,9 @@ public class Direccion {
|
||||
}
|
||||
|
||||
public List<Distribuidor> getDistribuidores() {
|
||||
if (distribuidores == null)
|
||||
distribuidores = new ArrayList<>();
|
||||
return distribuidores;
|
||||
if (this.distribuidores == null)
|
||||
this.distribuidores = new ArrayList<>();
|
||||
return this.distribuidores;
|
||||
}
|
||||
|
||||
public void setDistribuidores(List<Distribuidor> distribuidores) {
|
||||
@@ -97,9 +97,9 @@ public class Direccion {
|
||||
}
|
||||
|
||||
public List<Cliente> getClientes() {
|
||||
if (clientes == null)
|
||||
clientes = new ArrayList<>();
|
||||
return clientes;
|
||||
if (this.clientes == null)
|
||||
this.clientes = new ArrayList<>();
|
||||
return this.clientes;
|
||||
}
|
||||
|
||||
public void setClientes(List<Cliente> clientes) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Distribuidor {
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Integer id;
|
||||
|
||||
@Column(name="rut")
|
||||
@Column(name = "rut")
|
||||
private String rut;
|
||||
|
||||
@ManyToOne
|
||||
@@ -36,7 +36,7 @@ public class Distribuidor {
|
||||
private List<Direccion> direcciones;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -44,7 +44,7 @@ public class Distribuidor {
|
||||
}
|
||||
|
||||
public String getRut() {
|
||||
return rut;
|
||||
return this.rut;
|
||||
}
|
||||
|
||||
public void setRut(String rut) {
|
||||
@@ -52,7 +52,7 @@ public class Distribuidor {
|
||||
}
|
||||
|
||||
public Empresa getEmpresa() {
|
||||
return empresa;
|
||||
return this.empresa;
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import javax.persistence.Table;
|
||||
public class Editorial {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Integer id;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Editorial {
|
||||
private Set<Libro> libros;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -34,18 +34,18 @@ public class Editorial {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
public Set<Libro> getLibros() {
|
||||
public Set<Libro> getLibros() {
|
||||
if (this.libros == null) {
|
||||
this.libros = new HashSet<>();
|
||||
}
|
||||
return libros;
|
||||
return this.libros;
|
||||
}
|
||||
|
||||
public void setLibros(Set<Libro> libros) {
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Ejemplar {
|
||||
private Estado estado;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -38,7 +38,7 @@ public class Ejemplar {
|
||||
}
|
||||
|
||||
public String getSerie() {
|
||||
return serie;
|
||||
return this.serie;
|
||||
}
|
||||
|
||||
public void setSerie(String serie) {
|
||||
@@ -46,7 +46,7 @@ public class Ejemplar {
|
||||
}
|
||||
|
||||
public Libro getLibro() {
|
||||
return libro;
|
||||
return this.libro;
|
||||
}
|
||||
|
||||
public void setLibro(Libro libro) {
|
||||
@@ -55,7 +55,7 @@ public class Ejemplar {
|
||||
}
|
||||
|
||||
public Estado getEstado() {
|
||||
return estado;
|
||||
return this.estado;
|
||||
}
|
||||
|
||||
public void setEstado(Estado estado) {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class Empresa {
|
||||
private List<Distribuidor> distribuidores;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -33,7 +33,7 @@ public class Empresa {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
@@ -41,11 +41,11 @@ public class Empresa {
|
||||
}
|
||||
|
||||
public List<Distribuidor> getDistribuidores() {
|
||||
if(distribuidores == null){
|
||||
distribuidores = new ArrayList<>();
|
||||
if (this.distribuidores == null) {
|
||||
this.distribuidores = new ArrayList<>();
|
||||
}
|
||||
|
||||
return distribuidores;
|
||||
return this.distribuidores;
|
||||
}
|
||||
|
||||
public void setDistribuidores(List<Distribuidor> distribuidores) {
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Estado {
|
||||
private Set<Ejemplar> ejemplares;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -34,7 +34,7 @@ public class Estado {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
@@ -45,7 +45,7 @@ public class Estado {
|
||||
if (this.ejemplares == null) {
|
||||
this.ejemplares = new HashSet<>();
|
||||
}
|
||||
return ejemplares;
|
||||
return this.ejemplares;
|
||||
}
|
||||
|
||||
public void setLibros(Set<Ejemplar> ejemplares) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import javax.persistence.Table;
|
||||
public class Idioma {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy= GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Integer id;
|
||||
|
||||
@@ -26,7 +26,7 @@ public class Idioma {
|
||||
private Set<Libro> libros;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -34,7 +34,7 @@ public class Idioma {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
@@ -45,7 +45,7 @@ public class Idioma {
|
||||
if (this.libros == null) {
|
||||
this.libros = new HashSet<>();
|
||||
}
|
||||
return libros;
|
||||
return this.libros;
|
||||
}
|
||||
|
||||
public void setLibros(Set<Libro> libros) {
|
||||
|
||||
@@ -22,7 +22,7 @@ import xyz.danielcortes.framework.YearAttributeConverter;
|
||||
public class Libro {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "id", nullable = false)
|
||||
private Integer id;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class Libro {
|
||||
private Set<Ejemplar> ejemplares;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -82,7 +82,7 @@ public class Libro {
|
||||
}
|
||||
|
||||
public String getIsbn() {
|
||||
return isbn;
|
||||
return this.isbn;
|
||||
}
|
||||
|
||||
public void setIsbn(String isbn) {
|
||||
@@ -90,7 +90,7 @@ public class Libro {
|
||||
}
|
||||
|
||||
public String getTitulo() {
|
||||
return titulo;
|
||||
return this.titulo;
|
||||
}
|
||||
|
||||
public void setTitulo(String titulo) {
|
||||
@@ -98,7 +98,7 @@ public class Libro {
|
||||
}
|
||||
|
||||
public int getNumeroPaginas() {
|
||||
return numeroPaginas;
|
||||
return this.numeroPaginas;
|
||||
}
|
||||
|
||||
public void setNumeroPaginas(int numeroPaginas) {
|
||||
@@ -106,7 +106,7 @@ public class Libro {
|
||||
}
|
||||
|
||||
public int getPrecioReferencia() {
|
||||
return precioReferencia;
|
||||
return this.precioReferencia;
|
||||
}
|
||||
|
||||
public void setPrecioReferencia(int precioReferencia) {
|
||||
@@ -114,7 +114,7 @@ public class Libro {
|
||||
}
|
||||
|
||||
public Year getAnoPublicacion() {
|
||||
return anoPublicacion;
|
||||
return this.anoPublicacion;
|
||||
}
|
||||
|
||||
public void setAnoPublicacion(Year anoPublicacion) {
|
||||
@@ -122,9 +122,9 @@ public class Libro {
|
||||
}
|
||||
|
||||
public Set<Idioma> getIdiomas() {
|
||||
if(idiomas == null)
|
||||
if (this.idiomas == null)
|
||||
this.idiomas = new HashSet<>();
|
||||
return idiomas;
|
||||
return this.idiomas;
|
||||
}
|
||||
|
||||
public void setIdiomas(Set<Idioma> idiomas) {
|
||||
@@ -132,9 +132,9 @@ public class Libro {
|
||||
}
|
||||
|
||||
public Set<Autor> getAutores() {
|
||||
if(autores == null)
|
||||
if (this.autores == null)
|
||||
this.autores = new HashSet<>();
|
||||
return autores;
|
||||
return this.autores;
|
||||
}
|
||||
|
||||
public void setAutores(Set<Autor> autores) {
|
||||
@@ -142,10 +142,10 @@ public class Libro {
|
||||
}
|
||||
|
||||
public Set<Categoria> getCategorias() {
|
||||
if(this.categorias == null)
|
||||
if (this.categorias == null)
|
||||
this.categorias = new HashSet<>();
|
||||
|
||||
return categorias;
|
||||
return this.categorias;
|
||||
}
|
||||
|
||||
public void setCategorias(Set<Categoria> categorias) {
|
||||
@@ -153,7 +153,7 @@ public class Libro {
|
||||
}
|
||||
|
||||
public Editorial getEditorial() {
|
||||
return editorial;
|
||||
return this.editorial;
|
||||
}
|
||||
|
||||
public void setEditorial(Editorial editorial) {
|
||||
@@ -161,9 +161,9 @@ public class Libro {
|
||||
}
|
||||
|
||||
public Set<Ejemplar> getEjemplares() {
|
||||
if(ejemplares == null)
|
||||
if (this.ejemplares == null)
|
||||
this.ejemplares = new HashSet<>();
|
||||
return ejemplares;
|
||||
return this.ejemplares;
|
||||
}
|
||||
|
||||
public void setEjemplares(Set<Ejemplar> ejemplar) {
|
||||
@@ -172,7 +172,7 @@ public class Libro {
|
||||
|
||||
public void addEjemplar(Ejemplar ejemplar) {
|
||||
this.ejemplares.add(ejemplar);
|
||||
if(ejemplar.getLibro() != this){
|
||||
if (ejemplar.getLibro() != this) {
|
||||
ejemplar.setLibro(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Telefono {
|
||||
private List<Cliente> clientes;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -57,7 +57,7 @@ public class Telefono {
|
||||
}
|
||||
|
||||
public String getNumero() {
|
||||
return numero;
|
||||
return this.numero;
|
||||
}
|
||||
|
||||
public void setNumero(String numero) {
|
||||
@@ -65,10 +65,10 @@ public class Telefono {
|
||||
}
|
||||
|
||||
public List<Trabajador> getTrabajadores() {
|
||||
if (trabajadores == null) {
|
||||
trabajadores = new ArrayList<>();
|
||||
if (this.trabajadores == null) {
|
||||
this.trabajadores = new ArrayList<>();
|
||||
}
|
||||
return trabajadores;
|
||||
return this.trabajadores;
|
||||
}
|
||||
|
||||
public void setTrabajadores(List<Trabajador> trabajadores) {
|
||||
@@ -76,9 +76,9 @@ public class Telefono {
|
||||
}
|
||||
|
||||
public List<Distribuidor> getDistribuidores() {
|
||||
if (distribuidores == null)
|
||||
distribuidores = new ArrayList<>();
|
||||
return distribuidores;
|
||||
if (this.distribuidores == null)
|
||||
this.distribuidores = new ArrayList<>();
|
||||
return this.distribuidores;
|
||||
}
|
||||
|
||||
public void setDistribuidores(List<Distribuidor> distribuidores) {
|
||||
@@ -86,9 +86,9 @@ public class Telefono {
|
||||
}
|
||||
|
||||
public List<Cliente> getClientes() {
|
||||
if(clientes == null)
|
||||
clientes = new ArrayList<>();
|
||||
return clientes;
|
||||
if (this.clientes == null)
|
||||
this.clientes = new ArrayList<>();
|
||||
return this.clientes;
|
||||
}
|
||||
|
||||
public void setClientes(List<Cliente> clientes) {
|
||||
|
||||
@@ -49,7 +49,7 @@ public class Trabajador {
|
||||
private List<Direccion> direcciones;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -57,7 +57,7 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public String getRut() {
|
||||
return rut;
|
||||
return this.rut;
|
||||
}
|
||||
|
||||
public void setRut(String rut) {
|
||||
@@ -65,7 +65,7 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
@@ -73,7 +73,7 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public String getApellidoPaterno() {
|
||||
return apellidoPaterno;
|
||||
return this.apellidoPaterno;
|
||||
}
|
||||
|
||||
public void setApellidoPaterno(String apellidoPaterno) {
|
||||
@@ -81,7 +81,7 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public String getApellidoMaterno() {
|
||||
return apellidoMaterno;
|
||||
return this.apellidoMaterno;
|
||||
}
|
||||
|
||||
public void setApellidoMaterno(String apellidoMaterno) {
|
||||
@@ -89,7 +89,7 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public LocalDate getFechaContrato() {
|
||||
return fechaContrato;
|
||||
return this.fechaContrato;
|
||||
}
|
||||
|
||||
public void setFechaContrato(LocalDate fechaContrato) {
|
||||
@@ -97,7 +97,7 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public Usuario getUsuario() {
|
||||
return usuario;
|
||||
return this.usuario;
|
||||
}
|
||||
|
||||
public void setUsuario(Usuario usuario) {
|
||||
@@ -105,9 +105,9 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public List<Correo> getCorreos() {
|
||||
if(correos == null)
|
||||
correos = new ArrayList<>();
|
||||
return correos;
|
||||
if (this.correos == null)
|
||||
this.correos = new ArrayList<>();
|
||||
return this.correos;
|
||||
}
|
||||
|
||||
public void setCorreos(List<Correo> correos) {
|
||||
@@ -115,9 +115,9 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public List<Telefono> getTelefonos() {
|
||||
if(telefonos == null)
|
||||
telefonos = new ArrayList<>();
|
||||
return telefonos;
|
||||
if (this.telefonos == null)
|
||||
this.telefonos = new ArrayList<>();
|
||||
return this.telefonos;
|
||||
}
|
||||
|
||||
public void setTelefonos(List<Telefono> telefonos) {
|
||||
@@ -125,9 +125,9 @@ public class Trabajador {
|
||||
}
|
||||
|
||||
public List<Direccion> getDirecciones() {
|
||||
if(direcciones == null)
|
||||
direcciones = new ArrayList<>();
|
||||
return direcciones;
|
||||
if (this.direcciones == null)
|
||||
this.direcciones = new ArrayList<>();
|
||||
return this.direcciones;
|
||||
}
|
||||
|
||||
public void setDirecciones(List<Direccion> direcciones) {
|
||||
@@ -141,20 +141,21 @@ public class Trabajador {
|
||||
if (!(o instanceof Trabajador))
|
||||
return false;
|
||||
Trabajador that = (Trabajador) o;
|
||||
return Objects.equals(id, that.id) &&
|
||||
Objects.equals(rut, that.rut) &&
|
||||
Objects.equals(nombre, that.nombre) &&
|
||||
Objects.equals(apellidoPaterno, that.apellidoPaterno) &&
|
||||
Objects.equals(apellidoMaterno, that.apellidoMaterno) &&
|
||||
Objects.equals(fechaContrato, that.fechaContrato) &&
|
||||
Objects.equals(usuario, that.usuario) &&
|
||||
Objects.equals(correos, that.correos) &&
|
||||
Objects.equals(telefonos, that.telefonos);
|
||||
return Objects.equals(this.id, that.id) &&
|
||||
Objects.equals(this.rut, that.rut) &&
|
||||
Objects.equals(this.nombre, that.nombre) &&
|
||||
Objects.equals(this.apellidoPaterno, that.apellidoPaterno) &&
|
||||
Objects.equals(this.apellidoMaterno, that.apellidoMaterno) &&
|
||||
Objects.equals(this.fechaContrato, that.fechaContrato) &&
|
||||
Objects.equals(this.usuario, that.usuario) &&
|
||||
Objects.equals(this.correos, that.correos) &&
|
||||
Objects.equals(this.telefonos, that.telefonos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(id, rut, nombre, apellidoPaterno, apellidoMaterno, fechaContrato, usuario, correos, telefonos);
|
||||
return Objects.hash(this.id, this.rut, this.nombre, this.apellidoPaterno, this.apellidoMaterno, this.fechaContrato, this.usuario, this.correos,
|
||||
this.telefonos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ public class Usuario {
|
||||
private Trabajador trabajador;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
@@ -39,7 +39,7 @@ public class Usuario {
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
return this.nombre;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
@@ -47,7 +47,7 @@ public class Usuario {
|
||||
}
|
||||
|
||||
public byte[] getPassword() {
|
||||
return password;
|
||||
return this.password;
|
||||
}
|
||||
|
||||
public void setPassword(byte[] password) {
|
||||
@@ -55,7 +55,7 @@ public class Usuario {
|
||||
}
|
||||
|
||||
public byte[] getSalt() {
|
||||
return salt;
|
||||
return this.salt;
|
||||
}
|
||||
|
||||
public void setSalt(byte[] salt) {
|
||||
@@ -63,7 +63,7 @@ public class Usuario {
|
||||
}
|
||||
|
||||
public Trabajador getTrabajador() {
|
||||
return trabajador;
|
||||
return this.trabajador;
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
|
||||
@@ -10,18 +10,18 @@ import xyz.danielcortes.models.Trabajador;
|
||||
public class CorreoRepository extends BaseRepository<Correo> {
|
||||
|
||||
public List<Correo> getAll() {
|
||||
TypedQuery<Correo> query = em.createQuery("SELECT c FROM Correo c", Correo.class);
|
||||
TypedQuery<Correo> query = this.em.createQuery("SELECT c FROM Correo c", Correo.class);
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
public List<Correo> search(String term) {
|
||||
Query query = em.createQuery("SELECT c FROM Correo c WHERE LOWER(c.correo) LIKE :term ");
|
||||
Query query = this.em.createQuery("SELECT c FROM Correo c WHERE LOWER(c.correo) LIKE :term ");
|
||||
query.setParameter("term", "%" + term.toLowerCase() + "%");
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
public List<Correo> search(String term, Trabajador trabajador) {
|
||||
Query query = em.createQuery("SELECT c FROM Correo c JOIN c.trabajadores t WHERE t.id = :id AND LOWER(c.correo) LIKE :term ");
|
||||
Query query = this.em.createQuery("SELECT c FROM Correo c JOIN c.trabajadores t WHERE t.id = :id AND LOWER(c.correo) LIKE :term ");
|
||||
query.setParameter("id", trabajador.getId());
|
||||
query.setParameter("term", "%" + term.toLowerCase() + "%");
|
||||
return query.getResultList();
|
||||
|
||||
@@ -5,6 +5,7 @@ import xyz.danielcortes.models.Correo;
|
||||
import xyz.danielcortes.repository.CorreoRepository;
|
||||
|
||||
public class CorreoValidator {
|
||||
|
||||
private CorreoRepository correoRepository;
|
||||
|
||||
public CorreoValidator(CorreoRepository correoRepository) {
|
||||
@@ -12,7 +13,7 @@ public class CorreoValidator {
|
||||
}
|
||||
|
||||
public ValidationResult validateCorreo(String correo) {
|
||||
if(correo == null) {
|
||||
if (correo == null) {
|
||||
return new ValidationResult("El correo es nulo");
|
||||
} else if (correo.isEmpty()) {
|
||||
return new ValidationResult("El correo esta vacio");
|
||||
@@ -21,7 +22,7 @@ public class CorreoValidator {
|
||||
}
|
||||
|
||||
public ValidationResult validateOriginal(Correo original) {
|
||||
if(original == null) {
|
||||
if (original == null) {
|
||||
return new ValidationResult("El correo seleccionado no existe");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
|
||||
@@ -22,34 +22,35 @@ public class AutorCreatePanel extends BasePanel {
|
||||
private JButton volverButton;
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoPaternoField() {
|
||||
return apellidoPaternoField;
|
||||
return this.apellidoPaternoField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoMaternoField() {
|
||||
return apellidoMaternoField;
|
||||
return this.apellidoMaternoField;
|
||||
}
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return guardarButton;
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,9 +11,9 @@ import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.models.Autor;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
|
||||
public class AutorSearchPanel extends BasePanel {
|
||||
|
||||
@@ -27,42 +27,42 @@ public class AutorSearchPanel extends BasePanel {
|
||||
private JButton crearButton;
|
||||
private BaseTableModel<Autor> autorModel;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTable getAutorTable() {
|
||||
return autorTable;
|
||||
return this.autorTable;
|
||||
}
|
||||
|
||||
public JTextField getSearchField() {
|
||||
return searchField;
|
||||
return this.searchField;
|
||||
}
|
||||
|
||||
public JButton getBuscarButton() {
|
||||
return buscarButton;
|
||||
return this.buscarButton;
|
||||
}
|
||||
|
||||
public JButton getVerButton() {
|
||||
return verButton;
|
||||
return this.verButton;
|
||||
}
|
||||
|
||||
public JButton getEliminarButton() {
|
||||
return eliminarButton;
|
||||
return this.eliminarButton;
|
||||
}
|
||||
|
||||
public JButton getEditarButton() {
|
||||
return editarButton;
|
||||
return this.editarButton;
|
||||
}
|
||||
|
||||
public JButton getCrearButton() {
|
||||
return crearButton;
|
||||
return this.crearButton;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public BaseTableModel<Autor> getAutorModel() {
|
||||
return autorModel;
|
||||
return this.autorModel;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
@@ -92,7 +92,7 @@ public class AutorSearchPanel extends BasePanel {
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,27 +22,28 @@ public class AutorUpdatePanel extends BasePanel {
|
||||
private JButton volverButton;
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoPaternoField() {
|
||||
return apellidoPaternoField;
|
||||
return this.apellidoPaternoField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoMaternoField() {
|
||||
return apellidoMaternoField;
|
||||
return this.apellidoMaternoField;
|
||||
}
|
||||
|
||||
public JButton getActualizarButton() {
|
||||
return actualizarButton;
|
||||
return this.actualizarButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +51,7 @@ public class AutorUpdatePanel extends BasePanel {
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,31 +20,32 @@ public class AutorViewPanel extends BasePanel {
|
||||
private JButton volverButton;
|
||||
private JPanel contentPane;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoPaternoField() {
|
||||
return apellidoPaternoField;
|
||||
return this.apellidoPaternoField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoMaternoField() {
|
||||
return apellidoMaternoField;
|
||||
return this.apellidoMaternoField;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package xyz.danielcortes.views.mantenedores.categoria;
|
||||
|
||||
import com.intellij.uiDesigner.core.GridConstraints;
|
||||
import com.intellij.uiDesigner.core.GridLayoutManager;
|
||||
import com.intellij.uiDesigner.core.Spacer;
|
||||
@@ -19,26 +20,27 @@ public class CategoriaCreatePanel extends BasePanel {
|
||||
private JButton volverButton;
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return guardarButton;
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,9 +11,9 @@ import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
import xyz.danielcortes.framework.BaseTableModel;
|
||||
import xyz.danielcortes.models.Categoria;
|
||||
import xyz.danielcortes.framework.BasePanel;
|
||||
|
||||
public class CategoriaSearchPanel extends BasePanel {
|
||||
|
||||
@@ -29,39 +29,39 @@ public class CategoriaSearchPanel extends BasePanel {
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTable getCategoriaTable() {
|
||||
return categoriaTable;
|
||||
return this.categoriaTable;
|
||||
}
|
||||
|
||||
public JButton getVerButton() {
|
||||
return verButton;
|
||||
return this.verButton;
|
||||
}
|
||||
|
||||
public JButton getEditarButton() {
|
||||
return editarButton;
|
||||
return this.editarButton;
|
||||
}
|
||||
|
||||
public JButton getEliminarButton() {
|
||||
return eliminarButton;
|
||||
return this.eliminarButton;
|
||||
}
|
||||
|
||||
public JTextField getSearchField() {
|
||||
return searchField;
|
||||
return this.searchField;
|
||||
}
|
||||
|
||||
public JButton getBuscarButton() {
|
||||
return buscarButton;
|
||||
return this.buscarButton;
|
||||
}
|
||||
|
||||
public BaseTableModel<Categoria> getCategoriaModel() {
|
||||
return categoriaModel;
|
||||
return this.categoriaModel;
|
||||
}
|
||||
|
||||
public JButton getCrearButton() {
|
||||
return crearButton;
|
||||
return this.crearButton;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
@@ -89,7 +89,7 @@ public class CategoriaSearchPanel extends BasePanel {
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,19 +21,19 @@ public class CategoriaUpdatePanel extends BasePanel {
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JButton getUpdateButton() {
|
||||
return updateButton;
|
||||
return this.updateButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class CategoriaUpdatePanel extends BasePanel {
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,23 +18,24 @@ public class CategoriaViewPanel extends BasePanel {
|
||||
private JTextField nombreField;
|
||||
private JButton volverButton;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,42 +26,42 @@ public class ClienteCreatePanel extends BasePanel {
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoPaternoField() {
|
||||
return apellidoPaternoField;
|
||||
return this.apellidoPaternoField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoMaternoField() {
|
||||
return apellidoMaternoField;
|
||||
return this.apellidoMaternoField;
|
||||
}
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return guardarButton;
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getRutField() {
|
||||
return rutField;
|
||||
return this.rutField;
|
||||
}
|
||||
|
||||
public DatePicker getFechaNacimientoPicker() {
|
||||
return fechaNacimientoPicker;
|
||||
return this.fechaNacimientoPicker;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,40 +27,41 @@ public class ClienteSearchPanel extends BasePanel {
|
||||
private JButton crearButton;
|
||||
private BaseTableModel<Cliente> clienteModel;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTable getClienteTable() {
|
||||
return clienteTable;
|
||||
return this.clienteTable;
|
||||
}
|
||||
|
||||
public JTextField getSearchField() {
|
||||
return searchField;
|
||||
return this.searchField;
|
||||
}
|
||||
|
||||
public JButton getBuscarButton() {
|
||||
return buscarButton;
|
||||
return this.buscarButton;
|
||||
}
|
||||
|
||||
public JButton getVerButton() {
|
||||
return verButton;
|
||||
return this.verButton;
|
||||
}
|
||||
|
||||
public JButton getEliminarButton() {
|
||||
return eliminarButton;
|
||||
return this.eliminarButton;
|
||||
}
|
||||
|
||||
public JButton getEditarButton() {
|
||||
return editarButton;
|
||||
return this.editarButton;
|
||||
}
|
||||
|
||||
public JButton getCrearButton() {
|
||||
return crearButton;
|
||||
return this.crearButton;
|
||||
}
|
||||
|
||||
public BaseTableModel<Cliente> getClienteModel() {
|
||||
return clienteModel;
|
||||
return this.clienteModel;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
@@ -91,7 +92,7 @@ public class ClienteSearchPanel extends BasePanel {
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,43 +25,43 @@ public class ClienteUpdatePanel extends BasePanel {
|
||||
private DatePicker fechaNacimientoField;
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoPaternoField() {
|
||||
return apellidoPaternoField;
|
||||
return this.apellidoPaternoField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoMaternoField() {
|
||||
return apellidoMaternoField;
|
||||
return this.apellidoMaternoField;
|
||||
}
|
||||
|
||||
public JButton getActualizarButton() {
|
||||
return actualizarButton;
|
||||
return this.actualizarButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getRutField() {
|
||||
return rutField;
|
||||
return this.rutField;
|
||||
}
|
||||
|
||||
public DatePicker getFechaNacimientoField() {
|
||||
return fechaNacimientoField;
|
||||
return this.fechaNacimientoField;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,51 +26,51 @@ public class ClienteViewPanel extends BasePanel {
|
||||
private JTextField fechaNacimientoField;
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoPaternoField() {
|
||||
return apellidoPaternoField;
|
||||
return this.apellidoPaternoField;
|
||||
}
|
||||
|
||||
public JTextField getApellidoMaternoField() {
|
||||
return apellidoMaternoField;
|
||||
return this.apellidoMaternoField;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTextField getRutField() {
|
||||
return rutField;
|
||||
return this.rutField;
|
||||
}
|
||||
|
||||
public JTextField getFechaNacimientoField() {
|
||||
return fechaNacimientoField;
|
||||
return this.fechaNacimientoField;
|
||||
}
|
||||
|
||||
public JButton getDireccionesButton() {
|
||||
return direccionesButton;
|
||||
return this.direccionesButton;
|
||||
}
|
||||
|
||||
public JButton getCorreosButton() {
|
||||
return correosButton;
|
||||
return this.correosButton;
|
||||
}
|
||||
|
||||
public JButton getTelefonosButton() {
|
||||
return telefonosButton;
|
||||
return this.telefonosButton;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,26 +20,27 @@ public class CorreoCreatePanel extends BasePanel {
|
||||
private JTextField correoField;
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return guardarButton;
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getCorreoField() {
|
||||
return correoField;
|
||||
return this.correoField;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,44 +28,45 @@ public class CorreoSearchPanel extends BasePanel {
|
||||
private JButton volverButton;
|
||||
private BaseTableModel<Correo> correoModel;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTable getCorreosTable() {
|
||||
return correosTable;
|
||||
return this.correosTable;
|
||||
}
|
||||
|
||||
public JTextField getSearchField() {
|
||||
return searchField;
|
||||
return this.searchField;
|
||||
}
|
||||
|
||||
public JButton getBuscarButton() {
|
||||
return buscarButton;
|
||||
return this.buscarButton;
|
||||
}
|
||||
|
||||
public JButton getVerButton() {
|
||||
return verButton;
|
||||
return this.verButton;
|
||||
}
|
||||
|
||||
public JButton getEliminarButton() {
|
||||
return eliminarButton;
|
||||
return this.eliminarButton;
|
||||
}
|
||||
|
||||
public JButton getEditarButton() {
|
||||
return editarButton;
|
||||
return this.editarButton;
|
||||
}
|
||||
|
||||
public JButton getCrearButton() {
|
||||
return crearButton;
|
||||
return this.crearButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public BaseTableModel<Correo> getCorreoModel() {
|
||||
return correoModel;
|
||||
return this.correoModel;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
@@ -92,7 +93,7 @@ public class CorreoSearchPanel extends BasePanel {
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,26 +20,27 @@ public class CorreoUpdatePanel extends BasePanel {
|
||||
private JTextField correoField;
|
||||
|
||||
public JButton getActualizarButton() {
|
||||
return actualizarButton;
|
||||
return this.actualizarButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getCorreoField() {
|
||||
return correoField;
|
||||
return this.correoField;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,23 +18,24 @@ public class CorreoViewPanel extends BasePanel {
|
||||
private JButton volverButton;
|
||||
private JTextField correoField;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getCorreoField() {
|
||||
return correoField;
|
||||
return this.correoField;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,30 +21,31 @@ public class DireccionCreatePanel extends BasePanel {
|
||||
private JTextField numeroField;
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return guardarButton;
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getCalleField() {
|
||||
return calleField;
|
||||
return this.calleField;
|
||||
}
|
||||
|
||||
public JTextField getNumeroField() {
|
||||
return numeroField;
|
||||
return this.numeroField;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,44 +28,45 @@ public class DireccionSearchPanel extends BasePanel {
|
||||
private JButton volverButton;
|
||||
private BaseTableModel<Direccion> direccionModel;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTable getDireccionesTable() {
|
||||
return direccionesTable;
|
||||
return this.direccionesTable;
|
||||
}
|
||||
|
||||
public JTextField getSearchField() {
|
||||
return searchField;
|
||||
return this.searchField;
|
||||
}
|
||||
|
||||
public JButton getBuscarButton() {
|
||||
return buscarButton;
|
||||
return this.buscarButton;
|
||||
}
|
||||
|
||||
public JButton getVerButton() {
|
||||
return verButton;
|
||||
return this.verButton;
|
||||
}
|
||||
|
||||
public JButton getEliminarButton() {
|
||||
return eliminarButton;
|
||||
return this.eliminarButton;
|
||||
}
|
||||
|
||||
public JButton getEditarButton() {
|
||||
return editarButton;
|
||||
return this.editarButton;
|
||||
}
|
||||
|
||||
public JButton getCrearButton() {
|
||||
return crearButton;
|
||||
return this.crearButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public BaseTableModel<Direccion> getDireccionModel() {
|
||||
return direccionModel;
|
||||
return this.direccionModel;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
@@ -93,7 +94,7 @@ public class DireccionSearchPanel extends BasePanel {
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,30 +21,31 @@ public class DireccionUpdatePanel extends BasePanel {
|
||||
private JTextField numeroField;
|
||||
|
||||
public JButton getActualizarButton() {
|
||||
return actualizarButton;
|
||||
return this.actualizarButton;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getCalleField() {
|
||||
return calleField;
|
||||
return this.calleField;
|
||||
}
|
||||
|
||||
public JTextField getNumeroField() {
|
||||
return numeroField;
|
||||
return this.numeroField;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,27 +19,28 @@ public class DireccionViewPanel extends BasePanel {
|
||||
private JTextField direccionField;
|
||||
private JTextField numeroField;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getCalleField() {
|
||||
return direccionField;
|
||||
return this.direccionField;
|
||||
}
|
||||
|
||||
public JTextField getNumeroField() {
|
||||
return numeroField;
|
||||
return this.numeroField;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,34 +26,34 @@ public class DistribuidorCreatePanel extends BasePanel {
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return guardarButton;
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getRutField() {
|
||||
return rutField;
|
||||
return this.rutField;
|
||||
}
|
||||
|
||||
public JComboBox<Empresa> getEmpresaCombobox() {
|
||||
return empresaCombobox;
|
||||
return this.empresaCombobox;
|
||||
}
|
||||
|
||||
public DefaultComboBoxModel<Empresa> getEmpresaModel() {
|
||||
return empresaModel;
|
||||
return this.empresaModel;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,6 +118,6 @@ public class DistribuidorCreatePanel extends BasePanel {
|
||||
|
||||
private void createUIComponents() {
|
||||
this.empresaModel = new DefaultComboBoxModel<>();
|
||||
this.empresaCombobox = new JComboBox<>(empresaModel);
|
||||
this.empresaCombobox = new JComboBox<>(this.empresaModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,40 +27,41 @@ public class DistribuidorSearchPanel extends BasePanel {
|
||||
private JButton crearButton;
|
||||
private BaseTableModel<Distribuidor> distribuidorModel;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTable getDistribuidorTable() {
|
||||
return distribuidorTable;
|
||||
return this.distribuidorTable;
|
||||
}
|
||||
|
||||
public JTextField getSearchField() {
|
||||
return searchField;
|
||||
return this.searchField;
|
||||
}
|
||||
|
||||
public JButton getBuscarButton() {
|
||||
return buscarButton;
|
||||
return this.buscarButton;
|
||||
}
|
||||
|
||||
public JButton getVerButton() {
|
||||
return verButton;
|
||||
return this.verButton;
|
||||
}
|
||||
|
||||
public JButton getEliminarButton() {
|
||||
return eliminarButton;
|
||||
return this.eliminarButton;
|
||||
}
|
||||
|
||||
public JButton getEditarButton() {
|
||||
return editarButton;
|
||||
return this.editarButton;
|
||||
}
|
||||
|
||||
public JButton getCrearButton() {
|
||||
return crearButton;
|
||||
return this.crearButton;
|
||||
}
|
||||
|
||||
public BaseTableModel<Distribuidor> getDistribuidorModel() {
|
||||
return distribuidorModel;
|
||||
return this.distribuidorModel;
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
@@ -88,7 +89,7 @@ public class DistribuidorSearchPanel extends BasePanel {
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -26,34 +26,34 @@ public class DistribuidorUpdatePanel extends BasePanel {
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JButton getActualizarButton() {
|
||||
return actualizarButton;
|
||||
return this.actualizarButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getRutField() {
|
||||
return rutField;
|
||||
return this.rutField;
|
||||
}
|
||||
|
||||
public JComboBox<Empresa> getEmpresaCombobox() {
|
||||
return empresaCombobox;
|
||||
return this.empresaCombobox;
|
||||
}
|
||||
|
||||
public DefaultComboBoxModel<Empresa> getEmpresaModel() {
|
||||
return empresaModel;
|
||||
return this.empresaModel;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,6 +118,6 @@ public class DistribuidorUpdatePanel extends BasePanel {
|
||||
|
||||
private void createUIComponents() {
|
||||
this.empresaModel = new DefaultComboBoxModel<>();
|
||||
this.empresaCombobox = new JComboBox<>(empresaModel);
|
||||
this.empresaCombobox = new JComboBox<>(this.empresaModel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,38 +24,38 @@ public class DistribuidorViewPanel extends BasePanel {
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTextField getEmpresaField() {
|
||||
return empresaField;
|
||||
return this.empresaField;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
public JTextField getRutField() {
|
||||
return rutField;
|
||||
return this.rutField;
|
||||
}
|
||||
|
||||
public JButton getDireccionesButton() {
|
||||
return direccionesButton;
|
||||
return this.direccionesButton;
|
||||
}
|
||||
|
||||
public JButton getCorreosButton() {
|
||||
return correosButton;
|
||||
return this.correosButton;
|
||||
}
|
||||
|
||||
public JButton getTelefonosButton() {
|
||||
return telefonosButton;
|
||||
return this.telefonosButton;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,27 +19,28 @@ public class EditorialCreatePanel extends BasePanel {
|
||||
private JButton guardarButton;
|
||||
private JButton volverButton;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JTextField getNombreField() {
|
||||
return nombreField;
|
||||
return this.nombreField;
|
||||
}
|
||||
|
||||
public JButton getGuardarButton() {
|
||||
return guardarButton;
|
||||
return this.guardarButton;
|
||||
}
|
||||
|
||||
public JButton getVolverButton() {
|
||||
return volverButton;
|
||||
return this.volverButton;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user