Пример #1
0
 private void borrarDetalle() {
   int[] selectedRows = abmPanel.getjTable1().getSelectedRows();
   for (int ii = 0; ii < selectedRows.length; ii++) {
     int selectedRow = selectedRows[ii];
     DefaultTableModel dtm = (DefaultTableModel) abmPanel.getjTable1().getModel();
     DiscapacidadDetalle candidate = (DiscapacidadDetalle) dtm.getValueAt(selectedRow, 0);
     DiscapacidadDetalle removed = null;
     for (int i = 0; i < entity.getDetalle().size(); i++) {
       DiscapacidadDetalle ad = entity.getDetalle().get(i);
       if (candidate.getId() != null && candidate.getId().equals(ad.getId())) {
         removed = entity.getDetalle().remove(i);
       } else if (candidate.getId() == null
           && ad.getId() == null
           && candidate.getOrderIndex().equals(ad.getOrderIndex())) {
         removed = entity.getDetalle().remove(i);
       }
     }
     LOG.debug("borrando.. " + selectedRow + ", " + removed);
     dtm.removeRow(selectedRow);
   }
 }
Пример #2
0
 private void cargarTablaBuscador(List<DiscapacidadDetalle> list) {
   DefaultTableModel dtm = buscador.getDtm();
   dtm.setRowCount(0);
   for (DiscapacidadDetalle detalle : list) {
     dtm.addRow(
         new Object[] {
           detalle.getDiscapacidad(),
           detalle.getTipoDocumento().getNombre(),
           detalle.getSubTipoDocumento() != null
               ? detalle.getSubTipoDocumento().getNombre()
               : null,
           detalle.getDocumentoNumero(),
           detalle.getDocumentoFecha() == null
               ? null
               : UTIL.DATE_FORMAT.format(detalle.getDocumentoFecha()),
           Objects.toString(detalle.getApellido(), "")
               + " "
               + Objects.toString(detalle.getNombre(), ""),
           detalle.getPeriodoYear(),
           detalle.getObservacion(),
           detalle.getDiscapacidad().getBarcode(),
           detalle.getDiscapacidad().getPrecintos().isEmpty()
               ? "No"
               : "Si " + detalle.getDiscapacidad().getPrecintos().size(),
           detalle.getDiscapacidad().getRecibo() != null
               ? detalle.getDiscapacidad().getRecibo().getNumero()
               : null
         });
   }
 }
Пример #3
0
 private void cargarTablaDetalle(DiscapacidadDetalle detalle) {
   DefaultTableModel dtm = (DefaultTableModel) abmPanel.getjTable1().getModel();
   dtm.addRow(
       new Object[] {
         detalle,
         detalle.getTipoDocumento().getNombre(),
         detalle.getSubTipoDocumento() != null ? detalle.getSubTipoDocumento().getNombre() : null,
         detalle.getDocumentoNumero(),
         (detalle.getDocumentoFecha() != null
             ? UTIL.DATE_FORMAT.format(detalle.getDocumentoFecha())
             : null),
         (detalle.getApellido() == null ? "" : detalle.getApellido())
             + " "
             + (detalle.getNombre() == null ? "" : detalle.getNombre()),
         detalle.getPeriodoYear(),
         detalle.getObservacion()
       });
 }
Пример #4
0
 private void checkConstraints(DiscapacidadDetalle toAdd) throws MessageException {
   if (toAdd.getPeriodoYear() == null) {
     throw new MessageException("Número de carpeta no válida");
   }
   DefaultTableModel dtm = (DefaultTableModel) abmPanel.getjTable1().getModel();
   for (int row = 0; row < dtm.getRowCount(); row++) {
     DiscapacidadDetalle oldDiscapacidadDetalle = (DiscapacidadDetalle) dtm.getValueAt(row, 0);
     if (oldDiscapacidadDetalle.getTipoDocumento().equals(toAdd.getTipoDocumento())
         && Objects.equals(
             oldDiscapacidadDetalle.getSubTipoDocumento(), toAdd.getSubTipoDocumento())
         && Objects.equals(oldDiscapacidadDetalle.getDocumentoNumero(), toAdd.getDocumentoNumero())
         && Objects.equals(oldDiscapacidadDetalle.getPeriodoYear(), toAdd.getPeriodoYear())
         && Objects.equals(oldDiscapacidadDetalle.getNombre(), toAdd.getNombre())
         && Objects.equals(oldDiscapacidadDetalle.getApellido(), toAdd.getApellido())) {
       throw new MessageException(
           "Ya existe un detalle con los mismos datos:"
               + "\nTipo de Documento: "
               + toAdd.getTipoDocumento().getNombre()
               + "\nSub-Tipo de Documento: "
               + (toAdd.getSubTipoDocumento() == null
                   ? "<Sin Sub-Tipo>"
                   : toAdd.getSubTipoDocumento().getNombre())
               + "\nN° Documento: "
               + Objects.toString(toAdd.getDocumentoNumero(), "")
               + "\nPeriodo: "
               + Objects.toString(toAdd.getPeriodoYear(), "")
               + "\nNombre: "
               + (toAdd.getApellido() == null ? "" : toAdd.getApellido() + ", ")
               + (Objects.toString(toAdd.getNombre(), "")));
     }
   }
 }