ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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;
    }
        
}