`
vortexchoo
  • 浏览: 64727 次
  • 性别: Icon_minigender_1
  • 来自: 西安
社区版块
存档分类
最新评论

SC(smart Client)组件编写笔记

 
阅读更多

-------------------------------------------------------------------------------------------------------------------------------

isc.ClassFactory.defineClass("processView4SC", "IButton");

isc.processView4SC.addProperties({
    height:"30", width:"60",
    rowSpan:"*", endRow:true, startRow:true,
    autoDestroy:true,
    // this is going to be an editable data item
    shouldSaveValue:false,
    window:null,
    processTabSet:null,
    img:null,
    vlayout0:null,
    vlayout1:null,
    vlayout2:null,
    vlayout3:null,
    hlayout0:null,
    listGrid0:null,
    listGrid1:null,
    process_DS:null,
    workitem_DS:null,
    arg0:"",
    arg1:"",
    ID:"",
    button:null,
    label_finish:null,
    label_running:null,
    label_undo:null,
    pid:"",
    // Implement 'createCanvas' to build a ListGrid from which the user may
    // select items.
    create: function () {
        return this.button;
    },
    fix:function(){   
        this.img = isc.Img.create({
            ID:"viewer",
            width:780,
            height:360
        });
        this.process_DS=isc.DataSource.create({
            ID:"process",
            dataFormat:"xml",
            dataURL:"/SCProcessViewer/view/queryProcess.do?processInsId="+this.pid,
            recordXPath:"//processInfo", //<processInfo></processInfo> 
             fields:{
                 process_ins_id:{
                 name:"process_ins_id",
                 type:"text"
                 },
                 process_ins_name:{
                 name:"process_ins_name",
                 type:"text"
                 },
                 start_time:{
                 name:"start_time",
                 type:"text"
                 },
                 end_time:{
                 name:"end_time",
                 type:"text"
                 },
                 starter:{
                 name:"starter",
                 type:"text"
                 },
                 description:{
                 name:"description",
                 type:"text"
                 }
             },
             operationBindings:[
                                {operationType:"fetch",
                                 dataURL:"/SCProcessViewer/view/queryProcess.do?processInsId="+this.pid
                                 },
                                {operationType:"add",
                                 dataURL:""
                                 },
                                {operationType:"update",
                                 dataURL:""
                                 },
                                {operationType:"remove",
                                 dataURL:""
                                 }
                            ]
        });
        this.workitem_DS=isc.DataSource.create({
            ID:"workItem",
            dataFormat:"xml",
            dataURL:"/SCProcessViewer/view/queryWorkItem.do?processInsId="+this.pid,
            recordXPath:"//workItemInfo", //<workItemInfo></workItemInfo> 
             fields:{
                 workitem_id:{
                 name:"workitem_id",
                 type:"text"
                 },
                 process_ins_name:{
                 name:"process_ins_name",
                 type:"text"
                 },
                 start_time:{
                 name:"start_time",
                 type:"text"
                 },
                 ids:{
                 name:"ids",
                 type:"text"
                 },
                 description:{
                 name:"description",
                 type:"text"
                 }
                 },
                 operationBindings:[
                                    {operationType:"fetch",
                                     dataURL:"/SCProcessViewer/view/queryWorkItem.do?processInsId="+this.pid
                                     },
                                    {operationType:"add",
                                     dataURL:""
                                     },
                                    {operationType:"update",
                                     dataURL:""
                                     },
                                    {operationType:"remove",
                                     dataURL:""
                                     }
                                ]
        });
        this.listGrid0=isc.ListGrid.create({
            ID:"processInfo",
            dataSource:"process",
            autoDraw:false,
            fields:[
            {
            align:"center",
            name:"process_ins_name",
            title:"流程名称"
            },
            {
            align:"center",
            name:"process_ins_id",
            title:"流程编号"
            },
            {
            align:"center",
            name:"start_time",
            title:"流程开始时间"
            },
            {
            align:"center",
            name:"end_time",
            title:"流程结束时间"
            },
            {
            align:"center",
            name:"starter",
            title:"流程启动人"
            },
            {
            align:"center",
            name:"description",
            title:"描述"
            }
            ]
        });
       
       
        this.listGrid1=isc.ListGrid.create({
            ID:"workitemInfo",
            dataSource:"workItem",
            autoDraw:false,
            fields:[
            {
            align:"center",
            name:"workitem_id",
            title:"工作项编号"
            },
            {
            align:"center",
            name:"activity_ins_name",
            title:"当前节点名称"
            },
            {
            align:"center",
            name:"start_time",
            title:"活动开始时间"
            },
            {
            align:"center",
            name:"ids",
            title:"流程参与人"
            },
            {
            align:"center",
            name:"description",
            title:"描述"
            }
            ]
        });
        this.vlayout0=isc.VLayout.create({
            ID:"processVLayout0",
            autoDraw:false,
            members:[
            this.img
            ]
            });
        this.label_finish=isc.Label.create({
            height: 25,
            width:90,
            backgroundColor: "#76EF5E",
            align: "center",
            valign: "center",
            wrap: false,
            showEdges: false,
            showShadow: false,
            contents: "<font size='2' color='yellow'>完成状态</font>"
            });
        this.label_running=isc.Label.create({
            height: 25,
            width:90,
            backgroundColor: "#C53712",
            align: "center",
            valign: "center",
            wrap: false,
            showEdges: false,
            showShadow: false,
            contents: "<font size='2' color='yellow'>运行状态</font>"
            });
        this.label_undo=isc.Label.create({
            height: 25,
            width:90,
            backgroundColor: "#375C90",
            align: "center",
            valign: "center",
            wrap: false,
            showEdges: false,
            showShadow: false,
            contents: "<font size='2' color='yellow'>未执行状态</font>"
            });
        this.vlayout3=isc.VLayout.create({
            ID:"labelVLayout",
            autoDraw:false,
            members:[
                     this.label_finish,
                     this.label_running,
                     this.label_undo
            ]
            });
        this.hlayout0=isc.HLayout.create({
            ID:"processHLayout0",
            autoDraw:false,
            members:[
            this.vlayout0,
            this.vlayout3
            ]
            });
        this.vlayout1=isc.VLayout.create({
            ID:"processVLayout1",
            autoDraw:false,
            members:[
            this.hlayout0,
            this.listGrid0
            ]
            });
        this.vlayout2=isc.VLayout.create({
            ID:"processVLayout2",
            autoDraw:false,
            members:[
            this.listGrid1
            ]
            });
        this.processTabSet = isc.TabSet.create({
            ID:"processTabSet",
            autoDraw:false,
            tabs:[
            {
                title:"流程图查看",
                pane:this.vlayout1,
                ID:"Tab0",
                click:
                function(){
                }
            },
            {
                title:"流程流向查看",
                pane:this.vlayout2,
                ID:"Tab2",
                click:
                function(){
                }
                }
            ],
            destroyPanes:false
            });
            this.window= isc.Window.create({
                ID:"processViewWindow",
                autoDraw:false,
                items:[
                   this.processTabSet 
                ],
                title:"流程明细查看",
                width:900,
                height:480,
                autoCenter:true,
                showShadow:false,
                isModal:true,
                showMinimizeButton:false
                });
            this.button=isc.IButton.create({
                ID:"viewButton",
                autoDraw:false,
                title:"查看",
                click:
                function(){
                    this.showProcessView(this.arg0, this.arg1);
                }
                });
    },
    showProcessView:function(processInsId,loginName){
        this.arg0 = processInsId;
        this.arg1 = loginName;
        this.pid = processInsId;
        this.fix();
        this.img.setSrc("/monitor/MonitorServerlet?pinsId="+this.arg0+"&name="+this.arg1);
        this.listGrid0.fetchData();
        this.listGrid1.fetchData();
        this.window.show();
    },
    setProcessInsId:function(porcessInsId){
        this.arg0 = porcessInsId;
    },
    setLoginName:function(loginName){
        this.arg1 = loginName;
    }
});

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics