田源
2024-03-07 4b4083fd73dc27ece42f4835483565eef0e4f608
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
package com.vci.client.portal.UI.v3;
 
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
 
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
 
import com.vci.client.ui.swing.components.VCIJPanel;
import com.vci.client.ui.swing.components.VCIJSplitPane;
import com.vci.corba.omd.btm.BtmItem;
import com.vci.corba.portal.data.PLUILayout;
import com.vci.corba.portal.data.PLTabPage;
 
/**
 * 上下文里的一个区域里的页签及组件
 * 
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2016</p>
 * <p>Company: VCI</p>
 * @author xiongchao
 * @time 2017-2-15
 * @version 1.0
 */
public class RegionDataPanel extends VCIJPanel {
 
    /**
     * 
     */
    private static final long serialVersionUID = 8416846864932132684L;
 
    private VCIJSplitPane jspUpDwon = null;
    private BtmItem btmItem = null;
    private PLUILayout pageLayoutDefination = null;
    private short areaType = -1;
    public RegionDataPanel(){
        
    }
    public void refreshUI(){
        clearUI();
        
        tabPagePanel.setBtmItem(getBtmItem());
        tabPagePanel.setPageLayoutDefination(getPageLayoutDefination());
        tabPagePanel.setAreaType(getAreaType());
        
        tabPagePanel.refreshUI();
    }
    public void clearUI(){
        if(tabPagePanel != null){
            tabPagePanel.getTablePanel().getTableModel().clear();
            tabPagePanel.getTablePanel().getTableModel().fireTableDataChanged();
        }
        if(tabPageComptPanel != null){
            tabPageComptPanel.setPageLayoutDefination(null);
            tabPageComptPanel.setTabPage(null);
            tabPageComptPanel.getTablePanel().getTableModel().clear();
            tabPageComptPanel.getTablePanel().getTableModel().fireTableDataChanged();
        }
    }
    public void buildUI(){
        init();
    }
    
    private TabPagePanel tabPagePanel = null;
    private TabPageComptPanel tabPageComptPanel = null;
    private void init(){
        setLayout(new BorderLayout());
        
        jspUpDwon = new VCIJSplitPane(VCIJSplitPane.VERTICAL_SPLIT);
        jspUpDwon.setDividerSize(6);
        jspUpDwon.setContinuousLayout(true);
        jspUpDwon.setOneTouchExpandable(true);
        jspUpDwon.setDividerLocation(500);
        
        tabPagePanel = new TabPagePanel();
        tabPagePanel.setBtmItem(getBtmItem());
        tabPagePanel.setPageLayoutDefination(getPageLayoutDefination());
        tabPagePanel.setAreaType(getAreaType());
        tabPagePanel.buildUI();
 
        tabPagePanel.getTablePanel().getTable().getSelectionModel().addListSelectionListener(new ListSelectionListener() {
            @Override
            public void valueChanged(ListSelectionEvent e) {
                tabPage_valueChange();
            }
        });
        
        tabPagePanel.addRefreshUIActionListener(new TabPageRefreshActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                tabPageComptPanel.clearUI();
                tabPageComptPanel.setTabPage(null);
                tabPageComptPanel.refreshUI();
            }
        });
        
        tabPageComptPanel = new TabPageComptPanel();
        tabPageComptPanel.setBtmItem(getBtmItem());
        tabPageComptPanel.setPageLayoutDefination(getPageLayoutDefination());
        tabPageComptPanel.setTabPage(null);
        tabPageComptPanel.setAreaType(getAreaType());
        tabPageComptPanel.buildUI();
        
        jspUpDwon.setLeftComponent(tabPagePanel);
        jspUpDwon.setRightComponent(tabPageComptPanel);
        
        add(jspUpDwon, BorderLayout.CENTER);
    }
 
    private void tabPage_valueChange(){
        int row = tabPagePanel.getTablePanel().getTable().getSelectedRow();
        if(row < 0) return;
        
        PLTabPage tabPage = tabPagePanel.getTablePanel().getSpecialObjectByRowIndex(row);
        tabPageComptPanel.setBtmItem(getBtmItem());
        tabPageComptPanel.setPageLayoutDefination(getPageLayoutDefination());
        tabPageComptPanel.setTabPage(tabPage);
        tabPageComptPanel.setAreaType(getAreaType());
        tabPageComptPanel.refreshUI();
    }
    
    public BtmItem getBtmItem() {
        return btmItem;
    }
    public void setBtmItem(BtmItem btmItem) {
        this.btmItem = btmItem;
        if(tabPagePanel != null){
            tabPagePanel.setBtmItem(btmItem);
        }
        if(tabPageComptPanel != null){
            tabPageComptPanel.setBtmItem(btmItem);
        }
    }
    public PLUILayout getPageLayoutDefination() {
        return pageLayoutDefination;
    }
    public void setPageLayoutDefination(PLUILayout pageLayoutDefination) {
        this.pageLayoutDefination = pageLayoutDefination;
        if(tabPagePanel != null){
            tabPagePanel.setPageLayoutDefination(pageLayoutDefination);
        }
        if(tabPageComptPanel != null){
            tabPageComptPanel.setPageLayoutDefination(getPageLayoutDefination());
        }
    }
    public short getAreaType() {
        return areaType;
    }
    public void setAreaType(short areaType) {
        this.areaType = areaType;
    }
}