dangsn
2024-12-26 4e9ff2ce6a830bb2340d7c8612c72eea0c5a553e
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
package com.vci.client.framework.rightConfig.functiontree;
 
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.util.Locale;
 
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
 
import com.vci.client.LogonApplication;
import com.vci.client.common.TransmitTreeObject;
import com.vci.client.framework.delegate.OperateClientDelegate;
import com.vci.client.framework.rightConfig.object.FunctionObject;
import com.vci.client.framework.rightConfig.object.OperateObject;
import com.vci.client.logon.base.BaseJDialog;
import com.vci.client.ui.exception.VCIException;
import com.vci.client.ui.image.BundleImage;
import com.vci.client.ui.locale.LocaleDisplay;
import com.vci.client.ui.swing.VCIOptionPane;
import com.vci.client.ui.swing.components.VCIJPanel;
import com.vci.client.ui.tree.VCIBaseTreeModel;
import com.vci.client.ui.tree.VCIBaseTreeNode;
 
 
/**
* <p>Title:</p>
* <p>Description: 添加操作类型对话框</p>
* <p>Copyright: Copyright {c} 2011</p>
* <p>Company: VCI</p>
* @author ligang
* @time 2011-6-2
* @version 1.0
*/
public class OperationTypeTreeDialog extends BaseJDialog {
    
    private static final long serialVersionUID = -8198874185365333595L;
    
    TransmitTreeObject transmitTreeObject = new TransmitTreeObject();
    
    private JButton okButton = new JButton();
    private JButton cancelButton = new JButton();
    private JScrollPane jsp = new JScrollPane();
    private JLabel titleLabel = new JLabel(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.dialog.title", "RMIPFramework", getLocale()));
    
    private CommonTree modelDataTree = null;
    /**
     * 构造方法
     */
    public OperationTypeTreeDialog(TransmitTreeObject transmitTreeObject) {
        super(LogonApplication.frame,true);
        this.transmitTreeObject = transmitTreeObject;
        this.setModal(true);
        init();
    }
    
    /**
     * <p>Description: 初始化操作类型树</p>
     *
     *@author ligang
     *@time 2011-6-2
     *@return void
     */
    public void init() {
        setTitle(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.dialog.type", "RMIPFramework", getLocale()));
        this.setSize(new Dimension(225,600));
        Dimension screenSize = Toolkit.getDefaultToolkit ().getScreenSize ();
        this.setLocation ( (screenSize.width - 190) / 2, (screenSize.height - 525) / 2);
        titleLabel.setBounds(new Rectangle(10,7,120,15));
        
        VCIBaseTreeNode rootNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.dialog.type", "RMIPFramework", getLocale()),"root");
        VCIBaseTreeModel treeModel = new VCIBaseTreeModel(rootNode);
        initTree(rootNode,transmitTreeObject.getCurrentTreeNode());
        modelDataTree = new CommonTree(treeModel, new ModelManageTreeCellRenderer());
        
        jsp.getViewport().add(modelDataTree);
        jsp.setBounds(new Rectangle(10, 25, 200, 210));
        
        okButton.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.dialog.okButton", "RMIPFramework", getLocale()));
        okButton.setIcon(new BundleImage().createImageIcon("ok.gif"));
        okButton.setBounds(new Rectangle(16,240,90,25));
        
        cancelButton.setText(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.dialog.cancelButton", "RMIPFramework", getLocale()));
        cancelButton.setIcon(new BundleImage().createImageIcon("cancel.gif"));
        cancelButton.setBounds(new Rectangle(116,240,90,25));
        //按钮动作事件
        initAction();
        
        setLayout(new BorderLayout());
        add(jsp, BorderLayout.CENTER);
        VCIJPanel palBtn = new VCIJPanel();
        palBtn.add(okButton);
        palBtn.add(cancelButton);
        add(palBtn, BorderLayout.SOUTH);
        
    }
    
    /**
     * <p>Description: 按钮动作事件处理</p>
     *
     *@author ligang
     *@time 2011-6-2
     *@return void
     */
    private void initAction() {
        //确认动作事件
        okButton.addActionListener(new OperationTypeActionListener(this,"ok",transmitTreeObject));
        //取消动作事件
        cancelButton.addActionListener(new OperationTypeActionListener(this, "cancel",transmitTreeObject));
        
    }
    
    /**
     * <p>Description: 初始化操作类型树</p>
     *
     *@author xf
     *@time 2012-5-16
     *@return void
     * @param rootNode
     * @param puid
     */
    private void initTree(VCIBaseTreeNode rootNode, VCIBaseTreeNode currentTreeNode) {
        FunctionObject object = (FunctionObject)currentTreeNode.getObj();
        String id = object.getId();
        try {
            OperateObject[] operateObjs = new OperateClientDelegate(LogonApplication.getUserEntityObject()).getOperateTreeList(id);
            for(OperateObject obj : operateObjs){
                VCIBaseTreeNode node = new VCIBaseTreeNode(obj.getName(), obj);
                rootNode.add(node);
                node.setLeaf(true);
            }
        } catch (VCIException e) {
            e.printStackTrace();
            VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", Locale.getDefault()));
        }
    }
    
    public CommonTree getTree() {
        return this.modelDataTree;
    }
 
}