Class
zebkit.ui.tree.BaseTree
mixed with <zebkit.EventProducer> <zebkit.ui.HostDecorativeViews> extends <zebkit.ui.Panel> |
<zebkit.ui.tree> |
Abstract tree component that can used as basement for building own tree components. The component is responsible for rendering tree, calculating tree nodes metrics, computing visible area, organizing basic user interaction. Classes that inherit it has to provide the following important things:
A tree model item metric Developers have to implement "getItemPreferredSize(item)" method to say which size the given tree item wants to have. Tree node item rendering If necessary developers have to implement the way a tree item has to be visualized by implementing "this.paintItem(...)" method
zebkit.ui.tree.BaseTree
(a, [nodeState]
)
Parameters:
-
a
<zebkit.data.TreeModel | Object>tree model. It can be an instance of tree model class or an object that described tree model. An example of such object is shown below:
{ value : "Root", kids : [ { value: "Child 1", kids :[ "Sub child 1" ] }, "Child 2", "Child 3" ] }
-
[nodeState]
<Boolean>a default tree nodes state (expanded or collapsed)
protected
|
<zebkit.ui.tree.ItemMetric> | getIM (item) |
public | <zebkit.data.Item> | getItemAt ([root], x, y) |
protected
|
<Object> | getItemBounds (root) |
public | <Object> | getItemMetrics (i) |
protected
|
<Object> | getItemPreferredSize (root) |
protected
|
<Object> | getToggleBounds (root) |
protected
|
<Object> | getToggleBounds (root) |
protected
|
<zebkit.draw.View> | getToogleView (i) |
public | <Boolean> | isOpen (i) |
public | void | makeVisible (item) |
protected
|
<Boolean> | paintChild (g, root, index) |
protected
|
void | paintItem (g, root, node, x, y) |
public | void | select (item) |
public | void | setGaps (gx, gy) |
public | void | setLineColor (c) |
public | void | setModel (d) |
public | void | setSelectable (b) |
public | void | setViews (v) |
public | void | toggle (item) |
public | void | toggleAll (root, b) |
protected
|
void | togglePressed (root) |
protected
<zebkit.ui.tree.ItemMetric>
getIM (item )
Get a tree node metrics by the given tree model item. Parameters:
Returns:
<zebkit.ui.tree.ItemMetric>
a tree node metrics |
public
<zebkit.data.Item>
getItemAt ([root], x, y )
Get a tree item that is located at the given location. Parameters:
Returns:
<zebkit.data.Item>
a tree model item |
protected
<Object>
getItemBounds (root )
Get tree model item metrical bounds (location and size). Parameters:
Returns:
<Object>
a structure that keeps an item view location and size:
|
public
<Object>
getItemMetrics (i )
Get calculated for the given tree model item metrics Parameters:
Returns:
<Object>
an tree model item metrics. Th |
protected
<Object>
getItemPreferredSize (root )
An abstract method that a concrete tree component implementations have to override. The method has to return a preferred size the given tree model item wants to have. Parameters:
Returns:
<Object>
a structure that keeps an item preferred size:
|
protected
<Object>
getToggleBounds (root )
Get icon element bounds for the given tree model item. Parameters:
Returns:
<Object>
a structure that keeps an item icon location and size:
|
protected
<Object>
getToggleBounds (root )
Get toggle element bounds for the given tree model item. Parameters:
Returns:
<Object>
a structure that keeps an item toggle location and size:
|
protected
<zebkit.draw.View>
getToogleView (i )
Get current toggle element view. The view depends on the state of tree item. Parameters:
Returns:
<zebkit.draw.View>
a toggle element view |
public
<Boolean>
isOpen (i )
Test if the given tree component item is opened Parameters:
Returns:
<Boolean>
true if the given tree component item is opened |
public
void
makeVisible (item )
Make the given tree item visible. Tree component rendered content can takes more space than the UI component size is. In this case the content can be scrolled to make visible required tree item. Parameters:
|
protected
<Boolean>
paintChild (g, root, index )
Paint children items of the given root tree item. Parameters:
Returns:
<Boolean>
|
protected
void
paintItem (g, root, node, x, y )
An abstract method that a concrete tree component implementations should override. The method has to render the given tree node of the specified tree model item at the given location Parameters:
|
public
void
select (item )
Select the given item. Parameters:
|
public
chainable
setGaps (gx, gy )
Set the given horizontal gaps between tree node graphical elements: toggle, icon, item view Parameters:
|
public
chainable
setLineColor (c )
Set tree component connector lines color Parameters:
|
public
chainable
setModel (d )
Set the given tree model to be visualized with the UI component. Parameters:
|
public
void
setSelectable (b )
Say if items of the tree component should be selectable Parameters:
|
@Override
zebkit.ui.HostDecorativeViews
public chainable setViews (v )
Set the number of views to customize rendering of different visual elements of the tree UI component. The following decorative elements can be customized:
For instance:
Parameters:
|
public
chainable
toggle (item )
Toggle the given tree item Parameters:
|
public
chainable
toggleAll (root, b )
Toggle off or on recursively all items of the given item Parameters:
|
protected
void
togglePressed (root )
Called every time a pointer pressed in toggle area. Parameters:
|












public
![]() gapx
Horizontal gap between a node elements: toggle, icons and tree item view |
public
![]() gapy
Vertical gap between a node elements: toggle, icons and tree item view |
- childEventName ( e )
- clipCopy ( )
- clipPaste ( s )
- compAdded ( e )
- compEnabled ( e )
- compMoved ( e )
- compRemoved ( e )
- compShown ( e )
- compSized ( e )
- editingStarted ( src, item, editor )
- editingStopped ( src, item, oldValue, editor, isApplied )
- focusGained ( e )
- focusLost ( e )
- keyPressed ( e )
- keyReleased ( e )
- keyTyped ( e )
- pointerClicked ( e )
- pointerDragEnded ( e )
- pointerDragged ( e )
- pointerDragStarted ( e )
- pointerEntered ( e )
- pointerExited ( e )
- pointerMoved ( e )
- pointerPressed ( e )
- pointerReleased ( e )
- selected ( src, prevItem )
- toggled ( src, item )
editingStarted
Fired when a tree item editing has been started
Parameters:
|
editingStopped
Fired when a tree item editing has been stopped
Parameters:
|
selected
Fired when a tree item has been selected
Parameters:
|
toggled
Fired when a tree item has been toggled
Parameters:
|