Scout/Concepts/TreeField
Scout |
Wiki Home |
Website |
Download • Git |
Community |
Forums • Blog • Twitter • G+ |
Bugzilla |
Bugzilla |
Field that is used to display a tree.
Description
A TreeField is used to display a tree. Unlike the TreeBox that is a value field working with a CodeType or a LookupCall and providing checkboxes to select values, the TreeField is low level: you need to handle your Tree directly.
The TreeField is also used internally: in an Outline based application, the tree of pages on the left is displayed in a TreeField.
Code Example
Scout provides additional classes (AbstractTreeNodeBuilder
, AbstractTreeNode
) that might help you to instantiate your tree.
Here a code Snippet that constructs a tree given an array of LookupRows. The resulting field still differs from a TreeBox, because you have control of the tree and because this is not a value field.
public class TreeField extends AbstractTreeField { @Override protected void execInitField() throws ProcessingException { //Fetch the LookupRows: MyLookupCallcall = new MyLookupCall(); LookupRow[] lookupRows = call.getDataByAll(); //Build the Tree: ITree tree = getTree(); P_TreeNodeBuilder builder = new P_TreeNodeBuilder(); ITreeNode[] children = builder.createTreeNodes(lookupRows, ITreeNode.STATUS_NON_CHANGED, true); tree.addChildNodes(tree.getRootNode(), children); } @Order(10.0) public class Tree extends AbstractTree { } public class P_TreeNodeBuilder extends AbstractTreeNodeBuilder { @Override protected ITreeNode createEmptyTreeNode() throws ProcessingException { return new P_Node(); } } public class P_Node extends AbstractTreeNode { } }
Screenshot
Properties
Defined with getConfiguredXxxxxx() methods.
See also the Field page for the properties that all fields have in common.
Events
Defined with execXxxxxx() methods.
See also the Field page for the events that all fields have in common.