class org.aswing.JTree extends Container

A control that displays a set of hierarchical data as an outline.

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.

The following JTree methods use "visible" to mean "displayed":

  • isRootVisible()
  • setRootVisible()
  • scrollPathToVisible()
  • scrollRowToVisible()
  • getVisibleRowCount()
  • setVisibleRowCount()

The next group of 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.

If you are interested in detecting either double-click events or when a user clicks on a node, regardless of whether or not it was selected, we recommend you do the following:

    yourTree.addEventListener(MouseEvent.MOUSEDOWN, 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 TreeCell and TreeCellFactory and use setCellFactory to tell the tree to use it. To edit such nodes, subclass TreeCellEditor and use setCellEditor.

For a big model tree, there's two way to speed up the performance. E.g. call JTree.setFixedCellWidth(width:int) to fix the cell width.

@see TreeModel

Authors: paling, ngrebenshikov

Class Fields

static var ANCHOR_SELECTION_PATH_PROPERTY:String

Bound property name for anchor selection path.

static var AUTO_INCREMENT:Int

The default unit/block increment, it means auto count a value.

static var CELL_EDITOR_PROPERTY:String

Bound property name for cellEditor.

static var CELL_FACTORY_PROPERTY:String

Bound property name for cellFactory.

static var CONTIGUOUS_TREE_SELECTION:Int

Selection 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 DISCONTIGUOUSTREESELECTION.

static var DISCONTIGUOUS_TREE_SELECTION:Int

Selection can contain any number of items that are not necessarily contiguous.

static var EDITABLE_PROPERTY:String

Bound property name for editable.

static var EXPANDS_SELECTED_PATHS_PROPERTY:String

Bound property name for expands selected paths property

static var FONT_PROPERTY:String

Bound property name for font property

static var INVOKES_STOP_CELL_EDITING_PROPERTY:String

Bound property name for messagesStopCellEditing.

static var LEAD_SELECTION_PATH_PROPERTY:String

Bound property name for leadSelectionPath.

static var ROOT_VISIBLE_PROPERTY:String

Bound property name for rootVisible.

static var ROW_HEIGHT_PROPERTY:String

Bound property name for showsRootHandles.

static var SCROLLS_ON_EXPAND_PROPERTY:String

Bound property name for scrollsOnExpand.

static var SELECTION_MODEL_PROPERTY:String

Bound property name for selectionModel.

static var SINGLE_TREE_SELECTION:Int

Selection can only contain one path at a time.

static var TOGGLE_CLICK_COUNT_PROPERTY:String

Bound property name for toggleClickCount.

static var TREE_MODEL_PROPERTY:String

Bound property name for treeModel.

static var VISIBLE_ROW_COUNT_PROPERTY:String

Bound property name for visibleRowCount.

Instance Fields

Show inherited public instance fieldsHide inherited public instance fields

Inherited from Container

var layout:LayoutManager
function append(com:Component, ?constraints:Dynamic):Void
function appendAll(coms:Array<Dynamic>):Void
function doLayout():Void
function getComponent(index:Int):Component
function getComponentCount():Int
function getComponents():Array<Dynamic>
function getFocusTraversalPolicy():FocusTraversalPolicy
function getIndex(com:Component):Int
function getLayout():LayoutManager
function insert(i:Int, com:Component, ?constraints:Dynamic):Void
function insertAll(index:Int, coms:Array<Dynamic>):Void
function invalidate():Void
function isAncestorOf(c:Component):Bool
function reAppendChildren():Void
function remove(com:Component):Component
function removeAll():Void
function removeAt(i:Int):Component
function removeChild(child:DisplayObject):DisplayObject
function removeChildAt(index:Int):DisplayObject
function setFocusTraversalPolicy(ftp:FocusTraversalPolicy):Void
function setLayout(layout:LayoutManager):Void
function validate():Void

Inherited from Component

var __fieldBindings__:FieldsBindSignal
var __methodBindings__:MethodsBindSignal
var alignmentX:Float
var alignmentY:Float
var background:ASColor
var backgroundDecorator:GroundDecorator
var border:Border
var bounds:IntRectangle
var clipBounds:IntRectangle
var constraints:Dynamic
var currentSize:IntDimension
var dragEnabled:Bool
var dropTrigger:Bool
var enabled:Bool
var focusable:Bool
var focusableSet:Bool
var font:ASFont
var foreground:ASColor
var foregroundDecorator:GroundDecorator
var location:IntPoint
var maximumSize:IntDimension
var mideground:ASColor
var minimumSize:IntDimension
var opaque:Bool
var opaqueSet:Bool
var preferredSize:IntDimension
var resizerMargin:Insets
var styleProxy:Component
var styleTune:StyleTune
var toolTipText:String
var transitFocusFactor:Float
var ui:ComponentUI
var uiElement:Bool
var visibility:Bool
function addDragAcceptableInitiator(com:Component):Void
function componentToGlobal(p:IntPoint):IntPoint
function getClientProperty(key:String, ?defaultValue:Dynamic):Dynamic
function getDefaultBasicUIClass():Class<Dynamic>
function getFocusManager():FocusManager
function getGlobalLocation(?rv:IntPoint):IntPoint
function getInsets():Insets
function getInternalFocusObject():InteractiveObject
function getKeyboardManager():KeyboardManager
function getMousePosition():IntPoint
function getPaintBounds():IntRectangle
function getParent():Container
function getRootPaneAncestor():JRootPane
function getUIClassID():String
function globalToComponent(p:IntPoint):IntPoint
function hitTestMouse():Bool
function invalidate():Void
function invalidatePreferSizeCaches():Void
function isCachePreferSizes():Bool
function isDragAcceptableInitiator(com:Component):Bool
function isFocusOwner():Bool
function isFontValidated():Bool
function isOnStage():Bool
function isShowing():Bool
function isValid():Bool
function isValidateRoot():Bool
function makeFocus():Void
function pack():Void
function paintFocusRect(?force:Bool):Void
function paintImmediately():Void
function parentReAppendChildren():Void
function putClientProperty(key:String, value:Dynamic):Void
function reAppendToParent(?constraints:Dynamic):Void
function removeDragAcceptableInitiator(com:Component):Void
function removeFromContainer():Void
function repaint():Void
function repaintAndRevalidate():Void
function requestFocus():Bool
function revalidate():Void
function setCachePreferSizes(b:Bool):Void
function setClipSize(size:IntDimension):Void
function setDragAcceptableInitiatorAppraiser(func:Dynamic ->Bool):Void
function setFontValidated(b:Bool):Void
function setGlobalLocation(gp:IntPoint):Void
function transferFocus():Bool
function transferFocusBackward():Bool
function updateUI():Void
function validate():Void

Inherited from AWSprite

function bringToBottom(child:DisplayObject):Void
function bringToTop(child:DisplayObject):Void
function containsChild(child:DisplayObject):Bool
function getHighestIndexUnderForeground():Int
function getLowestIndexAboveBackground():Int
function isClipMasked():Bool
function setChildIndex(child:DisplayObject, index:Int):Void
function setClipMaskRect(b:IntRectangle):Void
function setClipMasked(m:Bool):Void
function toString():String

Inherited from Sprite

var buttonMode:Bool
var dropTarget:DisplayObject
var graphics:Graphics
var hitArea:Sprite
var soundTransform:SoundTransform
var useHandCursor:Bool
function startDrag(?lockCenter:Bool, ?bounds:Rectangle):Void
function startTouchDrag(touchPointID:Int, ?lockCenter:Bool, ?bounds:Rectangle):Void
function stopDrag():Void
function stopTouchDrag(touchPointID:Int):Void

Inherited from DisplayObjectContainer

var mouseChildren:Bool
var numChildren:Int
var tabChildren:Bool
var textSnapshot:TextSnapshot
function addChild(child:DisplayObject):DisplayObject
function addChildAt(child:DisplayObject, index:Int):DisplayObject
function areInaccessibleObjectsUnderPoint(point:Point):Bool
function contains(child:DisplayObject):Bool
function getChildAt(index:Int):DisplayObject
function getChildByName(name:String):DisplayObject
function getChildIndex(child:DisplayObject):Int
function getObjectsUnderPoint(point:Point):Array<DisplayObject>
function removeChild(child:DisplayObject):DisplayObject
function removeChildAt(index:Int):DisplayObject
function setChildIndex(child:DisplayObject, index:Int):Void
function swapChildren(child1:DisplayObject, child2:DisplayObject):Void
function swapChildrenAt(index1:Int, index2:Int):Void

Inherited from InteractiveObject

var accessibilityImplementation:AccessibilityImplementation
var contextMenu:ContextMenu
var doubleClickEnabled:Bool
var focusRect:Dynamic
var mouseEnabled:Bool
var tabEnabled:Bool
var tabIndex:Int

Inherited from DisplayObject

var accessibilityProperties:AccessibilityProperties
var alpha:Float
var blendMode:BlendMode
var blendShader:Shader
var cacheAsBitmap:Bool
var filters:Array<BitmapFilter>
var height:Float
var loaderInfo:LoaderInfo
var mask:DisplayObject
var mouseX:Float
var mouseY:Float
var name:String
var opaqueBackground:Null<UInt>
var parent:DisplayObjectContainer
var root:DisplayObject
var rotation:Float
var rotationX:Float
var rotationY:Float
var rotationZ:Float
var scale9Grid:Rectangle
var scaleX:Float
var scaleY:Float
var scaleZ:Float
var scrollRect:Rectangle
var stage:Stage
var transform:Transform
var visible:Bool
var width:Float
var x:Float
var y:Float
var z:Float
function getBounds(targetCoordinateSpace:DisplayObject):Rectangle
function getRect(targetCoordinateSpace:DisplayObject):Rectangle
function globalToLocal(point:Point):Point
function globalToLocal3D(point:Point):Vector3D
function hitTestObject(obj:DisplayObject):Bool
function hitTestPoint(x:Float, y:Float, ?shapeFlag:Bool):Bool
function local3DToGlobal(point3d:Vector3D):Point
function localToGlobal(point:Point):Point

Inherited from EventDispatcher

function addEventListener(type:String, listener:Dynamic ->Void?useCapture:Bool, ?priority:Int, ?useWeakReference:Bool):Void
function dispatchEvent(event:Event):Bool
function hasEventListener(type:String):Bool
function removeEventListener(type:String, listener:Dynamic ->Void?useCapture:Bool):Void
function toString():String
function willTrigger(type:String):Bool

var cellEditor:TreeCellEditor

Editor for the entries. Default is null (tree is not editable).

var cellFactory:TreeCellFactory

The cell used to draw nodes. If null, the UI uses a default cellRenderer.

var editable:Bool

Is the tree editable? Default is false.

var expandsSelectedPaths:Bool

If true, any time the selection is changed, either via the TreeSelectionModel, or the cover methods provided by JTree, the TreePaths parents will be expanded to make them visible (visible meaning the parent path is expanded, not necessarily in the visible rectangle of the JTree). If false, when the selection changes the nodes parent is not made visible (all its parents expanded). This is useful if you wish to have your selection model maintain paths that are not always visible (all parents expanded).

var fixedCellWidth:Int

The width of every cell in the list. If width is -1, cell widths are computed by applying TreeCell.getPreferredSize() for each list element.

The default value of this property is -1.

If your tree model is very large or all of your tree item has same width, we recommend you set a fixed cell with it will speed up the performance.

See setRowHeight()

var horizontalBlockIncrement:Int

The block value for the Horizontal scrolling.

var horizontalUnitIncrement:Int

Returns the unit value for the Horizontal scrolling.

var invokesStopCellEditing:Bool

If true, when editing is to be stopped by way of selection changing, data in tree changing or other means stopCellEditing is invoked, and changes are saved. If false, cancelCellEditing is invoked, and changes are discarded. Default is false.

var model:TreeModel

The model that defines the tree displayed by this object.

var rootVisible:Bool

True if the root node is displayed, false if its children are the highest visible nodes.

var rowHeight:Int

Height to use for each display row. If this is <= 0 the renderer determines the height for each row.

var rowHeightSet:Bool

Whether or not row height is set by user. If it is set by user, the LAF will not change the row height value.

var scrollsOnExpand:Bool

If true, when a node is expanded, as many of the descendants are scrolled to be visible.

var scrollsOnExpandSet:Bool

Whether or not scrolls on expand is set by user. If it is set by user, the LAF will not change the scrolls on expand value.

var selectionBackground:ASColor

The background color for selected cells. Cell renderers can use this color to render text and graphics for selected cells.

The default value of this property is defined by the look and feel implementation.

See selectionForeground, foreground, background, font

var selectionForeground:ASColor

The foreground color for selected cells. Cell renderers can use this color to render text and graphics for selected cells.

The default value of this property is defined by the look and feel implementation.

See selectionBackground, foreground, background, font

var selectionModel:TreeSelectionModel

Models the set of selected nodes in this tree.

var toggleClickCount:Int

Number of mouse clicks before a node is expanded.

var verticalBlockIncrement:Int

The block value for the Vertical scrolling.

var verticalUnitIncrement:Int

The unit value for the Vertical scrolling.

var visibleRowCount:Int

Number of rows to make visible at one time. This value is used for the Scrollable interface. It determines the preferred size of the display area.

function new(?newModel:TreeModel = null): Void

JTree(newModel:TreeModel);

JTree() a defaul model will be created

@see DefaultTreeModel.asksAllowsChildren

newModel

(optional) the TreeModel to use as the data model. If miss it, the empty model will be created.

returns

an instance of JTree which displays the root node (the tree is created using the specified data model).

function addSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool = true): Void

Adds the paths between index0 and index1, inclusive, to the selection.

index0

an integer specifying a display row, where 0 is the first row in the display

index1

an integer specifying a second display row

programmatic

indicate if this is a programmatic change

function addSelectionListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void

Adds a listener for tree selection events. the listenerthat will be notified when a node is selected or deselected (a "negative selection")

listener

the new listener to be added

priority

the priority

useWeakReference

Determines whether the reference to the listener is strong or weak.

function addSelectionPath(path:TreePath, ?programmatic:Bool = true): Void

Adds the node identified by the specified TreePath to the current selection. If any component of the path isn't viewable, and getExpandsSelectedPaths is true it is made viewable.

Note that JTree does not allow duplicate nodes to exist as children under the same parent -- each sibling must be a unique object.

path

the TreePath to add

programmatic

indicate if this is a programmatic change

function addSelectionPaths(paths:Array<Dynamic>, ?programmatic:Bool = true): Void

Adds each path in the array of paths to the current selection. If any component of any of the paths isn't viewable and getExpandsSelectedPaths is true, it is made viewable.

Note that JTree does not allow duplicate nodes to exist as children under the same parent -- each sibling must be a unique object.

paths

an array of TreePath objects that specifies the nodes to add

programmatic

indicate if this is a programmatic change

function addSelectionRow(row:Int, ?programmatic:Bool = true): Void

Adds the path at the specified row to the current selection.

row

an integer specifying the row of the node to add, where 0 is the first row in the display

programmatic

indicate if this is a programmatic change

function addSelectionRows(rows:Array<Dynamic>, ?programmatic:Bool = true): Void

Adds the paths at each of the specified rows to the current selection.

rows

an array of ints specifying the rows to add, where 0 indicates the first row in the display

programmatic

indicate if this is a programmatic change

function addStateListener(listener:Dynamic ->Void?priority:Int = 0, ?useWeakReference:Bool = false): Void

Add a listener to listen the viewpoat state change event.

When the viewpoat's state changed, the state is all about:

  • viewPosition
  • verticalUnitIncrement
  • verticalBlockIncrement
  • horizontalUnitIncrement
  • horizontalBlockIncrement
@see org.aswing.event.InteractiveEvent.STATE_CHANGED

listener

the listener

priority

the priority

useWeakReference

Determines whether the reference to the listener is strong or weak.

function cancelEditing(): Void

Cancels the current editing session. Has no effect if the tree isn't being edited.

function clearSelection(?programmatic:Bool = true): Void

Clears the selection.

programmatic

indicate if this is a programmatic change

function collapsePath(path:TreePath): Void

Ensures that the node identified by the specified path is collapsed and viewable.

path

the TreePath identifying a node

function collapseRow(row:Int): Void

Ensures that the node in the specified row is collapsed.

If row is < 0 or >= getRowCount this will have no effect.

row

an integer specifying a display row, where 0 is the first row in the display

function editingCanceled(source:CellEditor): Void

function editingStopped(source:CellEditor): Void

function expandPath(path:TreePath): Void

Ensures that the node identified by the specified path is expanded and viewable. If the last item in the path is a leaf, this will have no effect.

path

the TreePath identifying a node

function expandRow(row:Int): Void

Ensures that the node in the specified row is expanded and viewable.

If row is < 0 or >= getRowCount this will have no effect.

row

an integer specifying a display row, where 0 is the first row in the display

function fireTreeCollapsed(path:TreePath): Void

Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the path parameter.

path

the TreePath indicating the node that was collapsed See EventListenerList

function fireTreeExpanded(path:TreePath): Void

Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the path parameter.

path

the TreePath indicating the node that was expanded See EventListenerList

function fireTreeWillCollapse(path:TreePath): Void

Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the path parameter.

path

the TreePath indicating the node that was expanded See EventListenerList

function fireTreeWillExpand(path:TreePath): Void

Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created using the path parameter.

path

the TreePath indicating the node that was expanded See EventListenerList

function getAnchorSelectionPath(): TreePath

Returns the path identified as the anchor.

returns

path identified as the anchor

function getClosestPathForLocation(x:Int, y:Int): TreePath

Returns the path to the node that is closest to x,y. If no nodes are currently viewable, or there is no model, returns null, otherwise it always returns a valid path. To test if the node is exactly at x, y, get the node's bounds and test x, y against that.

@see getPathForLocation @see getPathBounds

x

an integer giving the number of pixels horizontally from the left edge of the display area, minus any left margin

y

an integer giving the number of pixels vertically from the top of the display area, minus any top margin

returns

the TreePath for the node closest to that location, null if nothing is viewable or there is no model

function getClosestRowForLocation(x:Int, y:Int): Int

Returns the row to the node that is closest to x,y. If no nodes are viewable or there is no model, returns -1. Otherwise, it always returns a valid row. To test if the returned object is exactly at x, y, get the bounds for the node at the returned row and test x, y against that.

@see getRowForLocation @see getRowBounds

x

an integer giving the number of pixels horizontally from the left edge of the display area, minus any left margin

y

an integer giving the number of pixels vertically from the top of the display area, minus any top margin

returns

the row closest to the location, -1 if nothing is viewable or there is no model

function getEditingPath(): TreePath

Returns the path to the element that is currently being edited.

returns

the TreePath for the node being edited

function getExpandedDescendants(parent:TreePath): Array<Dynamic>

Returns an Array of the descendants of the path parent that are currently expanded. If parent is not currently expanded, this will return null. If you expand/collapse nodes while iterating over the returned Array this may not return all the expanded paths, or may return paths that are no longer expanded.

parent

the path which is to be examined

returns

an Array of the descendents of parent, or null if parent is not currently expanded

function getLastSelectedPathComponent(): Dynamic

Returns the last path component in the first node of the current selection.

@see TreePath.getLastPathComponent

returns

the last Object in the first selected node's TreePath, or null if nothing is selected

function getLeadSelectionPath(): TreePath

Returns the path identified as the lead.

returns

path identified as the lead

function getLeadSelectionRow(): Int

Returns the row index corresponding to the lead path.

returns

an integer giving the row index of the lead path, where 0 is the first row in the display; or -1 if leadPath is null

function getLogicLocationFromPixelLocation(p:IntPoint): IntPoint

Returns the location in the JTree view area of the logic location.

function getMaxSelectionRow(): Int

Returns the last selected row.

returns

an integer designating the last selected row, where 0 is the first row in the display

function getMinSelectionRow(): Int

Gets the first selected row.

returns

an integer designating the first selected row, where 0 is the first row in the display

function getMousePointedPath(): TreePath

Returns the treePath that the user mouse pointed, null if no path was pointed.

returns

the path mouse pointed, null if not pointed any one.

function getPathBounds(path:TreePath): IntRectangle

Returns the IntRectangle that the specified node will be drawn into. Returns null if any component in the path is hidden (under a collapsed parent).

Note:
This method returns a valid rectangle, even if the specified node is not currently displayed.

path

the TreePath identifying the node

returns

the IntRectangle the node is drawn in, or null

function getPathForLocation(x:Int, y:Int): TreePath

Returns the path for the node at the specified location.

x

an integer giving the number of pixels horizontally from the left edge of the display area, minus any left margin

y

an integer giving the number of pixels vertically from the top of the display area, minus any top margin

returns

the TreePath for the node at that location

function getPathForRow(row:Int): TreePath

Returns the path for the specified row. If row is not visible, null is returned.

row

an integer specifying a row

returns

the TreePath to the specified node, null if row < 0 or row > getRowCount()

function getPixelLocationFromLogicLocation(p:IntPoint): IntPoint

Returns the location in the JTree view area of the logic location.

function getRowBounds(row:Int): IntRectangle

Returns the IntRectangle that the node at the specified row is drawn in.

row

the row to be drawn, where 0 is the first row in the display

returns

the IntRectangle the node is drawn in

function getRowCount(): Int

The number of rows that are currently being displayed.

returns

the number of rows that are being displayed

function getRowForLocation(x:Int, y:Int): Int

Returns the row for the specified location.

@see getClosestRowForLocation

x

an integer giving the number of pixels horizontally from the left edge of the display area, minus any left margin

y

an integer giving the number of pixels vertically from the top of the display area, minus any top margin

returns

the row corresponding to the location, or -1 if the location is not within the bounds of a displayed cell

function getRowForPath(path:TreePath): Int

Returns the row that displays the node identified by the specified path.

path

the TreePath identifying a node

returns

an integer specifying the display row, where 0 is the first row in the display, or -1 if any of the elements in path are hidden under a collapsed parent.

function getSelectionCount(): Int

Returns the number of nodes selected.

returns

the number of nodes selected

function getSelectionPath(): TreePath

Returns the path to the first selected node.

returns

the TreePath for the first selected node, or null if nothing is currently selected

function getSelectionPaths(): Array<Dynamic>

Returns the paths of all selected values.

returns

an array of TreePath objects indicating the selected nodes, or null if nothing is currently selected

function getSelectionRow(): Int

Returns the first selected row. If nothing is selected -1 will be returned.

returns

the first selected row. If nothing is selected -1 will be returned.

function getSelectionRows(): Array<Dynamic>

Returns all of the currently selected rows. This method is simply forwarded to the TreeSelectionModel. If nothing is selected null or an empty array will be returned, based on the TreeSelectionModel implementation.

returns

an array of integers that identifies all currently selected rows where 0 is the first row in the display

function getTreeUI(): TreeUI

Returns the L&F object that renders this component.

returns

the TreeUI object that renders this component

function hasBeenExpanded(path:TreePath): Bool

Returns true if the node identified by the path has ever been expanded.

returns

true if the path has ever been expanded

function isCollapsed(path:TreePath): Bool

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.

path

the TreePath to check

returns

true if any of the nodes in the node's path are collapsed, false if all nodes in the path are expanded

function isCollapsedOfRow(row:Int): Bool

Returns true if the node at the specified display row is collapsed.

row

the row to check, where 0 is the first row in the display

returns

true if the node is currently collapsed, otherwise false

function isEditing(): Bool

Returns true if the tree is being edited. The item that is being edited can be obtained using getSelectionPath.

@see getSelectionPath

returns

true if the user is currently editing a node

function isExpanded(path:TreePath): Bool

Returns true if the node identified by the path is currently expanded,

path

the TreePath specifying the node to check

returns

false if any of the nodes in the node's path are collapsed, true if all nodes in the path are expanded

function isExpandedOfRow(row:Int): Bool

Returns true if the node at the specified display row is currently expanded.

row

the row to check, where 0 is the first row in the display

returns

true if the node is currently expanded, otherwise false

function isPathEditable(path:TreePath): Bool

This is invoked from the UI before editing begins to insure that the given path can be edited. This is provided as an entry point for subclassers to add filtered editing without having to resort to creating a new editor.

@see editable

returns

true if every parent node and the node itself is editable

function isPathSelected(path:TreePath): Bool

Returns true if the item identified by the path is currently selected.

path

a TreePath identifying a node

returns

true if the node is selected

function isPathVisible(path:TreePath): Bool

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. Otherwise, this method returns false.

returns

true if the node is viewable, otherwise false

function isRowSelected(row:Int): Bool

Returns true if the node identified by row is selected.

row

an integer specifying a display row, where 0 is the first row in the display

returns

true if the node is selected

function isSelectionEmpty(): Bool

Returns true if the selection is currently empty.

returns

true if the selection is currently empty

function makePathVisible(path:TreePath): Void

Ensures that the node identified by path is currently viewable.

path

the TreePath to make visible

function removeDescendantSelectedPathsWithEvent(e:TreeModelEvent): Void

Removes any paths from the selection model that are descendants of the nodes identified by in e.

function removeSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool = true): Void

Removes the nodes between index0 and index1, inclusive, from the selection.

index0

an integer specifying a display row, where 0 is the first row in the display

index1

an integer specifying a second display row

programmatic

indicate if this is a programmatic change

function removeSelectionPath(path:TreePath, ?programmatic:Bool = true): Void

Removes the node identified by the specified path from the current selection.

path

the TreePath identifying a node

programmatic

indicate if this is a programmatic change

function removeSelectionPaths(paths:Array<Dynamic>, ?programmatic:Bool = true): Void

Removes the nodes identified by the specified paths from the current selection.

paths

an array of TreePath objects that specifies the nodes to remove

programmatic

indicate if this is a programmatic change

function removeSelectionRow(row:Int, ?programmatic:Bool = true): Void

Removes the row at the index row from the current selection.

row

the row to remove

programmatic

indicate if this is a programmatic change

function removeSelectionRows(rows:Array<Dynamic>, ?programmatic:Bool = true): Void

Removes the rows that are selected at each of the specified rows.

rows

an array of ints specifying display rows, where 0 is the first row in the display

programmatic

indicate if this is a programmatic change

function removeStateListener(listener:Dynamic ->Void): Void

Removes a state listener. @see org.aswing.event.AWEvent.STATE_CHANGED

listener

the listener to be removed.

function scrollPathToVisible(path:TreePath): Void

Makes sure all the path components in path are expanded (except for the last path component) and scrolls so that the node identified by the path is displayed. Only works when this JTree is contained in a JScrollPane.

path

the TreePath identifying the node to bring into view

function scrollRectToVisible(contentRect:IntRectangle, ?programmatic:Bool = true): Void

function scrollRowToVisible(row:Int): Void

Scrolls the item identified by row until it is displayed. The minimum of amount of scrolling necessary to bring the row into view is performed. Only works when this JTree is contained in a JScrollPane.

row

an integer specifying the row to scroll, where 0 is the first row in the display

function setAnchorSelectionPath(newPath:TreePath): Void

Sets the path identified as the anchor. The anchor is not maintained by JTree, rather the UI will update it.

newPath

the new anchor path

function setLeadSelectionPath(newPath:TreePath): Void

Sets the path identifies as the lead. The lead may not be selected. The lead is not maintained by JTree, rather the UI will update it.

newPath

the new lead path

function setSelectionInterval(index0:Int, index1:Int, ?programmatic:Bool = true): Void

Selects the nodes between index0 and index1, inclusive.

index0

an integer specifying a display row, where 0 is the first row in the display

index1

an integer specifying a second display row

programmatic

indicate if this is a programmatic change

function setSelectionMode(mode:Int): Void

Proxy method which passes specified selection mode to the currently configured selection model.

mode

the selection mode identifier

function setSelectionPath(path:TreePath, ?programmatic:Bool = true): Void

Selects the node identified by the specified path. If any component of the path is hidden (under a collapsed node), and getExpandsSelectedPaths is true it is exposed (made viewable).

path

the TreePath specifying the node to select

programmatic

indicate if this is a programmatic change

function setSelectionPaths(paths:Array<Dynamic>, ?programmatic:Bool = true): Void

Selects the nodes identified by the specified array of paths. If any component in any of the paths is hidden (under a collapsed node), and getExpandsSelectedPaths is true it is exposed (made viewable).

paths

an array of TreePath objects that specifies the nodes to select

programmatic

indicate if this is a programmatic change

function setSelectionRow(row:Int, ?programmatic:Bool = true): Void

Selects the node at the specified row in the display.

row

the row to select, where 0 is the first row in the display

programmatic

indicate if this is a programmatic change

function setSelectionRows(rows:Array<Dynamic>, ?programmatic:Bool = true): Void

Selects the nodes corresponding to each of the specified rows in the display. If a particular element of rows is < 0 or >= getRowCount, it will be ignored. If none of the elements in rows are valid rows, the selection will be cleared. That is it will be as if clearSelection was invoked.

rows

an array of ints specifying the rows to select, where 0 indicates the first row in the display

programmatic

indicate if this is a programmatic change

function setViewPosition(p:IntPoint, ?programmatic:Bool = true): Void

function startEditingAtPath(path:TreePath): Void

Selects the node identified by the specified path and initiates editing. The edit-attempt fails if the CellEditor does not allow editing for the specified item.

path

the TreePath identifying a node

function stopEditing(): Bool

Ends the current editing session. (The DefaultTreeCellEditor object saves any edits that are currently in progress on a cell. Other implementations may operate differently.) Has no effect if the tree isn't being edited.

Note:
To make edit-saves automatic whenever the user changes their position in the tree, use {@link setInvokesStopCellEditing}.

returns

true if editing was in progress and is now stopped, false if editing was not in progress

function treeDidChange(): Void

Notifies all listeners that have registered interest for notification on this event type.

e

the TreeSelectionEvent to be fired; generated by the

<code>TreeSelectionModel</code>

when a node is selected or deselected See EventListenerList