| Package | org.aswing |
| Class | public class JTree |
| Inheritance | JTree Container Component AWSprite flash.display.Sprite |
| Implements | CellEditorListener, TreeModelListener, Viewportable |
A specific node in a tree can be identified either by a
TreePath (an object
that encapsulates a node and all of its ancestors), or by its
display row, where each row in the display area displays one node.
An expanded node is a non-leaf node (as identified by
TreeModel.isLeaf(node) returning false) that will displays
its children when all its ancestors are expanded.
A collapsed
node is one which hides them. A hidden node is one which is
under a collapsed ancestor. All of a viewable nodes parents
are expanded, but may or may not be displayed. A displayed node
is both viewable and in the display area, where it can be seen.
JTree methods use "visible" to mean "displayed":
isRootVisible()
setRootVisible()
scrollPathToVisible()
scrollRowToVisible()
getVisibleRowCount()
setVisibleRowCount()
JTree methods use "visible" to mean
"viewable" (under an expanded parent):
isPathVisible()
makePathVisible()
If you are interested in knowing when the selection listen the
the TreeSelectionEvent.TREE_SELECTION_CHANGED event.
yourTree.addEventListener(MouseEvent.MOUSE_DOWN, __onPressed);
....
public function __onPressed(e:Event):void {
var selPath:TreePath = tree.getMousePointedPath();
....
}
};
To use JTree to display compound nodes
(for example, nodes containing both
a graphic icon and text), subclass {
See also
| Method | Defined by | ||
|---|---|---|---|
|
JTree(newModel:TreeModel)
; JTree() a defaul model will be created Returns an instance of JTree which displays the root node
-- the tree is created using the specified data model. | JTree | ||
![]() |
addChild(dis:DisplayObject):DisplayObject
Adds a child DisplayObject instance to this DisplayObjectContainer instance.
| AWSprite | |
![]() |
addChildAt(child:DisplayObject, index:int):DisplayObject
| AWSprite | |
![]() |
addDragAcceptableInitiator(com:Component):void
Adds a component to be the acceptable drag initiator to this component.
| Component | |
|
addSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void
Adds the paths between index0 and index1, inclusive, to the
selection.
| JTree | ||
|
addSelectionListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Adds a listener for tree selection events.
| JTree | ||
|
addSelectionPath(path:TreePath, programmatic:Boolean = true):void
Adds the node identified by the specified
TreePath
to the current selection. | JTree | ||
|
addSelectionPaths(paths:Array, programmatic:Boolean = true):void
Adds each path in the array of paths to the current selection.
| JTree | ||
|
addSelectionRow(row:int, programmatic:Boolean = true):void
Adds the path at the specified row to the current selection.
| JTree | ||
|
addSelectionRows(rows:Array, programmatic:Boolean = true):void
Adds the paths at each of the specified rows to the current selection.
| JTree | ||
|
addStateListener(listener:Function, priority:int = 0, useWeakReference:Boolean = false):void
Add a listener to listen the viewpoat state change event.
| JTree | ||
![]() |
On Component just can add to one Container.
| Container | |
![]() |
appendAll(... coms):void
Adds one or more component to the container with null constraints
| Container | |
![]() |
bringToBottom(child:DisplayObject):void
Brings a child to bottom.
| AWSprite | |
![]() |
bringToTop(child:DisplayObject):void
Brings a child to top.
| AWSprite | |
|
cancelEditing():void
Cancels the current editing session.
| JTree | ||
|
clearSelection(programmatic:Boolean = true):void
Clears the selection.
| JTree | ||
|
collapsePath(path:TreePath):void
Ensures that the node identified by the specified path is
collapsed and viewable.
| JTree | ||
|
collapseRow(row:int):void
Ensures that the node in the specified row is collapsed.
| JTree | ||
![]() | Component | ||
![]() |
containsChild(child:DisplayObject):Boolean
Returns whether child is directly child of this sprite, true only if getChildIndex(child) >= 0.
| AWSprite | |
![]() |
doLayout():void
layout this container
| Container | |
|
editingCanceled(source:CellEditor):void
| JTree | ||
|
editingStopped(source:CellEditor):void
| JTree | ||
|
expandPath(path:TreePath):void
Ensures that the node identified by the specified path is
expanded and viewable.
| JTree | ||
|
expandRow(row:int):void
Ensures that the node in the specified row is expanded and
viewable.
| JTree | ||
![]() |
fireFocusKeyDownEvent(e:KeyboardEvent):void
| Component | |
![]() |
fireFocusKeyUpEvent(e:KeyboardEvent):void
| Component | |
|
fireTreeCollapsed(path:TreePath):void
Notifies all listeners that have registered interest for
notification on this event type.
| JTree | ||
|
fireTreeExpanded(path:TreePath):void
Notifies all listeners that have registered interest for
notification on this event type.
| JTree | ||
|
fireTreeWillCollapse(path:TreePath):void
Notifies all listeners that have registered interest for
notification on this event type.
| JTree | ||
|
fireTreeWillExpand(path:TreePath):void
Notifies all listeners that have registered interest for
notification on this event type.
| JTree | ||
![]() |
getAlignmentX():Number
Returns the alignment along the x axis.
| Component | |
![]() |
getAlignmentY():Number
Returns the alignment along the y axis.
| Component | |
![]() |
getAlpha():Number
Returns the alpha of this component.
| Component | |
|
Returns the path identified as the anchor.
| JTree | ||
![]() |
getAwmlID():String
Returns ID used to identify components created from AWML.
| Component | |
![]() |
getAwmlIndex():Number
Returns position index of the component inside its AWML container.
| Component | |
![]() |
getAwmlNamespace():String
Returns namespace name used to identify components created from AWML.
| Component | |
![]() |
Gets the background color of this component.
| Component | |
![]() |
Returns the background decorator of this component.
| Component | |
![]() |
Returns the border.
| Component | |
![]() |
getBounds(targetCoordinateSpace:DisplayObject):Rectangle
Same to DisplayObject.getBounds(),
just add a explaination here that if you want to get the component bounds,
see {
| Component | |
|
Returns the editor used to edit entries in the tree.
| JTree | ||
|
Returns the current
TreeCellFactory
that is rendering each cell. | JTree | ||
![]() |
getChildAt(index:int):DisplayObject
| AWSprite | |
![]() |
getChildByName(name:String):DisplayObject
| AWSprite | |
![]() |
getChildIndex(child:DisplayObject):int
| AWSprite | |
![]() |
getClientProperty(key:*):*
Returns the value of the property with the specified key.
| Component | |
![]() |
Returns the clip bounds.
| Component | |
|
getClosestPathForLocation(x:int, y:int):TreePath
Returns the path to the node that is closest to x,y.
| JTree | ||
|
getClosestRowForLocation(x:int, y:int):int
Returns the row to the node that is closest to x,y.
| JTree | ||
![]() |
Stores the bounds value of this component into "return value" rv and returns rv. | Component | |
![]() |
getComponent(index:int):Component
Gets the nth(index) component in this container.
| Container | |
![]() |
getComponentCount():int
Gets the number of components in this container.
| Container | |
![]() |
getConstraints():Object
Gets cpmponent's constraints.
| Component | |
|
getDefaultBasicUIClass():Class
| JTree | ||
|
Returns the path to the element that is currently being edited.
| JTree | ||
|
getExpandedDescendants(parent:TreePath):Array
Returns an
Array of the descendants of the
path parent that
are currently expanded. | JTree | ||
| JTree | |||
|
getFixedCellWidth():int
Returns the fixed cell width value -- the value specified by setting
the
fixedCellWidth property, rather than that calculated
from the cell elements. | JTree | ||
![]() |
Returns the focus manager for this component's stage,
or null if this component is not on stage.
| Component | |
![]() |
Returns the focus traversal policy of this container, it will return its parent's
focus traversal policy if its self is null.
| Container | |
![]() |
Gets the font of this component.
| Component | |
![]() |
Gets the foreground color of this component.
| Component | |
![]() |
Returns the foreground decorator of this component.
| Component | |
![]() |
Stores the global location value of this component into "return value" p and returns p.
| Component | |
![]() |
getHeight():int
Returns the current height of this component
| Component | |
![]() |
Returns the current top index for a new child(none forground child).
| AWSprite | |
| JTree | |||
| JTree | |||
![]() |
Returns the index of the child component in this container.
| Container | |
![]() |
If a border has been set on this component, returns the border's insets;
otherwise returns an empty insets.
| Component | |
![]() |
getInternalFocusObject():InteractiveObject
Returns the object to receive the focus for this component.
| Component | |
![]() |
Returns the keyboard manager of this component's
JRootPane ancestor. | Component | |
|
getLastSelectedPathComponent():Object
Returns the last path component in the first node of the current
selection.
| JTree | ||
![]() | Container | ||
|
Returns the path identified as the lead.
| JTree | ||
|
getLeadSelectionRow():int
Returns the row index corresponding to the lead path.
| JTree | ||
![]() |
Stores the location value of this component into "return value" rv and returns rv.
| Component | |
|
Returns the location in the JTree view area of the logic location.
| JTree | ||
![]() |
Returns the current bottom index for none background child.
| AWSprite | |
![]() |
getMaximumHeight():int
Returns
getMaximumSize().height
| Component | |
![]() |
| Component | |
![]() |
getMaximumWidth():int
Returns
getMaximumSize().width
| Component | |
|
getMaxSelectionRow():int
Returns the last selected row.
| JTree | ||
![]() |
getMinimumHeight():int
Returns
getMinimumSize().height
| Component | |
![]() |
| Component | |
![]() |
getMinimumWidth():int
Returns
getMinimumSize().width
| Component | |
|
getMinSelectionRow():int
Gets the first selected row.
| JTree | ||
|
Returns the
TreeModel that is providing the data. | JTree | ||
|
Returns the treePath that the user mouse pointed, null if no path was pointed.
| JTree | ||
![]() |
Returns the coordinate of the mouse position, in pixels, in the component scope.
| Component | |
![]() |
getName():String
Returns the name of the component
| Component | |
![]() |
Returns the bounds that component should paint in.
| Component | |
![]() |
Returns the
Container parent,
if it parent is not a Container, null will be returned. | Component | |
|
Returns the
IntRectangle that the specified node will be drawn
into. | JTree | ||
|
getPathForLocation(x:int, y:int):TreePath
Returns the path for the node at the specified location.
| JTree | ||
|
getPathForRow(row:int):TreePath
Returns the path for the specified row.
| JTree | ||
|
Returns the location in the JTree view area of the logic location.
| JTree | ||
![]() |
getPreferredHeight():int
Returns
getPreferredSize().height
| Component | |
![]() |
| Component | |
![]() |
getPreferredWidth():int
Returns
getPreferredSize().width
| Component | |
![]() |
Returns the first
JRootPane ancestor of this component. | Component | |
|
getRowBounds(row:int):IntRectangle
Returns the
IntRectangle that the node at the specified row is
drawn in. | JTree | ||
|
getRowCount():int
Returns the number of rows that are currently being displayed.
| JTree | ||
|
getRowForLocation(x:int, y:int):int
Returns the row for the specified location.
| JTree | ||
|
getRowForPath(path:TreePath):int
Returns the row that displays the node identified by the specified
path.
| JTree | ||
|
getRowHeight():int
Returns the height of each row.
| JTree | ||
|
Returns the background color for selected cells.
| JTree | ||
|
getSelectionCount():int
Returns the number of nodes selected.
| JTree | ||
|
Returns the foreground color for selected cells.
| JTree | ||
|
Returns the model for selections.
| JTree | ||
|
Returns the path to the first selected node.
| JTree | ||
|
getSelectionPaths():Array
Returns the paths of all selected values.
| JTree | ||
|
getSelectionRow():int
Returns the first selected row.
| JTree | ||
|
getSelectionRows():Array
Returns all of the currently selected rows.
| JTree | ||
![]() |
Stores the size value of this component into "return value" rv and returns rv.
| Component | |
|
getToggleClickCount():int
Returns the number of mouse clicks needed to expand or close a node.
| JTree | ||
![]() |
getToolTipText():String
Returns the tooltip string that has been set with setToolTipText.
| Component | |
|
getTreeUI():TreeUI
Returns the L&F object that renders this component.
| JTree | ||
![]() | Component | ||
|
getUIClassID():String
Returns the name of the L&F class that renders this component.
| JTree | ||
| JTree | |||
|
getVerticalUnitIncrement():int
| JTree | ||
| JTree | |||
| JTree | |||
| JTree | |||
| JTree | |||
|
getVisibleRowCount():int
Returns the number of rows that are displayed in the display area.
| JTree | ||
![]() |
getWidth():int
Returns the current width of this component
| Component | |
![]() |
getX():int
Returns the current x coordinate of the components.
| Component | |
![]() |
getY():int
Returns the current y coordinate of the components.
| Component | |
![]() | Component | ||
|
hasBeenExpanded(path:TreePath):Boolean
Returns true if the node identified by the path has ever been
expanded.
| JTree | ||
![]() |
hitTestMouse():Boolean
Returns whether the component hit the mouse.
| Component | |
![]() |
hitTestObject(obj:DisplayObject):Boolean
| AWSprite | |
![]() |
hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean
| AWSprite | |
![]() |
Add component to spesified index.
| Container | |
![]() |
insertAll(index:int, ... coms):void
Insets one or more component to the container with null constraints at specified starting index.
| Container | |
![]() |
invalidate():void
Invalidates the container.
| Container | |
![]() |
invalidatePreferSizeCaches():void
Clears this component and all parents above it's preferred size caches.
| Component | |
![]() |
isAncestorOf(c:Component):Boolean
Checks if the component is contained in the component hierarchy of
this container.
| Container | |
![]() |
isCachePreferSizes():Boolean
Returns whether or not the preferred size, minimum size and
max size cache is turned on.
| Component | |
![]() |
isClipMasked():Boolean
Returns whether the component clip should be masked by its bounds.
| AWSprite | |
|
isCollapsed(path:TreePath):Boolean
Returns true if the value identified by path is currently collapsed,
this will return false if any of the values in path are currently
not being displayed.
| JTree | ||
|
isCollapsedOfRow(row:int):Boolean
Returns true if the node at the specified display row is collapsed.
| JTree | ||
![]() |
isDragAcceptableInitiator(com:Component):Boolean
Returns whether the component is acceptable drag initiator for this component.
| Component | |
![]() |
isDragEnabled():Boolean
Returns whether this component can fire ON_DRAG_RECOGNIZED event.
| Component | |
![]() |
isDropTrigger():Boolean
Returns whether this component can trigger dragging component to fire drag events
when dragging over to this component.(Default value is false)
| Component | |
|
isEditable():Boolean
Returns true if the tree is editable.
| JTree | ||
|
isEditing():Boolean
Returns true if the tree is being edited.
| JTree | ||
![]() |
isEnabled():Boolean
Returns whether the component is enabled.
| Component | |
|
isExpanded(path:TreePath):Boolean
Returns true if the node identified by the path is currently expanded,
| JTree | ||
|
isExpandedOfRow(row:int):Boolean
Returns true if the node at the specified display row is currently
expanded.
| JTree | ||
|
isExpandsSelectedPaths():Boolean
Returns the
expandsSelectedPaths property. | JTree | ||
![]() |
isFocusable():Boolean
Returns whether this Component can be focused.
| Component | |
![]() |
isFocusableSet():Boolean
Returns whether or not the opaque property is set by user.
| Component | |
![]() |
isFocusOwner():Boolean
Returns
true if this Component is the
focus owner. | Component | |
![]() |
isFontValidated():Boolean
Returns whether the new font are applied and taked effect.
| Component | |
|
isInvokesStopCellEditing():Boolean
Returns the indicator that tells what happens when editing is
interrupted.
| JTree | ||
![]() |
isOnStage():Boolean
Determines whether or not this component is on stage(on the display list).
| Component | |
![]() |
isOpaque():Boolean
Returns true if this component is completely opaque.
| Component | |
![]() |
isOpaqueSet():Boolean
Returns whether or not the opaque property is set by user.
| Component | |
|
isPathEditable(path:TreePath):Boolean
Returns
isEditable. | JTree | ||
|
isPathSelected(path:TreePath):Boolean
Returns true if the item identified by the path is currently selected.
| JTree | ||
|
isPathVisible(path:TreePath):Boolean
Returns true if the value identified by path is currently viewable,
which means it is either the root or all of its parents are expanded.
| JTree | ||
|
isRootVisible():Boolean
Returns true if the root node of the tree is displayed.
| JTree | ||
|
isRowHeightSet():Boolean
Returns whether or not row height is set by user.
| JTree | ||
|
isRowSelected(row:int):Boolean
Returns true if the node identified by row is selected.
| JTree | ||
|
isScrollsOnExpand():Boolean
Returns the value of the
scrollsOnExpand property. | JTree | ||
|
isScrollsOnExpandSet():Boolean
Returns whether or not scrolls on expand is set by user.
| JTree | ||
|
isSelectionEmpty():Boolean
Returns true if the selection is currently empty.
| JTree | ||
![]() |
isShowing():Boolean
Determines whether this component is showing on screen.
| Component | |
![]() |
isUIElement():Boolean
Returns true if this component is just a ui element component,
false means this component is a regular use created component.
| Component | |
![]() |
isValid():Boolean
Determines whether this component is valid.
| Component | |
![]() |
isValidateRoot():Boolean
If this method returns true, revalidate calls by descendants of this
component will cause the entire tree beginning with this root to be validated.
| Component | |
![]() |
isVisible():Boolean
| Component | |
![]() |
makeFocus():void
Makes this component's internal focus object to be the stage focus directly,
without any judgement.
| Component | |
|
makePathVisible(path:TreePath):void
Ensures that the node identified by path is currently viewable.
| JTree | ||
![]() |
pack():void
Causes this component to be sized to fit the preferred size.
| Component | |
![]() |
paintFocusRect(force:Boolean = false):void
Paints the focus rect if need.
| Component | |
![]() |
paintImmediately():void
Redraw the component UI face immediately if it is visible and ready to paint.
| Component | |
![]() |
parentReAppendChildren():void
Calls parent reAppendChildren if parent is a container.
| Component | |
![]() |
putClientProperty(key:*, value:*):void
Adds an arbitrary key/value "client property" to this component.
| Component | |
![]() |
reAppendChildren():void
Removes all children and then append them with their constraints.
| Container | |
![]() |
reAppendToParent(constraints:Object = null):void
Removes this component from its parent and then append it with specified constraints.
| Component | |
![]() |
Remove the specified child component.
| Container | |
![]() |
removeAll():void
Remove all child components.
| Container | |
![]() |
Remove the specified index child component.
| Container | |
![]() |
removeChild(child:DisplayObject):DisplayObject
Removes a normal display object child.
| Container | |
![]() |
removeChildAt(index:int):DisplayObject
Removes a normal display object child with index.
| Container | |
|
Removes any paths from the selection model that are descendants of
the nodes identified by in
e. | JTree | ||
![]() |
removeDragAcceptableInitiator(com:Component):void
Removes a component to be the acceptable drag initiator to this component.
| Component | |
![]() |
removeFromContainer():void
Removes this component from its parent,
whatever it is as a component child or only a display object child,
or it's parent is just a display object container.
| Component | |
|
removeSelectionInterval(index0:int, index1:int, programmatic:Boolean = true):void
Removes the nodes between index0 and index1, inclusive, from the
selection.
| JTree | ||
|
removeSelectionListener(listener:Function):void
| JTree | ||
|
removeSelectionPath(path:TreePath, programmatic:Boolean = true):void
Removes the node identified by the specified path from the current
selection.
| JTree | ||
|
removeSelectionPaths(paths:Array, programmatic:Boolean = true):void
Removes the nodes identified by the specified paths from the
current selection.
| JTree | ||
|
removeSelectionRow(row:int, programmatic:Boolean = true):void
Removes the row at the index
row from the current
selection. | JTree | ||
|
removeSelectionRows(rows:Array, programmatic:Boolean = true):void
Removes the rows that are selected at each of the specified
rows.
| JTree | ||