package com.vci.client.framework.rightConfig.modelConfig;
|
|
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.TreePath;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.common.TransmitTreeObject;
|
import com.vci.client.framework.appConfig.AppConfigCategoryPanel;
|
import com.vci.client.framework.appConfig.AppConfigDetailPanel;
|
import com.vci.client.framework.appConfig.AppConfigModulePanel;
|
import com.vci.client.framework.delegate.FuncOperationClientDelegate;
|
import com.vci.client.framework.delegate.FunctionClientDelegate;
|
import com.vci.client.framework.delegate.OperateClientDelegate;
|
import com.vci.client.framework.rightConfig.functiontree.FuncOperatePanel;
|
import com.vci.client.framework.rightConfig.functiontree.ModelManagementPanel;
|
import com.vci.client.framework.rightConfig.object.FuncOperationObject;
|
import com.vci.client.framework.rightConfig.object.FunctionObject;
|
import com.vci.client.framework.rightConfig.object.OperateObject;
|
import com.vci.client.framework.rightConfig.operate.OperateMangePanel;
|
import com.vci.client.framework.scaffold.AbstractTabbedMainPanel;
|
import com.vci.client.framework.scaffold.GenericMenuBar;
|
import com.vci.client.framework.specialrole.SpecialRoleClientObject;
|
import com.vci.client.framework.specialrole.ModuleInterface.IModuleShow;
|
import com.vci.client.framework.systemConfig.SystemMonitorPanel;
|
import com.vci.client.logon.base.BaseMenuBar;
|
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.tree.VCIBaseTree;
|
import com.vci.client.ui.tree.VCIBaseTreeModel;
|
import com.vci.client.ui.tree.VCIBaseTreeNode;
|
|
/**
|
*权限模块管理
|
*
|
*/
|
public class ModuleConfigMainPanel extends AbstractTabbedMainPanel implements IModuleShow{
|
|
private static final long serialVersionUID = 1L;
|
private JSplitPane jspoperateTypeMainPanel; // 把Panel分成左右两部分
|
private JScrollPane jTabbedPaneDetail;// jTabbedPaneDetail右边显示的JScrollPane
|
private JScrollPane leftPanel = new JScrollPane();
|
private TransmitTreeObject transmitTreeObject = new TransmitTreeObject();// 存储树信息
|
private VCIBaseTree tree;
|
private VCIBaseTreeModel treeModel;
|
private VCIBaseTreeNode modelConstructionTree;
|
private VCIBaseTreeNode systemConstructionTree;
|
private VCIBaseTreeNode operateTypeNode;
|
|
private String logonUserId = "",logonRoleId;
|
private String moduleName = "";
|
private String iconName,moduleShowInfo ;
|
private VCIBaseTreeNode sysConfNode;//系统配置项节点
|
private VCIBaseTreeNode sysConfClsfNode;//系统配置项分类节点
|
private VCIBaseTreeNode sysMonitorNode;//系统运行情况节点
|
private VCIBaseTreeNode sysOptionNode;//系统配置
|
|
private SpecialRoleClientObject specialRoleObject = new SpecialRoleClientObject();
|
public SpecialRoleClientObject getSpecialRoleObject() {
|
return specialRoleObject;
|
}
|
|
public void setSpecialRoleObject(SpecialRoleClientObject specialRoleObject) {
|
this.specialRoleObject = specialRoleObject;
|
}
|
|
public ModuleConfigMainPanel() {
|
init();
|
}
|
|
public void init() {
|
jTabbedPaneDetail = new JScrollPane();
|
jspoperateTypeMainPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,leftPanel, jTabbedPaneDetail);
|
jspoperateTypeMainPanel.setDividerSize(6);
|
jspoperateTypeMainPanel.setContinuousLayout(true);
|
jspoperateTypeMainPanel.setOneTouchExpandable(true);
|
jspoperateTypeMainPanel.setDividerLocation(200);
|
this.setLayout(new BorderLayout());
|
this.add(jspoperateTypeMainPanel, BorderLayout.CENTER);
|
initLeftPanel();
|
}
|
|
|
public void setModuleShowInfo(String moduleShowInfo) {
|
this.moduleShowInfo = moduleShowInfo;
|
}
|
|
public void setIconName(String iconName) {
|
this.iconName = iconName;
|
}
|
|
public void setModuleName(String moduleName) {
|
this.moduleName = moduleName;
|
}
|
|
public String getLogonUserId() {
|
return logonUserId;
|
}
|
|
public void setLogonUserId(String logonUserId) {
|
this.logonUserId = logonUserId;
|
}
|
|
public String getLogonRoleId() {
|
return logonRoleId;
|
}
|
|
public void setLogonRoleId(String logonRoleId) {
|
this.logonRoleId = logonRoleId;
|
}
|
|
/***
|
* 初始化树
|
*
|
*/
|
private void initLeftPanel() {
|
final VCIBaseTreeNode rootNode = new VCIBaseTreeNode(
|
LocaleDisplay.getI18nString("rmip.framework.moudelConfig.file", "RMIPFramework", getLocale()), "root");
|
treeModel = new VCIBaseTreeModel(rootNode);
|
initTree(rootNode, "root");
|
tree = new VCIBaseTree(treeModel, new ModuleTreeCellRenderer());
|
tree.addTreeSelectionListener(new TreeSelectionListener() {
|
public void valueChanged(TreeSelectionEvent e) {
|
moduleConfigTree_valueChanged(e);
|
}
|
});
|
// 展开事件
|
tree.addTreeExpansionListener(new TreeExpansionListener() {
|
public void treeExpanded(TreeExpansionEvent event) {
|
TreePath path = event.getPath();
|
VCIBaseTreeNode selectNode = (VCIBaseTreeNode) path.getLastPathComponent();
|
Object object = selectNode.getObj();
|
FunctionClientDelegate funcDel = new FunctionClientDelegate(LogonApplication.getUserEntityObject());
|
if (!selectNode.isExpand()) {
|
selectNode.setExpand(true);
|
if (object instanceof FunctionObject || object.equals("business") || object.equals("system")) {
|
String parentId = "";
|
if(object instanceof FunctionObject){
|
parentId = ((FunctionObject) object).getId();
|
try {
|
/**判断该模块下子对象是模块还是操作,0表示无子节点,1表示是模块,2表示是操作**/
|
int childType = funcDel.checkChildObject(parentId);
|
if(childType == 2){
|
FuncOperationObject[] funcOperations = new FuncOperationClientDelegate().getFuncOperationByModuleId(parentId, "", false);
|
for(FuncOperationObject obj:funcOperations){
|
VCIBaseTreeNode node = new VCIBaseTreeNode(obj.getOperAlias(), obj);
|
selectNode.add(node);
|
node.setLeaf(true);
|
}
|
}else if(childType == 1){
|
FunctionObject[] funcObjs = funcDel.getModuleListByParentId(parentId, true);
|
for(FunctionObject obj :funcObjs){
|
VCIBaseTreeNode node = new VCIBaseTreeNode(obj.getName(), obj);
|
selectNode.add(node);
|
if(funcDel.checkChildObject(obj.getId()) == 0 ){
|
node.setLeaf(true);
|
}
|
}
|
}
|
} catch (VCIException e) {
|
e.printStackTrace();
|
VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", getLocale()));
|
}
|
} else {
|
parentId = object.toString();
|
try {
|
FunctionObject[] funcObjs = funcDel.getModuleListByParentId(parentId, true);
|
for(FunctionObject obj :funcObjs){
|
VCIBaseTreeNode node = new VCIBaseTreeNode(obj.getName(), obj);
|
selectNode.add(node);
|
if(funcDel.checkChildObject(obj.getId()) == 0){
|
node.setLeaf(true);
|
}
|
}
|
} catch (VCIException e) {
|
e.printStackTrace();
|
VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", getLocale()));
|
}
|
}
|
|
} else if (object.equals("operateNode")) {
|
//加载所有操作
|
try {
|
OperateObject[] operateObjs = new OperateClientDelegate(LogonApplication.getUserEntityObject()).getOperateTreeList("");
|
for(OperateObject obj :operateObjs){
|
VCIBaseTreeNode node = new VCIBaseTreeNode(obj.getName(), obj);
|
node.setLeaf(true);
|
selectNode.add(node);
|
}
|
} catch (VCIException e) {
|
e.printStackTrace();
|
VCIOptionPane.showError(LogonApplication.frame,LocaleDisplay.getI18nString(e, "RMIPFramework", getLocale()));
|
}
|
}
|
treeModel.reload(selectNode);
|
}
|
}
|
|
public void treeCollapsed(TreeExpansionEvent event) {
|
}
|
|
});
|
leftPanel.getViewport().add(tree);
|
}
|
|
private void initTree(VCIBaseTreeNode rootNode, String puid) {
|
// 管理功能定义
|
systemConstructionTree = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.systemFunctionModel",
|
"RMIPFramework", getLocale()), "system");
|
|
// 业务功能定义
|
modelConstructionTree = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.framework.systemFunctionTree.businessFunctionModel",
|
"RMIPFramework", getLocale()), "business");
|
|
// 操作定义
|
operateTypeNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.framework.operateType.operateTypeModel.file",
|
"RMIPFramework", getLocale()), "operateNode");
|
|
// 配置管理模块
|
sysConfNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.framework.sysConfNode.sysConfModel",
|
"RMIPFramework", getLocale()), "sysConfNode");
|
sysConfNode.setLeaf(true);
|
|
// 配置分类管理
|
sysConfClsfNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.framework.sysConfNode.sysConfClsfModel",
|
"RMIPFramework", getLocale()), "sysConfClsfNode");
|
sysConfClsfNode.setLeaf(true);
|
|
|
// 配置管理
|
sysOptionNode = new VCIBaseTreeNode("系统配置", "sysOptionNode");
|
sysOptionNode.setLeaf(true);
|
|
|
rootNode.add(systemConstructionTree);
|
rootNode.add(modelConstructionTree);
|
rootNode.add(operateTypeNode);
|
// rootNode.add(sysConfClsfNode);
|
// rootNode.add(sysConfNode);
|
rootNode.add(sysOptionNode);
|
|
sysMonitorNode = new VCIBaseTreeNode(LocaleDisplay.getI18nString("rmip.framework.sysConfNode.sysMonitor",
|
"RMIPFramework", getLocale()), "sysMonitorNode");
|
sysMonitorNode.setLeaf(true);
|
rootNode.add(sysMonitorNode);
|
}
|
|
|
private void moduleConfigTree_valueChanged(TreeSelectionEvent e) {
|
TreePath treePath = e.getPath();
|
VCIBaseTreeNode selectNode = (VCIBaseTreeNode) treePath
|
.getLastPathComponent();
|
transmitTreeObject.setCurrentTreeNode(selectNode);
|
transmitTreeObject.setTree(tree);
|
transmitTreeObject.setTreeModel(treeModel);
|
|
Object object = selectNode.getObj();
|
JPanel newPanel = new JPanel();
|
if (object instanceof OperateObject|| object.equals("operateNode")) {
|
newPanel = new OperateMangePanel(object,transmitTreeObject);
|
}
|
else if (object.equals("business") || object.equals("system") || object instanceof FunctionObject) {
|
newPanel = new ModelManagementPanel(object,transmitTreeObject, this);
|
}
|
else if (object instanceof FuncOperationObject){
|
newPanel = new FuncOperatePanel((FuncOperationObject)object,transmitTreeObject);
|
}
|
// else if (object.equals("sysConfClsfNode")) {
|
// newPanel = new AppConfigCategoryPanel(null);
|
// }
|
// else if (object.equals("sysConfNode")) {
|
// newPanel = new AppConfigDetailPanel();
|
// }
|
else if (object.equals("sysMonitorNode")) {
|
newPanel = new SystemMonitorPanel();
|
}
|
else if (object.equals("sysOptionNode")) {
|
newPanel = new AppConfigModulePanel();
|
}
|
else {
|
jspoperateTypeMainPanel.setRightComponent(newPanel);
|
}
|
|
jspoperateTypeMainPanel.setRightComponent(newPanel);
|
int location = jspoperateTypeMainPanel.getDividerLocation();
|
jspoperateTypeMainPanel.setDividerLocation(location);
|
}
|
|
|
BaseMenuBar specialMenuBar = null;
|
public BaseMenuBar getSpecialMenuBar(){
|
if(specialMenuBar == null){
|
specialMenuBar = new GenericMenuBar(LogonApplication.frame);
|
}
|
return specialMenuBar;
|
}
|
|
@Override
|
public String getUserID() {
|
return logonUserId;
|
}
|
|
@Override
|
public JPanel getModuleComponent() {
|
return this;
|
}
|
|
@Override
|
public String getModuleName() {
|
return moduleName;
|
}
|
|
@Override
|
public String getIconName() {
|
return iconName;
|
}
|
|
@Override
|
public String getModuleShowInfo() {
|
return moduleShowInfo;
|
}
|
|
@Override
|
public String getRoleID() {
|
return logonRoleId;
|
}
|
//导入数据后重新刷新树
|
public void reloadFunctionTreeNode() {
|
int count = modelConstructionTree.getChildCount();
|
for (int i = count - 1; i >= 0; i--) {
|
treeModel.removeNodeFromParent((VCIBaseTreeNode)modelConstructionTree.getChildAt(i));
|
}
|
modelConstructionTree.setExpand(false);
|
modelConstructionTree.setLeaf(false);
|
treeModel.nodeChanged(modelConstructionTree);
|
treeModel.reload(modelConstructionTree.getParent());
|
}
|
}
|