^1640000859842
@
sname
XTree
slabel
XTree
sdescriptors
xworker.lang.MetaDescriptor3
sextends
xworker.swt.widgets.Tree
smany
true
seditCols
2
sinitialization
false
smodifier
public
sid
XTree
  @/@actions
  sname
  actions
  sdescriptors
  xworker.lang.MetaDescriptor3/@actions
  sid
  actions
    @/@actions/@create
    sname
    create
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Global
    sdisableGlobalContext
    false
    Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

//调用父方法创建树
def treeThing = world.getThing("xworker.swt.widgets.Tree");
def tree = treeThing.run("create", actionContext);

//如果提供的数据提供者，构造树节点
def provider = world.getThing(self.treeModelProvider);
if(provider == null){
    provider = self.getThing("TreeModel@0");
}

if(provider != null){
    self.doAction("initTreeItem", actionContext, [
            "tree":tree, "provider":provider, "includeRoot":self.getBoolean("includeRoot")]);
}
tree.setData("xthing", self);

return tree;
#$@text#$@
    sdescriptors
    xworker.lang.actions.Actions/@GroovyAction
    sid
    create
    @/@actions/@initTreeItem
    sname
    initTreeItem
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Global
    sdisableGlobalContext
    false
    Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

def model = provider.doAction("getTreeModel", actionContext);

if(model != null){
    if(includeRoot){
        initTreeItem(tree, model);
    }else{
        for(child in model.getChilds()){
            initTreeItem(tree, child);
        }
    }
}

//初始化树节点的方法
def initTreeItem(item, model){
    def subItem = new TreeItem(item, SWT.NONE);
    subItem.setText(model.getMetadata().getLabel());
    subItem.setData(model);
    
    for(child in model.getAllChilds()){
        initTreeItem(subItem, child);
    }
}
#$@text#$@
    sdescriptors
    xworker.lang.actions.Actions/@GroovyAction
    sid
    initTreeItem
      @/@actions/@initTreeItem/@ins
      sisValidate
      false
      sname
      ins
      sdescriptors
      xworker.lang.actions.Inout/@ins
      sid
      ins
        @/@actions/@initTreeItem/@ins/@tree
        sname
        tree
        stypeCheck
        false
        soptional
        true
        scheck
        false
        scheckLevel
        exception
        sdescriptors
        xworker.lang.actions.Inout/@ins/@param
        sid
        tree
        @/@actions/@initTreeItem/@ins/@provider
        sname
        provider
        stypeCheck
        false
        soptional
        true
        scheck
        false
        scheckLevel
        exception
        sdescriptors
        xworker.lang.actions.Inout/@ins/@param
        sid
        provider
        @/@actions/@initTreeItem/@ins/@includeRoot
        sname
        includeRoot
        stypeCheck
        false
        soptional
        true
        scheck
        false
        scheckLevel
        exception
        sdescriptors
        xworker.lang.actions.Inout/@ins/@param
        sid
        includeRoot
  @/@includeRoot
  sname
  includeRoot
  slabel
  是否包含子节点
  sinputtype
  truefalse
  scolspan
  2
  sdefault
  true
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  includeRoot
  @/@treeModelProvider
  sname
  treeModelProvider
  slabel
  数据提供者
  sinputtype
  dataSelector
  ssize
  60
  scolspan
  2
  LvalidateOnBlur
  false
  LallowDecimals
  false
  LallowNegative
  false
  sen_label
  Model Provider
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sid
  treeModelProvider
  @/@TreeModel
  sname
  TreeModel
  sdescriptors
  xworker.lang.MetaDescriptor3/@thing
  sextends
  xworker.dataObject.app.model.tree.TreeModel
  smany
  false
  seditCols
  2
  sinitialization
  false
  smodifier
  public
  sid
  TreeModel
