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;
|
}
|
|
}
|