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