Example #1
0
 private void doReport(Discapacidad o) throws MissingReportException, JRException {
   Reportes r =
       new Reportes(
           DAO.getJDBCConnection(),
           SGD.getResources().getString("report.codigobarra"),
           "Archivo " + o.getClass().getSimpleName() + " N" + o.getBarcode());
   r.addParameter("TABLA", o.getClass().getSimpleName());
   r.addParameter("ID_TABLA", o.getId());
   r.viewReport();
 }
Example #2
0
 private void setEntity(boolean cerrarYPrecintar) throws MessageException {
   if (entity.getDetalle() == null || entity.getDetalle().isEmpty()) {
     throw new MessageException(
         "Debe contener al menos un detalle (No vas a mandar la caja vacía..)");
   }
   if (cerrarYPrecintar) {
     List<String> codigoPrecintos = SGDUtilities.initPrecintosUI(customABMJDialog);
     if (codigoPrecintos.isEmpty()) {
       throw new MessageException(SGD.getResources().getString("cargaprecintoscancelada"));
     }
     for (String codigo : codigoPrecintos) {
       entity.getPrecintos().add(new DiscapacidadPrecinto(codigo, entity));
     }
   }
   if (entity.getId() == null) {
     @SuppressWarnings("unchecked")
     ComboBoxWrapper<UsuarioSector> cb =
         (ComboBoxWrapper<UsuarioSector>) abmPanel.getCbInstitucion().getSelectedItem();
     entity.setInstitucion(cb.getEntity().getInstitucion());
     entity.setSector(cb.getEntity().getSector());
     entity.setUsuario(UsuarioController.getCurrentUser());
   }
 }
Example #3
0
 @Override
 public void actionPerformed(ActionEvent e) {
   System.out.println(e.toString());
   System.out.println(customABMJDialog != null ? customABMJDialog.isActive() : "NO");
   if (customABMJDialog != null && customABMJDialog.isActive()) {
     if (e.getSource().getClass().equals(JButton.class)) {
       System.out.println("acá también..");
       if (e.getSource().equals(customABMJDialog.getBtnAceptar())) {
         crearArchivo(false);
       } else if (e.getSource().equals(customABMJDialog.getBtnExtraBottom())) {
         crearArchivo(true);
       } else if (e.getSource().equals(customABMJDialog.getBtnCancelar())) {
         btnCancelarAction();
       } else if (e.getSource().equals(customABMJDialog.getBtnNuevo())) {
         btnNuevoAction();
       } else if (e.getSource().equals(customABMJDialog.getBtnEditar())) {
         try {
           if (entity == null || entity.getId() == null) {
             throw new MessageException(
                 "No a seleccionado ninguna caja"
                     + "\nUtilice el buscador para seleccionar la que desea modificar.");
           }
           if (entity.getRecibo() != null) {
             throw new MessageException(
                 SGD.getResources()
                     .getString("recibonotnull")
                     .replaceAll("<Sector>", sectorUI.toString()));
           }
           if (!entity.getPrecintos().isEmpty()) {
             if (SGDUtilities.confirmarReAperturaDeArchivo()) {
               removePrecintos(entity);
             } else {
               return;
             }
           }
           customABMJDialog.setPanelComponentsEnabled(true);
           customABMJDialog.setEnabledBottomButtons(true);
           abmPanel.getCbInstitucion().setEnabled(false);
         } catch (MessageException ex) {
           ex.displayMessage(customABMJDialog);
         }
       } else if (e.getSource().equals(customABMJDialog.getBtnBuscar())) {
         initBuscador();
         if (buscador.isEligio()) {
           customABMJDialog.setPanelComponentsEnabled(false);
           customABMJDialog.setEnabledBottomButtons(false);
           setPanelABM(entity);
         }
       } else if (e.getSource().equals(customABMJDialog.getBtnBorrar())) {
         customABMJDialog.showMessage(
             "¡No implementado aún!", "Advertencia", JOptionPane.WARNING_MESSAGE);
       } else if (e.getSource().equals(abmPanel.getBtnAgregar())) {
         try {
           DiscapacidadDetalle detalle = getDetalle(abmPanel.getData());
           checkConstraints(detalle);
           entity.getDetalle().add(detalle);
           cargarTablaDetalle(detalle);
           abmPanel.resetUI(false);
           abmPanel.getCbTipoDocumento().requestFocusInWindow();
         } catch (MessageException ex) {
           customABMJDialog.showMessage(ex.getMessage(), "Error", JOptionPane.WARNING_MESSAGE);
         }
       } else if (e.getSource().equals(abmPanel.getBtnQuitar())) {
         borrarDetalle();
       } else if (e.getSource().equals(abmPanel.getBtnPrecintos())) {
         if (entity != null) {
           if (!entity.getPrecintos().isEmpty()) {
             SGDUtilities.initPrecintosUI(customABMJDialog, entity.getPrecintos());
           } else {
             customABMJDialog.showMessage(
                 SGD.getResources().getString("unclosedEntityPrecintos"),
                 "Error",
                 JOptionPane.WARNING_MESSAGE);
           }
         }
       }
     }
   } else if (buscador != null && buscador.isActive()) {
     if (e.getSource().equals(buscador.getbBuscar())) {
       String jpql = armarQuery();
       List<DiscapacidadDetalle> list = jpaController.findDetalleByJPQL(jpql);
       if (list.isEmpty()) {
         JOptionPane.showMessageDialog(buscador, "La busqueda no produjo ningún resultado");
         return;
       }
       cargarTablaBuscador(list);
     }
   }
 }