javax.swing.tree
Class DefaultTreeSelectionModel
- Cloneable, Serializable, TreeSelectionModel
DefaultTreeSelectionModel
- Serialized Form
clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
leadIndex
protected int leadIndex
The index of the last added path.
leadRow
protected int leadRow
The row of the last added path according to the RowMapper.
selectionMode
protected int selectionMode
The current selection mode.
addSelectionPath
public void addSelectionPath(TreePath path)
Adds a path to the list of selected paths. This method checks if the path
is already selected and doesn't add the same path twice.
If this changes the selection the registered TreeSelectionListeners are
notified.
- addSelectionPath in interface TreeSelectionModel
path
- the path to add to the selection
addSelectionPaths
public void addSelectionPaths(TreePath paths)
Adds the paths to the list of selected paths. This method checks if the
paths are already selected and doesn't add the same path twice.
If this changes the selection the registered TreeSelectionListeners are
notified.
paths
- the paths to add to the selection
arePathsContiguous
protected boolean arePathsContiguous(TreePath paths)
Returns true
if the paths are contiguous or we have no
RowMapper assigned.
paths
- the paths to check for continuity
true
if the paths are contiguous or we have no
RowMapper assigned
canPathsBeAdded
protected boolean canPathsBeAdded(TreePath paths)
Checks if the paths can be added. This returns
true
if:
paths
is null
or empty
- we have no RowMapper assigned
- nothing is currently selected
- selectionMode is
DefaultTreeSelectionModel
- adding the paths to the selection still results in a contiguous set
of paths
paths
- the paths to check
true
if the paths can be added with respect to the
selectionMode
canPathsBeRemoved
protected boolean canPathsBeRemoved(TreePath paths)
Checks if the paths can be removed without breaking the continuity of the
selection according to selectionMode.
paths
- the paths to check
true
if the paths can be removed with respect to
the selectionMode
getListeners
public EventListener[] getListeners(Class listenerType)
Returns all added listeners of a special type.
listenerType
- the listener type
- an array of listeners
- 1.3
insureRowContinuity
protected void insureRowContinuity()
Makes sure the currently selected paths are valid according to the
current selectionMode.
If the selectionMode is set to DefaultTreeSelectionModel
and the
selection isn't contiguous then the selection is reset to the first set
of contguous paths.
If the selectionMode is set to DefaultTreeSelectionModel
and the
selection has more than one path, the selection is reset to the contain
only the first path.
isRowSelected
public boolean isRowSelected(int row)
Checks if a particular row is selected.
- isRowSelected in interface TreeSelectionModel
row
- the index of the row to check
true
if the row is in this selection,
false
otherwise
removeSelectionPaths
public void removeSelectionPaths(TreePath paths)
Removes the paths from the selection.
If this changes the selection the registered TreeSelectionListeners are
notified.
paths
- the paths to remove
setSelectionMode
public void setSelectionMode(int mode)
Sets the current selection mode. Possible values are
DefaultTreeSelectionModel
, DefaultTreeSelectionModel
and
DefaultTreeSelectionModel
.
- setSelectionMode in interface TreeSelectionModel
mode
- the selection mode to be set
getSelectionMode()
, DefaultTreeSelectionModel
, DefaultTreeSelectionModel
, DefaultTreeSelectionModel
setSelectionPaths
public void setSelectionPaths(TreePath paths)
Sets the paths as selection. This method checks for duplicates and
removes them.
If this changes the selection the registered TreeSelectionListeners are
notified.
paths
- the paths to set as selection
toString
public String toString()
Returns a string that shows this object's properties.
- toString in interface Object
- a string that shows this object's properties
updateLeadIndex
protected void updateLeadIndex()
Updates the lead index instance field.
DefaultTreeSelectionModel.java
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.