I have a table that is full of information, before sending a request select the rows I want to send, when I have finished selecting the rows I click on the send button (it is sent correctly).
What I want is that when the rows are sent out a single message where I indicate the documents that have been sent, I have been trying with the following code but I get a separate sending message and I do not get a single message tell me the documents that have been sent.
public static String[] documentos;
protected void btnEnviarActionPerformed(ActionEvent e) {
int[] selectedRow = tbDocSolicitud.getSelectedRows();
int i = tbDocSolicitud.getSelectedRow();
if (i == -1){
JOptionPane.showMessageDialog(null,"Seleccione los documentos que desea solicitar");
}
else{
for(int t : selectedRow){
String codArchivo = (String) tbDocSolicitud.getValueAt(t, 0);
String codCentroCosto = (String) tbDocSolicitud.getValueAt(t, 1);
String tipoArchivo = (String) tbDocSolicitud.getValueAt(t, 4);
String doc = (String) tbDocSolicitud.getValueAt(t, 6).toString().trim();
String nivelArchivo = (String) tbDocSolicitud.getValueAt(t, 7);
String lote = (String) tbDocSolicitud.getValueAt(t, 9);
String fila = (String) tbDocSolicitud.getValueAt(t, 10);
String usuarioSolicita = Constante.idUsuario;
Objeto object = (Objeto) cboCentroCostoDestino.getSelectedItem();
String centroCostoDestino = ((Objeto)object).getCodigo();
String centroCostoOrigen = Constante.c_ccosto;
if (centroCostoDestino.equals("0")){
JOptionPane.showMessageDialog(null, "Seleccione el Destino del Documento","Alerta",JOptionPane.WARNING_MESSAGE);
cboCentroCostoDestino.requestFocus();
return;
}
else{
MovimientoArchivoDTO m = new MovimientoArchivoDTO();
m.setC_c_archivo(codArchivo);
CentroCostoDTO c = new CentroCostoDTO();
c.setC_ccosto(codCentroCosto);
m.setC_ccosto(c);
m.setC_ccosto_origen(centroCostoOrigen);
m.setC_ccosto_destino(centroCostoDestino);
m.setC_tipo_doc(tipoArchivo);
m.setC_t_doc(doc);
m.setC_c_nivel_archivo(nivelArchivo);
m.setLote(lote);
m.setFila(fila);
m.setC_c_usuario_solicita(usuarioSolicita);
int estado = x.RegistrarSolicitud_SA(m);
if (estado == 1){
//JOptionPane.showMessageDialog(null,"Se mandó el Documento:"+" "+doc);
documentos = doc.split(" ");
String notificacion = "Se mandaron los siguientes documentos:\n";
for (String value : documentos) {
notificacion = notificacion + "-" + value + "\n";
System.out.println(value);
}
JOptionPane.showMessageDialog(null, new Object[] { notificacion }, "Solicitud Enviada", 1, null);
}
else
mensaje("Error en enviar");
}
}
ListarDocumentoSA(estado_flg);
}
}
These images are the messages that come to me for each document that has been sent, but what I want is that the documents that have been sent appear in a single message.