|
|
@ -1,8 +1,10 @@ |
|
|
|
package com.fine.theme.icon.plugin; |
|
|
|
package com.fine.theme.icon.plugin; |
|
|
|
|
|
|
|
|
|
|
|
import com.fine.theme.icon.AbstractIconSet; |
|
|
|
import com.fine.theme.icon.AbstractIconSet; |
|
|
|
import com.fine.theme.icon.IconManager; |
|
|
|
|
|
|
|
import com.fine.theme.icon.IconType; |
|
|
|
import com.fine.theme.icon.IconType; |
|
|
|
|
|
|
|
import com.fine.theme.icon.UrlIconResource; |
|
|
|
|
|
|
|
import com.fine.theme.icon.img.ImageIconSource; |
|
|
|
|
|
|
|
import com.fine.theme.icon.svg.SvgIconSource; |
|
|
|
import com.formdev.flatlaf.json.Json; |
|
|
|
import com.formdev.flatlaf.json.Json; |
|
|
|
import com.formdev.flatlaf.json.ParseException; |
|
|
|
import com.formdev.flatlaf.json.ParseException; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
@ -27,7 +29,7 @@ public class PluginIconSet extends AbstractIconSet { |
|
|
|
private String base; |
|
|
|
private String base; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PluginIconSet(PluginUrlIconResource resource, Map<String, String> iconId2Path) { |
|
|
|
public PluginIconSet(UrlIconResource resource, Map<String, String> iconId2Path) { |
|
|
|
addIconWithMap(iconId2Path); |
|
|
|
addIconWithMap(iconId2Path); |
|
|
|
|
|
|
|
|
|
|
|
if (resource.getPath() == null) { |
|
|
|
if (resource.getPath() == null) { |
|
|
@ -66,15 +68,15 @@ public class PluginIconSet extends AbstractIconSet { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void dealWithIconString(String key, String value) { |
|
|
|
private void dealWithIconString(String key, String value) { |
|
|
|
if (IconManager.isSvgIcon(value)) { |
|
|
|
if (PluginIconManager.isSvgIcon(value)) { |
|
|
|
// 默认字符串提供正常图和灰化图
|
|
|
|
// 默认字符串提供正常图和灰化图
|
|
|
|
addIcon(new PluginSvgIconSource(key, |
|
|
|
addIcon(new SvgIconSource(key, |
|
|
|
base + value, |
|
|
|
base + value, |
|
|
|
IconManager.findDisablePath(base + value), |
|
|
|
PluginIconManager.findDisablePath(base + value), |
|
|
|
null |
|
|
|
null |
|
|
|
)); |
|
|
|
)); |
|
|
|
} else if (IconManager.isImageIcon(value)) { |
|
|
|
} else if (PluginIconManager.isImageIcon(value)) { |
|
|
|
addIcon(new PluginImageIconSource(key, base + value)); |
|
|
|
addIcon(new ImageIconSource(key, base + value)); |
|
|
|
} |
|
|
|
} |
|
|
|
// 其他无法识别格式不处理
|
|
|
|
// 其他无法识别格式不处理
|
|
|
|
} |
|
|
|
} |
|
|
@ -88,14 +90,14 @@ public class PluginIconSet extends AbstractIconSet { |
|
|
|
String disablePath = (String) value.get(IconType.disable.name()); |
|
|
|
String disablePath = (String) value.get(IconType.disable.name()); |
|
|
|
String whitePath = (String) value.get(IconType.white.name()); |
|
|
|
String whitePath = (String) value.get(IconType.white.name()); |
|
|
|
// 暂不支持混合格式,每个id的格式需要保持一致
|
|
|
|
// 暂不支持混合格式,每个id的格式需要保持一致
|
|
|
|
if (IconManager.isSvgIcon(normalPath)) { |
|
|
|
if (PluginIconManager.isSvgIcon(normalPath)) { |
|
|
|
addIcon(new PluginSvgIconSource(key, |
|
|
|
addIcon(new SvgIconSource(key, |
|
|
|
base + normalPath, |
|
|
|
base + normalPath, |
|
|
|
StringUtils.isNotBlank(disablePath) ? base + disablePath : null, |
|
|
|
StringUtils.isNotBlank(disablePath) ? base + disablePath : null, |
|
|
|
StringUtils.isNotBlank(whitePath) ? base + whitePath : null |
|
|
|
StringUtils.isNotBlank(whitePath) ? base + whitePath : null |
|
|
|
)); |
|
|
|
)); |
|
|
|
} else if (IconManager.isImageIcon(normalPath)) { |
|
|
|
} else if (PluginIconManager.isImageIcon(normalPath)) { |
|
|
|
addIcon(new PluginImageIconSource(key, |
|
|
|
addIcon(new ImageIconSource(key, |
|
|
|
base + normalPath, |
|
|
|
base + normalPath, |
|
|
|
StringUtils.isNotBlank(disablePath) ? base + disablePath : null, |
|
|
|
StringUtils.isNotBlank(disablePath) ? base + disablePath : null, |
|
|
|
StringUtils.isNotBlank(whitePath) ? base + whitePath : null |
|
|
|
StringUtils.isNotBlank(whitePath) ? base + whitePath : null |
|
|
@ -110,9 +112,9 @@ public class PluginIconSet extends AbstractIconSet { |
|
|
|
public void addIconWithMap(Map<String, String> iconId2Path) { |
|
|
|
public void addIconWithMap(Map<String, String> iconId2Path) { |
|
|
|
for (Map.Entry<String, String> entry: iconId2Path.entrySet()) { |
|
|
|
for (Map.Entry<String, String> entry: iconId2Path.entrySet()) { |
|
|
|
if (PluginIconManager.isSvgIcon(entry.getValue())) { |
|
|
|
if (PluginIconManager.isSvgIcon(entry.getValue())) { |
|
|
|
addIcon(new PluginSvgIconSource(entry.getKey(), entry.getValue())); |
|
|
|
addIcon(new SvgIconSource(entry.getKey(), entry.getValue())); |
|
|
|
} else if (PluginIconManager.isImageIcon(entry.getValue())) { |
|
|
|
} else if (PluginIconManager.isImageIcon(entry.getValue())) { |
|
|
|
addIcon(new PluginImageIconSource(entry.getKey(), entry.getValue())); |
|
|
|
addIcon(new ImageIconSource(entry.getKey(), entry.getValue())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|