^1660115385704
@
sname
SimpleDoc
slabel
SimpleDoc
sdescriptors
xworker.lang.MetaDescriptor3
smany
true
seditCols
2
sformNoLabel
false
sinitialization
false
smodifier
public
sinheritDescription
false
Sdescription
#$@text#$@
<p>一个简单的HTML文档，头是标题，左边是树菜单，右边是网页。</p>

<p><strong>如何编菜单和网页</strong></p>

<p>&nbsp;&nbsp;&nbsp; 它的第一个DocNode是根节点，只有第一个DocNode节点生效，HTML文档是DocNode的description属性。</p>
#$@text#$@
snotXmlAttribute
false
sjson_isArray
false
sth_createIndex
false
sth_registMyChilds
false
sth_mark
false
  @/@actions
  sname
  actions
  sdescriptors
  xworker.lang.MetaDescriptor3/@actions
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  actions
    @/@actions/@httpDo
    sname
    httpDo
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Local
    sdisableGlobalContext
    false
    Scode
#$@text#$@
import org.xmeta.Thing;

//根节点
def rootNode = self.getThing("DocNode@0");
if(rootNode == null){
    response.writer.println("Please add a DocNode");
    return;
}

//真正用于生成HTML的docThing的缓存
def docThing = self.getData("docThing");
//最后docThing的时间，要和当前的事物的时间一致，否则需要重新生成
def docThingLast = self.getData("docThingLast");
if(docThing == null || docThingLast != self.getMetadata().getLastModified()){
    docThing = world.getThing("xworker.doc.structures.SimpleDocProto").detach();
    docThing.put("title", self.title);
    docThing.put("defaultContentUrl", "do?sc=xworker.ide.worldexplorer.swt.http.ThingDoc/@desc&thing=" + rootNode.getMetadata().getPath());
    docThing.put("menu", createMenu(rootNode));
    self.setData("docThing", docThing);
    self.setData("docThingLast", self.getMetadata().getLastModified());
    docThing.getMetadata().setPath(self.getMetadata().getPath());
}

//生成页面
docThing.doAction("httpDo", actionContext);

def createMenu(node){
    def menu = new Thing("xworker.lang.Menu");
    menu.put("name", node.getMetadata().getName());
    menu.put("label", node.getMetadata().getLabel());
    def target = node.getStringBlankAsNull("target");
    if(target == null){
        target = "main";
    }
    menu.put("target", target);
    if(node.getStringBlankAsNull("url") != null){
        menu.put("url", node.getString("url"));
    }else{
        menu.put("url", "do?sc=xworker.ide.worldexplorer.swt.http.ThingDoc/@desc&thing=" + node.getMetadata().getPath());
    }
    for(childNode in node.getChilds()){
        menu.addChild(createMenu(childNode));
    }
    
    return menu;

}
#$@text#$@
    sinterpretationType
    Action
    screateLocalVarScope
    false
    ssaveReturn
    false
    sswitchResult
    false
    sdebugLog
    false
    sdescriptors
    xworker.lang.actions.Actions/@GroovyAction
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    httpDo
  @/@name
  sname
  name
  sshowLabel
  true
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  snotXmlAttribute
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  name
  @/@label
  sname
  label
  sshowLabel
  true
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  snotXmlAttribute
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  label
  @/@title
  sname
  title
  ssize
  60
  sshowLabel
  true
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  snotXmlAttribute
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  title
  @/@description
  sname
  description
  sinputtype
  html
  sshowLabel
  true
  sreadOnly
  false
  sinheritDescription
  false
  svalidateAllowBlank
  true
  LvalidateOnBlur
  true
  LallowDecimals
  true
  LallowNegative
  true
  snotXmlAttribute
  false
  sdescriptors
  xworker.lang.MetaDescriptor3/@attribute
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  description
  @/@DocNode
  sname
  DocNode
  sdescriptors
  xworker.lang.MetaDescriptor3/@thing
  smany
  true
  seditCols
  2
  sinitialization
  false
  smodifier
  public
  sinheritDescription
  false
  sdescription
  <p>文档节点，如果url不为空那么使用url的地址，否则使用当前事物的文档地址。</p>
  snotXmlAttribute
  false
  sjson_isArray
  false
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  DocNode
    @/@DocNode/@name
    sname
    name
    sshowLabel
    true
    sreadOnly
    false
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    name
    @/@DocNode/@label
    sname
    label
    ssize
    50
    sshowLabel
    true
    sreadOnly
    false
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    label
    @/@DocNode/@target
    sname
    target
    sinputtype
    select
    sshowLabel
    true
    sreadOnly
    false
    sdefault
    main
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_registDisabled
    false
    sth_mark
    false
    sid
    target
      @/@DocNode/@target/@main
      sname
      main
      svalue
      main
      sdescriptors
      xworker.lang.MetaDescriptor3/@attribute/@value
      sinheritDescription
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_registDisabled
      false
      sth_mark
      false
      sid
      main
      @/@DocNode/@target/@_blank
      sname
      _blank
      svalue
      _blank
      sdescriptors
      xworker.lang.MetaDescriptor3/@attribute/@value
      sinheritDescription
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_registDisabled
      false
      sth_mark
      false
      sid
      _blank
    @/@DocNode/@url
    sname
    url
    ssize
    60
    sshowLabel
    true
    sreadOnly
    false
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_registDisabled
    false
    sth_mark
    false
    sid
    url
    @/@DocNode/@description
    sname
    description
    sinputtype
    html
    sshowLabel
    true
    sreadOnly
    false
    sinheritDescription
    false
    svalidateAllowBlank
    true
    LvalidateOnBlur
    true
    LallowDecimals
    true
    LallowNegative
    true
    snotXmlAttribute
    false
    sdescriptors
    xworker.lang.MetaDescriptor3/@attribute
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    description
    @/@DocNode/@DocNode
    sname
    DocNode
    sdescriptors
    xworker.lang.MetaDescriptor3/@thing
    sextends
    xworker.doc.structures.SimpleDoc/@DocNode
    smany
    true
    seditCols
    2
    sinitialization
    false
    smodifier
    public
    sinheritDescription
    false
    snotXmlAttribute
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    DocNode
  @/@MenuBar
  sname
  MenuBar
  sextends
  xworker.web.ControlSet/@MenuBar
  sdescriptors
  xworker.lang.MetaDescriptor3/@MenuBar
  sinheritDescription
  false
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_registDisabled
  false
  sth_noThingRegistViewer
  false
  sth_fileMonitor
  false
  sth_mark
  false
  sth_registQueryOnlySelf
  false
  snotXmlAttribute
  false
  sjson_isArray
  false
  sid
  MenuBar
