コード例 #1
0
 void dispose() {
   if (swingEventList != null) {
     swingEventList.dispose();
   }
   threadSafeList.dispose();
   readOnlyList.dispose();
 }
コード例 #2
0
 /**
  * Adds all <code>fileDescs</code> as {@link LocalFileItem} to this list.
  *
  * <p>Caller is responsible for locking the iterable.
  */
 protected void addAllFileDescs(Iterable<FileDesc> fileDescs) {
   List<LocalFileItem> fileItems = new ArrayList<LocalFileItem>();
   for (FileDesc fileDesc : fileDescs) {
     fileItems.add(getOrCreateLocalFileItem(fileDesc));
   }
   threadSafeList.addAll(fileItems);
 }
コード例 #3
0
 /** Notification that meta information has changed in the filedesc. */
 protected void updateFileDesc(FileDesc fd) {
   LocalFileItem item = (LocalFileItem) fd.getClientProperty(FILE_ITEM_PROPERTY);
   if (item != null) {
     threadSafeList.getReadWriteLock().writeLock().lock();
     try {
       int idx = threadSafeList.indexOf(item);
       if (idx > 0) {
         threadSafeList.set(idx, item);
       } else {
         LOG.warnf(
             "Attempted to update FD w/ LocalFileItem that is not in list anymore. Item {0}",
             item);
       }
     } finally {
       threadSafeList.getReadWriteLock().writeLock().unlock();
     }
   } else {
     LOG.warnf("Attempted to update FD without LocalFileItem, FD {0}", fd);
   }
 }
コード例 #4
0
  /** Returns an array of the selected connections. */
  public ConnectionItem[] getSelectedConnections() {
    // Get selected rows.
    int[] rows = getSelectedRows();

    // Create result array.
    ConnectionItem[] items = new ConnectionItem[rows.length];
    for (int i = 0; i < rows.length; i++) {
      items[i] = connectionList.get(convertRowIndexToModel(rows[i]));
    }

    // Return result array.
    return items;
  }
コード例 #5
0
  /** Clears the data model and releases resources used by the event list. */
  public void clearEventList() {
    // Get table model and dispose resources.
    TableModel tableModel = getModel();
    if (tableModel instanceof DefaultEventTableModel) {
      ((DefaultEventTableModel) tableModel).dispose();
    }

    // Set default model to remove old reference.
    setModel(new DefaultTableModel());

    // Dispose connection list.
    connectionList.dispose();
    connectionList = null;
  }
コード例 #6
0
  /** Returns the tooltip text at the location of the specified mouse event. */
  @Override
  public String getToolTipText(MouseEvent e) {
    Point p = e.getPoint();
    int row = rowAtPoint(p);
    int col = columnAtPoint(p);

    // Get tooltip text if action is enabled.
    if (Boolean.TRUE.equals(tooltipsAction.getValue(Action.SELECTED_KEY)) && (row >= 0)) {
      // Get connection item and tooltip text array.
      ConnectionItem item = connectionList.get(convertRowIndexToModel(row));
      tipArray = tableFormat.getToolTipArray(item);

      // Return row/col text so tooltip manager will create new tooltip
      // for each table cell.
      return (row + "," + col);
    }

    // Reset tooltip array and return null.
    tipArray = new String[0];
    return null;
  }
コード例 #7
0
 protected void clearFileDescs() {
   threadSafeList.clear();
 }
コード例 #8
0
 protected void removeFileDesc(FileDesc fd) {
   LocalFileItem item = (LocalFileItem) fd.getClientProperty(FILE_ITEM_PROPERTY);
   threadSafeList.remove(item);
 }
コード例 #9
0
 /** Adds <code>fd</code> as {@link LocalFileItem} to this list. */
 protected void addFileDesc(FileDesc fd) {
   threadSafeList.add(getOrCreateLocalFileItem(fd));
 }
コード例 #10
0
 @Override
 public int size() {
   return threadSafeList.size();
 }