Class JTree.EmptySelectionModel
- All Implemented Interfaces:
Serializable, Cloneable, TreeSelectionModel
- Enclosing class:
JTree
protected static class JTree.EmptySelectionModel extends DefaultTreeSelectionModel
EmptySelectionModel is a TreeSelectionModel that does not allow anything to be selected. Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans has been added to the java.beans package. Please see XMLEncoder.
- Since:
- 1.2
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
protected static final JTree.EmptySelectionModel |
sharedInstance |
The single instance of EmptySelectionModel. |
Fields declared in class DefaultTreeSelectionModel
changeSupport, leadIndex, leadPath, leadRow, listenerList, listSelectionModel, rowMapper, selection, SELECTION_MODE_PROPERTY, selectionMode | Modifier and Type | Field | Description |
|---|---|---|
protected SwingPropertyChangeSupport |
changeSupport |
Used to messaged registered listeners. |
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. |
protected RowMapper |
rowMapper |
Provides a row for a given path. |
protected TreePath[] |
selection |
Paths that are currently selected. |
static final String |
SELECTION_MODE_PROPERTY |
Property name for selectionMode. |
protected int |
selectionMode |
Mode for the selection, will be either SINGLE_TREE_SELECTION, CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. |
Fields declared in interface TreeSelectionModel
CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION, SINGLE_TREE_SELECTION | Modifier and Type | Field | Description |
|---|---|---|
static final int |
CONTIGUOUS_TREE_SELECTION |
Selection can only be contiguous. |
static final int |
DISCONTIGUOUS_TREE_SELECTION |
Selection can contain any number of items that are not necessarily contiguous. |
static final int |
SINGLE_TREE_SELECTION |
Selection can only contain one path at a time. |
Constructor Summary
| Modifier | Constructor | Description |
|---|---|---|
protected |
Constructs an EmptySelectionModel. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
void |
addPropertyChangeListener |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
void |
addSelectionPaths |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
void |
addTreeSelectionListener |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
void |
removePropertyChangeListener |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
void |
removeSelectionPaths |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
void |
removeTreeSelectionListener |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
void |
setRowMapper |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
void |
setSelectionMode |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
void |
setSelectionPaths |
This is overridden to do nothing; EmptySelectionModel does not allow a selection. |
static JTree.EmptySelectionModel |
sharedInstance() |
Returns the single instance of EmptySelectionModel. |
Methods declared in class DefaultTreeSelectionModel
addSelectionPath, arePathsContiguous, canPathsBeAdded, canPathsBeRemoved, clearSelection, clone, fireValueChanged, getLeadSelectionPath, getLeadSelectionRow, getListeners, getMaxSelectionRow, getMinSelectionRow, getPropertyChangeListeners, getRowMapper, getSelectionCount, getSelectionMode, getSelectionPath, getSelectionPaths, getSelectionRows, getTreeSelectionListeners, insureRowContinuity, insureUniqueness, isPathSelected, isRowSelected, isSelectionEmpty, notifyPathChange, removeSelectionPath, resetRowSelection, setSelectionPath, toString, updateLeadIndex | Modifier and Type | Method | Description |
|---|---|---|
void |
addSelectionPath |
Adds path to the current selection. |
protected boolean |
arePathsContiguous |
Returns true if the paths are contiguous, or this object has no RowMapper. |
protected boolean |
canPathsBeAdded |
Used to test if a particular set of TreePaths can be added. |
protected boolean |
canPathsBeRemoved |
Returns true if the paths can be removed without breaking the continuity of the model. |
void |
clearSelection() |
Empties the current selection. |
Object |
clone() |
Returns a clone of this object with the same selection. |
protected void |
fireValueChanged |
Notifies all listeners that are registered for tree selection events on this object. |
TreePath |
getLeadSelectionPath() |
Returns the last path that was added. |
int |
getLeadSelectionRow() |
Returns the lead selection index. |
<T extends EventListener> |
getListeners |
Returns an array of all the objects currently registered as FooListeners upon this model. |
int |
getMaxSelectionRow() |
Returns the largest value obtained from the RowMapper for the current set of selected TreePaths. |
int |
getMinSelectionRow() |
Returns the smallest value obtained from the RowMapper for the current set of selected TreePaths. |
PropertyChangeListener[] |
getPropertyChangeListeners() |
Returns an array of all the property change listeners registered on this DefaultTreeSelectionModel. |
RowMapper |
getRowMapper() |
Returns the RowMapper instance that is able to map a TreePath to a row. |
int |
getSelectionCount() |
Returns the number of paths that are selected. |
int |
getSelectionMode() |
Returns the selection mode, one of SINGLE_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION or CONTIGUOUS_TREE_SELECTION. |
TreePath |
getSelectionPath() |
Returns the first path in the selection. |
TreePath[] |
getSelectionPaths() |
Returns the selection. |
int[] |
getSelectionRows() |
Returns the selection in terms of rows. |
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. |
boolean |
isPathSelected |
Returns true if the path, path, is in the current selection. |
boolean |
isRowSelected |
Returns true if the row identified by row is selected. |
boolean |
isSelectionEmpty() |
Returns true if the selection is currently empty. |
protected void |
notifyPathChange |
Deprecated. As of JDK version 1.7 |
void |
removeSelectionPath |
Removes path from the selection. |
void |
resetRowSelection() |
Updates this object's mapping from TreePath to rows. |
void |
setSelectionPath |
Sets the selection to path. |
String |
toString() |
Returns a string that displays and identifies this object's properties. |
protected void |
updateLeadIndex() |
Updates the leadIndex instance variable. |
Methods declared in class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | Modifier and Type | Method | Description |
|---|---|---|
boolean |
equals |
Indicates whether some other object is "equal to" this one. |
protected void |
finalize() |
Deprecated, for removal: This API element is subject to removal in a future version. Finalization is deprecated and subject to removal in a future release. |
final Class |
getClass() |
Returns the runtime class of this Object. |
int |
hashCode() |
Returns a hash code value for this object. |
final void |
notify() |
Wakes up a single thread that is waiting on this object's monitor. |
final void |
notifyAll() |
Wakes up all threads that are waiting on this object's monitor. |
final void |
wait() |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
final void |
wait |
Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed. |
Field Details
Constructor Details
EmptySelectionModel
protected EmptySelectionModel()
EmptySelectionModel.Method Details
setSelectionPaths
public void setSelectionPaths(TreePath[] paths)
EmptySelectionModel does not allow a selection.- Specified by:
-
setSelectionPathsin interfaceTreeSelectionModel - Overrides:
-
setSelectionPathsin classDefaultTreeSelectionModel - Parameters:
-
paths- the paths to select; this is ignored
addSelectionPaths
public void addSelectionPaths(TreePath[] paths)
EmptySelectionModel does not allow a selection.- Specified by:
-
addSelectionPathsin interfaceTreeSelectionModel - Overrides:
-
addSelectionPathsin classDefaultTreeSelectionModel - Parameters:
-
paths- the paths to add to the selection; this is ignored
removeSelectionPaths
public void removeSelectionPaths(TreePath[] paths)
EmptySelectionModel does not allow a selection.- Specified by:
-
removeSelectionPathsin interfaceTreeSelectionModel - Overrides:
-
removeSelectionPathsin classDefaultTreeSelectionModel - Parameters:
-
paths- the paths to remove; this is ignored
setSelectionMode
public void setSelectionMode(int mode)
EmptySelectionModel does not allow a selection.- Specified by:
-
setSelectionModein interfaceTreeSelectionModel - Overrides:
-
setSelectionModein classDefaultTreeSelectionModel - Parameters:
-
mode- the selection mode; this is ignored - Since:
- 1.7
setRowMapper
public void setRowMapper(RowMapper mapper)
EmptySelectionModel does not allow a selection.- Specified by:
-
setRowMapperin interfaceTreeSelectionModel - Overrides:
-
setRowMapperin classDefaultTreeSelectionModel - Parameters:
-
mapper- theRowMapperinstance; this is ignored - Since:
- 1.7
addTreeSelectionListener
public void addTreeSelectionListener(TreeSelectionListener listener)
EmptySelectionModel does not allow a selection.- Specified by:
-
addTreeSelectionListenerin interfaceTreeSelectionModel - Overrides:
-
addTreeSelectionListenerin classDefaultTreeSelectionModel - Parameters:
-
listener- the listener to add; this is ignored - Since:
- 1.7
removeTreeSelectionListener
public void removeTreeSelectionListener(TreeSelectionListener listener)
EmptySelectionModel does not allow a selection.- Specified by:
-
removeTreeSelectionListenerin interfaceTreeSelectionModel - Overrides:
-
removeTreeSelectionListenerin classDefaultTreeSelectionModel - Parameters:
-
listener- the listener to remove; this is ignored - Since:
- 1.7
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener listener)
EmptySelectionModel does not allow a selection.- Specified by:
-
addPropertyChangeListenerin interfaceTreeSelectionModel - Overrides:
-
addPropertyChangeListenerin classDefaultTreeSelectionModel - Parameters:
-
listener- the listener to add; this is ignored - Since:
- 1.7
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
EmptySelectionModel does not allow a selection.- Specified by:
-
removePropertyChangeListenerin interfaceTreeSelectionModel - Overrides:
-
removePropertyChangeListenerin classDefaultTreeSelectionModel - Parameters:
-
listener- the listener to remove; this is ignored - Since:
- 1.7
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.