All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.JTreeSelectionModel
java.lang.Object
|
+----com.sun.java.swing.JTreeSelectionModel
- public class JTreeSelectionModel
- extends Object
- implements TreeSelectionModel
Implementation of TreeSelectionModel. Listeners are notified whenever
the paths in the selection change, not the rows. If you directly
add paths to an instance of this class the path may not be visible.
For this reason it is preferrable that you use the path manipulation
methods provided by JTree that insure the path is visible. In order
to be able to track row changes you may wish to become a listener
for expansion events on the tree and test for changes from there.
-
listSelectionModel
- Handles maintaining the list selection model.
-
rowMapper
- Provides a row for a given path.
-
selection
- Paths that are currently selected.
-
selectionListener
- Event multicaster.
-
JTreeSelectionModel()
-
-
addSelectionPath(JTreePath)
- Adds path to the current selection.
-
addSelectionPaths(JTreePath[])
- Adds paths to the current selection.
-
addTreeSelectionListener(TreeSelectionListener)
- Adds x to the list of listeners that are notified each time the
selection changes.
-
clearSelection()
- Empties the current selection.
-
getMaxSelectionRow()
- Gets the last selected row.
-
getMinSelectionRow()
- Gets the first selected row.
-
getRowMapper()
- Returns the RowMapper instance that is able to map a path to a
row.
-
getSelectionCount()
- Returns the number of paths that are selected.
-
getSelectionPath()
- Returns the first path in the selection.
-
getSelectionPaths()
- Returns the paths in the selection.
-
getSelectionRows()
- Returns all of the currently selected rows.
-
insureUniqueness()
- Insures that all the elements in path are unique.
-
isPathSelected(JTreePath)
- Returns true if the path, path, is in the current selection.
-
isRowSelected(int)
- Returns true if the row identitifed by row is selected.
-
isSelectionEmpty()
- Returns true if the selection is currently empty.
-
notifyPathChange(Vector)
- Notifies listeners of a change in path.
-
removeSelectionPath(JTreePath)
- Removes path from the selection.
-
removeSelectionPaths(JTreePath[])
- Removes paths from the selection.
-
removeTreeSelectionListener(TreeSelectionListener)
- Removes x from the list of listeners that are notified each time
the selection changes.
-
resetRowSelection()
- Recalculates what rows are selected by asking the RowMapper for the
row for each path.
-
setRowMapper(RowMapper)
- Sets the RowMapper instance.
-
setSelectionPath(JTreePath)
- Sets the selection to path.
-
setSelectionPaths(JTreePath[])
- Sets the selection to the paths in paths.
selection
public JTreePath selection[]
- Paths that are currently selected. Will be null if nothing is
currently selected.
selectionListener
protected TreeSelectionListener selectionListener
- Event multicaster.
rowMapper
protected RowMapper rowMapper
- Provides a row for a given path.
listSelectionModel
protected JListSelectionModel listSelectionModel
- Handles maintaining the list selection model.
JTreeSelectionModel
public JTreeSelectionModel()
setRowMapper
public void setRowMapper(RowMapper newMapper)
- Sets the RowMapper instance. This instance is used to determine
what row corresponds to what path.
getRowMapper
public RowMapper getRowMapper()
- Returns the RowMapper instance that is able to map a path to a
row.
setSelectionPath
public void setSelectionPath(JTreePath path)
- Sets the selection to path. If this represents a change, then
the PathSelectionListeners are notified.
- Parameters:
- path - new path to select
setSelectionPaths
public void setSelectionPaths(JTreePath paths[])
- Sets the selection to the paths in paths. If this represents a
change the PathSelectionListeners are notified. Potentially
paths will be held by the reciever, in other words don't change
any of the objects in the array once passed in.
- Parameters:
- paths - new selection.
addSelectionPath
public void addSelectionPath(JTreePath path)
- Adds path to the current selection. If path is not currently
in the selection the PathSelectionListeners are notified.
- Parameters:
- path - the new path to add to the current selection.
addSelectionPaths
public void addSelectionPaths(JTreePath paths[])
- Adds paths to the current selection. If any of the paths in
paths are not currently in the selection the PathSelectionListeners
are notified.
- Parameters:
- path - the new path to add to the current selection.
removeSelectionPath
public void removeSelectionPath(JTreePath path)
- Removes path from the selection. If path is in the selection
The PathSelectionListeners are notified.
- Parameters:
- path - the path to remove from the selection.
removeSelectionPaths
public void removeSelectionPaths(JTreePath paths[])
- Removes paths from the selection. If any of the paths in paths
are in the selection the PathSelectionListeners are notified.
- Parameters:
- path - the path to remove from the selection.
getSelectionPath
public JTreePath getSelectionPath()
- Returns the first path in the selection.
getSelectionPaths
public JTreePath[] getSelectionPaths()
- Returns the paths in the selection.
getSelectionCount
public int getSelectionCount()
- Returns the number of paths that are selected.
isPathSelected
public boolean isPathSelected(JTreePath path)
- Returns true if the path, path, is in the current selection.
isSelectionEmpty
public boolean isSelectionEmpty()
- Returns true if the selection is currently empty.
clearSelection
public void clearSelection()
- Empties the current selection. If this represents a change in the
current selection, the selection listeners are notified.
addTreeSelectionListener
public void addTreeSelectionListener(TreeSelectionListener x)
- Adds x to the list of listeners that are notified each time the
selection changes.
- Parameters:
- x - the new listener to be added.
removeTreeSelectionListener
public void removeTreeSelectionListener(TreeSelectionListener x)
- Removes x from the list of listeners that are notified each time
the selection changes.
- Parameters:
- x - the listener to remove.
getSelectionRows
public int[] getSelectionRows()
- Returns all of the currently selected rows.
getMinSelectionRow
public int getMinSelectionRow()
- Gets the first selected row.
getMaxSelectionRow
public int getMaxSelectionRow()
- Gets the last selected row.
isRowSelected
public boolean isRowSelected(int row)
- Returns true if the row identitifed by row is selected.
resetRowSelection
public void resetRowSelection()
- Recalculates what rows are selected by asking the RowMapper for the
row for each path.
notifyPathChange
protected void notifyPathChange(Vector changedPaths)
- Notifies listeners of a change in path.
insureUniqueness
protected void insureUniqueness()
- Insures that all the elements in path are unique. This does not
check for a null selection!
All Packages Class Hierarchy This Package Previous Next Index