^1640740807830
@
sname
AttributeRelationEditor
slabel
AttributeRelationEditor
sdescriptors
xworker.swt.widgets.Display
  @/@shell
  sname
  shell
  stext
  关联设置编辑
  sNO_TRIM
  false
  sCLOSE
  true
  sTITLE
  true
  sMIN
  true
  sMAX
  true
  sBORDER
  false
  sRESIZE
  false
  sON_TOP
  false
  sTOOL
  false
  sNO_FOCUS
  false
  swidth
  -1
  sheight
  -1
  scenterScreen
  true
  spack
  true
  smaximized
  false
  sfullScreen
  false
  sH_SCROLL
  false
  sV_SCROLL
  false
  sNO_BACKGROUND
  false
  sNO_MERGE_PAINTS
  false
  sNO_REDRAW_RESIZE
  false
  sNO_RADIO_GROUP
  false
  sEMBEDDED
  false
  sDOUBLE_BUFFERED
  false
  scapture
  false
  senabled
  true
  sredraw
  true
  svisible
  true
  sdescriptors
  xworker.swt.widgets.Display/@Shell
  sid
  shell
    @/@shell/@shellGridLayout
    sname
    shellGridLayout
    smakeColumnsEqualWidth
    false
    smarginWidth
    5
    smarginHeight
    5
    smarginLeft
    0
    smarginTop
    0
    smarginRight
    0
    smarginBottom
    0
    shorizontalSpacing
    5
    sverticalSpacing
    5
    slabel
    shellGridLayout
    sdescriptors
    xworker.swt.Layouts/@GridLayout
    sid
    shellGridLayout
    @/@shell/@form
    sname
    form
    sformType
    edit
    sdescriptors
    xworker.swt.app.view.swt.Items/@DataObjectForm
    sid
    form
      @/@shell/@form/@formGridData
      sname
      formGridData
      sstyle
      FILL_BOTH
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      BEGINNING
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      formGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      formGridData
      @/@shell/@form/@dataObjects
      sname
      dataObjects
      slabel
      dataObjects
      sdescriptors
      xworker.swt.app.view.swt.widgets.form.DataObjectForm/@DataObjects
      sid
      dataObjects
        @/@shell/@form/@dataObjects/@AbstractDataObject
        sname
        AbstractDataObject
        seditCols
        2
        spaging
        false
        sreadUrl
        do?sc=xworker.web.app.view.extjs.server.DataObjectStore/@read
        screateUrl
        do?sc=xworker.web.app.view.extjs.server.DataObjectStore/@create
        supdateUrl
        do?sc=xworker.web.app.view.extjs.server.DataObjectStore/@update
        sdestroyUrl
        do?sc=xworker.web.app.view.extjs.server.DataObjectStore/@destroy
        LstoreAutoDestroy
        false
        sstoreAutoLoad
        false
        LstoreAutoSave
        true
        LstoreBatch
        true
        LstorePruneModifiedRecords
        false
        LstoreRemoteSort
        false
        LstoreRestful
        false
        sstoreRoot
        'rows'
        sstoreSuccessProperty
        'success'
        sstoreTotalProperty
        'totalCount'
        sstoreMessageProperty
        'msg'
        sgridEditable
        false
        sformReadUrl
        do?sc=xworker.web.app.view.extjs.server.DataObjectForm/@read
        sformCreateUrl
        do?sc=xworker.web.app.view.extjs.server.DataObjectForm/@create
        sformUpdateUrl
        do?sc=xworker.web.app.view.extjs.server.DataObjectForm/@update
        sformDestroyUrl
        do?sc=xworker.web.app.view.extjs.server.DataObjectForm/@delete
        spaging_afterPageText
        页 共
        spaging_beforePageText
        第
        Lpaging_displayInfo
        false
        spaging_displayMsg
        第{0}-第{1}条，共{2}条
        spaging_emptyMsg
        没有数据
        spaging_firstText
        首页
        spaging_lastText
        最后一页
        spaging_nextText
        下一页
        Lpaging_prependButtons
        false
        spaging_prevText
        上一页
        spaging_refreshText
        刷新
        sgridColumnLocking
        false
        sgridLockText
        '锁定'
        sgridUnlockText
        '解锁'
        scolumnGroup
        false
        sgridCheckable
        false
        sgridRowNumber
        false
        sgridGrouping
        false
        sgridGroupTextTpl
        '{text} ({[values.rs.length]} 条)'
        sgridRowExpander
        false
        sautoGenerateId
        false
        sidGenerateType
        action
        sidAction
        generateId
        sstoreSortDir
        ASC
        sautoInit
        false
        sautoInitAction
        autoInit
        sdescriptors
        xworker.dataObject.DataObjects/@AbstractDataObject
        sid
        AbstractDataObject
          @/@shell/@form/@dataObjects/@AbstractDataObject/@relationDataObject
          sname
          relationDataObject
          slabel
          关联事物
          stype
          string
          soptional
          true
          skey
          false
          sdataField
          true
          sviewField
          true
          sreadField
          true
          Sdescription
#$@text#$@
<p>被关联的事物路径。</p>
<p>如用户的性别标识关联性别事物，这里则是性别事物的路径。</p>
#$@text#$@
          screateEditor
          true
          seditEditor
          true
          sviewEditor
          true
          sgridEditor
          true
          squeryEditor
          true
          sinputtype
          openWindow
          ssize
          70
          sreadOnly
          false
          seditable
          true
          scolspan
          2
          sshowLabel
          true
          slabelAlign
          right
          slabelVAlign
          baseline
          svalidateAllowBlank
          true
          LvalidateOnBlur
          true
          LallowDecimals
          true
          LallowNegative
          true
          sinputattrs
          xworker.swt.xworker.attributeEditor.openWins.SelectThingOpenWindow/@shell|descriptor=xworker.dataObject.DataObject,returnType=path
          sshowInTable
          true
          sgridFixed
          false
          sgridHidden
          false
          sgridHideable
          true
          sgridSortable
          false
          scolumnLocked
          false
          sgridGroupable
          true
          sgridMenuDisabled
          false
          sgridResizable
          true
          sdescriptors
          xworker.dataObject.AbstractDataObject/@attribute
          sid
          relationDataObject
          @/@shell/@form/@dataObjects/@AbstractDataObject/@relationAttribute
          sname
          relationAttribute
          slabel
          关联属性名
          stype
          string
          soptional
          true
          skey
          false
          sdataField
          true
          sviewField
          true
          sreadField
          true
          Sdescription
#$@text#$@
<p>被关联的事物的属性。</p>
<p>如用户的性别标识关联性别的标识属性，这里则是性别的标识属性名。</p>
#$@text#$@
          screateEditor
          true
          seditEditor
          true
          sviewEditor
          true
          sgridEditor
          true
          squeryEditor
          true
          sinputtype
          openWindow
          sreadOnly
          false
          seditable
          true
          sshowLabel
          true
          slabelAlign
          right
          slabelVAlign
          baseline
          svalidateAllowBlank
          true
          LvalidateOnBlur
          true
          LallowDecimals
          true
          LallowNegative
          true
          sinputattrs
          xworker.swt.dataObject.SelectAttributeDialog/@shell|dataObjectIndicator=relationDataObject
          sshowInTable
          true
          sgridFixed
          false
          sgridHidden
          false
          sgridHideable
          true
          sgridSortable
          false
          scolumnLocked
          false
          sgridGroupable
          true
          sgridMenuDisabled
          false
          sgridResizable
          true
          sdescriptors
          xworker.dataObject.AbstractDataObject/@attribute
          sid
          relationAttribute
          @/@shell/@form/@dataObjects/@AbstractDataObject/@relationDisplayLabel
          sname
          relationDisplayLabel
          slabel
          关联显示标签
          stype
          string
          soptional
          true
          skey
          false
          sdataField
          true
          sviewField
          true
          sreadField
          true
          Sdescription
#$@text#$@
<p>示被关联事物的标签属性。</p>
<p>如用户的性别标识是下拉选择框，下拉选择框中的列表的显示文字是被关联事物的一个属性，这里则是那个属性名。</p>
#$@text#$@
          screateEditor
          true
          seditEditor
          true
          sviewEditor
          true
          sgridEditor
          true
          squeryEditor
          true
          sinputtype
          openWindow
          sreadOnly
          false
          seditable
          true
          sshowLabel
          true
          slabelAlign
          right
          slabelVAlign
          baseline
          svalidateAllowBlank
          true
          LvalidateOnBlur
          true
          LallowDecimals
          true
          LallowNegative
          true
          sinputattrs
          xworker.swt.dataObject.SelectAttributeDialog/@shell|dataObjectIndicator=relationDataObject
          sshowInTable
          true
          sgridFixed
          false
          sgridHidden
          false
          sgridHideable
          true
          sgridSortable
          false
          scolumnLocked
          false
          sgridGroupable
          true
          sgridMenuDisabled
          false
          sgridResizable
          true
          sdescriptors
          xworker.dataObject.AbstractDataObject/@attribute
          sid
          relationDisplayLabel
          @/@shell/@form/@dataObjects/@AbstractDataObject/@thingName
          sname
          thingName
          slabel
          关联事物名
          stype
          string
          soptional
          true
          skey
          false
          sdataField
          true
          sviewField
          true
          sreadField
          true
          Sdescription
#$@text#$@
<p>比如用户的属性性别，用户自身的属性性别标识sexId，也可以设置关联事物名sex，从而可以：</p>
<ul>
    <li>user.sexId，sexId为自己的属性</li>
    <li>user.sex.id，sex为关联属性名。</li>
    <li>user.sex.value</li>
</ul>
#$@text#$@
          screateEditor
          true
          seditEditor
          true
          sviewEditor
          true
          sgridEditor
          true
          squeryEditor
          true
          sreadOnly
          false
          seditable
          true
          sshowLabel
          true
          slabelAlign
          right
          slabelVAlign
          baseline
          svalidateAllowBlank
          true
          LvalidateOnBlur
          true
          LallowDecimals
          true
          LallowNegative
          true
          sshowInTable
          true
          sgridFixed
          false
          sgridHidden
          false
          sgridHideable
          true
          sgridSortable
          false
          scolumnLocked
          false
          sgridGroupable
          true
          sgridMenuDisabled
          false
          sgridResizable
          true
          sdescriptors
          xworker.dataObject.AbstractDataObject/@attribute
          sid
          thingName
          @/@shell/@form/@dataObjects/@AbstractDataObject/@many
          sname
          many
          slabel
          多个
          stype
          string
          soptional
          true
          skey
          false
          sdataField
          true
          sviewField
          true
          sreadField
          true
          sdefault
          false
          Sdescription
#$@text#$@
<p>false，一对一或多对一。如用户的性别是多对已。</p>
<p>true，一对多或者多对多。如用户的好友列表是一对多。</p>
#$@text#$@
          screateEditor
          true
          seditEditor
          true
          sviewEditor
          true
          sgridEditor
          true
          squeryEditor
          true
          sinputtype
          truefalse
          sreadOnly
          false
          seditable
          true
          sshowLabel
          true
          slabelAlign
          right
          slabelVAlign
          baseline
          svalidateAllowBlank
          true
          LvalidateOnBlur
          true
          LallowDecimals
          true
          LallowNegative
          true
          sshowInTable
          true
          sgridFixed
          false
          sgridHidden
          false
          sgridHideable
          true
          sgridSortable
          false
          scolumnLocked
          false
          sgridGroupable
          true
          sgridMenuDisabled
          false
          sgridResizable
          true
          sdescriptors
          xworker.dataObject.AbstractDataObject/@attribute
          sid
          many
    @/@shell/@23898
    sname
    buttonComposite
    sBORDER
    false
    sH_SCROLL
    false
    sV_SCROLL
    false
    sNO_BACKGROUND
    false
    sNO_FOCUS
    false
    sNO_MERGE_PAINTS
    false
    sNO_REDRAW_RESIZE
    false
    sNO_RADIO_GROUP
    false
    sEMBEDDED
    false
    sDOUBLE_BUFFERED
    false
    scapture
    false
    senabled
    true
    sredraw
    true
    svisible
    true
    sdescriptors
    xworker.swt.Widgets/@Composite
    sid
    23898
      @/@shell/@23898/@23899
      sname
      buttonCompositeGridData
      sstyle
      FILL_HORIZONTAL
      shorizontalIndent
      0
      swidth
      -1
      sheight
      -1
      shorizontalAlignment
      END
      sverticalAlignment
      CENTER
      shorizontalSpan
      1
      sverticalSpan
      1
      sgrabExcessHorizontalSpace
      false
      sgrabExcessVerticalSpace
      false
      slabel
      buttonCompositeGridData
      sdescriptors
      xworker.swt.layout.LayoutDatas/@GridData
      sid
      23899
      @/@shell/@23898/@23900
      sname
      buttonCompositeRowLayout
      sfill
      false
      sjustify
      false
      smarginWidth
      0
      smarginHeight
      0
      smarginLeft
      3
      smarginTop
      3
      smarginRight
      3
      smarginBottom
      3
      spack
      true
      sspacing
      3
      stype
      SWT.HORIZONTAL
      swrap
      true
      slabel
      buttonCompositeRowLayout
      sdescriptors
      xworker.swt.Layouts/@RowLayout
      sid
      23900
      @/@shell/@23898/@23901
      sname
      okButton
      stext
      确定
      stype
      SWT.PUSH
      sflat
      false
      sborder
      false
      sselected
      false
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      slabel
      okButton
      sdescriptors
      xworker.swt.Widgets/@Button
      sid
      23901
        @/@shell/@23898/@23901/@23902
        sname
        RowData
        sexclude
        false
        swidth
        80
        sheight
        -1
        slabel
        RowData
        sdescriptors
        xworker.swt.layout.LayoutDatas/@RowData
        sid
        23902
        @/@shell/@23898/@23901/@23903
        sname
        Listeners
        slabel
        Listeners
        sdescriptors
        xworker.swt.widgets.Widget/@Listeners
        sid
        23903
          @/@shell/@23898/@23901/@23903/@23904
          sname
          okButtonSelection
          stype
          Selection
          slabel
          okButtonSelection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sid
          23904
            @/@shell/@23898/@23901/@23903/@23904/@GroovyAction
            sname
            GroovyAction
            sisSynchronized
            false
            sthrowException
            true
            suseOtherAction
            false
            svarScope
            Local
            sdisableGlobalContext
            false
            Scode
#$@text#$@
import org.xmeta.Thing;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;

//表单的值
def values = form.doAction("getValues", actionContext);

//设置属性
def parentValues = currentModel.doAction("getValue", currentModelContext);
parentValues.relationDataObject = values.relationDataObject;
parentValues.relationValueField = values.relationAttribute;
parentValues.relationLabelField = values.relationDisplayLabel;
currentModel.doAction("setValue", currentModelContext, ["thingAttributes": parentValues]);

//关联事物
if(values.thingName != null && values.thingName != "" && values.relationDataObject != null && values.relationDataObject != ""){
    def relationThing = world.getThing(values.relationDataObject);
    if(relationThing != null){
        def have = false;
        for(child in thing.parent.get("thing@")){
            if(child.dataObjectPath == values.relationDataObject || child.metadata.name == values.thingName){
                child.name = values.thingName;
                child.many = values.many;
                child.dataObjectPath = values.relationDataObject;
                child.refAttributeName = values.relationAttribute;
                child.localAttributeName = thing.name;
                child.label = relationThing.metadata.label;
                have = true;
                break;
            }
        }
        
        if(!have){
            
            def desc = null;
            for(thingDesc in thing.parent.getDescriptor().get("thing@")){
                if(thingDesc.name == "thing" && thingDesc.getString("extends") != null && thingDesc.getString("extends").indexOf("xworker.dataObject.RelationDataObject") != -1){
                    desc = thingDesc;
                    break;
                }
            }
            if(desc != null){
                def child = new Thing(desc.metadata.path);
                child.name = values.thingName;
                child.many = values.many;
                child.dataObjectPath = values.relationDataObject;
                child.refAttributeName = values.relationAttribute;
                child.localAttributeName = thing.name;
                child.label = relationThing.metadata.label;
                thing.parent.addChild(child);
    
                def treeItem = thingContext.get("outlineTree").getSelection()[0].parentItem;
                def childTreeItem = new TreeItem(treeItem, SWT.NONE);
                childTreeItem.setText(child.metadata.label + " (" + child.thingName + ")");
                childTreeItem.setData(child);
            }
        }
    }
}

if(thingContext.get("okButtonSelection") != null){
    thingContext.okButtonSelection.handleEvent(null);
}else{
    thing.save();
}
shell.dispose();
#$@text#$@
            sdescriptors
            xworker.lang.actions.Actions/@GroovyAction
            sid
            GroovyAction
      @/@shell/@23898/@23905
      sname
      cancelButton
      stext
      取消
      stype
      SWT.PUSH
      sflat
      false
      sborder
      false
      sselected
      false
      scapture
      false
      senabled
      true
      sredraw
      true
      svisible
      true
      slabel
      cancelButton
      sdescriptors
      xworker.swt.Widgets/@Button
      sid
      23905
        @/@shell/@23898/@23905/@23906
        sname
        RowData
        sexclude
        false
        swidth
        80
        sheight
        -1
        slabel
        RowData
        sdescriptors
        xworker.swt.layout.LayoutDatas/@RowData
        sid
        23906
        @/@shell/@23898/@23905/@23907
        sname
        Listeners
        slabel
        Listeners
        sdescriptors
        xworker.swt.widgets.Widget/@Listeners
        sid
        23907
          @/@shell/@23898/@23905/@23907/@23908
          sname
          cancelButtonSelection
          stype
          Selection
          slabel
          cancelButtonSelection
          sdescriptors
          xworker.swt.events.Listeners/@listeners/@Listener
          sid
          23908
            @/@shell/@23898/@23905/@23907/@23908/@ShellNormalActions
            sname
            ShellNormalActions
            sshellName
            shell
            smethod
            dispose
            sinterpretationType
            Self
            svarScope
            Local
            sdescriptors
            xworker.swt.actions.ShellActions/@ShellNormalActions1
            sid
            ShellNormalActions
    @/@shell/@init
    sname
    init
    sisSynchronized
    false
    sthrowException
    true
    suseOtherAction
    false
    svarScope
    Local
    sdisableGlobalContext
    false
    Scode
#$@text#$@
def values = [:];
values.relationDataObject = thing.relationDataObject;
values.relationAttribute = thing.relationValueField;
values.relationDisplayLabel = thing.relationLabelField;

def have = false;
if(values.relationDataObject != null && values.relationDataObject != ""){
    for(child in thing.parent.get("thing@")){
        log.info("child.dataOjbectpaht=" + child.dataObjectPath);
        if(child.dataObjectPath == values.relationDataObject){
            values.thingName = child.metadata.name;
            values.many = child.many;
            have = true;
            break;
        }
    }
}
form.doAction("setValues", actionContext, ["values": values]);
#$@text#$@
    sdescriptors
    xworker.swt.Widgets/@Code
    sid
    init
