^1651632677546
@
sname
ResMonitor
slabel
资源监控
ssingleInstance
false
scloseable
true
suseRef
false
sdescriptors
xworker.swt.app.view.swt.app.workbentch.Editor
sinheritDescription
false
sth_createIndex
false
sth_registMyChilds
false
sth_mark
false
  @/@Control
  sname
  Control
  sdescriptors
  xworker.swt.app.view.swt.app.workbentch.Editor/@Control
  sinheritDescription
  false
  sth_createIndex
  false
  sth_registMyChilds
  false
  sth_mark
  false
  sid
  Control
    @/@Control/@mainSash
    sname
    mainSash
    sstyle
    VERTICAL
    sSMOOTH
    false
    sweights
    50,50
    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/@SashForm
    sinheritDescription
    false
    sth_createIndex
    false
    sth_registMyChilds
    false
    sth_mark
    false
    sid
    mainSash
      @/@Control/@mainSash/@dbMonitorEditor
      sname
      dbMonitorEditor
      sdataObject
      xworker.app.monitor.dataobjects.ResMonitor
      squeryButton
      true
      snewButton
      true
      seditButton
      true
      seditBatchButton
      false
      sdeleteButton
      true
      sselectAllButton
      false
      sselectRerverseButton
      false
      spagingToolbar
      true
      sactionContext
      monitorObjectContext
      stableCheck
      false
      sdebug
      false
      sdescriptors
      xworker.swt.app.view.swt.Items/@DataObjectEditCompoiste
      sinheritDescription
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      dbMonitorEditor
        @/@Control/@mainSash/@dbMonitorEditor/@actions
        sname
        actions
        sdescriptors
        xworker.swt.app.view.swt.widgets.DataObjectEditCompoiste/@actions1
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        actions
          @/@Control/@mainSash/@dbMonitorEditor/@actions/@tableSelection
          sname
          tableSelection
          sisSynchronized
          false
          sthrowException
          true
          suseOtherAction
          false
          svarScope
          Local
          sdisableGlobalContext
          false
          Scode
#$@text#$@
addTaskButton.setEnabled(true);
deleteTaskButton.setEnabled(false);
addDBButton.setEnabled(false);
deleteDbButton.setEnabled(false);
editParamButton.setEnabled(false);
editTaskButton.setEnabled(false);
editTaskParamButton.setEnabled(false);
addChildTaskButton.setEnabled(false);
editTaskThingButton.setEnabled(false);

taskDataStore.doAction("load", actionContext, 
    ["params":["monitorId": monitorObjectContext.dataTable.getSelection()[0].getData().get("id"), 
     "parentId":0]]);
    
dbDataStore.doAction("load", actionContext, 
    ["params":["taskId": -1]]);
    
helpBrowser.setText("");

for(int i=7; i<=16; i++){
    def column = tasksTable.getColumn(i);
    column.setText("参数" + (i -6));
}
#$@text#$@
          sinterpretationType
          Action
          screateLocalVarScope
          false
          ssaveReturn
          false
          sdescriptors
          xworker.lang.actions.Actions/@GroovyAction
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          tableSelection
          @/@Control/@mainSash/@dbMonitorEditor/@actions/@tableDeleted
          sname
          tableDeleted
          sisSynchronized
          false
          sthrowException
          true
          suseOtherAction
          false
          svarScope
          Local
          sdisableGlobalContext
          false
          Scode
#$@text#$@
addTaskButton.setEnabled(false);
deleteTaskButton.setEnabled(false);
addDBButton.setEnabled(false);
deleteDbButton.setEnabled(false);
editParamButton.setEnabled(false);
editTaskButton.setEnabled(false);
editTaskParamButton.setEnabled(false);
addChildTaskButton.setEnabled(false);
editTaskThingButton.setEnabled(false);

taskDataStore.doAction("load", actionContext, 
    ["params":["monitorId": monitorObjectContext.dataTable.getSelection()[0].getData().get("id")]]);
    
dbDataStore.doAction("load", actionContext, 
    ["params":["taskId": -1]]);
    
helpBrowser.setText("");
#$@text#$@
          sinterpretationType
          Action
          screateLocalVarScope
          false
          ssaveReturn
          false
          sdescriptors
          xworker.lang.actions.Actions/@GroovyAction
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          tableDeleted
          @/@Control/@mainSash/@dbMonitorEditor/@actions/@onStoreLoaded1
          sname
          onStoreLoaded
          swidgetForDisplay
          mainSash
          stype
          async
          scancelTaskOnWidgetDisposed
          false
          sinterpretationType
          Self
          sattributeTemplate
          false
          schildsAttributeTemplate
          false
          svarScope
          Local
          sisSynchronized
          false
          sthrowException
          true
          suseOtherAction
          false
          screateLocalVarScope
          false
          ssaveReturn
          false
          sdisableGlobalContext
          false
          sdescriptors
          xworker.swt.actions.DisplayActions/@DisplayExec
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          onStoreLoaded1
            @/@Control/@mainSash/@dbMonitorEditor/@actions/@onStoreLoaded1/@actions
            sname
            actions
            sdescriptors
            xworker.swt.actions.DisplayActions/@DisplayExec/@actions
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            actions
              @/@Control/@mainSash/@dbMonitorEditor/@actions/@onStoreLoaded1/@actions/@onStoreLoaded
              sname
              doAction
              sisSynchronized
              false
              sthrowException
              true
              suseOtherAction
              false
              svarScope
              Local
              sdisableGlobalContext
              false
              Scode
#$@text#$@
addTaskButton.setEnabled(false);
deleteTaskButton.setEnabled(false);
addDBButton.setEnabled(false);
deleteDbButton.setEnabled(false);
editParamButton.setEnabled(false);
editTaskButton.setEnabled(false);
editTaskParamButton.setEnabled(false);
addChildTaskButton.setEnabled(false);
editTaskThingButton.setEnabled(false);

taskDataStore.doAction("load", actionContext, 
    ["params":["monitorId": -1]]);
    
dbDataStore.doAction("load", actionContext, 
    ["params":["taskId": -1]]);
    
helpBrowser.setText("");
#$@text#$@
              sinterpretationType
              Action
              screateLocalVarScope
              false
              ssaveReturn
              false
              sdescriptors
              xworker.lang.actions.Actions/@GroovyAction
              sinheritDescription
              false
              sth_createIndex
              false
              sth_registMyChilds
              false
              sth_mark
              false
              sid
              onStoreLoaded
      @/@Control/@mainSash/@bottomSashForm
      sname
      bottomSashForm
      sstyle
      HORIZONTAL
      sSMOOTH
      false
      sweights
      50,50
      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/@SashForm
      sinheritDescription
      false
      sth_createIndex
      false
      sth_registMyChilds
      false
      sth_mark
      false
      sid
      bottomSashForm
        @/@Control/@mainSash/@bottomSashForm/@tasksComposite
        sname
        tasksComposite
        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
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        tasksComposite
          @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksCompositeGridLayout
          sname
          tasksCompositeGridLayout
          smakeColumnsEqualWidth
          false
          smarginWidth
          5
          smarginHeight
          5
          smarginLeft
          0
          smarginTop
          0
          smarginRight
          0
          smarginBottom
          0
          shorizontalSpacing
          5
          sverticalSpacing
          5
          sdescriptors
          xworker.swt.Layouts/@GridLayout
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          tasksCompositeGridLayout
          @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1
          sname
          tasksTable
          sselectStyle
          SINGLE
          sV_SCROLL
          true
          sH_SCROLL
          true
          sCHECK
          false
          sFULL_SELECTION
          true
          sHIDE_SELECTION
          true
          sBORDER
          false
          slineVisible
          true
          smultipleColumns
          true
          sheaderVisible
          true
          ssortIndicator
          true
          smoveableColumns
          true
          sheadImages
          false
          ssubImages
          false
          scheckSelection
          false
          scapture
          false
          senabled
          true
          sredraw
          true
          svisible
          true
          sVIRTUAL
          false
          sdescriptors
          xworker.swt.Widgets/@Tree,xworker.swt.Widgets/@Table
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          tasksTable1
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1/@DataStore
            sname
            taskDataStore
            sattachToParent
            true
            sloadBackground
            false
            sautoLoad
            false
            sautoSave
            true
            sdataObject
            xworker.app.monitor.dataobjects.ResMonitorTaskItems
            spaging
            extend
            spageSize
            50
            sstoreSortField
            _extend
            sstoreSortDir
            ASC
            seditable
            extend
            seditmethod
            extend
            sidName
            id
            sparentIdName
            parentId
            sdescriptors
            xworker.swt.widgets.Table/@DataStore
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            DataStore
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1/@DataStore/@queryConfig
              sname
              queryConfig
              boperator
              1
              sjoin
              and
              signoreNull
              true
              sdummySql
              false
              saddOneDay
              false
              sdescriptors
              xworker.swt.app.view.swt.data.DataStore/@Condition
              sinheritDescription
              false
              sth_createIndex
              false
              sth_registMyChilds
              false
              sth_mark
              false
              sid
              queryConfig
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1/@DataStore/@queryConfig/@parentId
                sname
                parentId
                sattributeName
                parentId
                sdataName
                parentId
                boperator
                1
                sjoin
                and
                signoreNull
                true
                sdummySql
                false
                saddOneDay
                false
                sdescriptors
                xworker.dataObject.query.Condition/@Condition
                sinheritDescription
                false
                sth_createIndex
                false
                sth_registMyChilds
                false
                sth_mark
                false
                sid
                parentId
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1/@DataStore/@queryConfig/@monitorId
                sname
                monitorId
                sattributeName
                monitorId
                sdataName
                monitorId
                boperator
                1
                sjoin
                and
                signoreNull
                true
                sdummySql
                false
                saddOneDay
                false
                sdescriptors
                xworker.dataObject.query.Condition/@Condition
                sinheritDescription
                false
                sth_createIndex
                false
                sth_registMyChilds
                false
                sth_mark
                false
                sid
                monitorId
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1/@Listeners
            sname
            Listeners
            sdescriptors
            xworker.swt.widgets.Widget/@Listeners
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            Listeners
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1/@Listeners/@tasksTableSelection
              sname
              tasksTableSelection
              stype
              Selection
              sdescriptors
              xworker.swt.events.Listeners/@listeners/@Listener
              sinheritDescription
              false
              sth_createIndex
              false
              sth_registMyChilds
              false
              sth_mark
              false
              sid
              tasksTableSelection
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1/@Listeners/@tasksTableSelection/@GroovyAction
                sname
                GroovyAction
                sisSynchronized
                false
                sthrowException
                true
                suseOtherAction
                false
                svarScope
                Local
                sdisableGlobalContext
                false
                Scode
#$@text#$@
import xworker.dataObject.DataObject;
import xworker.lang.util.XWorkerUtils;

deleteTaskButton.setEnabled(true);
addDBButton.setEnabled(true);
deleteDbButton.setEnabled(false);
editParamButton.setEnabled(false);
editTaskButton.setEnabled(true);
addChildTaskButton.setEnabled(true);
editTaskThingButton.setEnabled(true);

def task = tasksTable.getSelection()[0].getData();
//装载数据库
dbDataStore.doAction("load", actionContext, 
    ["params":["taskId": task.get("id")]]);
//log.info("taskId=" + task.get("id"));
    
//显示任务的文档    
def taskId = task.get("taskId");
def rtask = new DataObject("xworker.app.monitor.dataobjects.ResMonitorTasks");
rtask.put("id", taskId);
rtask = rtask.load(actionContext);

//参数的名称
for(int i=7; i<=16; i++){
    def column = tasksTable.getColumn(i);
    column.setText("参数" + (i - 6));
}
for(int i=3; i<=12; i++){
    def column = dbsTable.getColumn(i);
    column.setText("参数" + (i - 2));
}

def taskPath = rtask.getString("taskPath");
if(taskPath != null){
    def taskThing = world.getThing(taskPath);
    if(taskThing != null){
        helpBrowser.setUrl(XWorkerUtils.getThingDescUrl(taskThing));
        
        //任务资源参数
        def paramThing = taskThing.doAction("getParameterThing", actionContext);
        if(paramThing != null){
            tasksTable.setData("paramThing", paramThing);     
            
            def pthing = world.getThing(paramThing);
            if(pthing != null){
                for(pm in pthing.getChilds()){
                    int index = 0;
                    String name = pm.getMetadata().getLabel();;
                    String sname = pm.getString("name");
                    sname = sname.substring(5, sname.length());
                    index = 2 + Integer.parseInt(sname);
                    
                    if(index != 0){
                        def column = dbsTable.getColumn(index);
                        column.setText(name);
                    }
                }
            }      
        }
        
        //任务本身的参数
        def taskParamThing = taskThing.doAction("getTaskParameterThing", actionContext);
        if(taskParamThing != null){
            tasksTable.setData("taskParamThing", taskParamThing);     
            
            def pthing = world.getThing(taskParamThing);
            if(pthing != null){
                for(pm in pthing.getChilds()){
                    int index = 0;
                    String name = pm.getMetadata().getLabel();;
                    String sname = pm.getString("name");
                    sname = sname.substring(5, sname.length());
                    index = 6 + Integer.parseInt(sname);
                    
                    if(index != 0){
                        def column = tasksTable.getColumn(index);
                        column.setText(name);
                    }
                }
            }     
            
            editTaskParamButton.setEnabled(true); 
        }else{
            editTaskParamButton.setEnabled(false);
        }
    }
}
#$@text#$@
                sinterpretationType
                Action
                screateLocalVarScope
                false
                ssaveReturn
                false
                sdescriptors
                xworker.lang.actions.Actions/@GroovyAction
                sinheritDescription
                false
                sth_createIndex
                false
                sth_registMyChilds
                false
                sth_mark
                false
                sid
                GroovyAction
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@tasksTable1/@tasksTableGridData
            sname
            tasksTableGridData
            sstyle
            FILL_BOTH
            shorizontalIndent
            0
            swidth
            -1
            sheight
            -1
            shorizontalAlignment
            BEGINNING
            sverticalAlignment
            CENTER
            shorizontalSpan
            1
            sverticalSpan
            1
            sgrabExcessHorizontalSpace
            false
            sgrabExcessVerticalSpace
            false
            sdescriptors
            xworker.swt.layout.LayoutDatas/@GridData
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            tasksTableGridData
          @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163
          sname
          taskButtonComposite
          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
          18163
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18164
            sname
            buttonCompositeGridData
            sstyle
            FILL_HORIZONTAL
            shorizontalIndent
            0
            swidth
            -1
            sheight
            -1
            shorizontalAlignment
            END
            sverticalAlignment
            CENTER
            shorizontalSpan
            1
            sverticalSpan
            1
            sgrabExcessHorizontalSpace
            false
            sgrabExcessVerticalSpace
            false
            sdescriptors
            xworker.swt.layout.LayoutDatas/@GridData
            sid
            18164
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18165
            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
            sdescriptors
            xworker.swt.Layouts/@RowLayout
            sid
            18165
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18166
            sname
            addTaskButton
            stext
            添加任务
            stype
            SWT.PUSH
            sflat
            false
            sborder
            false
            sselected
            false
            scapture
            false
            senabled
            false
            sredraw
            true
            svisible
            true
            sdescriptors
            xworker.swt.Widgets/@Button
            sth_createIndex
            false
            sid
            18166
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18166/@18167
              sname
              RowData
              sexclude
              false
              swidth
              80
              sheight
              -1
              sdescriptors
              xworker.swt.layout.LayoutDatas/@RowData
              sth_createIndex
              false
              sid
              18167
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18166/@18168
              sname
              Listeners
              sdescriptors
              xworker.swt.widgets.Widget/@Listeners
              sth_createIndex
              false
              sid
              18168
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18166/@18168/@18169
                sname
                addTaskButtonSelection
                stype
                Selection
                sdescriptors
                xworker.swt.events.Listeners/@listeners/@Listener
                sth_createIndex
                false
                sid
                18169
                  @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18166/@18168/@18169/@GroovyAction
                  sname
                  GroovyAction
                  sisSynchronized
                  false
                  sthrowException
                  true
                  suseOtherAction
                  false
                  svarScope
                  Local
                  sdisableGlobalContext
                  false
                  Scode
#$@text#$@
import org.xmeta.ActionContext;
import xworker.swt.util.SwtDialog;
import xworker.dataObject.DataObject;
import xworker.dataObject.utils.DataObjectUtil;

//选择数据
def ac = new ActionContext();
ac.put("parent", addTaskButton.getShell());
def shellThing = world.getThing("xworker.app.appmanager.swt.editors.monitor.ResTaskSelector");
def shell = shellThing.doAction("create", ac);
def datas = SwtDialog.open(shell, ac);

//插入数据
for(data in datas){
    def dataObject = new DataObject("xworker.app.monitor.dataobjects.ResMonitorTaskItems");
    dataObject.put("monitorId", monitorObjectContext.dataTable.getSelection()[0].getData().get("id"));
    dataObject.put("taskId", data.get("id"));
    dataObject.put("parentId", 0);
    dataObject.put("taskName", data.get("name")); 
    dataObject.put("status", 0);
    taskDataStore.doAction("insert", actionContext, ["records":[dataObject]]);
    //DataObjectUtil.createIfNotExists(dataObject, ["monitorId", "taskId"] as String[], actionContext);
}

//重新刷新
//taskDataStore.doAction("reload", actionContext);
#$@text#$@
                  sinterpretationType
                  Action
                  screateLocalVarScope
                  false
                  ssaveReturn
                  false
                  sdescriptors
                  xworker.lang.actions.Actions/@GroovyAction
                  sinheritDescription
                  false
                  sth_createIndex
                  false
                  sth_registMyChilds
                  false
                  sth_mark
                  false
                  sid
                  GroovyAction
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181661
            sname
            addChildTaskButton
            stext
            添加子任务
            stype
            SWT.PUSH
            sflat
            false
            sborder
            false
            sselected
            false
            scapture
            false
            senabled
            false
            sredraw
            true
            svisible
            true
            sdescriptors
            xworker.swt.Widgets/@Button
            sth_createIndex
            false
            sid
            181661
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181661/@18167
              sname
              RowData
              sexclude
              false
              swidth
              80
              sheight
              -1
              sdescriptors
              xworker.swt.layout.LayoutDatas/@RowData
              sth_createIndex
              false
              sid
              18167
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181661/@18168
              sname
              Listeners
              sdescriptors
              xworker.swt.widgets.Widget/@Listeners
              sth_createIndex
              false
              sid
              18168
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181661/@18168/@18169
                sname
                addTaskButtonSelection
                stype
                Selection
                sdescriptors
                xworker.swt.events.Listeners/@listeners/@Listener
                sth_createIndex
                false
                sid
                18169
                  @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181661/@18168/@18169/@GroovyAction
                  sname
                  GroovyAction
                  sisSynchronized
                  false
                  sthrowException
                  true
                  suseOtherAction
                  false
                  svarScope
                  Local
                  sdisableGlobalContext
                  false
                  Scode
#$@text#$@
import org.xmeta.ActionContext;
import xworker.swt.util.SwtDialog;
import xworker.dataObject.DataObject;
import xworker.dataObject.utils.DataObjectUtil;

//选择数据
def ac = new ActionContext();
ac.put("parent", addTaskButton.getShell());
def shellThing = world.getThing("xworker.app.appmanager.swt.editors.monitor.ResTaskSelector");
def shell = shellThing.doAction("create", ac);
def datas = SwtDialog.open(shell, ac);

def parentItem = tasksTable.getSelection()[0];
def parentData = parentItem.getData();
//插入数据
for(data in datas){
    def dataObject = new DataObject("xworker.app.monitor.dataobjects.ResMonitorTaskItems");
    dataObject.put("monitorId", monitorObjectContext.dataTable.getSelection()[0].getData().get("id"));
    dataObject.put("taskId", data.get("id"));
    dataObject.put("taskName", data.get("name")); 
    dataObject.put("status", 1);
    dataObject.put("parentId", parentData.get("id"));    
    taskDataStore.doAction("insert", actionContext, ["records":[dataObject]]);
}
#$@text#$@
                  sinterpretationType
                  Action
                  screateLocalVarScope
                  false
                  ssaveReturn
                  false
                  sdescriptors
                  xworker.lang.actions.Actions/@GroovyAction
                  sinheritDescription
                  false
                  sth_createIndex
                  false
                  sth_registMyChilds
                  false
                  sth_mark
                  false
                  sid
                  GroovyAction
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817012
            sname
            editTaskButton
            stext
            编辑任务
            stype
            SWT.PUSH
            sflat
            false
            sborder
            false
            sselected
            false
            scapture
            false
            senabled
            false
            sredraw
            true
            svisible
            true
            sdescriptors
            xworker.swt.Widgets/@Button
            sth_createIndex
            false
            sid
            1817012
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817012/@18171
              sname
              RowData
              sexclude
              false
              swidth
              80
              sheight
              -1
              sdescriptors
              xworker.swt.layout.LayoutDatas/@RowData
              sth_createIndex
              false
              sid
              18171
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817012/@18172
              sname
              Listeners
              sdescriptors
              xworker.swt.widgets.Widget/@Listeners
              sth_createIndex
              false
              sid
              18172
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817012/@18172/@editTaskButtonSelection
                sname
                editTaskButtonSelection
                stype
                Selection
                sdescriptors
                xworker.swt.events.Listeners/@listeners/@Listener
                sinheritDescription
                false
                sth_createIndex
                false
                sth_registMyChilds
                false
                sth_mark
                false
                sid
                editTaskButtonSelection
                  @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817012/@18172/@editTaskButtonSelection/@DataStoreAction
                  sname
                  DataStoreAction
                  sstoreName
                  taskDataStore
                  smethod
                  openEditForm
                  srecordSource
                  DataObjectTable
                  srecordName
                  tasksTable
                  sdeleteConfirm
                  true
                  scrateConfirm
                  false
                  supdateConfirm
                  false
                  scommitConfirm
                  false
                  supdateBatchConfirm
                  true
                  sremoveBatchConfirm
                  true
                  sinterpretationType
                  Self
                  sattributeTemplate
                  false
                  schildsAttributeTemplate
                  false
                  svarScope
                  Local
                  sisSynchronized
                  false
                  sthrowException
                  true
                  suseOtherAction
                  false
                  screateLocalVarScope
                  false
                  ssaveReturn
                  false
                  sdisableGlobalContext
                  false
                  sdescriptors
                  xworker.swt.app.view.swt.data.DataStoreAction
                  sinheritDescription
                  false
                  sth_createIndex
                  false
                  sth_registMyChilds
                  false
                  sth_mark
                  false
                  sid
                  DataStoreAction
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170
            sname
            deleteTaskButton
            stext
            删除任务
            stype
            SWT.PUSH
            sflat
            false
            sborder
            false
            sselected
            false
            scapture
            false
            senabled
            false
            sredraw
            true
            svisible
            true
            sdescriptors
            xworker.swt.Widgets/@Button
            sth_createIndex
            false
            sid
            18170
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170/@18171
              sname
              RowData
              sexclude
              false
              swidth
              80
              sheight
              -1
              sdescriptors
              xworker.swt.layout.LayoutDatas/@RowData
              sth_createIndex
              false
              sid
              18171
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170/@18172
              sname
              Listeners
              sdescriptors
              xworker.swt.widgets.Widget/@Listeners
              sth_createIndex
              false
              sid
              18172
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170/@18172/@18173
                sname
                deleteTaskButtonSelection
                stype
                Selection
                sdescriptors
                xworker.swt.events.Listeners/@listeners/@Listener
                sth_createIndex
                false
                sid
                18173
                  @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170/@18172/@18173/@If
                  sname
                  If
                  sinterpretationType
                  Self
                  sattributeTemplate
                  false
                  schildsAttributeTemplate
                  false
                  svarScope
                  Local
                  sisSynchronized
                  false
                  sthrowException
                  true
                  suseOtherAction
                  false
                  screateLocalVarScope
                  false
                  ssaveReturn
                  false
                  sdisableGlobalContext
                  false
                  sdescriptors
                  xworker.lang.actions.Actions/@If
                  sinheritDescription
                  false
                  sth_createIndex
                  false
                  sth_registMyChilds
                  false
                  sth_mark
                  false
                  sid
                  If
                    @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170/@18172/@18173/@If/@actions
                    sname
                    actions
                    sdescriptors
                    xworker.lang.actions.If/@actions
                    sinheritDescription
                    false
                    sth_createIndex
                    false
                    sth_registMyChilds
                    false
                    sth_mark
                    false
                    sid
                    actions
                      @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170/@18172/@18173/@If/@actions/@condition
                      sname
                      condition
                      sisSynchronized
                      false
                      sthrowException
                      true
                      suseOtherAction
                      false
                      svarScope
                      Local
                      sdisableGlobalContext
                      false
                      Scode
#$@text#$@
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;

if(dbsTable.getItems().length > 0){
    def box = new MessageBox(dbsTable.getShell(), SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
    box.setText("删除任务");
    box.setMessage("资源不为空，还是确定要删除么？");
    
    if(SWT.OK ==  box.open()){
        return true;
    }else{
        return false;
    }
}else{
    return true;
}
#$@text#$@
                      sinterpretationType
                      Action
                      screateLocalVarScope
                      false
                      ssaveReturn
                      false
                      sdescriptors
                      xworker.lang.actions.Actions/@GroovyAction
                      sinheritDescription
                      false
                      sth_createIndex
                      false
                      sth_registMyChilds
                      false
                      sth_mark
                      false
                      sid
                      condition
                    @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170/@18172/@18173/@If/@ChildAction
                    sname
                    Then
                    sdescriptors
                    xworker.lang.actions.If/@ChildAction
                    sinheritDescription
                    false
                    sth_createIndex
                    false
                    sth_registMyChilds
                    false
                    sth_mark
                    false
                    sid
                    ChildAction
                      @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@18170/@18172/@18173/@If/@ChildAction/@DataStoreAction
                      sname
                      DataStoreAction
                      sstoreName
                      taskDataStore
                      smethod
                      remove
                      srecordSource
                      DataObjectTable
                      srecordName
                      tasksTable
                      sdeleteConfirm
                      true
                      scrateConfirm
                      false
                      supdateConfirm
                      false
                      scommitConfirm
                      false
                      supdateBatchConfirm
                      true
                      sremoveBatchConfirm
                      true
                      sdeleteMessage
                      确定要删除选中的任务么？
                      sinterpretationType
                      Self
                      sattributeTemplate
                      false
                      schildsAttributeTemplate
                      false
                      svarScope
                      Local
                      sisSynchronized
                      false
                      sthrowException
                      true
                      suseOtherAction
                      false
                      screateLocalVarScope
                      false
                      ssaveReturn
                      false
                      sdisableGlobalContext
                      false
                      sdescriptors
                      xworker.swt.app.view.swt.data.DataStoreAction
                      sinheritDescription
                      false
                      sth_createIndex
                      false
                      sth_registMyChilds
                      false
                      sth_mark
                      false
                      sid
                      DataStoreAction
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817011
            sname
            editTaskParamButton
            stext
            编辑参数
            stype
            SWT.PUSH
            sflat
            false
            sborder
            false
            sselected
            false
            scapture
            false
            senabled
            false
            sredraw
            true
            svisible
            true
            sdescriptors
            xworker.swt.Widgets/@Button
            sth_createIndex
            false
            sid
            1817011
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817011/@18171
              sname
              RowData
              sexclude
              false
              swidth
              100
              sheight
              -1
              sdescriptors
              xworker.swt.layout.LayoutDatas/@RowData
              sth_createIndex
              false
              sid
              18171
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817011/@18172
              sname
              Listeners
              sdescriptors
              xworker.swt.widgets.Widget/@Listeners
              sth_createIndex
              false
              sid
              18172
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817011/@18172/@18173
                sname
                deleteTaskButtonSelection
                stype
                Selection
                sdescriptors
                xworker.swt.events.Listeners/@listeners/@Listener
                sth_createIndex
                false
                sid
                18173
                  @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@1817011/@18172/@18173/@GroovyAction
                  sname
                  GroovyAction
                  sisSynchronized
                  false
                  sthrowException
                  true
                  suseOtherAction
                  false
                  svarScope
                  Local
                  sdisableGlobalContext
                  false
                  Scode
#$@text#$@
import org.xmeta.Thing;
import org.xmeta.ActionContext;
import xworker.swt.util.SwtDialog;

def paramThing = tasksTable.getData("taskParamThing");
def param = new Thing(paramThing);
def item = tasksTable.getSelection()[0];
def data = tasksTable.getSelection()[0].getData();
param.putAll(data);

def ac = new ActionContext();
ac.put("parent", editParamButton.getShell());
ac.put("paramThing", param);

def shellThing = world.getThing("xworker.app.appmanager.swt.editors.monitor.ParamsEditor");
def newShell = shellThing.doAction("create", ac);
def dialog = new SwtDialog(newShell, ac);
def result = dialog.open();
if(result != null){
    data.putAll(result);
    //data.update(actionContext);
    taskDataStore.doAction("update", actionContext, ["record": data]);
}
#$@text#$@
                  sinterpretationType
                  Action
                  screateLocalVarScope
                  false
                  ssaveReturn
                  false
                  sdescriptors
                  xworker.lang.actions.Actions/@GroovyAction
                  sinheritDescription
                  false
                  sth_createIndex
                  false
                  sth_registMyChilds
                  false
                  sth_mark
                  false
                  sid
                  GroovyAction
            @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181701
            sname
            editTaskThingButton
            stext
            编辑任务事物
            stype
            SWT.PUSH
            sflat
            false
            sborder
            false
            sselected
            false
            scapture
            false
            senabled
            false
            sredraw
            true
            svisible
            true
            sdescriptors
            xworker.swt.Widgets/@Button
            sth_createIndex
            false
            sid
            181701
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181701/@18171
              sname
              RowData
              sexclude
              false
              swidth
              100
              sheight
              -1
              sdescriptors
              xworker.swt.layout.LayoutDatas/@RowData
              sth_createIndex
              false
              sid
              18171
              @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181701/@18172
              sname
              Listeners
              sdescriptors
              xworker.swt.widgets.Widget/@Listeners
              sth_createIndex
              false
              sid
              18172
                @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181701/@18172/@18173
                sname
                deleteTaskButtonSelection
                stype
                Selection
                sdescriptors
                xworker.swt.events.Listeners/@listeners/@Listener
                sth_createIndex
                false
                sid
                18173
                  @/@Control/@mainSash/@bottomSashForm/@tasksComposite/@18163/@181701/@18172/@18173/@GroovyAction
                  sname
                  GroovyAction
                  sisSynchronized
                  false
                  sthrowException
                  true
                  suseOtherAction
                  false
                  svarScope
                  Local
                  sdisableGlobalContext
                  false
                  Scode
#$@text#$@
import xworker.dataObject.DataObject;
import xworker.lang.util.XWorkerUtils;

def task = tasksTable.getSelection()[0].getData();
def taskObj = new DataObject("xworker.app.monitor.dataobjects.ResMonitorTasks");
taskObj.put("id", task.get("taskId"));
taskObj = taskObj.load(actionContext);
if(taskObj != null){
    def path = taskObj.getString("taskPath");
    def thing = world.getThing(path);
    XWorkerUtils.ideOpenThing(thing);
}
#$@text#$@
                  sinterpretationType
                  Action
                  screateLocalVarScope
                  false
                  ssaveReturn
                  false
                  sdescriptors
                  xworker.lang.actions.Actions/@GroovyAction
                  sinheritDescription
                  false
                  sth_createIndex
                  false
                  sth_registMyChilds
                  false
                  sth_mark
                  false
                  sid
                  GroovyAction
        @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm
        sname
        bottomRightSashForm
        sstyle
        VERTICAL
        sSMOOTH
        false
        sweights
        60,40
        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/@SashForm
        sinheritDescription
        false
        sth_createIndex
        false
        sth_registMyChilds
        false
        sth_mark
        false
        sid
        bottomRightSashForm
          @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite
          sname
          resComposite
          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
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          dbsComposite
            @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@dbsCompositeGridLayout
            sname
            dbsCompositeGridLayout
            smakeColumnsEqualWidth
            false
            smarginWidth
            5
            smarginHeight
            5
            smarginLeft
            0
            smarginTop
            0
            smarginRight
            0
            smarginBottom
            0
            shorizontalSpacing
            5
            sverticalSpacing
            5
            sdescriptors
            xworker.swt.Layouts/@GridLayout
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            dbsCompositeGridLayout
            @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@dbsTable
            sname
            dbsTable
            sselectStyle
            SINGLE
            sV_SCROLL
            true
            sH_SCROLL
            true
            sCHECK
            true
            sFULL_SELECTION
            true
            sHIDE_SELECTION
            true
            sBORDER
            false
            slineVisible
            true
            smultipleColumns
            true
            sheaderVisible
            true
            ssortIndicator
            true
            smoveableColumns
            true
            sheadImages
            false
            ssubImages
            false
            sVIRTUAL
            false
            scapture
            false
            senabled
            true
            sredraw
            true
            svisible
            true
            sdescriptors
            xworker.swt.Widgets/@Table
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            dbsTable
              @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@dbsTable/@dbsTableGridData
              sname
              dbsTableGridData
              sstyle
              FILL_BOTH
              shorizontalIndent
              0
              swidth
              -1
              sheight
              -1
              shorizontalAlignment
              BEGINNING
              sverticalAlignment
              CENTER
              shorizontalSpan
              1
              sverticalSpan
              1
              sgrabExcessHorizontalSpace
              false
              sgrabExcessVerticalSpace
              false
              sdescriptors
              xworker.swt.layout.LayoutDatas/@GridData
              sinheritDescription
              false
              sth_createIndex
              false
              sth_registMyChilds
              false
              sth_mark
              false
              sid
              dbsTableGridData
              @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@dbsTable/@dbDataStore
              sname
              dbDataStore
              sattachToParent
              true
              sloadBackground
              true
              sautoLoad
              false
              sautoSave
              true
              sdataObject
              xworker.app.monitor.dataobjects.ResMonitorResItems
              spaging
              extend
              spageSize
              50
              sstoreSortField
              _extend
              sstoreSortDir
              ASC
              seditable
              extend
              seditmethod
              extend
              sdescriptors
              xworker.swt.widgets.Table/@DataStore
              sinheritDescription
              false
              sth_createIndex
              false
              sth_registMyChilds
              false
              sth_mark
              false
              sid
              dbDataStore
                @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@dbsTable/@dbDataStore/@queryConfig
                sname
                queryConfig
                sattributeName
                taskId
                sdataName
                taskId
                boperator
                1
                sjoin
                and
                signoreNull
                true
                sdummySql
                false
                saddOneDay
                false
                sdescriptors
                xworker.swt.app.view.swt.data.DataStore/@Condition
                sinheritDescription
                false
                sth_createIndex
                false
                sth_registMyChilds
                false
                sth_mark
                false
                sid
                queryConfig
              @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@dbsTable/@Listeners
              sname
              Listeners
              sdescriptors
              xworker.swt.widgets.Widget/@Listeners
              sinheritDescription
              false
              sth_createIndex
              false
              sth_registMyChilds
              false
              sth_mark
              false
              sid
              Listeners
                @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@dbsTable/@Listeners/@dbsTableSelection
                sname
                dbsTableSelection
                stype
                Selection
                sdescriptors
                xworker.swt.events.Listeners/@listeners/@Listener
                sinheritDescription
                false
                sth_createIndex
                false
                sth_registMyChilds
                false
                sth_mark
                false
                sid
                dbsTableSelection
                  @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@dbsTable/@Listeners/@dbsTableSelection/@GroovyAction
                  sname
                  GroovyAction
                  sisSynchronized
                  false
                  sthrowException
                  true
                  suseOtherAction
                  false
                  svarScope
                  Local
                  sdisableGlobalContext
                  false
                  Scode
#$@text#$@
deleteDbButton.setEnabled(true);
if(tasksTable.getData("paramThing") != null){
    editParamButton.setEnabled(true);
}
#$@text#$@
                  sinterpretationType
                  Action
                  screateLocalVarScope
                  false
                  ssaveReturn
                  false
                  sdescriptors
                  xworker.lang.actions.Actions/@GroovyAction
                  sinheritDescription
                  false
                  sth_createIndex
                  false
                  sth_registMyChilds
                  false
                  sth_mark
                  false
                  sid
                  GroovyAction
            @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163
            sname
            dbsButtonComposite
            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
            18163
              @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18164
              sname
              buttonCompositeGridData
              sstyle
              FILL_HORIZONTAL
              shorizontalIndent
              0
              swidth
              -1
              sheight
              -1
              shorizontalAlignment
              END
              sverticalAlignment
              CENTER
              shorizontalSpan
              1
              sverticalSpan
              1
              sgrabExcessHorizontalSpace
              false
              sgrabExcessVerticalSpace
              false
              sdescriptors
              xworker.swt.layout.LayoutDatas/@GridData
              sid
              18164
              @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18165
              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
              sdescriptors
              xworker.swt.Layouts/@RowLayout
              sid
              18165
              @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18166
              sname
              addDBButton
              stext
              添加资源
              stype
              SWT.PUSH
              sflat
              false
              sborder
              false
              sselected
              false
              scapture
              false
              senabled
              true
              sredraw
              true
              svisible
              true
              sdescriptors
              xworker.swt.Widgets/@Button
              sth_createIndex
              false
              sid
              18166
                @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18166/@18167
                sname
                RowData
                sexclude
                false
                swidth
                80
                sheight
                -1
                sdescriptors
                xworker.swt.layout.LayoutDatas/@RowData
                sth_createIndex
                false
                sid
                18167
                @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18166/@18168
                sname
                Listeners
                sdescriptors
                xworker.swt.widgets.Widget/@Listeners
                sth_createIndex
                false
                sid
                18168
                  @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18166/@18168/@18169
                  sname
                  addTaskButtonSelection
                  stype
                  Selection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sth_createIndex
                  false
                  sid
                  18169
                    @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18166/@18168/@18169/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    svarScope
                    Local
                    sdisableGlobalContext
                    false
                    Scode
#$@text#$@
import org.xmeta.ActionContext;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.MessageBox;

import xworker.swt.util.SwtDialog;
import xworker.dataObject.DataObject;
import xworker.dataObject.utils.DataObjectUtil;

//任务
def task = tasksTable.getSelection()[0].getData();
def taskDataObject = new DataObject("xworker.app.monitor.dataobjects.ResMonitorTasks");
taskDataObject.put("id", task.taskId);
taskDataObject = taskDataObject.load(actionContext);
//log.info("" + taskDataObject.taskPath);
def taskThing = world.getThing(taskDataObject.taskPath);
if(taskThing == null){
    def box = new MessageBox(tasksTable.getShell(), SWT.ICON_WARNING | SWT.OK);
    box.setText("添加资源");
    box.setMessage("任务不存在！任务没有设置taskPath或taskPath指向的事物不存在！");
    box.open();
    return;
}

def resSelectorPath = taskThing.doAction("getResSelectorPath");
if(resSelectorPath == null || world.getThing(resSelectorPath) == null){
    def box = new MessageBox(tasksTable.getShell(), SWT.ICON_WARNING | SWT.OK);
    box.setText("添加资源");
    box.setMessage("通过任务事物getResSelectorPath获取的选择资源的窗口事物不存在！");
    box.open();
    return;
}

//选择数据
def ac = new ActionContext();
ac.put("parent", addTaskButton.getShell());
def shellThing = world.getThing(resSelectorPath);
def shell = shellThing.doAction("create", ac);
def datas = SwtDialog.open(shell, ac);

//插入数据
for(data in datas){
    def dataObject = new DataObject("xworker.app.monitor.dataobjects.ResMonitorResItems");
    dataObject.put("taskId",tasksTable.getSelection()[0].getData().get("id"));
    dataObject.put("resId", data.get("id"));
    dataObject.put("resName", data.get("name")); 
    dataObject.put("status", 1);
    DataObjectUtil.createIfNotExists(dataObject, ["resId", "taskId"] as String[], actionContext);
}

//重新刷新
dbDataStore.doAction("reload", actionContext);
#$@text#$@
                    sinterpretationType
                    Action
                    screateLocalVarScope
                    false
                    ssaveReturn
                    false
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sinheritDescription
                    false
                    sth_createIndex
                    false
                    sth_registMyChilds
                    false
                    sth_mark
                    false
                    sid
                    GroovyAction
              @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18170
              sname
              deleteDbButton
              stext
              删除资源
              stype
              SWT.PUSH
              sflat
              false
              sborder
              false
              sselected
              false
              scapture
              false
              senabled
              true
              sredraw
              true
              svisible
              true
              sdescriptors
              xworker.swt.Widgets/@Button
              sth_createIndex
              false
              sid
              18170
                @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18170/@18171
                sname
                RowData
                sexclude
                false
                swidth
                80
                sheight
                -1
                sdescriptors
                xworker.swt.layout.LayoutDatas/@RowData
                sth_createIndex
                false
                sid
                18171
                @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18170/@18172
                sname
                Listeners
                sdescriptors
                xworker.swt.widgets.Widget/@Listeners
                sth_createIndex
                false
                sid
                18172
                  @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18170/@18172/@18173
                  sname
                  deleteTaskButtonSelection
                  stype
                  Selection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sth_createIndex
                  false
                  sid
                  18173
                    @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@18170/@18172/@18173/@DataStoreAction
                    sname
                    DataStoreAction
                    sstoreName
                    dbDataStore
                    smethod
                    remove
                    srecordSource
                    DataObjectTable
                    srecordName
                    dbsTable
                    sdeleteConfirm
                    true
                    scrateConfirm
                    false
                    supdateConfirm
                    false
                    scommitConfirm
                    false
                    supdateBatchConfirm
                    true
                    sremoveBatchConfirm
                    true
                    sdeleteMessage
                    却是要删除选中的资源么？
                    sinterpretationType
                    Self
                    sattributeTemplate
                    false
                    schildsAttributeTemplate
                    false
                    svarScope
                    Local
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    screateLocalVarScope
                    false
                    ssaveReturn
                    false
                    sdisableGlobalContext
                    false
                    sdescriptors
                    xworker.swt.app.view.swt.data.DataStoreAction
                    sinheritDescription
                    false
                    sth_createIndex
                    false
                    sth_registMyChilds
                    false
                    sth_mark
                    false
                    sid
                    DataStoreAction
              @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@181701
              sname
              editParamButton
              stext
              编辑参数
              stype
              SWT.PUSH
              sflat
              false
              sborder
              false
              sselected
              false
              scapture
              false
              senabled
              false
              sredraw
              true
              svisible
              true
              sdescriptors
              xworker.swt.Widgets/@Button
              sth_createIndex
              false
              sid
              181701
                @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@181701/@18171
                sname
                RowData
                sexclude
                false
                swidth
                80
                sheight
                -1
                sdescriptors
                xworker.swt.layout.LayoutDatas/@RowData
                sth_createIndex
                false
                sid
                18171
                @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@181701/@18172
                sname
                Listeners
                sdescriptors
                xworker.swt.widgets.Widget/@Listeners
                sth_createIndex
                false
                sid
                18172
                  @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@181701/@18172/@editParamButtonSelection
                  sname
                  editParamButtonSelection
                  stype
                  Selection
                  sdescriptors
                  xworker.swt.events.Listeners/@listeners/@Listener
                  sinheritDescription
                  false
                  sth_createIndex
                  false
                  sth_registMyChilds
                  false
                  sth_mark
                  false
                  sid
                  editParamButtonSelection
                    @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@dbsComposite/@18163/@181701/@18172/@editParamButtonSelection/@GroovyAction
                    sname
                    GroovyAction
                    sisSynchronized
                    false
                    sthrowException
                    true
                    suseOtherAction
                    false
                    svarScope
                    Local
                    sdisableGlobalContext
                    false
                    Scode
#$@text#$@
import org.xmeta.Thing;
import org.xmeta.ActionContext;
import xworker.swt.util.SwtDialog;

def paramThing = tasksTable.getData("paramThing");
def param = new Thing(paramThing);
def item = dbsTable.getSelection()[0];
def data = dbsTable.getSelection()[0].getData();
param.putAll(data);

def ac = new ActionContext();
ac.put("parent", editParamButton.getShell());
ac.put("paramThing", param);

def shellThing = world.getThing("xworker.app.appmanager.swt.editors.monitor.ParamsEditor");
def newShell = shellThing.doAction("create", ac);
def dialog = new SwtDialog(newShell, ac);
def result = dialog.open();
if(result != null){
    data.putAll(result);
    //data.update(actionContext);
    dbDataStore.doAction("update", actionContext, ["record": data]);
}
#$@text#$@
                    sinterpretationType
                    Action
                    screateLocalVarScope
                    false
                    ssaveReturn
                    false
                    sdescriptors
                    xworker.lang.actions.Actions/@GroovyAction
                    sinheritDescription
                    false
                    sth_createIndex
                    false
                    sth_registMyChilds
                    false
                    sth_mark
                    false
                    sid
                    GroovyAction
          @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@helpBrowser
          sname
          helpBrowser
          sMOZILLA
          false
          sWEBKIT
          false
          sjavascriptEnabled
          true
          sdescriptors
          xworker.swt.Widgets/@Browser
          sinheritDescription
          false
          sth_createIndex
          false
          sth_registMyChilds
          false
          sth_mark
          false
          sid
          helpBrowser
            @/@Control/@mainSash/@bottomSashForm/@bottomRightSashForm/@helpBrowser/@UtilBrowser
            sname
            UtilBrowser
            sdescriptors
            xworker.swt.browser.Browser/@UtilBrowser
            sinheritDescription
            false
            sth_createIndex
            false
            sth_registMyChilds
            false
            sth_mark
            false
            sid
            UtilBrowser
