田源
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
package com.vci.client.portal.UI.v3;
 
import java.awt.BorderLayout;
 
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
 
import com.vci.client.common.VCIBasePanel;
import com.vci.client.framework.rightConfig.object.FunctionObject;
import com.vci.client.ui.swing.components.VCIJPanel;
import com.vci.client.ui.swing.components.VCIJSplitPane;
import com.vci.client.ui.tree.VCIBaseTreeNode;
import com.vci.corba.omd.btm.BtmItem;
 
public class UIFManager extends VCIBasePanel {
 
    /**
     * 
     */
    private static final long serialVersionUID = -1523364425874164381L;
    public UIFManager(FunctionObject funcObj) {
        super(funcObj);
        init();
    }
 
    private void init(){
        initUI();
    }
    
    private VCIJSplitPane jspLeftToRight = null;
    private BtmLinkTypeTreePanel btmLinkTypeTreePanel = null;
    private UIContextDataPanel uIContextDataPanel = null;
    private void initUI(){
        setLayout(new BorderLayout());
        
        jspLeftToRight = new VCIJSplitPane(VCIJSplitPane.HORIZONTAL_SPLIT);
        jspLeftToRight.setDividerSize(6);
        jspLeftToRight.setContinuousLayout(true);
        jspLeftToRight.setOneTouchExpandable(true);
        jspLeftToRight.setDividerLocation(250);
        
        // 1、实例化
        btmLinkTypeTreePanel = new BtmLinkTypeTreePanel();
        
        // 1.1 设置参数(可选)
        // 显示 业务类型 链接类型 RadioButton,此时可以切换显示业务类型或链接类型的数据
        // 如果不设置此参数,则按只显示业务类型,此时没有 RadioButton
//        btmLinkTypeTreePanel.setShowBtmLinkTypeRadioButton(true);
        // 只显示链接类型数据,此时也没有RadioButton
//        btmLinkTypeTreePanel.setOnlyLinkType(true);
        
        // 2、构建UI
        btmLinkTypeTreePanel.buildUI();
        
        // 3、添加树节点选择后的事件处理
        btmLinkTypeTreePanel.addTreeSelectionListener(new TreeSelectionListener() {
            @Override
            public void valueChanged(TreeSelectionEvent e) {
                btmLinkTypeTree_valueChange(e);
            }
        });
        jspLeftToRight.add(btmLinkTypeTreePanel, VCIJSplitPane.LEFT);
        jspLeftToRight.setRightComponent(new VCIJPanel());
        add(jspLeftToRight, BorderLayout.CENTER);
    }
    
    private void btmLinkTypeTree_valueChange(TreeSelectionEvent e){
        if(e.getNewLeadSelectionPath() == null) {
            return;
        }
        VCIBaseTreeNode treeNode = (VCIBaseTreeNode) e.getNewLeadSelectionPath().getLastPathComponent();;
        Object obj = treeNode.getObj();
        if(!(obj instanceof BtmItem)){
            return;
        }
        BtmItem btmItem = (BtmItem)obj;
        
        if(uIContextDataPanel == null){
            uIContextDataPanel = new UIContextDataPanel();
            uIContextDataPanel.setOwnedModulePanel(this);
            uIContextDataPanel.setBtmItem(btmItem);
            uIContextDataPanel.buildUI();
        } else {
            uIContextDataPanel.setBtmItem(btmItem);
            uIContextDataPanel.refreshUI();
        }
        jspLeftToRight.setRightComponent(uIContextDataPanel);
        
        int location = jspLeftToRight.getDividerLocation();
        jspLeftToRight.setDividerLocation(location);    
    }
    
}