package com.vci.client.framework.systemConfig;
|
|
import java.awt.BorderLayout;
|
|
import javax.swing.JPanel;
|
import javax.swing.JScrollPane;
|
import javax.swing.JSplitPane;
|
import javax.swing.event.TreeExpansionEvent;
|
import javax.swing.event.TreeExpansionListener;
|
import javax.swing.event.TreeSelectionEvent;
|
import javax.swing.event.TreeSelectionListener;
|
import javax.swing.tree.TreeNode;
|
import javax.swing.tree.TreePath;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.common.TransmitTreeObject;
|
import com.vci.client.framework.delegate.PvolumeClientDelegate;
|
//import com.vci.client.framework.scaffold.TabbedMainPanelAdapter;
|
import com.vci.client.framework.systemConfig.object.AttributeObject;
|
import com.vci.client.framework.systemConfig.object.SpecialCharClsfObject;
|
import com.vci.client.framework.systemConfig.volumn.object.PvolumeObject;
|
import com.vci.client.ui.exception.VCIException;
|
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.VCIBaseTree;
|
import com.vci.client.ui.tree.VCIBaseTreeModel;
|
import com.vci.client.ui.tree.VCIBaseTreeNode;
|
|
public class SysConfigPanel extends VCIJPanel { // TabbedMainPanelAdapter {
|
|
/**************************** 国际化信息 **********************************/
|
// 系统配置管理
|
private String SYSCONFIGMODULE = LocaleDisplay.getI18nString("rmip.framework.systemConfigModule", "RMIPFramework",
|
getLocale());
|
// 特殊字符
|
private String SPECIALCHAR = LocaleDisplay.getI18nString("rmip.framework.sysconfig.specialChar", "RMIPFramework",
|
getLocale());
|
// 属性管理
|
private String ATTRMANAGEMENT = LocaleDisplay.getI18nString("rmip.framework.sysconfig.attrManagement",
|
"RMIPFramework", getLocale());
|
// 可用字符集
|
private String CHARACTERSET = LocaleDisplay.getI18nString("rmip.code.sysconfig.characterSet", "RMIPCode",
|
getLocale());
|
// 不可用字符集
|
private String NOCHARACTERSET = LocaleDisplay.getI18nString("rmip.code.sysconfig.nocharacterSet", "RMIPCode",
|
getLocale());
|
// 补位字符
|
private String COVERCHARACTER = LocaleDisplay.getI18nString("rmip.code.sysconfig.coverCharacter", "RMIPCode",
|
getLocale());
|
// 分隔符
|
private String SEPCHARACTER = LocaleDisplay.getI18nString("rmip.code.sysconfig.sepCharacter", "RMIPCode",
|
getLocale());
|
// 单位
|
private String UNIT = LocaleDisplay.getI18nString("rmip.framework.sysconfig.unit", "RMIPFramework", getLocale());
|
// 日期格式
|
private String DATEFORMAT = LocaleDisplay.getI18nString("rmip.code.sysconfig.dateformat", "RMIPCode", getLocale());
|
// 卷管理
|
private String VOLUMN = LocaleDisplay.getI18nString("rmip.code.sysconfig.volumn", "RMIPRm", getLocale());
|
|
private static final long serialVersionUID = -527263842809747743L;
|
private VCIBaseTreeModel treeModel = null;
|
private VCIBaseTree sysConfigTree = null;
|
JSplitPane jspConfigPanel; // 把Panel分成左右两部分
|
JScrollPane jTabbedPaneDetail;// jTabbedPaneDetail右边显示的JScrollPane
|
private JScrollPane leftPanel = new JScrollPane();
|
private TransmitTreeObject transmitTreeObject = new TransmitTreeObject();
|
JPanel rightPanel = null;
|
|
public SysConfigPanel() {
|
init();
|
}
|
|
public void init() {
|
jTabbedPaneDetail = new JScrollPane();
|
jspConfigPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, jTabbedPaneDetail);
|
jspConfigPanel.setDividerSize(10);
|
jspConfigPanel.setContinuousLayout(true);
|
jspConfigPanel.setOneTouchExpandable(true);
|
jspConfigPanel.setDividerLocation(200);
|
this.setLayout(new BorderLayout());
|
this.add(jspConfigPanel, BorderLayout.CENTER);
|
initLeftPanel();
|
}
|
|
/***
|
* 初始化数
|
*
|
*/
|
private void initLeftPanel() {
|
VCIBaseTreeNode rootNode = new VCIBaseTreeNode(SYSCONFIGMODULE, "root");
|
treeModel = new VCIBaseTreeModel(rootNode);
|
initTree(rootNode, "root");
|
sysConfigTree = new VCIBaseTree(treeModel, new SysConfigTreeCellRenderer());
|
sysConfigTree.addTreeSelectionListener(new TreeSelectionListener() {
|
public void valueChanged(TreeSelectionEvent e) {
|
// sysConfigTree_valueChanged(e);
|
}
|
});
|
sysConfigTree.addTreeExpansionListener(new TreeExpansionListener() {
|
public void treeCollapsed(TreeExpansionEvent tse) {
|
|
}
|
|
public void treeExpanded(TreeExpansionEvent tse) {
|
TreePath path = tse.getPath();
|
VCIBaseTreeNode treeNode = (VCIBaseTreeNode) path.getLastPathComponent();
|
TreeNode[] treeNodes = treeNode.getPath();
|
if (!treeNode.isExpand()) {
|
if (treeNode.getObj() instanceof SpecialCharClsfObject) {
|
if (treeNodes.length < 2) {
|
return;
|
}
|
initSpecialCharacter(treeNode, ((SpecialCharClsfObject) treeNode.getObj()).getId());
|
}
|
|
if (treeNode.getObj() instanceof PvolumeObject) {
|
if (treeNodes.length < 1) {
|
return;
|
}
|
PvolumeObject obj = (PvolumeObject) treeNode.getObj();
|
if ("root".equals(obj.getId())) {
|
initPvolume(treeNode, ((PvolumeObject) treeNode.getObj()).getId());
|
}
|
|
}
|
|
treeNode.setExpand(true);
|
}
|
}
|
});
|
transmitTreeObject.setTreeModel(treeModel);
|
transmitTreeObject.setTree(sysConfigTree);
|
leftPanel.getViewport().add(sysConfigTree);
|
}
|
|
/**
|
*
|
*
|
* @param rootNode
|
* @param puid
|
*/
|
|
private void initTree(VCIBaseTreeNode rootNode, String puid) {
|
// 用于检查权限
|
// boolean res = true;
|
//
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".separator");
|
// //分隔符
|
// if(res){
|
VCIBaseTreeNode sepCharacter = new VCIBaseTreeNode(SEPCHARACTER, "separator");
|
rootNode.add(sepCharacter);
|
// }
|
//
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".charset");
|
// //可用字符集
|
// if(res){
|
VCIBaseTreeNode characterSet = new VCIBaseTreeNode(CHARACTERSET, "charset");
|
rootNode.add(characterSet);
|
// }
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".nocharset");
|
// //不可用字符集
|
// if(res){
|
VCIBaseTreeNode nocharacterSet = new VCIBaseTreeNode(NOCHARACTERSET, "nocharset");
|
rootNode.add(nocharacterSet);
|
// }
|
//
|
// VCIBaseTreeNode folwWay = new VCIBaseTreeNode("流水方式","flowType");
|
// rootNode.add(folwWay);
|
//
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".dateFormat");
|
// //日期格式
|
// if(res){
|
VCIBaseTreeNode dateForm = new VCIBaseTreeNode(DATEFORMAT, "dateFormat");
|
rootNode.add(dateForm);
|
// }
|
//
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".unit");
|
// //单元
|
// if(res){
|
VCIBaseTreeNode unit = new VCIBaseTreeNode(UNIT, "unit");
|
rootNode.add(unit);
|
// }
|
////
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".fillerChar");
|
// //补位字符
|
// if(res){
|
VCIBaseTreeNode coverCharacter = new VCIBaseTreeNode(COVERCHARACTER, "fillerChar");
|
rootNode.add(coverCharacter);
|
// }
|
//
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".specialChar");
|
// //特殊字符
|
// if(res){
|
SpecialCharClsfObject specialCharClsfInfo = new SpecialCharClsfObject();
|
specialCharClsfInfo.setId("root");
|
VCIBaseTreeNode specialCharacter = new VCIBaseTreeNode(SPECIALCHAR, specialCharClsfInfo);
|
rootNode.add(specialCharacter);
|
// }
|
//
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".attribute");
|
// //属性管理
|
// if(res){
|
AttributeObject attributeObject = new AttributeObject();
|
VCIBaseTreeNode attribute = new VCIBaseTreeNode(ATTRMANAGEMENT, attributeObject);
|
rootNode.add(attribute);
|
// }
|
//
|
// res = RightControlUtil.getTreeNodeInfoByRole(getClass().getName()+".pvolume");
|
// //卷服务
|
// if(res){
|
PvolumeObject pvolume = new PvolumeObject();
|
pvolume.setId("root");
|
VCIBaseTreeNode pvolumeNode = new VCIBaseTreeNode(VOLUMN, pvolume);
|
rootNode.add(pvolumeNode);
|
}
|
|
private boolean initSpecialCharacter(VCIBaseTreeNode specialCharacter, String parentId) {
|
boolean rs = true;
|
// try {
|
// SpecialCharClsfObject[] specialCharClsfObject = new SystemCfgClientDelegate(LogonApplication.frame.getUserEntityObject()).fetchSpecialCharClsf(parentId);
|
//
|
// int len = specialCharClsfObject.length;
|
// for (int i = 0; i < len; i++) {
|
// VCIBaseTreeNode node = new VCIBaseTreeNode(specialCharClsfObject[i].getName(),specialCharClsfObject[i]);
|
// treeModel.insertNodeInto(node, specialCharacter, specialCharacter.getChildCount());
|
// }
|
//
|
// } catch (VCIError re) {
|
// VCIOptionPane.showError(LogonApplication.frame, LocaleDisplay.getI18nString(String.valueOf(re.code), "RMIPFramework", getLocale()));
|
// rs = false;
|
// }
|
return rs;
|
}
|
|
private boolean initPvolume(VCIBaseTreeNode pvolumnObj, String parentId) {
|
boolean rs = true;
|
try {
|
PvolumeObject[] pvolumnObject = new PvolumeClientDelegate(LogonApplication.getUserEntityObject())
|
.getAllPvolumes();
|
|
int len = pvolumnObject.length;
|
for (int i = 0; i < len; i++) {
|
VCIBaseTreeNode node = new VCIBaseTreeNode(pvolumnObject[i].getName(), pvolumnObject[i]);
|
treeModel.insertNodeInto(node, pvolumnObj, pvolumnObj.getChildCount());
|
}
|
|
} catch (VCIException re) {
|
VCIOptionPane.showError(LogonApplication.frame, "RMIPFramework", re);
|
rs = false;
|
}
|
return rs;
|
}
|
|
/**
|
* 返回当前选中的树节点
|
*
|
* @return
|
*/
|
public VCIBaseTreeNode getCurremtSelectedTreeNode() {
|
return (VCIBaseTreeNode) this.sysConfigTree.getLastSelectedPathComponent();
|
}
|
|
public TransmitTreeObject getTransmitTreeObject() {
|
return transmitTreeObject;
|
}
|
}
|