| Package | org.aswing.tree |
| Class | public class DefaultTreeSelectionModel |
| Inheritance | DefaultTreeSelectionModel flash.events.EventDispatcher |
| Implements | TreeSelectionModel |
| Subclasses | EmptySelectionModel |
resetRowSelection is called from any of the methods that update
the selected paths. If you subclass any of these methods to
filter what is allowed to be selected, be sure and message
resetRowSelection if you do not message super.
| Method | Defined by | ||
|---|---|---|---|
|
Creates a new instance of DefaultTreeSelectionModel that is
empty, with a selection mode of DISCONTIGUOUS_TREE_SELECTION.
| DefaultTreeSelectionModel | ||
|
addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Adds a PropertyChangeListener to the listener list.
| DefaultTreeSelectionModel | ||
|
addSelectionPath(path:TreePath, programmatic:Boolean = true):void
Adds path to the current selection.
| DefaultTreeSelectionModel | ||
|
addSelectionPaths(paths:Array, programmatic:Boolean = true):void
Adds paths(TreePath[]) to the current selection.
| DefaultTreeSelectionModel | ||
|
addTreeSelectionListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Adds x to the list of listeners that are notified each time the
set of selected TreePaths changes.
| DefaultTreeSelectionModel | ||
|
clearSelection(programmatic:Boolean = true):void
Empties the current selection.
| DefaultTreeSelectionModel | ||
|
Returns the last path that was added.
| DefaultTreeSelectionModel | ||
|
getLeadSelectionRow():int
Returns the lead selection index.
| DefaultTreeSelectionModel | ||
|
getMaxSelectionRow():int
Returns the largest value obtained from the RowMapper for the
current set of selected TreePaths.
| DefaultTreeSelectionModel | ||
|
getMinSelectionRow():int
Returns the smallest value obtained from the RowMapper for the
current set of selected TreePaths.
| DefaultTreeSelectionModel | ||
|
Returns the RowMapper instance that is able to map a TreePath to a
row.
| DefaultTreeSelectionModel | ||
|
getSelectionCount():int
Returns the number of paths that are selected.
| DefaultTreeSelectionModel | ||
|
getSelectionMode():int
Returns the selection mode, one of
SINGLE_TREE_SELECTION,
DISCONTIGUOUS_TREE_SELECTION or
CONTIGUOUS_TREE_SELECTION. | DefaultTreeSelectionModel | ||
|
Returns the first path in the selection.
| DefaultTreeSelectionModel | ||
|
getSelectionPaths():Array
Returns the paths(TreePath[]) in the selection.
| DefaultTreeSelectionModel | ||
|
getSelectionRows():Array
Returns all of the currently selected rows(int[]).
| DefaultTreeSelectionModel | ||
|
isPathSelected(path:TreePath):Boolean
Returns true if the path,
path,
is in the current selection. | DefaultTreeSelectionModel | ||
|
isRowSelected(row:int):Boolean
Returns true if the row identified by
row is selected. | DefaultTreeSelectionModel | ||
|
isSelectionEmpty():Boolean
Returns true if the selection is currently empty.
| DefaultTreeSelectionModel | ||
|
removePropertyChangeListener(listener:Function):void
Removed a propertyChangeListener.
| DefaultTreeSelectionModel | ||
|
removeSelectionPath(path:TreePath, programmatic:Boolean = true):void
Removes path from the selection.
| DefaultTreeSelectionModel | ||
|
removeSelectionPaths(paths:Array, programmatic:Boolean = true):void
Removes paths from the selection.
| DefaultTreeSelectionModel | ||
|
removeTreeSelectionListener(listener:Function):void
Removed a treeSelectionListener.
| DefaultTreeSelectionModel | ||
|
resetRowSelection():void
Updates this object's mapping from TreePath to rows.
| DefaultTreeSelectionModel | ||
|
setRowMapper(newMapper:RowMapper):void
Sets the RowMapper instance.
| DefaultTreeSelectionModel | ||
|
setSelectionMode(mode:int):void
Sets the selection model, which must be one of SINGLE_TREE_SELECTION,
CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION.
| DefaultTreeSelectionModel | ||
|
setSelectionPath(path:TreePath, programmatic:Boolean = true):void
Sets the selection to path.
| DefaultTreeSelectionModel | ||
|
setSelectionPaths(pPaths:Array, programmatic:Boolean = true):void
Sets the selection to the paths in paths.
| DefaultTreeSelectionModel | ||
|
toString():String
Returns a string that displays and identifies this
object's properties.
| DefaultTreeSelectionModel | ||
| Method | Defined by | ||
|---|---|---|---|
|
firePropertyChange(name:String, oldValue:*, newValue:*):void
| DefaultTreeSelectionModel | ||
|
fireValueChanged(e:TreeSelectionEvent):void
Notifies all listeners that are registered for
tree selection events on this object.
| DefaultTreeSelectionModel | ||
| Constant | Defined by | ||
|---|---|---|---|
| CONTIGUOUS_TREE_SELECTION : int = 2 [static] Selection can only be contiguous.
| DefaultTreeSelectionModel | ||
| DISCONTIGUOUS_TREE_SELECTION : int = 4 [static] Selection can contain any number of items that are not necessarily
contiguous.
| DefaultTreeSelectionModel | ||
| ON_PROPERTY_CHANGED : String = "onPropertyChanged" [static]
onPropertyChanged(source:DefaultTreeSelectionModel, name:String, oldValue, newValue);
| DefaultTreeSelectionModel | ||
| ON_SELECTION_CHANGED : String = "onSelectionChanged" [static]
onSelectionChanged(source:DefaultTreeSelectionModel, e:TreeSelectionEvent);
| DefaultTreeSelectionModel | ||
| SELECTION_MODE_PROPERTY : String = "selectionMode" [static] Property name for selectionMode.
| DefaultTreeSelectionModel | ||
| SINGLE_TREE_SELECTION : int = 1 [static] Selection can only contain one path at a time.
| DefaultTreeSelectionModel | ||
| DefaultTreeSelectionModel | () | constructor |
public function DefaultTreeSelectionModel()Creates a new instance of DefaultTreeSelectionModel that is empty, with a selection mode of DISCONTIGUOUS_TREE_SELECTION.
| addPropertyChangeListener | () | method |
public function addPropertyChangeListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):voidAdds a PropertyChangeListener to the listener list. The listener is registered for all properties.
A PropertyChangeEvent will get fired when the selection mode changes. Parameters
listener:Function — the propertyChangeListener to be added
|
|
priority:int (default = 0) — the priority
|
|
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak.
|
See also
| addSelectionPath | () | method |
public function addSelectionPath(path:TreePath, programmatic:Boolean = true):void
Adds path to the current selection. If path is not currently
in the selection the TreeSelectionListeners are notified. This has
no effect if path is null.
path:TreePath — the new path to add to the current selection.
|
|
programmatic:Boolean (default = true) — indicate if this is a programmatic change.
|
| addSelectionPaths | () | method |
public function addSelectionPaths(paths:Array, programmatic:Boolean = true):void
Adds paths(TreePath[]) to the current selection. If any of the paths in
paths are not currently in the selection the TreeSelectionListeners
are notified. This has
no effect if paths is null.
The lead path is set to the last element in paths.
If the selection mode is CONTIGUOUS_TREE_SELECTION,
and adding the new paths would make the selection discontiguous.
Then two things can result: if the TreePaths in paths
are contiguous, then the selection becomes these TreePaths,
otherwise the TreePaths aren't contiguous and the selection becomes
the first TreePath in paths.
Parameters
paths:Array — the new path to add to the current selection.
|
|
programmatic:Boolean (default = true) — indicate if this is a programmatic change.
|
| addTreeSelectionListener | () | method |
public function addTreeSelectionListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):voidAdds x to the list of listeners that are notified each time the set of selected TreePaths changes.
Parameterslistener:Function — the new listener to be added
|
|
priority:int (default = 0) — the priority
|
|
useWeakReference:Boolean (default = false) — Determines whether the reference to the listener is strong or weak.
|
See also
| clearSelection | () | method |
public function clearSelection(programmatic:Boolean = true):voidEmpties the current selection. If this represents a change in the current selection, the selection listeners are notified.
Parametersprogrammatic:Boolean (default = true) — indicate if this is a programmatic change.
|
| firePropertyChange | () | method |
protected function firePropertyChange(name:String, oldValue:*, newValue:*):voidParameters
name:String |
|
oldValue:* |
|
newValue:* |
| fireValueChanged | () | method |
protected function fireValueChanged(e:TreeSelectionEvent):voidNotifies all listeners that are registered for tree selection events on this object.
Parameterse:TreeSelectionEvent |
See also
| getLeadSelectionPath | () | method |
public function getLeadSelectionPath():TreePathReturns the last path that was added. This may differ from the leadSelectionPath property maintained by the JTree.
ReturnsTreePath |
| getLeadSelectionRow | () | method |
public function getLeadSelectionRow():intReturns the lead selection index. That is the last index that was added.
Returnsint |
| getMaxSelectionRow | () | method |
public function getMaxSelectionRow():intReturns the largest value obtained from the RowMapper for the current set of selected TreePaths. If nothing is selected, or there is no RowMapper, this will return -1.
Returnsint |
| getMinSelectionRow | () | method |
public function getMinSelectionRow():intReturns the smallest value obtained from the RowMapper for the current set of selected TreePaths. If nothing is selected, or there is no RowMapper, this will return -1.
Returnsint |
| getRowMapper | () | method |
public function getRowMapper():RowMapperReturns the RowMapper instance that is able to map a TreePath to a row.
ReturnsRowMapper |
| getSelectionCount | () | method |
public function getSelectionCount():intReturns the number of paths that are selected.
Returnsint |
| getSelectionMode | () | method |
public function getSelectionMode():int
Returns the selection mode, one of SINGLE_TREE_SELECTION,
DISCONTIGUOUS_TREE_SELECTION or
CONTIGUOUS_TREE_SELECTION.
int |
| getSelectionPath | () | method |
public function getSelectionPath():TreePathReturns the first path in the selection. This is useful if there if only one item currently selected.
ReturnsTreePath |
| getSelectionPaths | () | method |
public function getSelectionPaths():ArrayReturns the paths(TreePath[]) in the selection. This will return null (or an empty array) if nothing is currently selected.
ReturnsArray |
| getSelectionRows | () | method |
public function getSelectionRows():ArrayReturns all of the currently selected rows(int[]). This will return null (or an empty array) if there are no selected TreePaths or a RowMapper has not been set. This may return an array of length less that than of the selected TreePaths if some of the rows are not visible (that is the RowMapper returned -1 for the row corresponding to the TreePath).
ReturnsArray |
| isPathSelected | () | method |
public function isPathSelected(path:TreePath):Boolean
Returns true if the path, path,
is in the current selection.
path:TreePath |
Boolean |
| isRowSelected | () | method |
public function isRowSelected(row:int):Boolean
Returns true if the row identified by row is selected.
row:int |
Boolean |
| isSelectionEmpty | () | method |
public function isSelectionEmpty():BooleanReturns true if the selection is currently empty.
ReturnsBoolean |
| removePropertyChangeListener | () | method |
public function removePropertyChangeListener(listener:Function):voidRemoved a propertyChangeListener.
Parameterslistener:Function — the listener to be removed.
|
| removeSelectionPath | () | method |
public function removeSelectionPath(path:TreePath, programmatic:Boolean = true):void
Removes path from the selection. If path is in the selection
The TreeSelectionListeners are notified. This has no effect if
path is null.
path:TreePath — the path to remove from the selection.
|
|
programmatic:Boolean (default = true) — indicate if this is a programmatic change.
|
| removeSelectionPaths | () | method |
public function removeSelectionPaths(paths:Array, programmatic:Boolean = true):void
Removes paths from the selection. If any of the paths in paths
are in the selection the TreeSelectionListeners are notified.
This has no effect if paths is null.
paths:Array — the paths to remove from the selection.
|
|
programmatic:Boolean (default = true) — indicate if this is a programmatic change.
|
| removeTreeSelectionListener | () | method |
public function removeTreeSelectionListener(listener:Function):voidRemoved a treeSelectionListener.
Parameterslistener:Function — the listener to be removed.
|
| resetRowSelection | () | method |
public function resetRowSelection():voidUpdates this object's mapping from TreePath to rows. This should be invoked when the mapping from TreePaths to integers has changed (for example, a node has been expanded).
You do not normally have to call this, JTree and its associated Listeners will invoke this for you. If you are implementing your own View class, then you will have to invoke this.
This will invoke insureRowContinuity to make sure
the currently selected TreePaths are still valid based on the
selection mode.
| setRowMapper | () | method |
public function setRowMapper(newMapper:RowMapper):voidSets the RowMapper instance. This instance is used to determine the row for a particular TreePath.
ParametersnewMapper:RowMapper |
| setSelectionMode | () | method |
public function setSelectionMode(mode:int):void
Sets the selection model, which must be one of SINGLE_TREE_SELECTION,
CONTIGUOUS_TREE_SELECTION or DISCONTIGUOUS_TREE_SELECTION. If mode
is not one of the defined value,
DISCONTIGUOUS_TREE_SELECTION is assumed.
This may change the selection if the current selection is not valid
for the new mode. For example, if three TreePaths are
selected when the mode is changed to SINGLE_TREE_SELECTION,
only one TreePath will remain selected. It is up to the particular
implementation to decide what TreePath remains selected.
Setting the mode to something other than the defined types will
result in the mode becoming DISCONTIGUOUS_TREE_SELECTION.
Parameters
mode:int |
| setSelectionPath | () | method |
public function setSelectionPath(path:TreePath, programmatic:Boolean = true):void
Sets the selection to path. If this represents a change, then
the TreeSelectionListeners are notified. If path is
null, this has the same effect as invoking clearSelection.
path:TreePath — new path to select.
|
|
programmatic:Boolean (default = true) — indicate if this is a programmatic change.
|
| setSelectionPaths | () | method |
public function setSelectionPaths(pPaths:Array, programmatic:Boolean = true):voidSets the selection to the paths in paths. If this represents a change the TreeSelectionListeners are notified. Potentially paths will be held by this object; in other words don't change any of the objects in the array once passed in.
If paths is
null, this has the same effect as invoking clearSelection.
The lead path is set to the last path in pPaths.
If the selection mode is CONTIGUOUS_TREE_SELECTION,
and adding the new paths would make the selection discontiguous,
the selection is reset to the first TreePath in paths.
Parameters
pPaths:Array — new selection.
|
|
programmatic:Boolean (default = true) — indicate if this is a programmatic change.
|
| toString | () | method |
public override function toString():StringReturns a string that displays and identifies this object's properties.
ReturnsString — a String representation of this object
|
| CONTIGUOUS_TREE_SELECTION | constant |
public static const CONTIGUOUS_TREE_SELECTION:int = 2Selection can only be contiguous. This will only be enforced if a RowMapper instance is provided. That is, if no RowMapper is set this behaves the same as DISCONTIGUOUS_TREE_SELECTION.
| DISCONTIGUOUS_TREE_SELECTION | constant |
public static const DISCONTIGUOUS_TREE_SELECTION:int = 4Selection can contain any number of items that are not necessarily contiguous.
| ON_PROPERTY_CHANGED | constant |
public static const ON_PROPERTY_CHANGED:String = "onPropertyChanged"onPropertyChanged(source:DefaultTreeSelectionModel, name:String, oldValue, newValue);
| ON_SELECTION_CHANGED | constant |
public static const ON_SELECTION_CHANGED:String = "onSelectionChanged"onSelectionChanged(source:DefaultTreeSelectionModel, e:TreeSelectionEvent);
| SELECTION_MODE_PROPERTY | constant |
public static const SELECTION_MODE_PROPERTY:String = "selectionMode"Property name for selectionMode.
| SINGLE_TREE_SELECTION | constant |
public static const SINGLE_TREE_SELECTION:int = 1Selection can only contain one path at a time.