void dispose() { if (swingEventList != null) { swingEventList.dispose(); } threadSafeList.dispose(); readOnlyList.dispose(); }
/** * 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); }
/** 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); } }
/** 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; }
/** 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; }
/** 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; }
protected void clearFileDescs() { threadSafeList.clear(); }
protected void removeFileDesc(FileDesc fd) { LocalFileItem item = (LocalFileItem) fd.getClientProperty(FILE_ITEM_PROPERTY); threadSafeList.remove(item); }
/** Adds <code>fd</code> as {@link LocalFileItem} to this list. */ protected void addFileDesc(FileDesc fd) { threadSafeList.add(getOrCreateLocalFileItem(fd)); }
@Override public int size() { return threadSafeList.size(); }