package com.vci.common.portal.enums; /** * 组件类型 * @author xiongchao * */ public enum ComponentType { Table("Table", "表格", 1), Custom("Custom", "自定义", 2), TreeTable("TreeTable", "树表", 3), Form("Form", "表单", 4), Tree("Tree", "树", 5), UILayout("UILayout", "UI布局", 6); private String name = ""; private String label = ""; private int intVal = 1; private ComponentType(String name, String label, int intVal){ this.name = name; this.label = label; this.intVal = intVal; } public static ComponentType getByName(String name){ ComponentType res = getByType(GetByType.Name, name); return res; } public static ComponentType getByLabel(String label){ ComponentType res = getByType(GetByType.Label, label); return res; } public static ComponentType getByVal(int val){ ComponentType res = getByType(GetByType.IntVal, String.valueOf(val)); return res; } public static ComponentType getByType(GetByType type, String val){ ComponentType[] alls = getAll(); ComponentType res = null; for(ComponentType obj : alls){ if(type == GetByType.Name && obj.getName().equalsIgnoreCase(val)){ res = obj; break; } else if(type == GetByType.Label && obj.getLabel().equalsIgnoreCase(val)){ res = obj; break; } else if(type == GetByType.IntVal && String.valueOf(obj.getIntVal()).equalsIgnoreCase(val)){ res = obj; break; } } return res; } public static ComponentType[] getAll(){ return ComponentType.values(); } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public int getIntVal() { return intVal; } public void setIntVal(int intVal) { this.intVal = intVal; } }