package com.vci.client.framework.rightConfig.modelConfig;
|
|
import java.awt.Component;
|
|
import javax.swing.JTree;
|
import javax.swing.ToolTipManager;
|
import javax.swing.tree.DefaultTreeCellRenderer;
|
|
import com.vci.client.framework.rightConfig.functiontree.FunctionHelper;
|
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.ui.swing.VCISwingUtil;
|
import com.vci.client.ui.tree.VCIBaseTreeNode;
|
|
/**
|
* 构建权限模块树
|
*
|
* @author 刘迪 2011-05-31
|
*/
|
public class ModuleTreeCellRenderer extends DefaultTreeCellRenderer {
|
|
/**
|
*
|
*/
|
private static final long serialVersionUID = 8393197719527584042L;
|
|
|
public ModuleTreeCellRenderer() {
|
}
|
|
public Component getTreeCellRendererComponent(JTree tree, Object value,
|
boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
|
super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
|
|
try {
|
ToolTipManager.sharedInstance().registerComponent(tree);
|
VCIBaseTreeNode node = (VCIBaseTreeNode) value;
|
String icon = "";
|
|
if(node == null || (node != null && node.getObj() == null)) {
|
icon = "formsection.gif";
|
} else {
|
Object obj = node.getObj();
|
String sc = obj.getClass().getSimpleName();
|
|
if (obj instanceof String) {
|
if (obj.equals("root")) {
|
icon = "house.png";
|
} else if (obj.equals(("business"))) {
|
icon = "businessModule.png";
|
} else if (obj.equals(("system"))) {
|
icon = "sysModule.png";
|
} else if (obj.equals(("sysConfNode"))) {
|
icon = "options.png";
|
} else if (obj.equals(("sysConfClsfNode"))) {
|
icon = "folder_page.png";
|
} else if (obj.equals(("sysMonitorNode"))) {
|
icon = "sysmonitor.png";
|
} else if (obj.equals(("operateNode"))) {
|
icon = "codevalue.gif";
|
} else if (obj.equals(("sysOptionNode"))) {
|
icon = "options.png";
|
}
|
} else if(obj instanceof FunctionObject ){
|
FunctionObject func = (FunctionObject)obj;
|
// icon = func.getImage();
|
// if(icon.trim().length() == 0){
|
|
icon = "folder_brick.png";
|
switch (func.getFuncType()) {
|
case 0:
|
case 1:
|
icon = "folder_brick.png";
|
break;
|
case 2:
|
icon = "function.png";
|
break;
|
}
|
} else if(obj instanceof FuncOperationObject || node.getObj() instanceof OperateObject){
|
icon = "cmd.png";
|
} else if (sc.equals("BtmItem")){
|
icon = "object.png";
|
} else if (sc.equals("PLUILayout")){
|
icon = "application_form_add.png";
|
} else if (sc.equals("PLTabPage")){
|
icon = "folder_page.gif";
|
} else if (sc.equals("PLPageDefination")){
|
icon = "tables.gif";
|
} else if (sc.equals("PLTabButton")){
|
icon = "formsection.gif";
|
}else {
|
icon = "formsection.gif";
|
}
|
}
|
if(node != null && node.isRoot()){
|
icon = "house.png";
|
}
|
setIcon(VCISwingUtil.createImageIcon(icon));
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return this;
|
}
|
}
|