Class zebkit.ui.tree.Tree
extends <zebkit.ui.tree.BaseTree>
<zebkit.ui.tree>

Tree UI component that visualizes a tree data model. The model itself can be passed as JavaScript structure or as a instance of zebkit.data.TreeModel. Internally tree component keeps the model always as zebkit.data.TreeModel class instance:

    var tree = new zebkit.ui.tree.Tree({
         value: "Root",
         kids : [  "Item 1", "Item 2"]
    });

or

    var model = new zebkit.data.TreeModel("Root");
    model.add(model.root, "Item 1");
    model.add(model.root, "Item 2");

    var tree = new zebkit.ui.tree.Tree(model);

Tree model rendering is fully customizable by defining an own views provider. Default views provider renders tree model item as text. The tree node can be made editable by defining an editor provider. By default tree modes are not editable.

Constructor:
zebkit.ui.tree.Tree ([model], [b])

Parameters:
  • [model] <Object | zebkit.data.TreeModel>

    a tree data model passed as JavaScript structure or as an instance

  • [b] <Boolean>

    the tree component items toggle state. true to have all items in opened state.




private <Boolean> se (item, e)
public void setEditorProvider (p)
public void setModel (d)
public void setViewProvider (p)
protected void startEditing (item)
protected void stopEditing (true)


Inherited methods:
$setConstraints(c)    add(constr, d)    byConstraints([p], c)    byPath(path, [cb])    calcPreferredSize(target)    doLayout( )    fire(event, [path], [params])    focused( )    getBottom( )    getCanvas( )    getComponentAt(x, y)    getHorPadding( )    getIM(item)    getItemAt([root], x, y)    getItemBounds(root)    getItemMetrics(i)    getItemPreferredSize(root)    getLeft( )    getPreferredSize( )    getRight( )    getToggleBounds(root)    getToogleView(i)    getTop( )    getVerPadding( )    hasFocus( )    indexOf(c)    insert(i, constr, d)    invalidate( )    invalidateLayout( )    isOpen(i)    kidAdded(index, constr, l)    kidRemoved(i, l)    laidout( )    load(JSON)    makeVisible(item)    off([eventName], [path], [cb])    on([eventName], [path], cb)    paintChild(g, root, index)    paintComponent(g)    paintItem(g, root, node, x, y)    paintViewAt(g, ax, ay, v)    properties([path], props)    property([path], name, value)    recalc( )    relocated(px, py)    remove(c)    removeAll( )    removeAt(i)    removeByConstraints(ctr)    removeMe([after])    repaint([x], [y], [w], [h])    requestFocus( )    requestFocusIn([timeout])    resized(pw, ph)    select(item)    setAt(i, d)    setBackground(v)    setBorder([v])    setBottomPadding(bottom)    setBounds(x, y, w, h)    setByConstraints(constr, c)    setConstraints(ctr)    setEnabled(b)    setGaps(gx, gy)    setId(id)    setKids(a)    setLayout(m)    setLeftPadding(left)    setLineColor(c)    setLocation(xx, yy)    setPadding(v)    setParent(o)    setPreferredSize(w, h)    setProperties([path], props)    setRightPadding(right)    setSelectable(b)    setSize(w, h)    setTopPadding(top)    setViews(v)    setVisible(b)    toBack( )    toFront( )    toggle(item)    toggleAll(root, b)    togglePressed(root)    toPreferredHeight( )    toPreferredSize( )    toPreferredWidth( )    toView(target)    validate( )    validateMetric( )    vrp( )   


private <Boolean> se (item, e)

Initiate the given item editing if the specified event matches condition


Parameters:
Returns: <Boolean>

return true if an item editing process has been started, false otherwise

public void setEditorProvider (p)

Set the given editor provider. The editor provider is a class that is used to decide which UI component has to be used as an item editor, how the editing should be triggered and how the edited value has to be fetched from an UI editor.


Parameters:
@Override zebkit.ui.tree.BaseTree
public chainable setModel (d)

Set the given tree model to be visualized with the UI component.


Parameters:
public chainable setViewProvider (p)

Set tree component items view provider. Provider says how tree model items have to be visualized.


Parameters:
protected void startEditing (item)

Start editing the given if an editor for the item has been defined.


Parameters:
protected void stopEditing (true)

Stop editing currently edited tree item and apply or discard the result of the editing to tree data model.


Parameters:
  • true <Boolean>

    if the editing result has to be applied to tree data model



Inherited attributes:
public zebkit.draw.View bg    public zebkit.draw.View border    public Boolean canHaveFocus    public Object constraints    public Integer gapx    public Integer gapy    public Integer height    public Boolean isEnabled    public Boolean isValid    public Boolean isVisible    public Array kids    public zebkit.layout.Layout layout    public String lnColor    public zebkit.layout.Layoutable parent    public zebkit.data.Item selected    public Integer width    public Integer x    public Integer y   



public <zebkit.ui.tree.DefEditors> editors

A tree model editor provider

public <zebkit.ui.tree.DefsViews> provider

A tree model items view provider