Ahora todos los fields de las vistas vistas se mueven de la misma manera

This commit is contained in:
Daniel Cortes
2019-02-16 14:49:40 -03:00
parent c2ff258cef
commit e65ac2bc10
7 changed files with 53 additions and 95 deletions

View File

@@ -24,7 +24,6 @@
package danielcortes.xyz.controllers;
import danielcortes.xyz.controllers.actions.MoveToAction;
import danielcortes.xyz.data.DAOManager;
import danielcortes.xyz.models.caja.Caja;
import danielcortes.xyz.models.documentos.Documentos;
@@ -41,7 +40,7 @@ import java.awt.event.ActionEvent;
* Controlador destinado a la vista ArqueoView
* Maneja su contenido y las acciones que esta realiza.
*/
public class ArqueoController {
public class ArqueoController extends BaseController{
private ArqueoView view;
private Caja caja;
private Efectivo efectivo;
@@ -164,45 +163,22 @@ public class ArqueoController {
* Setea los eventos de los fields de la vista
*/
private void setUpViewEvents() {
this.view.getVeinteMilField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getDiezMilField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getCincoMilField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getDosMilField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getMilField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getQuinientosField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getCienField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getCincuentaField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getDiezField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "save");
this.view.getVeinteMilField().getActionMap().put("nextField", new MoveToAction(this.view.getDiezMilField()));
this.view.getDiezMilField().getActionMap().put("nextField", new MoveToAction(this.view.getCincoMilField()));
this.view.getCincoMilField().getActionMap().put("nextField", new MoveToAction(this.view.getDosMilField()));
this.view.getDosMilField().getActionMap().put("nextField", new MoveToAction(this.view.getMilField()));
this.view.getMilField().getActionMap().put("nextField", new MoveToAction(this.view.getQuinientosField()));
this.view.getQuinientosField().getActionMap().put("nextField", new MoveToAction(this.view.getCienField()));
this.view.getCienField().getActionMap().put("nextField", new MoveToAction(this.view.getCincuentaField()));
this.view.getCincuentaField().getActionMap().put("nextField", new MoveToAction(this.view.getDiezField()));
this.view.getDiezField().getActionMap().put("save", new GuardarEfectivoAction());
this.view.getChequesField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getTarjetasField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "nextField");
this.view.getRetiroField().getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ENTER"), "save");
this.view.getChequesField().getActionMap().put("nextField", new MoveToAction(this.view.getTarjetasField()));
this.view.getTarjetasField().getActionMap().put("nextField", new MoveToAction(this.view.getRetiroField()));
this.view.getRetiroField().getActionMap().put("save", new GuardarDocumentosAction());
this.view.getGuardarEfectivoButton().addActionListener(e -> {
this.guardarEfectivoActionListener();
});
this.view.getGuardarDocumentosButton().addActionListener(e -> {
this.guardarEfectivoActionListener();
});
this.view.getCalcularFondoButton().addActionListener(e -> {
this.calcularFondoActionListener();
});
moveTo(this.view.getVeinteMilField(), this.view.getDiezMilField());
moveTo(this.view.getDiezMilField(), this.view.getCincoMilField());
moveTo(this.view.getCincoMilField(), this.view.getDosMilField());
moveTo(this.view.getDosMilField(), this.view.getMilField());
moveTo(this.view.getMilField(), this.view.getQuinientosField());
moveTo(this.view.getQuinientosField(), this.view.getCienField());
moveTo(this.view.getCienField(), this.view.getCincuentaField());
moveTo(this.view.getCincuentaField(), this.view.getDiezField());
doAction(this.view.getDiezField(), "save", KeyStroke.getKeyStroke("ENTER"), e -> this.guardarEfectivoActionListener());
moveTo(this.view.getChequesField(), this.view.getTarjetasField());
moveTo(this.view.getTarjetasField(), this.view.getRetiroField());
doAction(this.view.getRetiroField(), "save", KeyStroke.getKeyStroke("ENTER"), e -> this.guardarDocumentosActionListener());
this.view.getGuardarEfectivoButton().addActionListener(e -> this.guardarEfectivoActionListener());
this.view.getGuardarDocumentosButton().addActionListener(e -> this.guardarEfectivoActionListener());
this.view.getCalcularFondoButton().addActionListener(e -> this.calcularFondoActionListener());
}
/**