Ejecute el reformateo global del codigo en intellij
This commit is contained in:
@@ -21,6 +21,16 @@ public abstract class AbstractCorreoCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
@@ -36,14 +46,4 @@ public abstract class AbstractCorreoCreateController extends BaseController {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,28 @@ public abstract class AbstractCorreoSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
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 search();
|
||||
|
||||
protected abstract void view();
|
||||
|
||||
protected abstract void edit();
|
||||
|
||||
protected abstract void delete();
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
@@ -40,28 +62,6 @@ public abstract class AbstractCorreoSearchController extends BaseController {
|
||||
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) {
|
||||
|
||||
@@ -24,30 +24,6 @@ public abstract class AbstractCorreoUpdateController extends BaseController {
|
||||
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());
|
||||
@@ -75,4 +51,28 @@ public abstract class AbstractCorreoUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getCorreoField().requestFocus();
|
||||
this.fillCorreo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
protected void fillCorreo() {
|
||||
this.view.getCorreoField().setText(this.correo.getCorreo());
|
||||
}
|
||||
|
||||
public void setCorreo(Correo correo) {
|
||||
this.correo = correo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,12 @@ public abstract class AbstractCorreoViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
@@ -32,18 +38,12 @@ public abstract class AbstractCorreoViewController extends BaseController {
|
||||
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());
|
||||
public void setCorreo(Correo correo) {
|
||||
this.correo = correo;
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,16 @@ public abstract class AbstractDireccionCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getNumeroField().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
protected abstract void save();
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
@@ -37,14 +47,4 @@ public abstract class AbstractDireccionCreateController extends BaseController {
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getNumeroField().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
protected abstract void save();
|
||||
|
||||
protected abstract void volver();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,28 @@ public abstract class AbstractDireccionSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
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 search();
|
||||
|
||||
protected abstract void view();
|
||||
|
||||
protected abstract void edit();
|
||||
|
||||
protected abstract void delete();
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
@@ -40,28 +62,6 @@ public abstract class AbstractDireccionSearchController extends BaseController {
|
||||
this.view.getDireccionesTable().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 loadDireccionesTable();
|
||||
|
||||
protected void loadDireccionesTable(List<Direccion> direccions) {
|
||||
|
||||
@@ -24,31 +24,6 @@ public abstract class AbstractDireccionUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getCalleField().requestFocus();
|
||||
this.fillDireccion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setDireccion(Direccion direccion) {
|
||||
this.direccion = direccion;
|
||||
}
|
||||
|
||||
protected void fillDireccion() {
|
||||
this.view.getCalleField().setText(this.direccion.getCalle());
|
||||
this.view.getNumeroField().setText(this.direccion.getNumero());
|
||||
}
|
||||
|
||||
protected void setupListeners() {
|
||||
this.view.getNumeroField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
@@ -85,4 +60,29 @@ public abstract class AbstractDireccionUpdateController extends BaseController {
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getCalleField().requestFocus();
|
||||
this.fillDireccion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
protected void fillDireccion() {
|
||||
this.view.getCalleField().setText(this.direccion.getCalle());
|
||||
this.view.getNumeroField().setText(this.direccion.getNumero());
|
||||
}
|
||||
|
||||
public void setDireccion(Direccion direccion) {
|
||||
this.direccion = direccion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,12 @@ public abstract class AbstractDireccionViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
@@ -32,18 +38,12 @@ public abstract class AbstractDireccionViewController extends BaseController {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setDireccion(Direccion direccion) {
|
||||
this.direccion = direccion;
|
||||
}
|
||||
|
||||
public void fillDireccion() {
|
||||
this.view.getCalleField().setText(this.direccion.getCalle());
|
||||
this.view.getNumeroField().setText(this.direccion.getNumero());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
public void setDireccion(Direccion direccion) {
|
||||
this.direccion = direccion;
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,16 @@ public abstract class AbstractTelefonoCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNumeroField().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();
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
@@ -37,14 +47,4 @@ public abstract class AbstractTelefonoCreateController extends BaseController {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNumeroField().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();
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,28 @@ public abstract class AbstractTelefonoSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
protected 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 search();
|
||||
|
||||
protected abstract void view();
|
||||
|
||||
protected abstract void edit();
|
||||
|
||||
protected abstract void delete();
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
@@ -40,28 +62,6 @@ public abstract class AbstractTelefonoSearchController extends BaseController {
|
||||
this.view.getTelefonosTable().clearSelection();
|
||||
}
|
||||
|
||||
protected 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 loadTelefonosTable();
|
||||
|
||||
protected void loadTelefonosTable(List<Telefono> telefonos) {
|
||||
|
||||
@@ -17,6 +17,12 @@ public abstract class AbstractTelefonoViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
protected void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
@@ -32,18 +38,12 @@ public abstract class AbstractTelefonoViewController extends BaseController {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setTelefono(Telefono telefono) {
|
||||
this.telefono = telefono;
|
||||
}
|
||||
|
||||
protected void fillTelefono() {
|
||||
this.view.getTelefonoField().setText(this.telefono.getNumero());
|
||||
}
|
||||
|
||||
protected void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
public void setTelefono(Telefono telefono) {
|
||||
this.telefono = telefono;
|
||||
}
|
||||
|
||||
protected abstract void volver();
|
||||
|
||||
}
|
||||
|
||||
@@ -24,11 +24,6 @@ public class AutorCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getApellidoMaternoField().addActionListener(e -> this.save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
@@ -69,6 +64,11 @@ public class AutorCreateController extends BaseController {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -27,16 +27,6 @@ public class AutorSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
this.view.getAutorTable().clearSelection();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadAutorTable();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getCrearButton().addActionListener(e -> this.getParentController().showCard(PanelName.AUTOR_CREATE));
|
||||
this.view.getSearchField().addActionListener(e -> this.search());
|
||||
@@ -46,6 +36,21 @@ public class AutorSearchController extends BaseController {
|
||||
this.view.getEliminarButton().addActionListener(e -> this.delete());
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Autor> autores = this.autorRepository.search(term);
|
||||
this.loadAutorTable(autores);
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Autor autor = this.getSelectedAutor();
|
||||
if (autor != null) {
|
||||
AutorViewController controller = (AutorViewController) this.getParentController().getCard(PanelName.AUTOR_VIEW);
|
||||
controller.setAutor(autor);
|
||||
this.getParentController().showCard(PanelName.AUTOR_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
private void edit() {
|
||||
Autor autor = this.getSelectedAutor();
|
||||
if (autor != null) {
|
||||
@@ -80,26 +85,6 @@ public class AutorSearchController extends BaseController {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Autor autor = this.getSelectedAutor();
|
||||
if (autor != null) {
|
||||
AutorViewController controller = (AutorViewController) this.getParentController().getCard(PanelName.AUTOR_VIEW);
|
||||
controller.setAutor(autor);
|
||||
this.getParentController().showCard(PanelName.AUTOR_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Autor> autores = this.autorRepository.search(term);
|
||||
this.loadAutorTable(autores);
|
||||
}
|
||||
|
||||
private void loadAutorTable() {
|
||||
List<Autor> autores = this.autorRepository.getAll();
|
||||
this.loadAutorTable(autores);
|
||||
}
|
||||
|
||||
private void loadAutorTable(List<Autor> autores) {
|
||||
BaseTableModel<Autor> model = this.view.getAutorModel();
|
||||
model.setRows(autores);
|
||||
@@ -120,6 +105,21 @@ public class AutorSearchController extends BaseController {
|
||||
return this.view.getAutorModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadAutorTable();
|
||||
}
|
||||
|
||||
private void loadAutorTable() {
|
||||
List<Autor> autores = this.autorRepository.getAll();
|
||||
this.loadAutorTable(autores);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
this.view.getAutorTable().clearSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -25,25 +25,6 @@ public class AutorUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
public void setAutor(Autor autor) {
|
||||
this.autor = autor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillAutor();
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillAutor() {
|
||||
if (this.autor == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.autor.getNombre());
|
||||
this.view.getApellidoPaternoField().setText(this.autor.getApellidoPaterno());
|
||||
this.view.getApellidoMaternoField().setText(this.autor.getApellidoMaterno());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getApellidoPaternoField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
@@ -88,6 +69,25 @@ public class AutorUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.AUTOR_SEARCH);
|
||||
}
|
||||
|
||||
public void setAutor(Autor autor) {
|
||||
this.autor = autor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillAutor();
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillAutor() {
|
||||
if (this.autor == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.autor.getNombre());
|
||||
this.view.getApellidoPaternoField().setText(this.autor.getApellidoPaterno());
|
||||
this.view.getApellidoMaternoField().setText(this.autor.getApellidoMaterno());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -18,21 +18,17 @@ public class AutorViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillAutor();
|
||||
}
|
||||
|
||||
public void setAutor(Autor autor) {
|
||||
this.autor = autor;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> {
|
||||
this.getParentController().showCard(PanelName.AUTOR_SEARCH);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillAutor();
|
||||
}
|
||||
|
||||
private void fillAutor() {
|
||||
if (this.autor == null)
|
||||
return;
|
||||
@@ -46,4 +42,8 @@ public class AutorViewController extends BaseController {
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setAutor(Autor autor) {
|
||||
this.autor = autor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,6 @@ public class CategoriaCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNombreField().addActionListener(e -> this.save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
@@ -53,6 +48,11 @@ public class CategoriaCreateController extends BaseController {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -29,10 +29,9 @@ public class CategoriaSearchController extends BaseController {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
this.view.getCategoriaTable().clearSelection();
|
||||
private void loadCategoriaTable() {
|
||||
List<Categoria> categorias = this.categoriaRepository.getAll();
|
||||
this.loadCategoriaTable(categorias);
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
@@ -44,6 +43,26 @@ public class CategoriaSearchController extends BaseController {
|
||||
this.view.getEliminarButton().addActionListener(e -> this.delete());
|
||||
}
|
||||
|
||||
private void loadCategoriaTable(List<Categoria> categorias) {
|
||||
BaseTableModel<Categoria> model = this.view.getCategoriaModel();
|
||||
model.setRows(categorias);
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Categoria> categorias = this.categoriaRepository.search(term);
|
||||
this.loadCategoriaTable(categorias);
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Categoria categoria = this.getSelectedCategoria();
|
||||
if (categoria != null) {
|
||||
CategoriaViewController controller = (CategoriaViewController) this.getParentController().getCard(PanelName.CATEGORIA_VIEW);
|
||||
controller.setCategoria(categoria);
|
||||
this.getParentController().showCard(PanelName.CATEGORIA_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
private void edit() {
|
||||
Categoria categoria = this.getSelectedCategoria();
|
||||
if (categoria != null) {
|
||||
@@ -78,35 +97,6 @@ public class CategoriaSearchController extends BaseController {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Categoria categoria = this.getSelectedCategoria();
|
||||
if (categoria != null) {
|
||||
CategoriaViewController controller = (CategoriaViewController) this.getParentController().getCard(PanelName.CATEGORIA_VIEW);
|
||||
controller.setCategoria(categoria);
|
||||
this.getParentController().showCard(PanelName.CATEGORIA_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Categoria> categorias = this.categoriaRepository.search(term);
|
||||
this.loadCategoriaTable(categorias);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadCategoriaTable();
|
||||
}
|
||||
|
||||
private void loadCategoriaTable() {
|
||||
List<Categoria> categorias = this.categoriaRepository.getAll();
|
||||
this.loadCategoriaTable(categorias);
|
||||
}
|
||||
|
||||
private void loadCategoriaTable(List<Categoria> categorias) {
|
||||
BaseTableModel<Categoria> model = this.view.getCategoriaModel();
|
||||
model.setRows(categorias);
|
||||
}
|
||||
|
||||
private Categoria getSelectedCategoria() {
|
||||
int selectedRow = this.view.getCategoriaTable().getSelectedRow();
|
||||
if (selectedRow == -1) {
|
||||
@@ -122,6 +112,16 @@ public class CategoriaSearchController extends BaseController {
|
||||
return this.view.getCategoriaModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadCategoriaTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
this.view.getCategoriaTable().clearSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -25,17 +25,6 @@ public class CategoriaUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCategoria();
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillCategoria() {
|
||||
if (this.categoria != null)
|
||||
this.view.getNombreField().setText(this.categoria.getNombre());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNombreField().addActionListener(e -> this.update());
|
||||
this.view.getUpdateButton().addActionListener(e -> this.update());
|
||||
@@ -63,6 +52,17 @@ public class CategoriaUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.CATEGORIA_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCategoria();
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillCategoria() {
|
||||
if (this.categoria != null)
|
||||
this.view.getNombreField().setText(this.categoria.getNombre());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -18,12 +18,17 @@ public class CategoriaViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CATEGORIA_SEARCH));
|
||||
}
|
||||
|
||||
public void setCategoria(Categoria categoria) {
|
||||
this.categoria = categoria;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CATEGORIA_SEARCH));
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCategoria();
|
||||
}
|
||||
|
||||
private void fillCategoria() {
|
||||
@@ -31,11 +36,6 @@ public class CategoriaViewController extends BaseController {
|
||||
this.view.getNombreField().setText(this.categoria.getNombre());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCategoria();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -25,11 +25,6 @@ public class ClienteCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CLIENTE_SEARCH));
|
||||
@@ -83,6 +78,11 @@ public class ClienteCreateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.CLIENTE_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -26,27 +26,6 @@ public class ClienteUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
public void setCliente(Cliente cliente) {
|
||||
this.cliente = cliente;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCliente();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillCliente() {
|
||||
if (this.clienteRespository == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.cliente.getRut());
|
||||
this.view.getNombreField().setText(this.cliente.getNombre());
|
||||
this.view.getApellidoPaternoField().setText(this.cliente.getApellidoPaterno());
|
||||
this.view.getApellidoMaternoField().setText(this.cliente.getApellidoMaterno());
|
||||
this.view.getFechaNacimientoField().setDate(this.cliente.getFechaNacimiento());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.CLIENTE_SEARCH));
|
||||
@@ -99,6 +78,27 @@ public class ClienteUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.CLIENTE_SEARCH);
|
||||
}
|
||||
|
||||
public void setCliente(Cliente cliente) {
|
||||
this.cliente = cliente;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillCliente();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillCliente() {
|
||||
if (this.clienteRespository == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.cliente.getRut());
|
||||
this.view.getNombreField().setText(this.cliente.getNombre());
|
||||
this.view.getApellidoPaternoField().setText(this.cliente.getApellidoPaterno());
|
||||
this.view.getApellidoMaternoField().setText(this.cliente.getApellidoMaterno());
|
||||
this.view.getFechaNacimientoField().setDate(this.cliente.getFechaNacimiento());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -30,6 +30,25 @@ public class ClienteCorreoSearchController extends AbstractCorreoSearchControlle
|
||||
this.getParentController().showCard(PanelName.CLIENTE_CORREO_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Correo> correo = this.correoRepository.search(term, this.cliente);
|
||||
this.loadCorreosTable(correo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo != null) {
|
||||
ClienteCorreoViewController controller = (ClienteCorreoViewController) this.getParentController()
|
||||
.getCard(PanelName.CLIENTE_CORREO_VIEW);
|
||||
controller.setCorreo(correo);
|
||||
controller.setCliente(this.cliente);
|
||||
this.getParentController().showCard(PanelName.CLIENTE_CORREO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
@@ -63,25 +82,6 @@ public class ClienteCorreoSearchController extends AbstractCorreoSearchControlle
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo != null) {
|
||||
ClienteCorreoViewController controller = (ClienteCorreoViewController) this.getParentController()
|
||||
.getCard(PanelName.CLIENTE_CORREO_VIEW);
|
||||
controller.setCorreo(correo);
|
||||
controller.setCliente(this.cliente);
|
||||
this.getParentController().showCard(PanelName.CLIENTE_CORREO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Correo> correo = this.correoRepository.search(term, this.cliente);
|
||||
this.loadCorreosTable(correo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
ClienteViewController controller = (ClienteViewController) this.getParentController().getCard(PanelName.CLIENTE_VIEW);
|
||||
|
||||
@@ -30,6 +30,25 @@ public class ClienteDireccionSearchController extends AbstractDireccionSearchCon
|
||||
this.getParentController().showCard(PanelName.CLIENTE_DIRECCION_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Direccion> direccion = this.direccionRepository.search(term, this.cliente);
|
||||
this.loadDireccionesTable(direccion);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
if (direccion != null) {
|
||||
ClienteDireccionViewController controller = (ClienteDireccionViewController) this.getParentController()
|
||||
.getCard(PanelName.CLIENTE_DIRECCION_VIEW);
|
||||
controller.setDireccion(direccion);
|
||||
controller.setCliente(this.cliente);
|
||||
this.getParentController().showCard(PanelName.CLIENTE_DIRECCION_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
@@ -63,25 +82,6 @@ public class ClienteDireccionSearchController extends AbstractDireccionSearchCon
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
if (direccion != null) {
|
||||
ClienteDireccionViewController controller = (ClienteDireccionViewController) this.getParentController()
|
||||
.getCard(PanelName.CLIENTE_DIRECCION_VIEW);
|
||||
controller.setDireccion(direccion);
|
||||
controller.setCliente(this.cliente);
|
||||
this.getParentController().showCard(PanelName.CLIENTE_DIRECCION_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Direccion> direccion = this.direccionRepository.search(term, this.cliente);
|
||||
this.loadDireccionesTable(direccion);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
ClienteViewController controller = (ClienteViewController) this.getParentController().getCard(PanelName.CLIENTE_VIEW);
|
||||
|
||||
@@ -19,16 +19,6 @@ public class ClienteTelefonoSearchController extends AbstractTelefonoSearchContr
|
||||
super(view, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void create() {
|
||||
ClienteTelefonoCreateController controller = (ClienteTelefonoCreateController) this.getParentController()
|
||||
@@ -37,6 +27,25 @@ public class ClienteTelefonoSearchController extends AbstractTelefonoSearchContr
|
||||
this.getParentController().showCard(PanelName.CLIENTE_TELEFONO_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Telefono> telefono = this.telefonoRepository.search(term, this.cliente);
|
||||
this.loadTelefonosTable(telefono);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
if (telefono != null) {
|
||||
ClienteTelefonoViewController controller = (ClienteTelefonoViewController) this.getParentController()
|
||||
.getCard(PanelName.CLIENTE_TELEFONO_VIEW);
|
||||
controller.setTelefono(telefono);
|
||||
controller.setCliente(this.cliente);
|
||||
this.getParentController().showCard(PanelName.CLIENTE_TELEFONO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
@@ -70,25 +79,6 @@ public class ClienteTelefonoSearchController extends AbstractTelefonoSearchContr
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
if (telefono != null) {
|
||||
ClienteTelefonoViewController controller = (ClienteTelefonoViewController) this.getParentController()
|
||||
.getCard(PanelName.CLIENTE_TELEFONO_VIEW);
|
||||
controller.setTelefono(telefono);
|
||||
controller.setCliente(this.cliente);
|
||||
this.getParentController().showCard(PanelName.CLIENTE_TELEFONO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Telefono> telefono = this.telefonoRepository.search(term, this.cliente);
|
||||
this.loadTelefonosTable(telefono);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
ClienteViewController controller = (ClienteViewController) this.getParentController().getCard(PanelName.CLIENTE_VIEW);
|
||||
@@ -96,6 +86,16 @@ public class ClienteTelefonoSearchController extends AbstractTelefonoSearchContr
|
||||
this.getParentController().showCard(PanelName.CLIENTE_VIEW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadTelefonosTable() {
|
||||
List<Telefono> telefonos = this.cliente.getTelefonos();
|
||||
|
||||
@@ -28,22 +28,11 @@ public class DistribuidorCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEmpresasCombobox();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH));
|
||||
}
|
||||
|
||||
private void fillEmpresasCombobox() {
|
||||
this.view.getEmpresaModel().removeAllElements();
|
||||
this.view.getEmpresaModel().addAll(this.empresaRepository.getAll());
|
||||
}
|
||||
|
||||
private void save() {
|
||||
String rut = this.view.getRutField().getText();
|
||||
ValidationResult rutValidation = this.validator.validateRut(rut);
|
||||
@@ -68,6 +57,17 @@ public class DistribuidorCreateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEmpresasCombobox();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillEmpresasCombobox() {
|
||||
this.view.getEmpresaModel().removeAllElements();
|
||||
this.view.getEmpresaModel().addAll(this.empresaRepository.getAll());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -29,30 +29,6 @@ public class DistribuidorUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
public void setDistribuidor(Distribuidor distribuidor) {
|
||||
this.distribuidor = distribuidor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEmpresaCombobox();
|
||||
this.fillDistribuidor();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillEmpresaCombobox() {
|
||||
this.view.getEmpresaModel().removeAllElements();
|
||||
this.view.getEmpresaModel().addAll(this.empresaRepository.getAll());
|
||||
}
|
||||
|
||||
private void fillDistribuidor() {
|
||||
if (this.distribuidorRepository == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.distribuidor.getRut());
|
||||
this.view.getEmpresaCombobox().setSelectedItem(this.distribuidor.getEmpresa());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH));
|
||||
@@ -87,6 +63,30 @@ public class DistribuidorUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH);
|
||||
}
|
||||
|
||||
public void setDistribuidor(Distribuidor distribuidor) {
|
||||
this.distribuidor = distribuidor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEmpresaCombobox();
|
||||
this.fillDistribuidor();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillEmpresaCombobox() {
|
||||
this.view.getEmpresaModel().removeAllElements();
|
||||
this.view.getEmpresaModel().addAll(this.empresaRepository.getAll());
|
||||
}
|
||||
|
||||
private void fillDistribuidor() {
|
||||
if (this.distribuidorRepository == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.distribuidor.getRut());
|
||||
this.view.getEmpresaCombobox().setSelectedItem(this.distribuidor.getEmpresa());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -21,15 +21,6 @@ public class DistribuidorViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillDistribuidor();
|
||||
}
|
||||
|
||||
public void setDistribuidor(Distribuidor distribuidor) {
|
||||
this.distribuidor = distribuidor;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.DISTRIBUIDOR_SEARCH));
|
||||
this.view.getCorreosButton().addActionListener(e -> this.gotoCorreosView());
|
||||
@@ -37,6 +28,20 @@ public class DistribuidorViewController extends BaseController {
|
||||
this.view.getDireccionesButton().addActionListener(e -> this.gotoDireccionView());
|
||||
}
|
||||
|
||||
private void gotoCorreosView() {
|
||||
DistribuidorCorreoSearchController controller = (DistribuidorCorreoSearchController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_CORREO_SEARCH);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_CORREO_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoTelefonoView() {
|
||||
DistribuidorTelefonoSearchController controller = (DistribuidorTelefonoSearchController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_TELEFONO_SEARCH);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_TELEFONO_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoDireccionView() {
|
||||
DistribuidorDireccionSearchController controller = (DistribuidorDireccionSearchController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_DIRECCION_SEARCH);
|
||||
@@ -44,19 +49,9 @@ public class DistribuidorViewController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_DIRECCION_SEARCH);
|
||||
}
|
||||
|
||||
|
||||
private void gotoTelefonoView() {
|
||||
DistribuidorTelefonoSearchController controller = (DistribuidorTelefonoSearchController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_TELEFONO_SEARCH);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_TELEFONO_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoCorreosView() {
|
||||
DistribuidorCorreoSearchController controller = (DistribuidorCorreoSearchController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_CORREO_SEARCH);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_CORREO_SEARCH);
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillDistribuidor();
|
||||
}
|
||||
|
||||
private void fillDistribuidor() {
|
||||
@@ -71,4 +66,8 @@ public class DistribuidorViewController extends BaseController {
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setDistribuidor(Distribuidor distribuidor) {
|
||||
this.distribuidor = distribuidor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,25 @@ public class DistribuidorCorreoSearchController extends AbstractCorreoSearchCont
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_CORREO_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Correo> correo = this.correoRepository.search(term, this.distribuidor);
|
||||
this.loadCorreosTable(correo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo != null) {
|
||||
DistribuidorCorreoViewController controller = (DistribuidorCorreoViewController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_CORREO_VIEW);
|
||||
controller.setCorreo(correo);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_CORREO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
@@ -63,25 +82,6 @@ public class DistribuidorCorreoSearchController extends AbstractCorreoSearchCont
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo != null) {
|
||||
DistribuidorCorreoViewController controller = (DistribuidorCorreoViewController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_CORREO_VIEW);
|
||||
controller.setCorreo(correo);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_CORREO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Correo> correo = this.correoRepository.search(term, this.distribuidor);
|
||||
this.loadCorreosTable(correo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
DistribuidorViewController controller = (DistribuidorViewController) this.getParentController().getCard(PanelName.DISTRIBUIDOR_VIEW);
|
||||
|
||||
@@ -30,6 +30,25 @@ public class DistribuidorDireccionSearchController extends AbstractDireccionSear
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_DIRECCION_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Direccion> direccion = this.direccionRepository.search(term, this.distribuidor);
|
||||
this.loadDireccionesTable(direccion);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
if (direccion != null) {
|
||||
DistribuidorDireccionViewController controller = (DistribuidorDireccionViewController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_DIRECCION_VIEW);
|
||||
controller.setDireccion(direccion);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_DIRECCION_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
@@ -63,25 +82,6 @@ public class DistribuidorDireccionSearchController extends AbstractDireccionSear
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
if (direccion != null) {
|
||||
DistribuidorDireccionViewController controller = (DistribuidorDireccionViewController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_DIRECCION_VIEW);
|
||||
controller.setDireccion(direccion);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_DIRECCION_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Direccion> direccion = this.direccionRepository.search(term, this.distribuidor);
|
||||
this.loadDireccionesTable(direccion);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
DistribuidorViewController controller = (DistribuidorViewController) this.getParentController().getCard(PanelName.DISTRIBUIDOR_VIEW);
|
||||
|
||||
@@ -30,6 +30,25 @@ public class DistribuidorTelefonoSearchController extends AbstractTelefonoSearch
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_TELEFONO_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Telefono> telefono = this.telefonoRepository.search(term, this.distribuidor);
|
||||
this.loadTelefonosTable(telefono);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
if (telefono != null) {
|
||||
DistribuidorTelefonoViewController controller = (DistribuidorTelefonoViewController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_TELEFONO_VIEW);
|
||||
controller.setTelefono(telefono);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_TELEFONO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
@@ -63,25 +82,6 @@ public class DistribuidorTelefonoSearchController extends AbstractTelefonoSearch
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
if (telefono != null) {
|
||||
DistribuidorTelefonoViewController controller = (DistribuidorTelefonoViewController) this.getParentController()
|
||||
.getCard(PanelName.DISTRIBUIDOR_TELEFONO_VIEW);
|
||||
controller.setTelefono(telefono);
|
||||
controller.setDistribuidor(this.distribuidor);
|
||||
this.getParentController().showCard(PanelName.DISTRIBUIDOR_TELEFONO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Telefono> telefono = this.telefonoRepository.search(term, this.distribuidor);
|
||||
this.loadTelefonosTable(telefono);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
DistribuidorViewController controller = (DistribuidorViewController) this.getParentController().getCard(PanelName.DISTRIBUIDOR_VIEW);
|
||||
|
||||
@@ -25,11 +25,6 @@ public class EditorialCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getNombreField().addActionListener(e -> this.save());
|
||||
@@ -53,6 +48,11 @@ public class EditorialCreateController extends BaseController {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -28,13 +28,9 @@ public class EditorialSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadEditorialTable();
|
||||
private void loadEditorialTable() {
|
||||
List<Editorial> editoriales = this.editorialRepository.getAll();
|
||||
this.loadEditorialTable(editoriales);
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
@@ -46,22 +42,15 @@ public class EditorialSearchController extends BaseController {
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Editorial editorial = this.getSelectedEditorial();
|
||||
if (editorial != null) {
|
||||
EditorialViewController controller = (EditorialViewController) this.getParentController().getCard(PanelName.EDITORIAL_VIEW);
|
||||
controller.setEditorial(editorial);
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_VIEW);
|
||||
}
|
||||
private void loadEditorialTable(List<Editorial> editoriales) {
|
||||
BaseTableModel<Editorial> model = this.view.getEditorialModel();
|
||||
model.setRows(editoriales);
|
||||
}
|
||||
|
||||
private void edit() {
|
||||
Editorial editorial = this.getSelectedEditorial();
|
||||
if (editorial != null) {
|
||||
EditorialUpdateController controller = (EditorialUpdateController) this.getParentController().getCard(PanelName.EDITORIAL_UPDATE);
|
||||
controller.setEditorial(editorial);
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_UPDATE);
|
||||
}
|
||||
private void search() {
|
||||
String term = this.view.getBuscarField().getText();
|
||||
List<Editorial> editoriales = this.editorialRepository.search(term);
|
||||
this.loadEditorialTable(editoriales);
|
||||
}
|
||||
|
||||
private void delete() {
|
||||
@@ -88,20 +77,22 @@ public class EditorialSearchController extends BaseController {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getBuscarField().getText();
|
||||
List<Editorial> editoriales = this.editorialRepository.search(term);
|
||||
this.loadEditorialTable(editoriales);
|
||||
private void edit() {
|
||||
Editorial editorial = this.getSelectedEditorial();
|
||||
if (editorial != null) {
|
||||
EditorialUpdateController controller = (EditorialUpdateController) this.getParentController().getCard(PanelName.EDITORIAL_UPDATE);
|
||||
controller.setEditorial(editorial);
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadEditorialTable(List<Editorial> editoriales) {
|
||||
BaseTableModel<Editorial> model = this.view.getEditorialModel();
|
||||
model.setRows(editoriales);
|
||||
private void view() {
|
||||
Editorial editorial = this.getSelectedEditorial();
|
||||
if (editorial != null) {
|
||||
EditorialViewController controller = (EditorialViewController) this.getParentController().getCard(PanelName.EDITORIAL_VIEW);
|
||||
controller.setEditorial(editorial);
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_VIEW);
|
||||
}
|
||||
|
||||
private void loadEditorialTable() {
|
||||
List<Editorial> editoriales = this.editorialRepository.getAll();
|
||||
this.loadEditorialTable(editoriales);
|
||||
}
|
||||
|
||||
private Editorial getSelectedEditorial() {
|
||||
@@ -119,6 +110,15 @@ public class EditorialSearchController extends BaseController {
|
||||
return this.view.getEditorialModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadEditorialTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -25,19 +25,6 @@ public class EditorialUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (this.editorial == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.editorial.getNombre());
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
public void setEditorial(Editorial editorial) {
|
||||
this.editorial = editorial;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNombreField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
@@ -64,8 +51,21 @@ public class EditorialUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (this.editorial == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.editorial.getNombre());
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setEditorial(Editorial editorial) {
|
||||
this.editorial = editorial;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,21 +18,17 @@ public class EditorialViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEditorial();
|
||||
}
|
||||
|
||||
public void setEditorial(Editorial editorial) {
|
||||
this.editorial = editorial;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> {
|
||||
this.getParentController().showCard(PanelName.EDITORIAL_SEARCH);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEditorial();
|
||||
}
|
||||
|
||||
private void fillEditorial() {
|
||||
if (this.editorial == null)
|
||||
return;
|
||||
@@ -44,4 +40,8 @@ public class EditorialViewController extends BaseController {
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setEditorial(Editorial editorial) {
|
||||
this.editorial = editorial;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,6 @@ public class EmpresaCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
this.view.getNombreField().addActionListener(e -> this.save());
|
||||
@@ -53,6 +48,11 @@ public class EmpresaCreateController extends BaseController {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -27,13 +27,9 @@ public class EmpresaSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadEmpresaTable();
|
||||
private void loadEmpresaTable() {
|
||||
List<Empresa> empresas = this.empresaRepository.getAll();
|
||||
this.loadEmpresaTable(empresas);
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
@@ -45,22 +41,15 @@ public class EmpresaSearchController extends BaseController {
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Empresa empresa = this.getSelectedEmpresa();
|
||||
if (empresa != null) {
|
||||
EmpresaViewController controller = (EmpresaViewController) this.getParentController().getCard(PanelName.EMPRESA_VIEW);
|
||||
controller.setEmpresa(empresa);
|
||||
this.getParentController().showCard(PanelName.EMPRESA_VIEW);
|
||||
}
|
||||
private void loadEmpresaTable(List<Empresa> empresas) {
|
||||
BaseTableModel<Empresa> model = this.view.getEmpresaModel();
|
||||
model.setRows(empresas);
|
||||
}
|
||||
|
||||
private void edit() {
|
||||
Empresa empresa = this.getSelectedEmpresa();
|
||||
if (empresa != null) {
|
||||
EmpresaUpdateController controller = (EmpresaUpdateController) this.getParentController().getCard(PanelName.EMPRESA_UPDATE);
|
||||
controller.setEmpresa(empresa);
|
||||
this.getParentController().showCard(PanelName.EMPRESA_UPDATE);
|
||||
}
|
||||
private void search() {
|
||||
String term = this.view.getBuscarField().getText();
|
||||
List<Empresa> empresaes = this.empresaRepository.search(term);
|
||||
this.loadEmpresaTable(empresaes);
|
||||
}
|
||||
|
||||
private void delete() {
|
||||
@@ -82,20 +71,22 @@ public class EmpresaSearchController extends BaseController {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getBuscarField().getText();
|
||||
List<Empresa> empresaes = this.empresaRepository.search(term);
|
||||
this.loadEmpresaTable(empresaes);
|
||||
private void edit() {
|
||||
Empresa empresa = this.getSelectedEmpresa();
|
||||
if (empresa != null) {
|
||||
EmpresaUpdateController controller = (EmpresaUpdateController) this.getParentController().getCard(PanelName.EMPRESA_UPDATE);
|
||||
controller.setEmpresa(empresa);
|
||||
this.getParentController().showCard(PanelName.EMPRESA_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadEmpresaTable(List<Empresa> empresas) {
|
||||
BaseTableModel<Empresa> model = this.view.getEmpresaModel();
|
||||
model.setRows(empresas);
|
||||
private void view() {
|
||||
Empresa empresa = this.getSelectedEmpresa();
|
||||
if (empresa != null) {
|
||||
EmpresaViewController controller = (EmpresaViewController) this.getParentController().getCard(PanelName.EMPRESA_VIEW);
|
||||
controller.setEmpresa(empresa);
|
||||
this.getParentController().showCard(PanelName.EMPRESA_VIEW);
|
||||
}
|
||||
|
||||
private void loadEmpresaTable() {
|
||||
List<Empresa> empresas = this.empresaRepository.getAll();
|
||||
this.loadEmpresaTable(empresas);
|
||||
}
|
||||
|
||||
private Empresa getSelectedEmpresa() {
|
||||
@@ -113,6 +104,15 @@ public class EmpresaSearchController extends BaseController {
|
||||
return this.view.getEmpresaModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadEmpresaTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -25,19 +25,6 @@ public class EmpresaUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (this.empresa == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.empresa.getNombre());
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNombreField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
@@ -64,8 +51,21 @@ public class EmpresaUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.EMPRESA_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (this.empresa == null)
|
||||
return;
|
||||
|
||||
this.view.getNombreField().setText(this.empresa.getNombre());
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,21 +18,17 @@ public class EmpresaViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEmpresa();
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> {
|
||||
this.getParentController().showCard(PanelName.EMPRESA_SEARCH);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillEmpresa();
|
||||
}
|
||||
|
||||
private void fillEmpresa() {
|
||||
if (this.empresa == null)
|
||||
return;
|
||||
@@ -44,4 +40,8 @@ public class EmpresaViewController extends BaseController {
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setEmpresa(Empresa empresa) {
|
||||
this.empresa = empresa;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,11 +25,6 @@ public class IdiomaCreateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNombreField().addActionListener(e -> this.save());
|
||||
this.view.getGuardarButton().addActionListener(e -> this.save());
|
||||
@@ -53,6 +48,11 @@ public class IdiomaCreateController extends BaseController {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getNombreField().requestFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -28,13 +28,9 @@ public class IdiomaSearchController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadIdiomaTable();
|
||||
private void loadIdiomaTable() {
|
||||
List<Idioma> idiomas = this.idiomaRepository.getAll();
|
||||
this.loadIdiomaTable(idiomas);
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
@@ -46,22 +42,15 @@ public class IdiomaSearchController extends BaseController {
|
||||
this.view.getVerButton().addActionListener(e -> this.view());
|
||||
}
|
||||
|
||||
private void view() {
|
||||
Idioma idioma = this.getSelectedIdioma();
|
||||
if (idioma != null) {
|
||||
IdiomaViewController controller = (IdiomaViewController) this.getParentController().getCard(PanelName.IDIOMA_VIEW);
|
||||
controller.setIdioma(idioma);
|
||||
this.getParentController().showCard(PanelName.IDIOMA_VIEW);
|
||||
}
|
||||
private void loadIdiomaTable(List<Idioma> idiomas) {
|
||||
BaseTableModel<Idioma> model = this.view.getIdiomaTableModel();
|
||||
model.setRows(idiomas);
|
||||
}
|
||||
|
||||
private void edit() {
|
||||
Idioma idioma = this.getSelectedIdioma();
|
||||
if (idioma != null) {
|
||||
IdiomaUpdateController controller = (IdiomaUpdateController) this.getParentController().getCard(PanelName.IDIOMA_UPDATE);
|
||||
controller.setIdioma(idioma);
|
||||
this.getParentController().showCard(PanelName.IDIOMA_UPDATE);
|
||||
}
|
||||
private void search() {
|
||||
String term = this.view.getBuscarField().getText();
|
||||
List<Idioma> idiomas = this.idiomaRepository.search(term);
|
||||
this.loadIdiomaTable(idiomas);
|
||||
}
|
||||
|
||||
private void delete() {
|
||||
@@ -89,25 +78,22 @@ public class IdiomaSearchController extends BaseController {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
private void search() {
|
||||
String term = this.view.getBuscarField().getText();
|
||||
List<Idioma> idiomas = this.idiomaRepository.search(term);
|
||||
this.loadIdiomaTable(idiomas);
|
||||
private void edit() {
|
||||
Idioma idioma = this.getSelectedIdioma();
|
||||
if (idioma != null) {
|
||||
IdiomaUpdateController controller = (IdiomaUpdateController) this.getParentController().getCard(PanelName.IDIOMA_UPDATE);
|
||||
controller.setIdioma(idioma);
|
||||
this.getParentController().showCard(PanelName.IDIOMA_UPDATE);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadIdiomaTable(List<Idioma> idiomas) {
|
||||
BaseTableModel<Idioma> model = this.view.getIdiomaTableModel();
|
||||
model.setRows(idiomas);
|
||||
private void view() {
|
||||
Idioma idioma = this.getSelectedIdioma();
|
||||
if (idioma != null) {
|
||||
IdiomaViewController controller = (IdiomaViewController) this.getParentController().getCard(PanelName.IDIOMA_VIEW);
|
||||
controller.setIdioma(idioma);
|
||||
this.getParentController().showCard(PanelName.IDIOMA_VIEW);
|
||||
}
|
||||
|
||||
private void loadIdiomaTable() {
|
||||
List<Idioma> idiomas = this.idiomaRepository.getAll();
|
||||
this.loadIdiomaTable(idiomas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
private Idioma getSelectedIdioma() {
|
||||
@@ -124,4 +110,18 @@ public class IdiomaSearchController extends BaseController {
|
||||
return this.view.getIdiomaTableModel().getRow(selectedRow);
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
this.loadIdiomaTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,18 +25,6 @@ public class IdiomaUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (this.idioma == null)
|
||||
return;
|
||||
|
||||
this.fillIdioma();
|
||||
}
|
||||
|
||||
private void fillIdioma() {
|
||||
this.view.getNombreField().setText(this.idioma.getNombre());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getNombreField().addActionListener(e -> this.update());
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
@@ -64,6 +52,18 @@ public class IdiomaUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.IDIOMA_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
if (this.idioma == null)
|
||||
return;
|
||||
|
||||
this.fillIdioma();
|
||||
}
|
||||
|
||||
private void fillIdioma() {
|
||||
this.view.getNombreField().setText(this.idioma.getNombre());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -18,21 +18,17 @@ public class IdiomaViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillIdioma();
|
||||
}
|
||||
|
||||
public void setIdioma(Idioma idioma) {
|
||||
this.idioma = idioma;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> {
|
||||
this.getParentController().showCard(PanelName.IDIOMA_SEARCH);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillIdioma();
|
||||
}
|
||||
|
||||
private void fillIdioma() {
|
||||
if (this.idioma == null)
|
||||
return;
|
||||
@@ -44,4 +40,8 @@ public class IdiomaViewController extends BaseController {
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setIdioma(Idioma idioma) {
|
||||
this.idioma = idioma;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,27 +26,6 @@ public class TrabajadorUpdateController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillTrabajador();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillTrabajador() {
|
||||
if (this.trabajadorRespository == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.trabajador.getRut());
|
||||
this.view.getNombreField().setText(this.trabajador.getNombre());
|
||||
this.view.getApellidoPaternoField().setText(this.trabajador.getApellidoPaterno());
|
||||
this.view.getApellidoMaternoField().setText(this.trabajador.getApellidoMaterno());
|
||||
this.view.getFechaContratoField().setDate(this.trabajador.getFechaContrato());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.TRABAJADOR_SEARCH));
|
||||
@@ -99,6 +78,27 @@ public class TrabajadorUpdateController extends BaseController {
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_SEARCH);
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillTrabajador();
|
||||
this.view.getRutField().requestFocus();
|
||||
}
|
||||
|
||||
private void fillTrabajador() {
|
||||
if (this.trabajadorRespository == null)
|
||||
return;
|
||||
|
||||
this.view.getRutField().setText(this.trabajador.getRut());
|
||||
this.view.getNombreField().setText(this.trabajador.getNombre());
|
||||
this.view.getApellidoPaternoField().setText(this.trabajador.getApellidoPaterno());
|
||||
this.view.getApellidoMaternoField().setText(this.trabajador.getApellidoMaterno());
|
||||
this.view.getFechaContratoField().setDate(this.trabajador.getFechaContrato());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
|
||||
@@ -24,15 +24,6 @@ public class TrabajadorViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillTrabajador();
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.getParentController().showCard(PanelName.TRABAJADOR_SEARCH));
|
||||
this.view.getCorreosButton().addActionListener(e -> this.gotoCorreosView());
|
||||
@@ -41,20 +32,6 @@ public class TrabajadorViewController extends BaseController {
|
||||
this.view.getDireccionesButton().addActionListener(e -> this.gotoDireccionView());
|
||||
}
|
||||
|
||||
private void gotoDireccionView() {
|
||||
TrabajadorDireccionSearchController controller = (TrabajadorDireccionSearchController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_DIRECCION_SEARCH);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_DIRECCION_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoTelefonoView() {
|
||||
TrabajadorTelefonoSearchController controller = (TrabajadorTelefonoSearchController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_TELEFONO_SEARCH);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_TELEFONO_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoCorreosView() {
|
||||
TrabajadorCorreoSearchController controller = (TrabajadorCorreoSearchController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_CORREO_SEARCH);
|
||||
@@ -83,6 +60,25 @@ public class TrabajadorViewController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
private void gotoTelefonoView() {
|
||||
TrabajadorTelefonoSearchController controller = (TrabajadorTelefonoSearchController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_TELEFONO_SEARCH);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_TELEFONO_SEARCH);
|
||||
}
|
||||
|
||||
private void gotoDireccionView() {
|
||||
TrabajadorDireccionSearchController controller = (TrabajadorDireccionSearchController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_DIRECCION_SEARCH);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_DIRECCION_SEARCH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.fillTrabajador();
|
||||
}
|
||||
|
||||
private void fillTrabajador() {
|
||||
if (this.trabajador == null)
|
||||
return;
|
||||
@@ -98,4 +94,8 @@ public class TrabajadorViewController extends BaseController {
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,25 @@ public class TrabajadorCorreoSearchController extends AbstractCorreoSearchContro
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_CORREO_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Correo> correo = this.correoRepository.search(term, this.trabajador);
|
||||
this.loadCorreosTable(correo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo != null) {
|
||||
TrabajadorCorreoViewController controller = (TrabajadorCorreoViewController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_CORREO_VIEW);
|
||||
controller.setCorreo(correo);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_CORREO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
@@ -63,25 +82,6 @@ public class TrabajadorCorreoSearchController extends AbstractCorreoSearchContro
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Correo correo = this.getSelectedCorreo();
|
||||
if (correo != null) {
|
||||
TrabajadorCorreoViewController controller = (TrabajadorCorreoViewController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_CORREO_VIEW);
|
||||
controller.setCorreo(correo);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_CORREO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Correo> correo = this.correoRepository.search(term, this.trabajador);
|
||||
this.loadCorreosTable(correo);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
|
||||
@@ -31,6 +31,25 @@ public class TrabajadorDireccionSearchController extends AbstractDireccionSearch
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_DIRECCION_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Direccion> direccion = this.direccionRepository.search(term, this.trabajador);
|
||||
this.loadDireccionesTable(direccion);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
if (direccion != null) {
|
||||
TrabajadorDireccionViewController controller = (TrabajadorDireccionViewController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_DIRECCION_VIEW);
|
||||
controller.setDireccion(direccion);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_DIRECCION_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
@@ -64,25 +83,6 @@ public class TrabajadorDireccionSearchController extends AbstractDireccionSearch
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Direccion direccion = this.getSelectedDireccion();
|
||||
if (direccion != null) {
|
||||
TrabajadorDireccionViewController controller = (TrabajadorDireccionViewController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_DIRECCION_VIEW);
|
||||
controller.setDireccion(direccion);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_DIRECCION_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Direccion> direccion = this.direccionRepository.search(term, this.trabajador);
|
||||
this.loadDireccionesTable(direccion);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
|
||||
@@ -19,16 +19,6 @@ public class TrabajadorTelefonoSearchController extends AbstractTelefonoSearchCo
|
||||
super(view, parent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void create() {
|
||||
TrabajadorTelefonoCreateController controller = (TrabajadorTelefonoCreateController) this.getParentController()
|
||||
@@ -37,6 +27,25 @@ public class TrabajadorTelefonoSearchController extends AbstractTelefonoSearchCo
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_TELEFONO_CREATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Telefono> telefono = this.telefonoRepository.search(term, this.trabajador);
|
||||
this.loadTelefonosTable(telefono);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
if (telefono != null) {
|
||||
TrabajadorTelefonoViewController controller = (TrabajadorTelefonoViewController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_TELEFONO_VIEW);
|
||||
controller.setTelefono(telefono);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_TELEFONO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void edit() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
@@ -70,25 +79,6 @@ public class TrabajadorTelefonoSearchController extends AbstractTelefonoSearchCo
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void view() {
|
||||
Telefono telefono = this.getSelectedTelefono();
|
||||
if (telefono != null) {
|
||||
TrabajadorTelefonoViewController controller = (TrabajadorTelefonoViewController) this.getParentController()
|
||||
.getCard(PanelName.TRABAJADOR_TELEFONO_VIEW);
|
||||
controller.setTelefono(telefono);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_TELEFONO_VIEW);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void search() {
|
||||
String term = this.view.getSearchField().getText();
|
||||
List<Telefono> telefono = this.telefonoRepository.search(term, this.trabajador);
|
||||
this.loadTelefonosTable(telefono);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
@@ -96,6 +86,16 @@ public class TrabajadorTelefonoSearchController extends AbstractTelefonoSearchCo
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_VIEW);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadTelefonosTable() {
|
||||
List<Telefono> telefonos = this.trabajador.getTelefonos();
|
||||
|
||||
@@ -43,14 +43,14 @@ public class UsuarioUpdateController extends BaseController {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
public void fillUser() {
|
||||
this.view.getUserField().setText(this.trabajador.getUsuario().getNombre());
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getActualizarButton().addActionListener(e -> this.update());
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
|
||||
@@ -24,36 +24,18 @@ public class UsuarioViewController extends BaseController {
|
||||
this.setupListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getUserField().requestFocus();
|
||||
this.fillUsuario();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
public void fillUsuario() {
|
||||
this.view.getUserField().setText(this.trabajador.getUsuario().getNombre());
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getVolverButton().addActionListener(e -> this.volver());
|
||||
this.view.getEditarButton().addActionListener(e -> this.editar());
|
||||
this.view.getEliminarButton().addActionListener(e -> this.eliminar());
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_VIEW);
|
||||
}
|
||||
|
||||
private void editar() {
|
||||
UsuarioUpdateController controller = (UsuarioUpdateController) this.getParentController().getCard(PanelName.USUARIO_UPDATE);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
@@ -79,10 +61,28 @@ public class UsuarioViewController extends BaseController {
|
||||
this.volver();
|
||||
}
|
||||
|
||||
private void volver() {
|
||||
TrabajadorViewController controller = (TrabajadorViewController) this.getParentController().getCard(PanelName.TRABAJADOR_VIEW);
|
||||
controller.setTrabajador(this.trabajador);
|
||||
this.getParentController().showCard(PanelName.TRABAJADOR_VIEW);
|
||||
@Override
|
||||
public LaunchController getParentController() {
|
||||
return this.parentController;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
this.view.getUserField().requestFocus();
|
||||
this.fillUsuario();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BasePanel getView() {
|
||||
return this.view;
|
||||
}
|
||||
|
||||
public void fillUsuario() {
|
||||
this.view.getUserField().setText(this.trabajador.getUsuario().getNombre());
|
||||
}
|
||||
|
||||
public void setTrabajador(Trabajador trabajador) {
|
||||
this.trabajador = trabajador;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,9 +41,9 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
||||
return this.columns[index];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
return this.valueAt.apply(this.rows, rowIndex, columnIndex);
|
||||
public void addRow(T item) {
|
||||
this.rows.add(item);
|
||||
this.fireTableRowsInserted(this.getRowCount() - 1, this.getRowCount() - 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,9 +56,9 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
||||
return this.columns.length;
|
||||
}
|
||||
|
||||
public void addRow(T item) {
|
||||
this.rows.add(item);
|
||||
this.fireTableRowsInserted(this.getRowCount() - 1, this.getRowCount() - 1);
|
||||
@Override
|
||||
public Object getValueAt(int rowIndex, int columnIndex) {
|
||||
return this.valueAt.apply(this.rows, rowIndex, columnIndex);
|
||||
}
|
||||
|
||||
public void setRows(List<T> items) {
|
||||
@@ -67,11 +67,6 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
||||
this.fireTableRowsInserted(0, this.getRowCount() - 1);
|
||||
}
|
||||
|
||||
public void removeRow(int row) {
|
||||
this.rows.remove(row);
|
||||
this.fireTableRowsDeleted(row, row);
|
||||
}
|
||||
|
||||
public void removeRows() {
|
||||
int rowCount = this.getRowCount();
|
||||
if (rowCount > 0) {
|
||||
@@ -80,6 +75,11 @@ public class BaseTableModel<T> extends AbstractTableModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void removeRow(int row) {
|
||||
this.rows.remove(row);
|
||||
this.fireTableRowsDeleted(row, row);
|
||||
}
|
||||
|
||||
public T getRow(int row) {
|
||||
if (row > -1 || row < this.getRowCount()) {
|
||||
return this.rows.get(row);
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.time.DateTimeException;
|
||||
import java.time.Year;
|
||||
|
||||
public class GeneralValidator {
|
||||
|
||||
public static boolean isLong(String number) {
|
||||
try {
|
||||
Long.parseLong(number);
|
||||
|
||||
@@ -13,8 +13,7 @@ public class LoggedEvent extends EventObject {
|
||||
/**
|
||||
* Crea el objeto y almacena los datos entregados
|
||||
*
|
||||
* El metodo lanza un {@code IllegalArgumentException} en caso que
|
||||
* {@code source} y {@code user} sean nulos.
|
||||
* El metodo lanza un {@code IllegalArgumentException} en caso que {@code source} y {@code user} sean nulos.
|
||||
*
|
||||
* @param source El objeto en el que el evento se origino
|
||||
* @param user El usuario que fue logeado en el sistema
|
||||
@@ -26,6 +25,6 @@ public class LoggedEvent extends EventObject {
|
||||
}
|
||||
|
||||
public Usuario getUser() {
|
||||
return user;
|
||||
return this.user;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ public interface LoggedListener extends EventListener {
|
||||
|
||||
/**
|
||||
* Se invoca cuando un usuario se logra logear al sistema.
|
||||
*
|
||||
* @param e El evento que se ejecutara
|
||||
*/
|
||||
public void loginTry(LoggedEvent e);
|
||||
void loginTry(LoggedEvent e);
|
||||
}
|
||||
|
||||
@@ -9,11 +9,13 @@ import javax.crypto.SecretKeyFactory;
|
||||
import javax.crypto.spec.PBEKeySpec;
|
||||
|
||||
public class Passwords {
|
||||
|
||||
private static final Random RANDOM = new SecureRandom();
|
||||
private static final int ITERATIONS = 10000;
|
||||
private static final int KEY_LENGHT = 256;
|
||||
|
||||
private Passwords(){}
|
||||
private Passwords() {
|
||||
}
|
||||
|
||||
public static byte[] getNextSalt() {
|
||||
byte[] salt = new byte[16];
|
||||
@@ -21,6 +23,18 @@ public class Passwords {
|
||||
return salt;
|
||||
}
|
||||
|
||||
public static boolean isExpectedPassword(char[] password, byte[] salt, byte[] expectedHash) {
|
||||
byte[] pwdHash = hash(password, salt);
|
||||
Arrays.fill(password, Character.MIN_VALUE);
|
||||
if (pwdHash.length != expectedHash.length)
|
||||
return false;
|
||||
for (int i = 0; i < pwdHash.length; i++) {
|
||||
if (pwdHash[i] != expectedHash[i])
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static byte[] hash(char[] password, byte[] salt) {
|
||||
PBEKeySpec spec = new PBEKeySpec(password, salt, ITERATIONS, KEY_LENGHT);
|
||||
Arrays.fill(password, Character.MIN_VALUE);
|
||||
@@ -33,14 +47,4 @@ public class Passwords {
|
||||
spec.clearPassword();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isExpectedPassword(char[] password, byte[] salt, byte[] expectedHash){
|
||||
byte[] pwdHash = hash(password, salt);
|
||||
Arrays.fill(password, Character.MIN_VALUE);
|
||||
if(pwdHash.length != expectedHash.length) return false;
|
||||
for(int i = 0; i < pwdHash.length; i++){
|
||||
if(pwdHash[i] != expectedHash[i]) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package xyz.danielcortes.framework;
|
||||
|
||||
public interface TriFunction<A, B, C, D> {
|
||||
|
||||
D apply(A a, B b, C c);
|
||||
}
|
||||
|
||||
@@ -26,9 +26,21 @@ public class LoginController {
|
||||
}
|
||||
|
||||
private void setupListeners() {
|
||||
this.view.getUserField().addActionListener(e -> login());
|
||||
this.view.getPassField().addActionListener(e -> login());
|
||||
this.view.getLoginButton().addActionListener(e -> login());
|
||||
this.view.getUserField().addActionListener(e -> this.login());
|
||||
this.view.getPassField().addActionListener(e -> this.login());
|
||||
this.view.getLoginButton().addActionListener(e -> this.login());
|
||||
}
|
||||
|
||||
private void createFrame() {
|
||||
Dimension dimension = new Dimension(400, 400);
|
||||
this.frame = new JFrame();
|
||||
this.frame.setSize(dimension);
|
||||
this.frame.setMinimumSize(dimension);
|
||||
this.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
this.frame.setLocationRelativeTo(null);
|
||||
this.frame.setTitle("Login");
|
||||
this.frame.setContentPane(this.view.getContentPane());
|
||||
this.frame.setVisible(true);
|
||||
}
|
||||
|
||||
private void login() {
|
||||
@@ -48,7 +60,7 @@ public class LoginController {
|
||||
char[] pass = this.view.getPassField().getPassword();
|
||||
if (Passwords.isExpectedPassword(pass, user.getSalt(), user.getPassword())) {
|
||||
this.frame.dispose();
|
||||
loggedListener.loginTry(new LoggedEvent(this, user));
|
||||
this.loggedListener.loginTry(new LoggedEvent(this, user));
|
||||
} else {
|
||||
JOptionPane.showMessageDialog(
|
||||
null,
|
||||
@@ -59,18 +71,6 @@ public class LoginController {
|
||||
}
|
||||
}
|
||||
|
||||
private void createFrame() {
|
||||
Dimension dimension = new Dimension(400, 400);
|
||||
this.frame = new JFrame();
|
||||
this.frame.setSize(dimension);
|
||||
this.frame.setMinimumSize(dimension);
|
||||
this.frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||
this.frame.setLocationRelativeTo(null);
|
||||
this.frame.setTitle("Login");
|
||||
this.frame.setContentPane(this.view.getContentPane());
|
||||
this.frame.setVisible(true);
|
||||
}
|
||||
|
||||
public void setLoggedListener(LoggedListener listener) {
|
||||
this.loggedListener = listener;
|
||||
}
|
||||
|
||||
@@ -19,27 +19,27 @@ public class LoginPanel {
|
||||
private JPasswordField passField;
|
||||
private JTextField userField;
|
||||
|
||||
public JButton getLoginButton() {
|
||||
return loginButton;
|
||||
}
|
||||
|
||||
public JPanel getContentPane() {
|
||||
return contentPane;
|
||||
}
|
||||
|
||||
public JPasswordField getPassField() {
|
||||
return passField;
|
||||
}
|
||||
|
||||
public JTextField getUserField() {
|
||||
return userField;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
public JButton getLoginButton() {
|
||||
return this.loginButton;
|
||||
}
|
||||
|
||||
public JPanel getContentPane() {
|
||||
return this.contentPane;
|
||||
}
|
||||
|
||||
public JPasswordField getPassField() {
|
||||
return this.passField;
|
||||
}
|
||||
|
||||
public JTextField getUserField() {
|
||||
return this.userField;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,12 +9,13 @@ import xyz.danielcortes.models.Distribuidor;
|
||||
public class DistribuidorRepository extends BaseRepository<Distribuidor> {
|
||||
|
||||
public List<Distribuidor> getAll() {
|
||||
TypedQuery<Distribuidor> query = em.createQuery("SELECT d FROM Distribuidor d", Distribuidor.class);
|
||||
TypedQuery<Distribuidor> query = this.em.createQuery("SELECT d FROM Distribuidor d", Distribuidor.class);
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
public List<Distribuidor> search(String term) {
|
||||
Query query = em.createQuery("SELECT d FROM Distribuidor d JOIN d.empresa e WHERE e.id = d.empresa.id AND (LOWER(e.nombre) LIKE :term OR LOWER(d.rut) LIKE :term)" );
|
||||
Query query = this.em.createQuery(
|
||||
"SELECT d FROM Distribuidor d JOIN d.empresa e WHERE e.id = d.empresa.id AND (LOWER(e.nombre) LIKE :term OR LOWER(d.rut) LIKE :term)");
|
||||
query.setParameter("term", "%" + term + "%");
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ import xyz.danielcortes.models.Empresa;
|
||||
public class EmpresaRepository extends BaseRepository<Empresa> {
|
||||
|
||||
public List<Empresa> getAll() {
|
||||
TypedQuery<Empresa> query = em.createQuery("SELECT e FROM Empresa e", Empresa.class);
|
||||
TypedQuery<Empresa> query = this.em.createQuery("SELECT e FROM Empresa e", Empresa.class);
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
public List<Empresa> search(String term) {
|
||||
Query query = em.createQuery("SELECT e FROM Empresa e WHERE LOWER(e.nombre) LIKE :term" );
|
||||
Query query = this.em.createQuery("SELECT e FROM Empresa e WHERE LOWER(e.nombre) LIKE :term");
|
||||
query.setParameter("term", "%" + term.toLowerCase() + "%");
|
||||
return query.getResultList();
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import xyz.danielcortes.models.Usuario;
|
||||
public class UsuarioRepository extends BaseRepository<Usuario> {
|
||||
|
||||
public Optional<Usuario> getByName(String name) {
|
||||
TypedQuery<Usuario> query = em.createQuery("SELECT u FROM Usuario u WHERE nombre = :nombre", Usuario.class);
|
||||
TypedQuery<Usuario> query = this.em.createQuery("SELECT u FROM Usuario u WHERE nombre = :nombre", Usuario.class);
|
||||
query.setParameter("nombre", name);
|
||||
|
||||
try {
|
||||
|
||||
@@ -54,14 +54,6 @@ public class ClienteValidator {
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
public ValidationResult validateFechaNacimiento(LocalDate fecha) {
|
||||
if (fecha == null) {
|
||||
return new ValidationResult("La fecha es nula");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
|
||||
private boolean rutChecksum(String rut) {
|
||||
char lastchar = rut.charAt(rut.length() - 1);
|
||||
rut = rut.toLowerCase().replaceAll("[^\\dkK]", "");
|
||||
@@ -85,4 +77,11 @@ public class ClienteValidator {
|
||||
return lastchar == digitoVerificador;
|
||||
}
|
||||
|
||||
public ValidationResult validateFechaNacimiento(LocalDate fecha) {
|
||||
if (fecha == null) {
|
||||
return new ValidationResult("La fecha es nula");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,27 +21,13 @@ public class DistribuidorValidator {
|
||||
} else if (rut.length() < 4) {
|
||||
return new ValidationResult("El rut es muy corto");
|
||||
}
|
||||
if (!rutChecksum(rut)) {
|
||||
if (!this.rutChecksum(rut)) {
|
||||
return new ValidationResult("El rut es invalido");
|
||||
}
|
||||
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
public ValidationResult validateEmpresa(Empresa empresa) {
|
||||
if(empresa == null) {
|
||||
return new ValidationResult("La empresa no existe");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
public ValidationResult validateOriginal(Distribuidor distribuidor) {
|
||||
if(distribuidor == null){
|
||||
return new ValidationResult("El distribuidor es nulo");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
private boolean rutChecksum(String rut) {
|
||||
char lastchar = rut.charAt(rut.length() - 1);
|
||||
rut = rut.toLowerCase().replaceAll("[^\\dkK]", "");
|
||||
@@ -66,4 +52,18 @@ public class DistribuidorValidator {
|
||||
return lastchar == digitoVerificador;
|
||||
}
|
||||
|
||||
public ValidationResult validateEmpresa(Empresa empresa) {
|
||||
if (empresa == null) {
|
||||
return new ValidationResult("La empresa no existe");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
public ValidationResult validateOriginal(Distribuidor distribuidor) {
|
||||
if (distribuidor == null) {
|
||||
return new ValidationResult("El distribuidor es nulo");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ public class EjemplarValidator {
|
||||
if (serie.isEmpty()) {
|
||||
return new ValidationResult("La serie esta vacia");
|
||||
}
|
||||
if (ejemplarRepository.exists(serie, libro_id)) {
|
||||
if (this.ejemplarRepository.exists(serie, libro_id)) {
|
||||
return new ValidationResult("El numero de serie ya existe");
|
||||
}
|
||||
|
||||
|
||||
@@ -35,14 +35,61 @@ public class LibroValidator {
|
||||
}
|
||||
|
||||
isbn = isbn.replaceAll("[^\\d]", "");
|
||||
if ((isbn.length() == 13 && !ISBN13CheckSum(isbn))
|
||||
|| (isbn.length() == 10 && !ISBN10CheckSum(isbn))
|
||||
if ((isbn.length() == 13 && !this.ISBN13CheckSum(isbn))
|
||||
|| (isbn.length() == 10 && !this.ISBN10CheckSum(isbn))
|
||||
|| (isbn.length() != 10 && isbn.length() != 13)) {
|
||||
return new ValidationResult("El ISBN no es valido");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
private boolean ISBN13CheckSum(String isbn) {
|
||||
if (isbn.length() != 13)
|
||||
return false;
|
||||
|
||||
int sum = 0;
|
||||
for (int i = 0; i < 12; i++) {
|
||||
int digit = isbn.charAt(i) - '0';
|
||||
if (0 > digit || 9 < digit)
|
||||
return false;
|
||||
if (i % 2 == 0) {
|
||||
sum += digit;
|
||||
} else {
|
||||
sum += digit * 3;
|
||||
}
|
||||
}
|
||||
|
||||
char last = isbn.charAt(12);
|
||||
if (((last < '0') || (last > '9')))
|
||||
return false;
|
||||
|
||||
return (10 - (sum % 10) == last - '0');
|
||||
}
|
||||
|
||||
private boolean ISBN10CheckSum(String isbn) {
|
||||
if (isbn.length() != 10)
|
||||
return false;
|
||||
|
||||
int sum = 0;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
int digit = isbn.charAt(i) - '0';
|
||||
if (0 > digit || 9 < digit)
|
||||
return false;
|
||||
sum += (digit * (10 - i));
|
||||
}
|
||||
|
||||
char last = isbn.charAt(9);
|
||||
if ((last != 'X') && ((last < '0') || (last > '9')))
|
||||
return false;
|
||||
|
||||
if (last == 'X')
|
||||
sum += 10;
|
||||
else
|
||||
sum += last - '0';
|
||||
|
||||
return (sum % 11 == 0);
|
||||
}
|
||||
|
||||
public ValidationResult validateTitulo(String titulo) {
|
||||
if (titulo == null) {
|
||||
return new ValidationResult("El titulo es nulo");
|
||||
@@ -137,51 +184,4 @@ public class LibroValidator {
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
private boolean ISBN10CheckSum(String isbn) {
|
||||
if (isbn.length() != 10)
|
||||
return false;
|
||||
|
||||
int sum = 0;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
int digit = isbn.charAt(i) - '0';
|
||||
if (0 > digit || 9 < digit)
|
||||
return false;
|
||||
sum += (digit * (10 - i));
|
||||
}
|
||||
|
||||
char last = isbn.charAt(9);
|
||||
if ((last != 'X') && ((last < '0') || (last > '9')))
|
||||
return false;
|
||||
|
||||
if (last == 'X')
|
||||
sum += 10;
|
||||
else
|
||||
sum += last - '0';
|
||||
|
||||
return (sum % 11 == 0);
|
||||
}
|
||||
|
||||
private boolean ISBN13CheckSum(String isbn) {
|
||||
if (isbn.length() != 13)
|
||||
return false;
|
||||
|
||||
int sum = 0;
|
||||
for (int i = 0; i < 12; i++) {
|
||||
int digit = isbn.charAt(i) - '0';
|
||||
if (0 > digit || 9 < digit)
|
||||
return false;
|
||||
if (i % 2 == 0) {
|
||||
sum += digit;
|
||||
} else {
|
||||
sum += digit * 3;
|
||||
}
|
||||
}
|
||||
|
||||
char last = isbn.charAt(12);
|
||||
if (((last < '0') || (last > '9')))
|
||||
return false;
|
||||
|
||||
return (10 - (sum % 10) == last - '0');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,20 +47,13 @@ public class TrabajadorValidator {
|
||||
} else if (rut.length() < 4) {
|
||||
return new ValidationResult("El rut es muy corto");
|
||||
}
|
||||
if (!rutChecksum(rut)) {
|
||||
if (!this.rutChecksum(rut)) {
|
||||
return new ValidationResult("El rut es invalido");
|
||||
}
|
||||
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
public ValidationResult validateFechaContrato(LocalDate date) {
|
||||
if (date == null) {
|
||||
return new ValidationResult("La fecha es nula");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
private boolean rutChecksum(String rut) {
|
||||
char lastchar = rut.charAt(rut.length() - 1);
|
||||
rut = rut.toLowerCase().replaceAll("[^\\dkK]", "");
|
||||
@@ -84,4 +77,11 @@ public class TrabajadorValidator {
|
||||
return lastchar == digitoVerificador;
|
||||
}
|
||||
|
||||
public ValidationResult validateFechaContrato(LocalDate date) {
|
||||
if (date == null) {
|
||||
return new ValidationResult("La fecha es nula");
|
||||
}
|
||||
return ValidationResult.NON_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ public class ComprarLibroPanel extends BasePanel {
|
||||
|
||||
private JPanel contentPane;
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return null;
|
||||
}
|
||||
|
||||
{
|
||||
// GUI initializer generated by IntelliJ IDEA GUI Designer
|
||||
// >>> IMPORTANT!! <<<
|
||||
// DO NOT EDIT OR ADD ANY CODE HERE!
|
||||
$$$setupUI$$$();
|
||||
this.$$$setupUI$$$();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JPanel getContentPane() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user