01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08: package com.gwtext.client.widgets.tree;
09:
10: import com.google.gwt.core.client.JavaScriptObject;
11: import com.gwtext.client.core.JsObject;
12:
13: /**
14: * Helper class to enable tree node sorting functionality.
15: */
16: public class TreeSorter extends JsObject {
17:
18: /**
19: * Construct a new TreeSorter.
20: *
21: * @param treePanel the tree panel to sort
22: * @param config the TreeSorter config
23: */
24: public TreeSorter(TreePanel treePanel, TreeSorterConfig config) {
25: jsObj = create(treePanel.getOrCreateJsObj(),
26: config == null ? null : config.getJsObj());
27: }
28:
29: private native JavaScriptObject create(JavaScriptObject treePanel,
30: JavaScriptObject config) /*-{
31: return new $wnd.Ext.tree.TreeSorter(treePanel, config);
32: }-*/;
33:
34: //http://extjs.com/forum/showthread.php?t=6795
35: /**
36: * Sort the TreePanel starting from the specified node.
37: *
38: * @param startNode the start node
39: */
40: public native void sort(TreeNode startNode) /*-{
41: var sorter = this.@com.gwtext.client.core.JsObject::getJsObj()();
42: var startNodeJ = startNode.@com.gwtext.client.core.JsObject::getJsObj()();
43: sorter.doSort(startNodeJ);
44: }-*/;
45: }
|