/** 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);
 }
Exemplo n.º 2
0
 public void handle(Throwable exception) {
   try {
     if (exception instanceof NullPointerException) {
       synchronized (lock) {
         JTable table = ui.getList();
         DefaultTableModel model = (DefaultTableModel) table.getModel();
         Vector<?> data = model.getDataVector();
         for (int i = 0; i < data.size(); i++) {
           Object row = data.get(i);
           if (row == null) data.remove(i);
         }
       }
     }
     exception.printStackTrace();
   } catch (Throwable exception2) {
     exception.printStackTrace();
   }
 }
 /** 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);
       }
     }
   }
 }
 /** Reaction to Add/Delete buttons. */
 public void actionPerformed(ActionEvent e) {
   String cmd = e.getActionCommand();
   if (cmdAdd.equals(cmd)) {
     Zone z = ((ControllerSWARM) controller).new Zone();
     Vector<AbstractNetworkElement> ml =
         ((AbstractControllerComplex) controller).getMyMonitor().getPredecessors();
     Vector<AbstractNetworkElement> cl =
         ((AbstractControllerComplex) controller).getMyMonitor().getSuccessors();
     if (ml.size() > 0) z.bottleneck = (AbstractLinkHWC) ml.firstElement();
     if (cl.size() > 0) {
       z.setFromOnramp((AbstractLinkHWC) cl.firstElement());
       z.setToOnramp((AbstractLinkHWC) cl.firstElement());
     }
     z.initialize();
     zones.add(z);
     zoneTM.fireTableStructureChanged();
     setUpBottleneckColumn();
     setUpFromOnrampColumn();
     setUpToOnrampColumn();
   }
   if (cmdDelete.equals(cmd)) {
     try {
       int[] selected = zonetab.getSelectedRows();
       if ((selected != null) && (selected.length > 0))
         for (int i = 0; i < selected.length; i++) {
           int idx = selected[i] - i;
           if ((idx >= 0) && (idx < zones.size())) {
             zones.remove(idx);
             zoneTM.fireTableStructureChanged();
             setUpBottleneckColumn();
             setUpFromOnrampColumn();
             setUpToOnrampColumn();
           }
         }
     } catch (Exception ex) {
     }
   }
   return;
 }
Exemplo n.º 5
0
 /**
  * removeRowData
  *
  * @param row int
  */
 public void removeRowData(int row) {
   if (rowData.size() > row && row >= 0) {
     rowData.remove(row);
   }
   fireTableDataChanged();
 }
Exemplo n.º 6
0
 /** Remove an existing listener of document change events. */
 public void removeDocumentChangeListener(DocumentChangeListener l) {
   if (l != null) dc_listeners.remove(l);
 }