/** Remove a message from the table */ public void removeRow(int row) { SOAPMonitorData soap = null; if (filter_data == null) { soap = (SOAPMonitorData) data.elementAt(row); data.remove(soap); } else { soap = (SOAPMonitorData) filter_data.elementAt(row); filter_data.remove(soap); data.remove(soap); } fireTableRowsDeleted(row, row); }
public static Vector expandFileList(String[] files, boolean inclDirs) { Vector v = new Vector(); if (files == null) return v; for (int i = 0; i < files.length; i++) v.add(new File(URLDecoder.decode(files[i]))); for (int i = 0; i < v.size(); i++) { File f = (File) v.get(i); if (f.isDirectory()) { File[] fs = f.listFiles(); for (int n = 0; n < fs.length; n++) v.add(fs[n]); if (!inclDirs) { v.remove(i); i--; } } } return v; }
/** Update a message */ public void updateData(SOAPMonitorData soap) { int row; if (filter_data == null) { // No filter, so just fire table updated row = data.indexOf(soap); if (row != -1) { fireTableRowsUpdated(row, row); } } else { // Check if the row was being displayed row = filter_data.indexOf(soap); if (row == -1) { // Row was not displayed, so check for if it // now needs to be displayed if (filterMatch(soap)) { int index = -1; row = data.indexOf(soap) + 1; while ((row < data.size()) && (index == -1)) { index = filter_data.indexOf(data.elementAt(row)); if (index != -1) { // Insert at this location filter_data.add(index, soap); } row++; } if (index == -1) { // Insert at end index = filter_data.size(); filter_data.addElement(soap); } fireTableRowsInserted(index, index); } } else { // Row was displayed, so check if it needs to // be updated or removed if (filterMatch(soap)) { fireTableRowsUpdated(row, row); } else { filter_data.remove(soap); fireTableRowsDeleted(row, row); } } } }