I am developing a Java application.
I have created a GUI for creating an object, but I want to begin constructing it, then pass it to other GUI to finish the construction, before storing it in the database.
This is a class that I call the Selector:
private void aceptar() throws Exception {
Comprobante comprobanteOperaciones = new Comprobante();
if (partidas.size() > 0) {
comprobanteOperaciones.setPartidas(partidas);
comprobanteOperaciones.setFechaOperaciones(dialog.getTxtFechaOperaciones().getDate());
comprobanteOperaciones.setDescripcion(generarDescripcion());
new ComprobanteOperacionesRegistrarController(dialog, securityFacade, comprobanteOperaciones).openDialog();
} else {
throw new Exception("No hay partidas seleccionadas");
}
}
Then I create the object and I set some of the attributes, before sending it to the other class, that I call Register:
public class ComprobanteOperacionesRegistrarController{
private Comprobante comprobanteOperaciones;
public ComprobanteOperacionesRegistrarController(Window window,
SeguridadFacade seguridadFacade, Comprobante comprobante) throws Exception {
super(new UI_ComprobanteOperacionesRegistrar(window), seguridadFacade);
this.comprobanteOperaciones = comprobante;
}
@Override
protected void initialize() throws Exception {
operacionesFacade = OperacionesFacade.getInstance();
configuracionFacade = ConfiguracionFacade.getInstance();
reportesFacade = ReportesFacade.getInstance();
tableOperacionesModel = (DefaultTableModel) dialog.getTableOperaciones().getModel();
dialog.getBtnCancelar().addActionListener(this);
dialog.getBtnImprimir().addActionListener(this);
dialog.getTxtFechaOperaciones().addPropertyChangeListener(
new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
llenarPartidasParcial();
}
}
);
llenarNoComprobante();
llenarDatosComprobante();
llenarPartidasParcial();
}
...
When I debug the app, I added breakpoints before and after sending the object to the other class.
Before sending the object, it is filled with the information and the object is created. When I go to the next breakpoint:
this.comprobanteOperaciones = comprobante;
But when I evaluate the object there, it's null.