wangting
2024-09-27 a3e87f78ee262ca9bb7d9b0c997639d5f3295890
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package com.vci.client.uif.engine.client.custm;
 
import java.awt.BorderLayout;
import java.awt.Component;
import java.text.SimpleDateFormat;
 
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.Border;
 
import com.vci.client.ClientSession;
import com.vci.client.uif.engine.client.AbstractRegionPanel;
import com.vci.client.uif.engine.common.IDataNode;
import com.vci.corba.common.VCIError;
 
/**
 *  在页面加载时进行了如下的设置
 *      cTabPanel.preInit(type, context); 设置了当前页面主对象的业务类型和上下文
        cTabPanel.setDefination(cDefination); 设置了当前界面的界面定义
        cTabPanel.setTabId(cPage.plOId); 设置了当前页面的唯一oid
        // 设置源数据对象
        cTabPanel.setSourceData(dataNode); 设置了当前界面的源数据,类型为IDataNode
        
        cTabPanel.setFromDataMap(dataMap); 设置了当前界面的源数据,类型为hashmap
        cTabPanel.setBaseLayoutPanel(this); 设置主框架的panel
        
   所有自定义的panel,基于如上参数进行初始化
 * @author VCI_STGK_Lincq
 *
 */
public class CustomPanel extends AbstractRegionPanel{
    
    private static final long serialVersionUID = 1L;
    public CustomModel customMode = null;
 
 
    public CustomPanel() {
        customMode = new CustomModel(this);
        this.setDataModel(customMode);
    }
 
    @Override
    public Component init() {
        // TODO Auto-generated method stub
        
        //initToolbar();
        this.setLayout(new BorderLayout(0, 0));
        CustomButtonPanel buttonPanel = new CustomButtonPanel(null, getType(), getContext(), 
                getDefination(), this);
        buttonPanel.init();
        add(buttonPanel, BorderLayout.NORTH);
        add(getContentPanel(), BorderLayout.CENTER);
        this.setDataModel(customMode);
        setBuilt(true);
        setComponentPanel(this);
        return this;
    }
    
    /**
     * @Title        :获取系统当前日期(服务器端)
     * @Description    :
     * @return
     */
    private String getCurrentDateTime(){
        //return "TODO:getCurrentDateTime()";
        String format = "yyyy-MM-dd HH:mm:ss";
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        String dateString = "";
        try {
            dateString = sdf.format(ClientSession.getFrameworkService().getSystemTime());
        } catch (VCIError e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return dateString;
    }
    
    private JLabel testLabel = null;
    
    private JPanel getContentPanel(){
        JPanel panel = new JPanel();
        testLabel = new JLabel("Hell World:" + getCurrentDateTime()) ;
        panel.add(testLabel);
        return panel;
    }
 
    public void mouseClickAction() {
        Object[] selectObject = null;
        Object clickObject = null;
        this.customMode.setRegionPanel(this);
        this.customMode.setSelectObjects(selectObject);
        this.customMode.setClickObject(clickObject);
        
        //TODO 具体点击事件的实现
        //重绘右侧
        IDataNode clickDataNode = (IDataNode)clickObject;
        this.getBaseLayoutPanel().reinitRightPanel(clickDataNode);
        //或者 刷新影响对象
        this.getDataModel().getUILayoutModel().notify(this.getDataModel());
    }
    
    //刷新当前界面
    public void repaint(Object obj){
        testLabel.setText("Hell World:" + getCurrentDateTime());
    }
    
    /**
     * 刷新界面
     */
    public void refreshUI(){
        testLabel.setText("Hell World:" + getCurrentDateTime());
    }
}