public class IlpDefaultTreeSelectionModel extends DefaultTreeSelectionModel implements IlpTreeSelectionModel
IlpTreeSelectionModel
.
This model maintains the selection of IlpObject
s as well as
IlpRepresentationObject
s.
In addition to the common TreePath
and Row
interfaces, Object
and RepresentationObject
interfaces are provided, which allows you to manipulate the selection of
IlpObject
s and IlpTreeNode
s directly.
We strongly discourages the use of the Row
interface and the
CONTIGUOUS_TREE_SELECTION
mode with IlpTreeView
. In
particular, you should be aware that the Row
interface ignores
the hidden nodes (descendants of collapsed nodes). So a node that
is selected but hidden will not be returned by
getSelectionRows()
.
In addition, contiguity is based on the expanded nodes, so you may lose
selected hidden nodes when using CONTIGUOUS_TREE_SELECTION
.
changeSupport, leadIndex, leadPath, leadRow, listenerList, listSelectionModel, rowMapper, selection, SELECTION_MODE_PROPERTY, selectionMode
CONTIGUOUS_TREE_SELECTION, DISCONTIGUOUS_TREE_SELECTION, SINGLE_TREE_SELECTION
Constructor and Description |
---|
IlpDefaultTreeSelectionModel()
Creates a new instance of
IlpTreeSelectionModel that is
empty, with a selection mode of DISCONTIGUOUS_TREE_SELECTION . |
Modifier and Type | Method and Description |
---|---|
void |
addSelectionObject(IlpObject object)
Adds the given
IlpObject to the selection. |
void |
addSelectionRepresentationObject(IlpRepresentationObject object)
Adds
object to the current selection. |
void |
addSelectionRepresentationObjects(Collection objects)
Adds
objects to the current selection. |
IlpRepresentationObject |
getLeadSelectionRepresentationObject()
Returns the last object that was added.
|
IlpRepresentationObjectMapper |
getRepresentationObjectMapper()
Returns the
IlpRepresentationObjectMapper used
to find the IlpRepresentationObject associated
with an IlpObject . |
IlpObject |
getSelectedObject()
Returns the first selected
IlpObject
from the collection of selected objects. |
Collection |
getSelectedObjects()
Returns the set of selected
IlpObject s. |
IlpRepresentationObject |
getSelectedRepresentationObject()
Returns the first object in the selection.
|
Collection |
getSelectedRepresentationObjects()
Returns the objects in the selection.
|
TreePath |
getTreePathFor(IlpRepresentationObject object)
Returns the tree path corresponding to a given representation object.
|
TreePath[] |
getTreePathsFor(Collection objects)
Returns the tree paths corresponding to a given set of representation
objects.
|
boolean |
isObjectSelected(IlpObject object)
|
boolean |
isRepresentationObjectSelected(IlpRepresentationObject object)
Returns true if
object is in the current
selection. |
void |
removeSelectionObject(IlpObject object)
Removes the given
IlpObject from the selection. |
void |
removeSelectionRepresentationObject(IlpRepresentationObject object)
Removes
object from the selection. |
void |
removeSelectionRepresentationObjects(Collection objects)
Removes
objects from the selection. |
void |
setRepresentationObjectMapper(IlpRepresentationObjectMapper representationObjectMapper)
Sets the
IlpRepresentationObjectMapper which will
be used to find the IlpRepresentationObject
associated with an IlpObject . |
void |
setSelectedObject(IlpObject object)
Sets the selected
IlpObject . |
void |
setSelectedObjects(Collection objects)
Sets the set of selected
IlpObject s. |
void |
setSelectedRepresentationObject(IlpRepresentationObject object)
Sets the selection to
object . |
void |
setSelectedRepresentationObjects(Collection objects)
Sets the selection to the representation objects in
objects . |
void |
setSelectionRepresentationObject(IlpRepresentationObject object)
Deprecated.
Please use
setSelectedRepresentationObject instead. |
void |
setSelectionRepresentationObjects(Collection objects)
Deprecated.
Please use
setSelectedRepresentationObjects instead. |
addPropertyChangeListener, addSelectionPath, addSelectionPaths, addTreeSelectionListener, 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, removePropertyChangeListener, removeSelectionPath, removeSelectionPaths, removeTreeSelectionListener, resetRowSelection, setRowMapper, setSelectionMode, setSelectionPath, setSelectionPaths, toString, updateLeadIndex
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addPropertyChangeListener, addSelectionPath, addSelectionPaths, addTreeSelectionListener, clearSelection, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getRowMapper, getSelectionCount, getSelectionMode, getSelectionPath, getSelectionPaths, getSelectionRows, isPathSelected, isRowSelected, isSelectionEmpty, removePropertyChangeListener, removeSelectionPath, removeSelectionPaths, removeTreeSelectionListener, resetRowSelection, setRowMapper, setSelectionMode, setSelectionPath, setSelectionPaths
clearSelection
clearSelection
public IlpDefaultTreeSelectionModel()
IlpTreeSelectionModel
that is
empty, with a selection mode of DISCONTIGUOUS_TREE_SELECTION
.public void addSelectionRepresentationObject(IlpRepresentationObject object)
object
to the current selection. If object
is
not currently in the selection the TreeSelectionListeners
are notified.
This has no effect if object
is null.addSelectionRepresentationObject
in interface IlpRepresentationObjectSelectionModel
object
- The new object to add to the current selection.public void addSelectionRepresentationObjects(Collection objects)
objects
to the current selection. If any of the
representation objects in objects
are not currently in the
selection the TreeSelectionListeners
are notified. This has
no effect if objects
is null.
The lead path is set to the last element in objects
.
If the selection mode is CONTIGUOUS_TREE_SELECTION
and adding the new objects would make the selection discontiguous,
one of two situations may occur: if the IlpRepresentationObject
s
in objects
are contiguous, these
IlpRepresentationObject
s will become the selection; otherwise, the
IlpRepresentationObject
s are not contiguous and the first IlpRepresentationObject
in
objects
becomes the selection.
addSelectionRepresentationObjects
in interface IlpTreeSelectionModel
objects
- The new objects to add to the current selection.public void removeSelectionRepresentationObject(IlpRepresentationObject object)
object
from the selection. If object
is in
the selection, the TreeSelectionListeners
are notified. This has no effect
if object
is null
.removeSelectionRepresentationObject
in interface IlpRepresentationObjectSelectionModel
object
- The object to remove from the selection.public void removeSelectionRepresentationObjects(Collection objects)
objects
from the selection. If any of the objects in
objects
are in the selection the TreeSelectionListeners
are
notified. This has no effect if objects
is null
.removeSelectionRepresentationObjects
in interface IlpTreeSelectionModel
removeSelectionRepresentationObjects
in interface IlpRepresentationObjectSelectionModel
objects
- The objects to remove from the selection.@Deprecated public void setSelectionRepresentationObject(IlpRepresentationObject object)
setSelectedRepresentationObject
instead.object
. If this represents a change, then
the TreeSelectionListeners
are notified. If object
is
null
, this has the same effect as invoking
clearSelection
.setSelectionRepresentationObject
in interface IlpTreeSelectionModel
object
- New object to select.public void setSelectedRepresentationObject(IlpRepresentationObject object)
object
. If this represents a change, then
the TreeSelectionListeners
are notified. If object
is
null
, this has the same effect as invoking
clearSelection
.setSelectedRepresentationObject
in interface IlpTreeSelectionModel
setSelectedRepresentationObject
in interface IlpRepresentationObjectSelectionModel
object
- New object to select.public Collection getSelectedRepresentationObjects()
getSelectedRepresentationObjects
in interface IlpRepresentationObjectSelectionModel
IlpRepresentationObject
spublic IlpRepresentationObject getSelectedRepresentationObject()
getSelectedRepresentationObject
in interface IlpRepresentationObjectSelectionModel
null
if
the selection is empty.@Deprecated public void setSelectionRepresentationObjects(Collection objects)
setSelectedRepresentationObjects
instead.objects
.
If this represents a change the TreeSelectionListeners
are notified.
If objects
is null
, this has the same effect as invoking
clearSelection
.
The lead path is set to the last object in objects
.
If the selection mode is CONTIGUOUS_TREE_SELECTION
and adding the new objects would make the selection discontiguous,
the selection will be reset to the first IlpRepresentationObject
in
objects
.
setSelectionRepresentationObjects
in interface IlpTreeSelectionModel
objects
- New selection.public void setSelectedRepresentationObjects(Collection objects)
objects
.
If this represents a change the TreeSelectionListeners
are notified.
If objects
is null
, this has the same effect as invoking
clearSelection
.
The lead path is set to the last object in objects
.
If the selection mode is CONTIGUOUS_TREE_SELECTION
and adding the new objects would make the selection discontiguous,
the selection will be reset to the first IlpRepresentationObject
in
objects
.
setSelectedRepresentationObjects
in interface IlpRepresentationObjectSelectionModel
objects
- New selection.public boolean isRepresentationObjectSelected(IlpRepresentationObject object)
object
is in the current
selection.isRepresentationObjectSelected
in interface IlpRepresentationObjectSelectionModel
object
- The representation object that may be selected.public IlpRepresentationObject getLeadSelectionRepresentationObject()
getLeadSelectionRepresentationObject
in interface IlpTreeSelectionModel
public TreePath getTreePathFor(IlpRepresentationObject object)
object
- The representation object whose tree path is required.public TreePath[] getTreePathsFor(Collection objects)
objects
- The representation objects whose tree paths are required.public IlpObject getSelectedObject()
IlpObject
from the collection of selected objects.
Returns null
if there is no selected object.getSelectedObject
in interface IlpObjectSelectionModel
public Collection getSelectedObjects()
IlpObject
s.
The set should be ordered if the component implementing this interface
supports an ordered selection.
Returns an empty set if there is no selected object.getSelectedObjects
in interface IlpObjectSelectionModel
IlpObject
s.public void setSelectedObject(IlpObject object)
IlpObject
.
This has no effect if the given object is already selected.setSelectedObject
in interface IlpObjectSelectionModel
object
- The object that will become the selection.public void setSelectedObjects(Collection objects)
IlpObject
s.setSelectedObjects
in interface IlpObjectSelectionModel
objects
- The collection of objects that will become the selection.public boolean isObjectSelected(IlpObject object)
isObjectSelected
in interface IlpObjectSelectionModel
object
- The object which may be selected.public void addSelectionObject(IlpObject object)
IlpObject
to the selection.
This has no effect if the given object is null
.addSelectionObject
in interface IlpObjectSelectionModel
object
- The object that will be added to the selection.public void removeSelectionObject(IlpObject object)
IlpObject
from the selection.
This has no effect if the given object is null
.removeSelectionObject
in interface IlpObjectSelectionModel
object
- The object that will be removed from the selection.public void setRepresentationObjectMapper(IlpRepresentationObjectMapper representationObjectMapper)
IlpRepresentationObjectMapper
which will
be used to find the IlpRepresentationObject
associated with an IlpObject
.setRepresentationObjectMapper
in interface IlpTreeSelectionModel
representationObjectMapper
- The representation object mapper to be
used. If this parameter is null
, the
IlpObject
selection API has no effect.public IlpRepresentationObjectMapper getRepresentationObjectMapper()
IlpRepresentationObjectMapper
used
to find the IlpRepresentationObject
associated
with an IlpObject
.getRepresentationObjectMapper
in interface IlpTreeSelectionModel
null
.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.