コード例 #1
0
 /** Find the row in the table for a given message id */
 public int findRow(SOAPMonitorData soap) {
   int row = -1;
   if (filter_data != null) {
     row = filter_data.indexOf(soap);
   } else {
     row = data.indexOf(soap);
   }
   return row;
 }
コード例 #2
0
 /** 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);
       }
     }
   }
 }
コード例 #3
0
ファイル: DataContainer.java プロジェクト: rakyll/plantuml
 /**
  * Returns the index of the specified element.
  *
  * @param element Element to be looked for.
  * @return -1 if not found.
  */
 public int getIndexOf(DataElement element) {
   return _container.indexOf(element);
 }