Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.gwtext.client.widgets.tree
Class AsyncTreeNode

    java.lang.Object
      com.gwtext.client.core.JsObject
          com.gwtext.client.data.Node
              com.gwtext.client.widgets.tree.TreeNode
                  com.gwtext.client.widgets.tree.AsyncTreeNode

    public class AsyncTreeNode

extends TreeNode

Provides the abilty to asynchronously lazy load a TreeNodes children. An AsyncTreeNode is assigned a `TreeLoader` which is reponsible for fetching the tree data and loading it into the tree as children. The `TreeLoader` can be configured to load tree data from remote Json data and `XMLTreeLoader` can be use to load tree data from XML returned from a remote URL.

Sample code for loading a Tree node using AsyncTreeNode and XmltreeLoader :

         final TreePanel treePanel = new TreePanel();
         treePanel.setAnimate(true);
         treePanel.setEnableDD(true);
         treePanel.setContainerScroll(true);
         treePanel.setRootVisible(true);

         final XMLTreeLoader loader = new XMLTreeLoader();
         loader.setDataUrl("countries-cb.xml");
         loader.setMethod(Connection.GET);
         loader.setRootTag("countries");
         loader.setFolderIdMapping("@id");
         loader.setLeafIdMapping("@id");
         loader.setFolderTitleMapping("@title");
         loader.setFolderTag("team");
         loader.setLeafTitleMapping("@title");
         loader.setLeafTag("country");
         loader.setQtipMapping("@qtip");
         loader.setDisabledMapping("@disabled");
         loader.setCheckedMapping("@checked");
         loader.setIconMapping("@icon");
         loader.setAttributeMappings(new String[]{"@rank"});

         AsyncTreeNode root = new AsyncTreeNode("Countries", loader);
         treePanel.setRootNode(root);

         root.expand();
         treePanel.expandAll();

The above code loads a Tree using the following XML data - countries-cb.xml

    <countries>
        <team id="team-a" title="Team A" icon="images/silk/flag_yellow.gif" checked="true">
            <country title="Brazil" qtip="Rank 2" rank="2"  checked="false"/>
            <country title="Canada" qtip="Rank 3" rank="3" checked="false"/>
            <country title="China" qtip="Rank 4" rank="4" checked="false"/>
        </team>
        <team title="Team B" icon="images/silk/flag_blue.gif">
            <country title="Germany" qtip="Captain" checked="true" rank="1"/>
            <country title="France" qtip="Rank 2" rank="2" checked="false"/>
            <country title="Canada" qtip="Rank 3" rank="3" checked="false"/>
            <country title="India" qtip="Rank 4" rank="4" checked="false"/>
            <country title="Seychelles" qtip="Rank 5" rank="5" checked="false"/>
        </team>

        <team title="Team C" icon="images/silk/flag_green.gif">
            <country title="United States" qtip="Captain - Rank 1" checked="true" rank="1"/>
            <country title="Japan" qtip="Rank 2" rank="2" checked="false"/>
            <country title="Italy" qtip="Rank 3" rank="3" checked="false"/>
            <country title="Finland" qtip="Rank 4" rank="4" checked="false"/>
        </team>
      </countries>

See Also:
  `TreeLoader`, `XMLTreeLoader`

Field Summary

Fields inherited from class com.gwtext.client.data.Node
`configJS`

Fields inherited from class com.gwtext.client.core.JsObject
`jsObj`

Constructor Summary
`AsyncTreeNode(com.google.gwt.core.client.JavaScriptObject jsObj)` Construct a new AsyncTreeNode
`AsyncTreeNode(java.lang.String text, TreeLoader treeLoader)` Construct a new AsyncTreeNode
`AsyncTreeNode(java.lang.String text, TreeLoader treeLoader, boolean expanded)` Construct a new AsyncTreeNode
`AsyncTreeNode(TreeLoader treeLoader)` Construct a new AsyncTreeNode

Method Summary
`void` | `addListener(AsyncTreeNodeListener listener)` Adds an AsyncTreeNode Listener.
`protected com.google.gwt.core.client.JavaScriptObject` | `create(com.google.gwt.core.client.JavaScriptObject config)`
`TreeLoader` | `getLoader()` Return the TreeLoader associated with this node.
`boolean` | `isLoaded()` Returns true if this node has been loaded.
`boolean` | `isLoading()` Returns true if this node is currently loading.
`void` | `reload()` Trigger a reload for this node.
`void` | `reload(Function callback)` Trigger a reload for this node.
`void` | `setLoader(TreeLoader loader)`

Methods inherited from class com.gwtext.client.widgets.tree.TreeNode
`addListener, cloneNode, cloneNode, collapse, collapse, collapseChildNodes, createNode, destroy, disable, enable, ensureVisible, expand, expand, expand, expandChildNodes, getIconCls, getText, getUI, instance, isDisabled, isExpandable, isExpanded, isRendered, isSelected, select, setAllowDrag, setAllowDrop, setChecked, setCls, setDisabled, setExpandable, setExpanded, setHref, setHrefTarget, setIcon, setIconCls, setSingleClickExpand, setText, setTooltip, setTooltip, toggle, unselect`

Methods inherited from class com.gwtext.client.data.Node
`addListener, appendChild, bubble, cascade, contains, eachChild, equals, findChildBy, getAttribute, getAttributeAsObject, getChildNodes, getDepth, getFirstChild, getId, getJsObj, getLastChild, getNextSibling, getOwnerTree, getParentNode, getPath, getPath, getPreviousSibling, getUserObject, hashCode, indexOf, insertBefore, isAncestor, isFirst, isLast, isLeaf, item, remove, removeChild, replaceChild, setAttribute, setAttribute, setAttribute, setId, setLeaf, setUserObject, sort`

Methods inherited from class com.gwtext.client.core.JsObject
`getProperties, isCreated, setJsObj`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AsyncTreeNode

    public AsyncTreeNode(com.google.gwt.core.client.JavaScriptObject jsObj)

  Construct a new AsyncTreeNode

  Parameters:
    `jsObj` -

### AsyncTreeNode

    public AsyncTreeNode(TreeLoader treeLoader)

  Construct a new AsyncTreeNode

  Parameters:
    `treeLoader` - the tree loader

### AsyncTreeNode

    public AsyncTreeNode(java.lang.String text,
                         TreeLoader treeLoader)

  Construct a new AsyncTreeNode

  Parameters:
    `treeLoader` - the tree loader
    `text` - the node label / display text

### AsyncTreeNode

    public AsyncTreeNode(java.lang.String text,
                         TreeLoader treeLoader,
                         boolean expanded)

  Construct a new AsyncTreeNode

  Parameters:
    `treeLoader` - the tree loader
    `text` - the node label / display text
    `expanded` - true to expand

Method Detail

### create

    protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)

  Overrides:
    `create` in class `TreeNode`

### isLoaded

    public boolean isLoaded()

  Returns true if this node has been loaded.

  Returns:
    true if node loaded

### isLoading

    public boolean isLoading()

  Returns true if this node is currently loading.

  Returns:
    true if node loading

### getLoader

    public TreeLoader getLoader()

  Return the TreeLoader associated with this node.

  Returns:
    the tree loader

### reload

    public void reload()

  Trigger a reload for this node.

### reload

    public void reload(Function callback)

  Trigger a reload for this node.

  Parameters:
    `callback` - the callback to execute when the reload is complete

### addListener

    public void addListener(AsyncTreeNodeListener listener)

  Adds an AsyncTreeNode Listener.

  Parameters:
    `listener` - the listener

### setLoader

    public void setLoader(TreeLoader loader)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD