package com.vci.web.enumpck;
|
|
import com.vci.starter.web.enumpck.BaseEnum;
|
|
/**
|
* UI树的加载方式
|
* @author weidy
|
* @date 2021-2-15
|
*/
|
public enum UITreeLoadTypeEnum implements BaseEnum {
|
/**
|
* 全部展开
|
*/
|
ALL("all","全部展开"),
|
|
/**
|
* 逐级展开
|
*/
|
NODE("node","逐级展开");
|
|
/**
|
* 值
|
*/
|
private String value;
|
|
/**
|
* 显示文本
|
*/
|
private String text;
|
|
@Override
|
public String getValue() {
|
return value;
|
}
|
|
@Override
|
public String getText() {
|
return text;
|
}
|
|
public void setValue(String value) {
|
this.value = value;
|
}
|
|
public void setText(String text) {
|
this.text = text;
|
}
|
|
private UITreeLoadTypeEnum(String value, String text){
|
this.value = value;
|
this.text = text;
|
}
|
|
/**
|
* 根据名称获取对应的枚举值
|
* @param text 名称
|
* @return 枚举值
|
*/
|
public static String getValueByText(String text){
|
for(UITreeLoadTypeEnum wenum : UITreeLoadTypeEnum.values()){
|
if(wenum.getText().equalsIgnoreCase(text)){
|
return wenum.getValue();
|
}
|
}
|
return "";
|
}
|
|
/**
|
* 根据枚举值获取名称
|
* @param value 枚举值
|
* @return 名称
|
*/
|
public static String getTextByValue(String value){
|
for(UITreeLoadTypeEnum wenum : UITreeLoadTypeEnum.values()){
|
if(wenum.getValue().equalsIgnoreCase(value)){
|
return wenum.getText();
|
}
|
}
|
return "";
|
}
|
|
/**
|
* 值转换为枚举对象
|
* @param value 值
|
* @return 如果不符合要求返回Null
|
*/
|
public static UITreeLoadTypeEnum forValue(String value){
|
for(UITreeLoadTypeEnum wenum : UITreeLoadTypeEnum.values()){
|
if(wenum.getValue().equalsIgnoreCase(value)){
|
return wenum;
|
}
|
}
|
return UITreeLoadTypeEnum.NODE;
|
}
|
}
|