/** Listener to handle table selection changes */ public void valueChanged(ListSelectionEvent e) { int row = table.getSelectedRow(); // Check if they selected a specific row if (row > 0) { remove_button.setEnabled(true); } else { remove_button.setEnabled(false); } // Check for "most recent" selection if (row == 0) { row = model.getRowCount() - 1; if (row == 0) { row = -1; } } if (row == -1) { // Clear the details panel details_time_value.setText(""); details_target_value.setText(""); details_status_value.setText(""); request_text.setText(""); response_text.setText(""); } else { // Show the details for the row SOAPMonitorData soap = model.getData(row); details_time_value.setText(soap.getTime()); details_target_value.setText(soap.getTargetService()); details_status_value.setText(soap.getStatus()); if (soap.getSOAPRequest() == null) { request_text.setText(""); } else { request_text.setText(soap.getSOAPRequest()); request_text.setCaretPosition(0); } if (soap.getSOAPResponse() == null) { response_text.setText(""); } else { response_text.setText(soap.getSOAPResponse()); response_text.setCaretPosition(0); } } }
/** Get value at (part of table model interface) */ public Object getValueAt(int row, int col) { SOAPMonitorData soap; String value = null; soap = (SOAPMonitorData) data.elementAt(row); if (filter_data != null) { soap = (SOAPMonitorData) filter_data.elementAt(row); } switch (col) { case 0: value = soap.getTime(); break; case 1: value = soap.getTargetService(); break; case 2: value = soap.getStatus(); break; } return value; }