Class fvaswing.components.FvTree

Implemented Interfaces

DragListener

Description

Tree componant.

Extends AsWing JTree componant.

Features :

Use fvaswing.components.tree.FvTreeCellFactory cell factory ( or extend ) to add tree node context menu support.

Field Index

DEFAULT_EXPAND_TIMER, DND_COPY, DND_MIX, DND_MOVE, DND_NONE, ITEM_CLONE_MODE, ITEM_LINK_MODE

Method Index

new FvTree()
collapseAll(), editingStopped(), expandAll(), getAutoDragAndDropEnabled(), getAutoExpandTimer(), getAutoSortingEnabled(), getCopyItemMode(), getDefaultTreeModel(), getDragAndDropType(), getModel(), getNodeById(), getOrderArrangementEnabled(), getPreventRemovingEnabled(), getRemoveOutsideEnabled(), getRuntimeCopySelection(), getSelectionNode(), getSelectionNodes(), isAcceptableTreeSourceData(), isEditable(), isValidEditingValue(), onDragDrop(), onDragEnter(), onDragExit(), onDragOverring(), onDragStart(), removeNode(), removeNodes(), removePath(), removePaths(), setAutoDragAndDropEnabled(), setAutoExpandTimer(), setAutoSortingEnabled(), setCopyItemMode(), setDragAndDropType(), setModel(), setOrderArrangementEnabled(), setPreventRemovingEnabled(), setRemoveOutsideEnabled(), setRuntimeCopySelection(), sort(), sortNode(), sortPath()

Constructor Detail

FvTree

public function FvTree(m:FvTreeModel)

Constructor.

Field Detail

DND_NONE

static public DND_NONE:Number
Drag and drop disabled.

DND_MOVE

static public DND_MOVE:Number
Drag and drop enabled, and the action of items is move.

DND_COPY

static public DND_COPY:Number
Drag and drop enabled, and the action of items is copy.

DND_MIX

static public DND_MIX:Number
Drag and drop enabled, and the action depend of Control Key state :
  • released : move node
  • pressed : copy node

DEFAULT_EXPAND_TIMER

static public DEFAULT_EXPAND_TIMER:Number
Time to wait before target node expand himself. ( default is 2000 ms ).

ITEM_LINK_MODE

static public ITEM_LINK_MODE:Number
A simple copy ( reference ) is done when user copy a node.

ITEM_CLONE_MODE

static public ITEM_CLONE_MODE:Number
An item content clone is build when user copy a node. ( default )

Method Detail

setModel

public function setModel(m:FvTreeModel):Void

Sets the FvTreeModel that will provide the data.

Parameters

getModel

public function getModel():FvTreeModel

Returns the FvTreeModel that is providing the data.

setDragAndDropType

public function setDragAndDropType(type:Number):Void

Sets auto drag and drop type.

Available mode are :

  • #DND_NONE
  • #DND_MOVE
  • #DND_COPY

getDragAndDropType

public function getDragAndDropType():Number

Returns the auto drag and drop type.

Return value can be :

  • #DND_NONE
  • #DND_MOVE
  • #DND_COPY

setAutoDragAndDropEnabled

public function setAutoDragAndDropEnabled(b:Boolean):Void

Allows auto Drag'n Drop.

Means allow Drag'n Drop inside the current tree.

getAutoDragAndDropEnabled

public function getAutoDragAndDropEnabled():Boolean

Returns true if Drag'n Drop is allowed inside current component.

setCopyItemMode

public function setCopyItemMode(n:Number):Void

Sets copy item mode.

Available mode are :

  • #ITEM_LINK_MODE
  • #ITEM_CLONE_MODE

getCopyItemMode

public function getCopyItemMode():Number

Returns copy item mode.

Returns value can be :

  • #ITEM_LINK_MODE
  • #ITEM_CLONE_MODE

setRuntimeCopySelection

public function setRuntimeCopySelection(b:Boolean):Void

Defines if user can choose between copy item mode.
Default is false.

If true a popupmenu is opened when user press Shift key.

getRuntimeCopySelection

public function getRuntimeCopySelection():Boolean

Returns if user can choose between copy item mode.

setRemoveOutsideEnabled

public function setRemoveOutsideEnabled(b:Boolean):Void

Sets if dropped node(s) can be removed from tree when usser drop them outside the tree component.

Use {link #setPreventBeforeRemoving()} method to determine if a confirmation dialog appear ( or not ) before removing dropped node(s).

getRemoveOutsideEnabled

public function getRemoveOutsideEnabled():Boolean

Returns true if node(s) can be removed when user dropped them outside the tree component.

Use #setRemoveOutsideEnabled() to define this property.

setPreventRemovingEnabled

public function setPreventRemovingEnabled(b:Boolean):Void

Indicates if a confirmation dialog appear before removing node in Outside dropping.

getPreventRemovingEnabled

public function getPreventRemovingEnabled():Boolean

Returns true if confirmation dialog is needed.

setOrderArrangementEnabled

public function setOrderArrangementEnabled(b:Boolean):Void

Sets if user can arrange nodes order ( in childnode structure ) using Dran'n Drop process. ( default is false )

getOrderArrangementEnabled

public function getOrderArrangementEnabled():Boolean

Returns true if user can arrange nodes order ( in childnode structure ) using Dran'n Drop process.

setAutoExpandTimer

public function setAutoExpandTimer(n:Number):Void

Sets necessary time before expand a target node during Dnd process.
Must be > 0.

Default is 2000 ms.

getAutoExpandTimer

public function getAutoExpandTimer():Number

Returns necessary time before expand a target node during Dnd process.

isAcceptableTreeSourceData

public function isAcceptableTreeSourceData(dragInitiator:Component, sd:SourceData):Boolean

Returns is the source data is acceptale to drop in this tree as build-in support

isEditable

public function isEditable():Boolean

Returns true if the tree is editable.

If node is selelected check the node.isEditable() property

Return

true if the tree is editable

sort

public function sort():Void

Sorts all tree nodes.

Use FvTreeModel#setSortingProcess() method to define sorting function.

sortNode

public function sortNode(node:FvTreeNode):Void

Sorts passed-in node childnodes.

Use FvTreeModel#setSortingProcess() method to define sorting function.

sortPath

public function sortPath(path:TreePath):Void

Sorts passed-in path treepath.

Use FvTreeModel#setSortingProcess() method to define sorting function.

setAutoSortingEnabled

public function setAutoSortingEnabled(b:Boolean):Void

Sets if childnodes are automatically reorder ( sort ).

getAutoSortingEnabled

public function getAutoSortingEnabled():Boolean

Returns true if auto sorting is enabled.

getNodeById

public function getNodeById(nodeID:Number):FvTreeNode

Returns tree node resgitred with passed-in nodeID in current tree.

If not, return null

getSelectionNode

public function getSelectionNode():FvTreeNode

Returns the first selected node.

getSelectionNodes

public function getSelectionNodes():Array

Returns the node of all selected values.

removePath

public function removePath(path:TreePath):Void

Removes passed-in path from model.

removePaths

public function removePaths(paths:Array):Void

Removes passed-in paths list from tree model.

removeNode

public function removeNode(node:FvTreeNode):Void

Removes passed-in node from tree model.

removeNodes

public function removeNodes(nodes:Array):Void

Removes passed-in nodes list from tree model.

collapseAll

public function collapseAll():Void

Collapse all tree paths.

expandAll

public function expandAll():Void

Collapse all tree paths.

editingStopped

public function editingStopped(source:CellEditor):Void

Editor has ended editing.

isValidEditingValue

public function isValidEditingValue(newValue):Boolean

Returns true if newValue is a valid value for current edited cell.

Override this method to implement your own value checking process.

onDragStart

public function onDragStart(dragInitiator:Component, sourceData:SourceData, pos:Point):Void

Null. Implemented for DragListener interface.

onDragEnter

public function onDragEnter(dragInitiator:Component, sourceData:SourceData, pos:Point, targetComponent:Component):Void

Null. Implemented for DragListener interface.

onDragOverring

public function onDragOverring(dragInitiator:Component, sourceData:SourceData, pos:Point, targetComponent:Component):Void

Null. Implemented for DragListener interface.

onDragExit

public function onDragExit(dragInitiator:Component, sourceData:SourceData, pos:Point, targetComponent:Component):Void

Null. Implemented for DragListener interface.

onDragDrop

public function onDragDrop(dragInitiator:Component, sourceData:SourceData, pos:Point, targetComponent:Component):Void

Called when drag operation finished outside the component.

Allow detection of component initiator outside drop.

If you overrides method, think about call the super.onDragDrop() method to keep outside dropping detection.

Parameters

dragInitiatorthe drag initiator component
posa Point indicating the cursor location in global space
targetComponentdropped component, it may be null if droped on a non-drag-trigger space.

getDefaultTreeModel

static public function getDefaultTreeModel():FvTreeModel

Creates and returns a sample FvTreeModel.

Overrides JTree method.

Return

the default FvTreeModel