|
|
@ -58,23 +58,36 @@ public class JsonIconSet extends AbstractIconSet { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void applyIcon(String key, Object value) { |
|
|
|
private void applyIcon(String key, Object value) { |
|
|
|
if (value instanceof String) { |
|
|
|
if (value instanceof String) { |
|
|
|
String path = (String) value; |
|
|
|
dealWithIconString(key, (String) value); |
|
|
|
if (IconManager.isSvgIcon(path)) { |
|
|
|
} else if (value instanceof Map) { |
|
|
|
|
|
|
|
dealWithIconMap(key, (Map<String, Object>) value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 处理字符串格式的icon配置 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private void dealWithIconString(String key, String value) { |
|
|
|
|
|
|
|
if (IconManager.isSvgIcon(value)) { |
|
|
|
// 默认字符串提供正常图和灰化图
|
|
|
|
// 默认字符串提供正常图和灰化图
|
|
|
|
addIcon(new SvgIconSource(key, |
|
|
|
addIcon(new SvgIconSource(key, |
|
|
|
base + path, |
|
|
|
base + value, |
|
|
|
IconManager.findDisablePath(base + path), |
|
|
|
IconManager.findDisablePath(base + value), |
|
|
|
null |
|
|
|
null |
|
|
|
)); |
|
|
|
)); |
|
|
|
} else if (IconManager.isImageIcon(path)) { |
|
|
|
} else if (IconManager.isImageIcon(value)) { |
|
|
|
addIcon(new ImageIconSource(key, base + path)); |
|
|
|
addIcon(new ImageIconSource(key, base + value)); |
|
|
|
} |
|
|
|
} |
|
|
|
// 其他无法识别格式不处理
|
|
|
|
// 其他无法识别格式不处理
|
|
|
|
} else if (value instanceof Map) { |
|
|
|
} |
|
|
|
Map<String, Object> iconObj = (Map<String, Object>) value; |
|
|
|
|
|
|
|
String normalPath = (String) iconObj.get(IconType.normal.name()); |
|
|
|
/** |
|
|
|
String disablePath = (String) iconObj.get(IconType.disable.name()); |
|
|
|
* 处理object形式的icon配置 |
|
|
|
String whitePath = (String) iconObj.get(IconType.white.name()); |
|
|
|
*/ |
|
|
|
|
|
|
|
private void dealWithIconMap(String key, Map<String, Object> value) { |
|
|
|
|
|
|
|
String normalPath = (String) value.get(IconType.normal.name()); |
|
|
|
|
|
|
|
String disablePath = (String) value.get(IconType.disable.name()); |
|
|
|
|
|
|
|
String whitePath = (String) value.get(IconType.white.name()); |
|
|
|
// 暂不支持混合格式,每个id的格式需要保持一致
|
|
|
|
// 暂不支持混合格式,每个id的格式需要保持一致
|
|
|
|
if (IconManager.isSvgIcon(normalPath)) { |
|
|
|
if (IconManager.isSvgIcon(normalPath)) { |
|
|
|
addIcon(new SvgIconSource(key, |
|
|
|
addIcon(new SvgIconSource(key, |
|
|
@ -90,7 +103,6 @@ public class JsonIconSet extends AbstractIconSet { |
|
|
|
)); |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|