API Overview API Index Package Overview Direct link to this page
JDK 1.6
  javax.swing.tree. DefaultTreeSelectionModel View Source
Author(s)
Scott Violet
Since
Version
1.51 11/17/05
Serial
Hierarchy
 Object
      DefaultTreeSelectionModel
Implements
 Cloneable
 Serializable
 TreeSelectionModel
Subclasses
Description
public class DefaultTreeSelectionModel
  Default implementation of TreeSelectionModel.
See also:    JTree
Constructors
public DefaultTreeSelectionModel ()
Creates a new instance of DefaultTreeSelectionModel that is empty, with a selection mode of DISCONTIGUOUS_TREE_SELECTION.
Methods
Hide/Show inherited methods
publicsynchronized void addPropertyChangeListener (PropertyChangeListener listener) [Specified in TreeSelectionModel]
  Adds a PropertyChangeListener to the listener list.
public void addSelectionPath (TreePath path) [Specified in TreeSelectionModel]
  Adds path to the current selection.
public void addSelectionPaths (TreePath paths) [Specified in TreeSelectionModel]
  Adds paths to the current selection.
public void addTreeSelectionListener (TreeSelectionListener x) [Specified in TreeSelectionModel]
  Adds x to the list of listeners that are notified each time the set of selected TreePaths changes.
protected boolean arePathsContiguous (TreePath paths)
Returns true if the paths are contiguous, or this object has no RowMapper.
protected boolean canPathsBeAdded (TreePath paths)
  Used to test if a particular set of TreePaths can be added.
protected boolean canPathsBeRemoved (TreePath paths)
  Returns true if the paths can be removed without breaking the continuity of the model.
public void clearSelection () [Specified in TreeSelectionModel]
  Empties the current selection.
public Object clone () throws CloneNotSupportedException
  Returns a clone of this object with the same selection.
protected void fireValueChanged (TreeSelectionEvent e)
  Notifies all listeners that are registered for tree selection events on this object.
public TreePath getLeadSelectionPath () [Specified in TreeSelectionModel]
  Returns the last path that was added.
public int getLeadSelectionRow () [Specified in TreeSelectionModel]
  Returns the lead selection index.
public T getListeners (Class< T> listenerType)
  Returns an array of all the objects currently registered as FooListeners upon this model.
public int getMaxSelectionRow () [Specified in TreeSelectionModel]
  Returns the largest value obtained from the RowMapper for the current set of selected TreePaths.
public int getMinSelectionRow () [Specified in TreeSelectionModel]
  Returns the smallest value obtained from the RowMapper for the current set of selected TreePaths.
public PropertyChangeListener getPropertyChangeListeners ()
  Returns an array of all the property change listeners registered on this DefaultTreeSelectionModel.
public RowMapper getRowMapper () [Specified in TreeSelectionModel]
Returns the RowMapper instance that is able to map a TreePath to a row.
public int getSelectionCount () [Specified in TreeSelectionModel]
Returns the number of paths that are selected.
public int getSelectionMode () [Specified in TreeSelectionModel]
Returns the selection mode, one of SINGLE_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION or CONTIGUOUS_TREE_SELECTION.
public TreePath getSelectionPath () [Specified in TreeSelectionModel]
  Returns the first path in the selection.
public TreePath getSelectionPaths () [Specified in TreeSelectionModel]
  Returns the paths in the selection.
public int getSelectionRows () [Specified in TreeSelectionModel]
  Returns all of the currently selected rows.
public TreeSelectionListener getTreeSelectionListeners ()
  Returns an array of all the tree selection listeners registered on this model.
protected void insureRowContinuity ()
  Makes sure the currently selected TreePaths are valid for the current selection mode.
protected void insureUniqueness ()
  This method is obsolete and its implementation is now a noop.
public boolean isPathSelected (TreePath path) [Specified in TreeSelectionModel]
Returns true if the path, path, is in the current selection.
public boolean isRowSelected (int row) [Specified in TreeSelectionModel]
Returns true if the row identified by row is selected.
public boolean isSelectionEmpty () [Specified in TreeSelectionModel]
Returns true if the selection is currently empty.
protected void notifyPathChange (Vector<PathPlaceHolder> changedPaths, TreePath oldLeadSelection)
  Notifies listeners of a change in path.
publicsynchronized void removePropertyChangeListener (PropertyChangeListener listener) [Specified in TreeSelectionModel]
  Removes a PropertyChangeListener from the listener list.
public void removeSelectionPath (TreePath path) [Specified in TreeSelectionModel]
  Removes path from the selection.
public void removeSelectionPaths (TreePath paths) [Specified in TreeSelectionModel]
  Removes paths from the selection.
public void removeTreeSelectionListener (TreeSelectionListener x) [Specified in TreeSelectionModel]
  Removes x from the list of listeners that are notified each time the set of selected TreePaths changes.
public void resetRowSelection () [Specified in TreeSelectionModel]
  Updates this object's mapping from TreePath to rows.
public void setRowMapper (RowMapper newMapper) [Specified in TreeSelectionModel]
  Sets the RowMapper instance.
public void setSelectionMode (int mode) [Specified in TreeSelectionModel]
  Sets the selection model, which must be one of SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.
public void setSelectionPath (TreePath path) [Specified in TreeSelectionModel]
  Sets the selection to path.
public void setSelectionPaths (TreePath pPaths) [Specified in TreeSelectionModel]
  Sets the selection to the paths in paths.
public String toString ()
  Returns a string that displays and identifies this object's properties.
protected void updateLeadIndex ()
Updates the leadIndex instance variable.
Fields
Hide/Show inherited fields
protected SwingPropertyChangeSupport changeSupport
Used to messaged registered listeners.
publicfinalstatic int CONTIGUOUS_TREE_SELECTION = "2" [Inherited From TreeSelectionModel]
  Selection can only be contiguous.
publicfinalstatic int DISCONTIGUOUS_TREE_SELECTION = "4" [Inherited From TreeSelectionModel]
Selection can contain any number of items that are not necessarily contiguous.
protected int leadIndex
Index of the lead path in selection.
protected TreePath leadPath
Last path that was added.
protected int leadRow
Lead row.
protected EventListenerList listenerList
Event listener list.
protected DefaultListSelectionModel listSelectionModel
  Handles maintaining the list selection model.
protectedtransient RowMapper rowMapper
Provides a row for a given path.
protected TreePath selection
  Paths that are currently selected.
publicfinalstatic String SELECTION_MODE_PROPERTY = "selectionMode"
Property name for selectionMode.
protected int selectionMode
Mode for the selection, will be either SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.
publicfinalstatic int SINGLE_TREE_SELECTION = "1" [Inherited From TreeSelectionModel]
Selection can only contain one path at a time.
Nested Classes
Generated By: JavaOnTracks Doclet 0.1.4     ©Thibaut Colar