From f2c8761693dea65f2012b5af320fad37d2460890 Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 9 May 2024 21:01:37 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-114888=20feat:=20=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=99=A8=E4=BC=98=E5=8C=96=201.=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81png=E6=B3=A8=E5=86=8C=202.=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=9F=A5=E6=89=BE=E6=97=A7=E7=89=88=E5=9B=BE=E6=A0=87=203.=20?= =?UTF-8?q?=E6=96=B0=E5=9B=BE=E6=A0=87=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=96=B9=E5=BC=8F=203.=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fine/theme/icon/AbstractIconSet.java | 58 +-- .../fine/theme/icon/AbstractIconSource.java | 65 ++-- .../java/com/fine/theme/icon/IconManager.java | 153 ++++---- .../java/com/fine/theme/icon/IconSet.java | 25 +- .../java/com/fine/theme/icon/IconSource.java | 5 +- .../java/com/fine/theme/icon/IconType.java | 1 + .../java/com/fine/theme/icon/JsonIconSet.java | 109 ++++++ .../java/com/fine/theme/icon/LazyIcon.java | 46 ++- .../fine/theme/icon/img/ImageIconSource.java | 58 +++ .../java/com/fine/theme/icon/svg/SvgIcon.java | 8 - .../fine/theme/icon/svg/SvgIconSource.java | 61 +--- .../theme/icon/svg/batik/BatikSvgIcon.java | 160 +++++++++ .../icon/svg/{ => batik}/SvgTranscoder.java | 39 +- .../fine/theme/light/ui/FineLightIconSet.java | 339 +----------------- .../icontainer/UIModeControlContainer.java | 11 +- .../com/fr/design/gui/ispinner/UISpinner.java | 14 +- .../mainframe/EastRegionContainerPane.java | 41 +-- .../resources/com/fine/theme/icon/default.svg | 6 + .../fine/theme/light/ui/fine_light.icon.json | 278 ++++++++++++++ .../main/java/com/fr/start/MainDesigner.java | 5 +- 20 files changed, 864 insertions(+), 618 deletions(-) create mode 100644 designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java create mode 100644 designer-base/src/main/java/com/fine/theme/icon/img/ImageIconSource.java create mode 100644 designer-base/src/main/java/com/fine/theme/icon/svg/batik/BatikSvgIcon.java rename designer-base/src/main/java/com/fine/theme/icon/svg/{ => batik}/SvgTranscoder.java (62%) create mode 100644 designer-base/src/main/resources/com/fine/theme/icon/default.svg create mode 100644 designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json diff --git a/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSet.java b/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSet.java index c207a99744..008779ca71 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSet.java +++ b/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSet.java @@ -1,10 +1,11 @@ package com.fine.theme.icon; -import com.fr.third.errorprone.annotations.Immutable; +import com.fr.essential.errorprone.annotations.Immutable; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; +import java.awt.Dimension; import java.util.Collection; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -19,68 +20,47 @@ import java.util.concurrent.ConcurrentHashMap; @Immutable public abstract class AbstractIconSet implements IconSet { - private final String id; + protected String name; + protected boolean dark; - private final Map> map = new ConcurrentHashMap<>(64); - private final Map cache = new ConcurrentHashMap<>(64); - private final Map disableCache = new ConcurrentHashMap<>(64); + private final Map> iconSourceMap = new ConcurrentHashMap<>(64); + private final Map iconCache = new ConcurrentHashMap<>(64); - public AbstractIconSet(String id) { - this.id = id; + public AbstractIconSet() { } @Override public @NotNull String getId() { - return id; + return name; } @Override public @NotNull Collection getIds() { - return map.keySet(); + return iconSourceMap.keySet(); } @Override public void addIcon(@NotNull IconSource icon) { - map.put(icon.getId(), icon); + iconSourceMap.put(icon.getId(), icon); } + @SafeVarargs @Override - public void addIcon(@NotNull IconSource... icons) { + public final void addIcon(@NotNull IconSource... icons) { for (IconSource icon : icons) { - map.put(icon.getId(), icon); + iconSourceMap.put(icon.getId(), icon); } } @Override - public @Nullable Icon findIcon(@NotNull String id) { - Icon icon = cache.get(id); + public @Nullable Icon findIcon(@NotNull String id, @NotNull Dimension dimension, IconType type) { + String cacheKey = IconManager.genCacheKey(id, dimension, type); + Icon icon = iconCache.get(cacheKey); if (icon == null) { - IconSource iconSource = map.get(id); + IconSource iconSource = iconSourceMap.get(id); if (iconSource != null) { - icon = iconSource.loadIcon(); - cache.put(id, icon); - } - } - return icon; - } - - @Override - public @Nullable Icon findWhiteIcon(@NotNull String id) { - IconSource iconSource = map.get(id); - if (iconSource != null) { - return iconSource.white(); - } - return null; - } - - @Override - public @Nullable Icon findDisableIcon(@NotNull String id) { - Icon icon = disableCache.get(id); - if (icon == null) { - IconSource iconSource = map.get(id); - if (iconSource != null) { - icon = iconSource.disabled(); - disableCache.put(id, icon); + icon = iconSource.loadIcon(dimension, type); + iconCache.put(cacheKey, icon); } } return icon; diff --git a/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java b/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java index 134bbb2a69..1eb6c18637 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java +++ b/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java @@ -5,10 +5,17 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.Icon; +import java.awt.Dimension; + /** * 抽象图标源 - * 能够根据图标源寻找灰化图标资源 + *

+ * 1. 记录图标来源的所有信息 + * 2. 如果使用来源提供灰化和反白图标,source负责提供图标的不同来源 + * 3. 默认查找命名,如图标名称为 path/pic.svg,根据以下规则自动查询灰化和反白图标 + * 1). 灰化图 path/pic_disable.svg + * 2). 反白图 path/pic_white.svg * * @author vito * @since 11.0 @@ -17,7 +24,7 @@ import javax.swing.Icon; @Immutable public abstract class AbstractIconSource implements IconSource { - public static final String ICON_DISABLE = "_disable"; + private static final String ICON_DISABLE_SUFFIX = "_disable"; protected String id; @@ -26,28 +33,24 @@ public abstract class AbstractIconSource implements IconSource implements IconSource implements IconSource + * IconSource - 表示实际 Icon 的源的接口。 + * 目前有两种实现可用: ImageIconSource 和 SvgIconSource . + *

+ * IconSet - 表示不同可用图标集实现的接口。 + * 目前有两种实现可用: XmlIconSet 和 RuntimeIconSet . + *

+ * IconManager 可用于在运行时添加/删除 IconSet 并检索实际 Icon。 * * @author vito * @since 11.0 @@ -23,11 +36,9 @@ import java.util.HashMap; @Immutable public class IconManager { + public static final Dimension DEFAULT_DIMENSION = new Dimension(16, 16); private static final ArrayList ICON_SETS = new ArrayList<>(2); - private static final HashMap> CACHE = new HashMap<>(64); - private static final HashMap> DISABLE_CACHE = new HashMap<>(64); - private static final HashMap> WHITE_CACHE = new HashMap<>(32); /** @@ -51,103 +62,94 @@ public class IconManager { * @param set 图标集 */ public static void addSet(@NotNull IconSet set) { - if (!ICON_SETS.contains(set)) { - ICON_SETS.add(set); - // 清理可能来自其他图集相同名称图标 - clearIconSetCache(set); - } else { - throw new IconException("[IconManager] IconSet by id:" + set.getId() + "is added!"); - } + ICON_SETS.remove(set); + ICON_SETS.add(set); + clearCache(); } /** * 根据图标ID获取图标 + *

+ * 查找路径 + * 1)查找图集图标 + * 2)路径为图片图标,从路径再查找 + * 3)提供默认svg图标 * * @param id 图标ID * @param 图标类型 * @return 图标 */ @NotNull - public static I getIcon(String id) { - Icon icon = findIcon(id); + public static I getIcon(@NotNull final String id, @NotNull Dimension dimension, @NotNull IconType type) { + Icon icon = findIcon(id, dimension, type); if (icon == null) { - throw new IconException("[IconManager] Can not find icon by id: " + id); + // 只有找不到再进行其他fallback,提升效率 + if (IconManager.isImageIcon(id)) { + return (I) fallbackLegacyIcon(id); + } else { + FineLoggerFactory.getLogger().warn("[IconManager] Can not find icon by id: " + id); + return (I) new LazyIcon("default"); + } } return (I) icon; } - /** - * 获取灰化图标 - * - * @param id 图标ID - * @param 图标类型 - * @return 图标 - */ - @NotNull - public static I getWhiteIcon(String id) { - final WeakReference reference = WHITE_CACHE.get(id); + private static Icon fallbackLegacyIcon(String id) { + return IOUtils.readIcon(id); + } + + @Nullable + private static I findIcon(String id, Dimension dimension, IconType type) { + String cacheKey = genCacheKey(id, dimension, type); + final WeakReference reference = CACHE.get(cacheKey); I icon = reference != null ? (I) reference.get() : null; if (icon == null) { for (IconSet set : ICON_SETS) { - Icon f = set.findWhiteIcon(id); + Icon f = set.findIcon(id, dimension, type); if (f != null) { icon = (I) f; - WHITE_CACHE.put(id, new WeakReference<>(icon)); + CACHE.put(cacheKey, new WeakReference<>(icon)); } } } - if (icon == null) { - throw new IconException("[IconManager] Can not find icon by id: " + id); - } return icon; } + /** - * 获取灰化图标 + * 生成缓存key * - * @param id 图标ID - * @param 图标类型 - * @return 图标 + * @param id id + * @param dimension 尺寸 + * @param type 图标类型 + * @return 缓存key */ - @NotNull - public static I getDisableIcon(String id) { - Icon icon = findDisableIcon(id); - if (icon == null) { - throw new IconException("[IconManager] Can not find icon by id: " + id); + public static @NotNull String genCacheKey(String id, Dimension dimension, IconType type) { + if (DEFAULT_DIMENSION.equals(dimension)) { + return id + "_" + type; } - return (I) icon; + return id + "_" + dimension.width + "_" + dimension.height + "_" + type; } - @Nullable - private static I findDisableIcon(String id) { - final WeakReference reference = DISABLE_CACHE.get(id); - I icon = reference != null ? (I) reference.get() : null; - if (icon == null) { - for (IconSet set : ICON_SETS) { - Icon f = set.findDisableIcon(id); - if (f != null) { - icon = (I) f; - DISABLE_CACHE.put(id, new WeakReference<>(icon)); - } - } - } - return icon; + /** + * 是否SVG图标格式 + * + * @param path 路径 + * @return 是否SVG图标格式 + */ + public static boolean isSvgIcon(String path) { + return FileExtension.SVG.matchExtension(path); } - @Nullable - private static I findIcon(String id) { - final WeakReference reference = CACHE.get(id); - I icon = reference != null ? (I) reference.get() : null; - if (icon == null) { - for (IconSet set : ICON_SETS) { - Icon f = set.findIcon(id); - if (f != null) { - icon = (I) f; - CACHE.put(id, new WeakReference<>(icon)); - } - } - } - return icon; + /** + * 是否支持的图片图标格式,目前只支持png和jpg + * + * @param path 路径 + * @return 是否支持的图片图标格式 + */ + public static boolean isImageIcon(String path) { + return FileExtension.PNG.matchExtension(path) + || FileExtension.JPG.matchExtension(path); } /** @@ -155,24 +157,5 @@ public class IconManager { */ public static void clearCache() { CACHE.clear(); - DISABLE_CACHE.clear(); - WHITE_CACHE.clear(); - } - - /** - * 清理图标缓存 - */ - public static void clearIconCache(String id) { - CACHE.remove(id); - DISABLE_CACHE.remove(id); - WHITE_CACHE.clear(); - } - - private static void clearIconSetCache(@NotNull IconSet set) { - for (String id : set.getIds()) { - CACHE.remove(id); - DISABLE_CACHE.remove(id); - WHITE_CACHE.remove(id); - } } } diff --git a/designer-base/src/main/java/com/fine/theme/icon/IconSet.java b/designer-base/src/main/java/com/fine/theme/icon/IconSet.java index 0439243fa5..d60aed98d4 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/IconSet.java +++ b/designer-base/src/main/java/com/fine/theme/icon/IconSet.java @@ -2,9 +2,9 @@ package com.fine.theme.icon; import com.fr.third.errorprone.annotations.Immutable; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import javax.swing.Icon; +import java.awt.Dimension; import java.util.Collection; /** @@ -16,9 +16,6 @@ import java.util.Collection; */ @Immutable public interface IconSet extends Identifiable { - @NotNull - @Override - String getId(); /** * 返回集合中所有 Icons 的 id。 @@ -48,24 +45,6 @@ public interface IconSet extends Identifiable { * @param id id * @return Icon */ - @Nullable - Icon findIcon(@NotNull String id); - - /** - * 返回指定 id 的 Icon。 - * - * @param id id - * @return Icon - */ - @Nullable - Icon findWhiteIcon(@NotNull String id); + Icon findIcon(@NotNull String id, @NotNull Dimension dimension, IconType type); - /** - * 返回指定 id 的 Icon。 - * - * @param id id - * @return Icon - */ - @Nullable - Icon findDisableIcon(@NotNull String id); } diff --git a/designer-base/src/main/java/com/fine/theme/icon/IconSource.java b/designer-base/src/main/java/com/fine/theme/icon/IconSource.java index 78de6e6584..187ec69cdf 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/IconSource.java +++ b/designer-base/src/main/java/com/fine/theme/icon/IconSource.java @@ -4,6 +4,7 @@ import com.fr.third.errorprone.annotations.Immutable; import org.jetbrains.annotations.NotNull; import javax.swing.Icon; +import java.awt.Dimension; import java.io.Serializable; /** @@ -15,7 +16,7 @@ import java.io.Serializable; * Created on 2023/11/6 */ @Immutable -public interface IconSource extends Identifiable, DisabledIcon, WhiteIcon, Cloneable, Serializable { +public interface IconSource extends Identifiable, Cloneable, Serializable { /** * 获取图标资源 @@ -32,5 +33,5 @@ public interface IconSource extends Identifiable, DisabledIcon, * @return 图标 */ @NotNull - I loadIcon(); + I loadIcon(Dimension dimension, IconType type); } diff --git a/designer-base/src/main/java/com/fine/theme/icon/IconType.java b/designer-base/src/main/java/com/fine/theme/icon/IconType.java index 1f89331b3d..0e5821a469 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/IconType.java +++ b/designer-base/src/main/java/com/fine/theme/icon/IconType.java @@ -20,4 +20,5 @@ public enum IconType { * 原始图 */ normal + } diff --git a/designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java b/designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java new file mode 100644 index 0000000000..f341317d0c --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java @@ -0,0 +1,109 @@ +package com.fine.theme.icon; + +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.ParseException; +import com.fr.stable.StringUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.Objects; + + +/** + * json 格式图标集 + * + * @author vito + * @since 11.0 + * Created on 2023/11/17 + */ +public class JsonIconSet extends AbstractIconSet { + + private String base; + + public JsonIconSet(UrlIconResource resource) { + addIcon(new SvgIconSource("default", "com/fine/theme/icon/default.svg")); + Map json; + try (InputStream in = resource.getInputStream()) { + try (Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) { + json = (Map) Json.parse(reader); + } + } catch (ParseException | IOException ex) { + throw new RuntimeException(ex.getMessage(), ex); + } + + + name = (String) json.get("name"); + dark = Boolean.parseBoolean((String) json.get("dark")); + base = (String) json.get("base"); + if (base == null) { + base = StringUtils.EMPTY; + } + + Map icons = (Map) json.get("icons"); + + for (Map.Entry icon : icons.entrySet()) { + applyIcon(icon.getKey(), icon.getValue()); + } + + } + + /** + * 从配置文件中添加icon,只处理认识的格式和结构 + */ + private void applyIcon(String key, Object value) { + if (value instanceof String) { + String path = (String) value; + if (IconManager.isSvgIcon(path)) { + addIcon(new SvgIconSource(key, base + path)); + } else if (IconManager.isImageIcon(path)) { + addIcon(new ImageIconSource(key, base + path)); + } + // 其他无法识别格式不处理 + } else if (value instanceof Map) { + Map iconObj = (Map) value; + String normalPath = (String) iconObj.get(IconType.normal.name()); + String disablePath = (String) iconObj.get(IconType.disable.name()); + String whitePath = (String) iconObj.get(IconType.white.name()); + // 暂不支持混合格式,每个id的格式需要保持一致 + if (IconManager.isSvgIcon(normalPath)) { + addIcon(new SvgIconSource(key, + base + normalPath, + base + disablePath, + base + whitePath + )); + } else if (IconManager.isImageIcon(normalPath)) { + addIcon(new ImageIconSource(key, + base + normalPath, + base + disablePath, + base + whitePath + )); + } + } + } + + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + JsonIconSet that = (JsonIconSet) o; + return Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hashCode(name); + } + +} diff --git a/designer-base/src/main/java/com/fine/theme/icon/LazyIcon.java b/designer-base/src/main/java/com/fine/theme/icon/LazyIcon.java index 0032ce258f..e93e619684 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/LazyIcon.java +++ b/designer-base/src/main/java/com/fine/theme/icon/LazyIcon.java @@ -5,11 +5,15 @@ import org.jetbrains.annotations.NotNull; import javax.swing.Icon; import java.awt.Component; +import java.awt.Dimension; import java.awt.Graphics; import java.util.StringJoiner; +import static com.fine.theme.utils.FineUIScale.scale; + /** * 懒加载图标 + * 非常懒,宽高都不想算 * * @author vito * @since 11.0 @@ -20,15 +24,37 @@ public class LazyIcon implements Identifiable, DisabledIcon, WhiteIcon, Icon { @NotNull private final String id; + private final Dimension dimension; + private final IconType type; public LazyIcon(@NotNull final String id) { this.id = id; + this.dimension = IconManager.DEFAULT_DIMENSION; + this.type = IconType.normal; + } + + public LazyIcon(@NotNull final String id, int side) { + this.id = id; + this.dimension = new Dimension(side, side); + this.type = IconType.normal; + } + + public LazyIcon(@NotNull final String id, @NotNull Dimension dimension) { + this.id = id; + this.dimension = dimension; this.type = IconType.normal; } - private LazyIcon(@NotNull final String id, IconType type) { + private LazyIcon(@NotNull final String id, @NotNull IconType type) { + this.id = id; + this.dimension = IconManager.DEFAULT_DIMENSION; + this.type = type; + } + + public LazyIcon(@NotNull final String id, @NotNull Dimension dimension, @NotNull IconType type) { this.id = id; + this.dimension = dimension; this.type = type; } @@ -46,25 +72,18 @@ public class LazyIcon implements Identifiable, DisabledIcon, WhiteIcon, Icon { @Override public int getIconWidth() { - return getIcon().getIconWidth(); + return scale(dimension.width); } @Override public int getIconHeight() { - return getIcon().getIconHeight(); + return scale(dimension.height); } @NotNull public I getIcon() { - switch (type) { - case white: - return IconManager.getWhiteIcon(getId()); - case disable: - return IconManager.getDisableIcon(getId()); - default: - return IconManager.getIcon(getId()); - } + return IconManager.getIcon(getId(), dimension, type); } /** @@ -75,7 +94,7 @@ public class LazyIcon implements Identifiable, DisabledIcon, WhiteIcon, Icon { @NotNull @Override public Icon disabled() { - return new LazyIcon(getId(), IconType.disable); + return new LazyIcon(getId(), dimension, IconType.disable); } /** @@ -86,7 +105,7 @@ public class LazyIcon implements Identifiable, DisabledIcon, WhiteIcon, Icon { @NotNull @Override public Icon white() { - return new LazyIcon(getId(), IconType.white); + return new LazyIcon(getId(), dimension, IconType.white); } @@ -94,6 +113,7 @@ public class LazyIcon implements Identifiable, DisabledIcon, WhiteIcon, Icon { public String toString() { return new StringJoiner(", ", LazyIcon.class.getSimpleName() + "[", "]") .add("id='" + id + "'") + .add("size=" + "[w=" + scale(dimension.width) + ",h=" + scale(dimension.height) + "]") .add("type=" + type) .toString(); } diff --git a/designer-base/src/main/java/com/fine/theme/icon/img/ImageIconSource.java b/designer-base/src/main/java/com/fine/theme/icon/img/ImageIconSource.java new file mode 100644 index 0000000000..2f0c17d442 --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/icon/img/ImageIconSource.java @@ -0,0 +1,58 @@ +package com.fine.theme.icon.img; + +import com.fine.theme.icon.AbstractIconSource; +import com.fine.theme.icon.IconResource; +import com.fine.theme.icon.IconType; +import com.fine.theme.icon.UrlIconResource; +import com.fr.clone.cloning.Immutable; +import com.fr.general.FRLogger; +import com.fr.general.IOUtils; +import com.fr.stable.StringUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import javax.swing.ImageIcon; +import java.awt.Dimension; +import java.awt.image.BufferedImage; + +/** + * 图片图标源 + * + * @author vito + * @since 11.0 + * Created on 2024/05/09 + */ +@Immutable +public class ImageIconSource extends AbstractIconSource { + + + public ImageIconSource(@NotNull String id, @NotNull String resource) { + super(id, new UrlIconResource(resource)); + } + + public ImageIconSource(@NotNull String id, + @NotNull String resource, + @Nullable String grayResource, + @Nullable String whiteResource) { + super(id, new UrlIconResource(resource), + StringUtils.isEmpty(grayResource) ? null : new UrlIconResource(grayResource), + StringUtils.isEmpty(whiteResource) ? null : new UrlIconResource(whiteResource)); + } + + @NotNull + @Override + protected ImageIcon loadIcon(@NotNull IconResource resource, Dimension dimension, IconType type) { + byte[] bytes = IOUtils.inputStream2Bytes(resource.getInputStream()); + if (bytes == null && resource instanceof UrlIconResource) { + // 换readImageWithCache尝试读取 + UrlIconResource iconResource = (UrlIconResource) resource; + BufferedImage icon = IOUtils.readImageWithCache(iconResource.getPath()); + if (icon == null) { + FRLogger.getLogger().error(iconResource.getPath()); + return new ImageIcon(); + } + return new ImageIcon(icon); + } + return new ImageIcon(bytes); + } +} diff --git a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java index 66b062e2e9..051e8d1280 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java +++ b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java @@ -51,10 +51,6 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { private final NullableLazyValue svgDocument = NullableLazyValue.createValue(() -> load(IconType.normal)); private final NullableLazyValue whiteSvgDocument = NullableLazyValue.createValue(() -> load(IconType.white)); - public SvgIcon(IconResource resource, Dimension size) { - this(resource, size, IconType.normal); - } - public SvgIcon(IconResource resource, Dimension size, IconType type) { this.resource = resource; this.size = size; @@ -63,10 +59,6 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { this.type = type; } - public SvgIcon(IconResource resource, int side) { - this(resource, new Dimension(side, side), IconType.normal); - } - /** * 如果支持绘制Retina绘制,则进行Retina绘制, * 绘制结束不影响任何外部尺寸 diff --git a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIconSource.java b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIconSource.java index e77a219b1f..eeb929dd92 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIconSource.java +++ b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIconSource.java @@ -2,12 +2,13 @@ package com.fine.theme.icon.svg; import com.fine.theme.icon.AbstractIconSource; import com.fine.theme.icon.IconResource; +import com.fine.theme.icon.IconType; import com.fine.theme.icon.UrlIconResource; import com.fr.clone.cloning.Immutable; +import com.fr.stable.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import javax.swing.Icon; import java.awt.Dimension; /** @@ -20,61 +21,23 @@ import java.awt.Dimension; @Immutable public class SvgIconSource extends AbstractIconSource { - private static final int ICON_SIDE_LENGTH = 16; - - private final Dimension size; public SvgIconSource(@NotNull String id, @NotNull String resource) { - this(id, new UrlIconResource(resource), null, new Dimension(ICON_SIDE_LENGTH, ICON_SIDE_LENGTH)); - } - - public SvgIconSource(@NotNull String id, @NotNull String resource, boolean autoFindDisable) { - this(id, new UrlIconResource(resource), autoFindDisable, new Dimension(ICON_SIDE_LENGTH, ICON_SIDE_LENGTH)); - } - - public SvgIconSource(@NotNull String id, @NotNull String resource, int side) { - this(id, new UrlIconResource(resource), null, side); - } - - public SvgIconSource(@NotNull String id, @NotNull String resource, boolean autoFindDisable, int side) { - this(id, new UrlIconResource(resource), autoFindDisable, new Dimension(side, side)); - } - - public SvgIconSource(@NotNull String id, @NotNull String resource, @Nullable String grayResource, int side) { - this(id, new UrlIconResource(resource), new UrlIconResource(grayResource), side); - } - - public SvgIconSource(@NotNull String id, @NotNull IconResource resource, - @Nullable IconResource grayResource, int side) { - this(id, resource, grayResource, new Dimension(side, side)); - } - - public SvgIconSource(@NotNull String id, @NotNull IconResource resource, - boolean autoFindDisable, Dimension size) { - super(id, resource, autoFindDisable); - this.size = size; + super(id, new UrlIconResource(resource)); } - public SvgIconSource(@NotNull String id, @NotNull IconResource resource, - @Nullable IconResource grayResource, Dimension size) { - super(id, resource, grayResource); - this.size = size; + public SvgIconSource(@NotNull String id, + @NotNull String resource, + @Nullable String grayResource, + @Nullable String whiteResource) { + super(id, new UrlIconResource(resource), + StringUtils.isEmpty(grayResource) ? null : new UrlIconResource(grayResource), + StringUtils.isEmpty(whiteResource) ? null : new UrlIconResource(whiteResource)); } - @NotNull @Override - protected SvgIcon loadIcon(@NotNull IconResource resource) { - return new SvgIcon(resource, size); - } - - @Override - public @NotNull SvgIcon loadDisableIcon() { - return new SvgIcon(resource, size).disabled(); - } - - @Override - public @NotNull Icon white() { - return new SvgIcon(resource, size).white(); + protected SvgIcon loadIcon(@NotNull IconResource resource, Dimension dimension, IconType type) { + return new SvgIcon(resource, dimension, type); } } diff --git a/designer-base/src/main/java/com/fine/theme/icon/svg/batik/BatikSvgIcon.java b/designer-base/src/main/java/com/fine/theme/icon/svg/batik/BatikSvgIcon.java new file mode 100644 index 0000000000..80848e5761 --- /dev/null +++ b/designer-base/src/main/java/com/fine/theme/icon/svg/batik/BatikSvgIcon.java @@ -0,0 +1,160 @@ +package com.fine.theme.icon.svg.batik; + +import com.fine.theme.icon.DisabledIcon; +import com.fine.theme.icon.GraphicsFilter; +import com.fine.theme.icon.IconResource; +import com.fine.theme.icon.IconType; +import com.fine.theme.icon.WhiteIcon; +import com.formdev.flatlaf.FlatLaf; +import com.formdev.flatlaf.util.GrayFilter; +import com.fr.clone.cloning.Immutable; +import com.fr.log.FineLoggerFactory; +import org.apache.batik.transcoder.TranscoderException; +import org.apache.batik.transcoder.TranscoderInput; +import org.jetbrains.annotations.NotNull; + +import javax.swing.Icon; +import javax.swing.UIManager; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.awt.image.RGBImageFilter; +import java.util.StringJoiner; + +import static com.fine.theme.utils.FineUIScale.scale; +import static com.fine.theme.utils.FineUIUtils.RETINA_SCALE_FACTOR; +import static com.fine.theme.utils.FineUIUtils.getRetina; + +/** + * svg图标 + * 1.绘制长度会跟随DPI比率变化 + * 1跟2的缩放原因不同,因此不能混淆,宽高测量等依旧 + * 使用DPI缩放进行,只有绘制内容时使用Retina绘制(如果有) + * Retina绘制不影响最终尺寸,注意区分 + * + * @author vito + * @since 11.0 + * Created on 2023/11/15 + */ +@Immutable +public class BatikSvgIcon implements DisabledIcon, WhiteIcon, Icon { + + private final Dimension size; + private final Dimension scaleSize; + private final IconResource resource; + private final IconType type; + + + public BatikSvgIcon(IconResource resource, Dimension size) { + this(resource, size, IconType.normal); + } + + public BatikSvgIcon(IconResource resource, Dimension size, IconType type) { + this.resource = resource; + this.size = size; + // 根据dpi进行缩放 + this.scaleSize = scale(size); + this.type = type; + } + + public BatikSvgIcon(IconResource resource, int side) { + this(resource, new Dimension(side, side), IconType.normal); + } + + + /** + * 如果支持绘制Retina绘制,则进行Retina绘制, + * 绘制结束不影响任何外部尺寸 + */ + @Override + public void paintIcon(Component c, Graphics g, int x, int y) { + if (getRetina()) { + BufferedImage image = toImage(scaleRetina(size)); + // 高清绘制的原理:scale(1/2,1/2)的原理是坐标减半,底层是矩阵进行坐标变换,意思是坐标减半进行绘制, + // 这样就可以将两倍图绘制到一倍的大小,如果这时候设备支持Retina绘制(四个像素模拟一个像素), + // 正好就可以将4个像素利用起来,每个像素点都有不同的颜色,而不像之前只能是四个共用一个颜色。因此图像 + // 可以更加细腻当然,绘图之后,需要将这个坐标变换给恢复。 + ((Graphics2D) g).scale(1.0 / RETINA_SCALE_FACTOR, 1.0 / RETINA_SCALE_FACTOR); + g.drawImage(image, x * RETINA_SCALE_FACTOR, y * RETINA_SCALE_FACTOR, null); + ((Graphics2D) g).scale(RETINA_SCALE_FACTOR, RETINA_SCALE_FACTOR); + } else { + BufferedImage image = toImage(size); + g.drawImage(image, x, y, null); + } + } + + private static Dimension scaleRetina(Dimension dimension) { + return getRetina() + ? new Dimension(dimension.width * RETINA_SCALE_FACTOR, dimension.height * RETINA_SCALE_FACTOR) + : dimension; + } + + /** + * 根据指定尺寸绘制图片,这里尺寸为结算后的尺寸, + * 因此不必进行缩放 + * + * @param size 图像尺寸 + * @return 图像 + */ + private BufferedImage toImage(Dimension size) { + SvgTranscoder transcoder = new SvgTranscoder(size); + TranscoderInput transcoderInput = new TranscoderInput(resource.getInputStream()); + try { + transcoder.transcode(transcoderInput, null); + return transcoder.getImage(); + } catch (TranscoderException e) { + FineLoggerFactory.getLogger().error("SvgIcon from url: " + resource + "can not paint.", e); + } + return transcoder.getImage(); + } + + + private Graphics2D grayGraphics(Graphics g) { + Object grayFilterObj = UIManager.get("Component.grayFilter"); + RGBImageFilter grayFilter = (grayFilterObj instanceof RGBImageFilter) + ? (RGBImageFilter) grayFilterObj + : GrayFilter.createDisabledIconFilter(FlatLaf.isLafDark()); + + return new GraphicsFilter((Graphics2D) g.create(), grayFilter); + } + + @Override + public int getIconWidth() { + return scaleSize.width; + } + + @Override + public int getIconHeight() { + return scaleSize.height; + } + + + @Override + public String toString() { + return new StringJoiner(", ", BatikSvgIcon.class.getSimpleName() + "[", "]") + .add("resource=" + resource) + .add("type=" + type) + .add("size=" + size) + .add("scaleSize=" + scaleSize) + .toString(); + } + + /** + * 默认提供一个简单的灰化处理 + */ + @Override + public @NotNull BatikSvgIcon white() { + return new BatikSvgIcon(resource, size, IconType.white); + } + + + /** + * 默认提供一个简单的灰化处理 + */ + @Override + public @NotNull BatikSvgIcon disabled() { + return new BatikSvgIcon(resource, size, IconType.disable); + } +} diff --git a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgTranscoder.java b/designer-base/src/main/java/com/fine/theme/icon/svg/batik/SvgTranscoder.java similarity index 62% rename from designer-base/src/main/java/com/fine/theme/icon/svg/SvgTranscoder.java rename to designer-base/src/main/java/com/fine/theme/icon/svg/batik/SvgTranscoder.java index abb55e1c72..2fd3663167 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgTranscoder.java +++ b/designer-base/src/main/java/com/fine/theme/icon/svg/batik/SvgTranscoder.java @@ -1,4 +1,4 @@ -package com.fine.theme.icon.svg; +package com.fine.theme.icon.svg.batik; import org.apache.batik.transcoder.SVGAbstractTranscoder; import org.apache.batik.transcoder.TranscoderException; @@ -8,6 +8,9 @@ import org.apache.batik.transcoder.image.ImageTranscoder; import java.awt.Color; import java.awt.Dimension; import java.awt.image.BufferedImage; +import java.awt.image.DataBuffer; +import java.awt.image.IndexColorModel; +import java.awt.image.Raster; /** * Svg图标转码器 @@ -18,16 +21,20 @@ import java.awt.image.BufferedImage; */ public class SvgTranscoder extends ImageTranscoder { + public enum Type { + gray, white, origin + } + private BufferedImage bufferedImage; - private boolean gray = false; + private Type type = Type.origin; public SvgTranscoder(Dimension size) { addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, (float) size.getWidth()); addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, (float) size.getHeight()); } - public SvgTranscoder(Dimension size, Color background, boolean gray) { - this.gray = gray; + public SvgTranscoder(Dimension size, Color background, Type type) { + this.type = type; addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, (float) size.getWidth()); addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, (float) size.getHeight()); addTranscodingHint(ImageTranscoder.KEY_BACKGROUND_COLOR, background); @@ -41,9 +48,14 @@ public class SvgTranscoder extends ImageTranscoder { @Override public BufferedImage createImage(int width, int height) { - return gray ? - createGrayImage(width, height) : - new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + switch (type) { + case gray: + return createGrayImage(width, height); + case white: + return createWhiteImage(width, height); + default: + return new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); + } } /** @@ -54,6 +66,19 @@ public class SvgTranscoder extends ImageTranscoder { } + /** + * 灰化底图 + */ + private BufferedImage createWhiteImage(int width, int height) { + byte[] arr = {(byte) 0xff, (byte) 0,}; + return new BufferedImage( + new IndexColorModel(1, 2, arr, arr, arr), + Raster.createPackedRaster(DataBuffer.TYPE_BYTE, width, height, 1, 1, null), + false, + null); + } + + @Override public void writeImage(BufferedImage bufferedImage, TranscoderOutput transcoderOutput) throws TranscoderException { this.bufferedImage = bufferedImage; diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java index 3bb48ea05b..33fa2aecbd 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java @@ -1,344 +1,17 @@ package com.fine.theme.light.ui; -import com.fine.theme.icon.AbstractIconSet; -import com.fine.theme.icon.svg.SvgIconSource; +import com.fine.theme.icon.JsonIconSet; +import com.fine.theme.icon.UrlIconResource; /** * Fine 亮主题图标集 * * @author vito * @since 11.0 - * Created on 2023/11/17 + * Created on 2024/5/7 */ -public class FineLightIconSet extends AbstractIconSet { - - public FineLightIconSet(String id) { - super(id); - load(); - } - - private void load() { - addIcon( - new SvgIconSource("cut", "com/fine/theme/icon/cut.svg", true), - new SvgIconSource("save", "com/fine/theme/icon/save.svg", true), - new SvgIconSource("copy", "com/fine/theme/icon/copy.svg", true), - new SvgIconSource("formatBrush", "com/fine/theme/icon/formatBrush.svg", true), - new SvgIconSource("paste", "com/fine/theme/icon/paste.svg", true), - new SvgIconSource("undo", "com/fine/theme/icon/undo.svg", true), - new SvgIconSource("redo", "com/fine/theme/icon/redo.svg", true), - new SvgIconSource("version_save", "com/fine/theme/icon/version_save.svg", true), - new SvgIconSource("font_miss_check", "com/fine/theme/icon/font_miss_check.svg", true), - new SvgIconSource("template_theme", "com/fine/theme/icon/template_theme.svg", true), - new SvgIconSource("remove", "com/fine/theme/icon/remove.svg", true), - new SvgIconSource("search", "com/fine/theme/icon/search.svg", true), - new SvgIconSource("add", "com/fine/theme/icon/add.svg", true), - new SvgIconSource("drag_left", "com/fine/theme/icon/drag_left.svg", true), - new SvgIconSource("drag_right", "com/fine/theme/icon/drag_right.svg", true), - new SvgIconSource("down_arrow", "com/fine/theme/icon/down_arrow.svg", true), - new SvgIconSource("up_arrow", "com/fine/theme/icon/up_arrow.svg", true), - new SvgIconSource("down_arrow_12", "com/fine/theme/icon/down_arrow.svg", true, 12), - new SvgIconSource("up_arrow_12", "com/fine/theme/icon/up_arrow.svg", true, 12), - new SvgIconSource("select", "com/fine/theme/icon/select.svg", true), - - // 数据集相关Icon - new SvgIconSource("database", "com/fine/theme/icon/dataset/database.svg", true), - new SvgIconSource("preview", "com/fine/theme/icon/dataset/preview.svg", true), - new SvgIconSource("connection", "com/fine/theme/icon/dataset/connection.svg"), - new SvgIconSource("class_table_data", "com/fine/theme/icon/dataset/class_table_data.svg", true), - new SvgIconSource("data_table", "com/fine/theme/icon/dataset/data_table.svg", true), - new SvgIconSource("multi", "com/fine/theme/icon/dataset/multi.svg"), - new SvgIconSource("file", "com/fine/theme/icon/dataset/file.svg"), - new SvgIconSource("tree", "com/fine/theme/icon/dataset/tree.svg"), - new SvgIconSource("store_procedure", "com/fine/theme/icon/dataset/store_procedure.svg", true), - new SvgIconSource("batch_esd_on", "com/fine/theme/icon/dataset/batch_esd_on.svg", true), - new SvgIconSource("batch_esd_off", "com/fine/theme/icon/dataset/batch_esd_off.svg", true), - new SvgIconSource("edit", "com/fine/theme/icon/dataset/edit.svg", true), - new SvgIconSource("server_database", "com/fine/theme/icon/dataset/server_database.svg", true), - new SvgIconSource("field", "com/fine/theme/icon/dataset/field.svg", true), - - // 目录树相关Icon - new SvgIconSource("folder", "com/fine/theme/icon/filetree/folder.svg", true), - new SvgIconSource("folder_open", "com/fine/theme/icon/filetree/folder_open.svg", true), - new SvgIconSource("cpt_icon", "com/fine/theme/icon/filetree/cpt_icon.svg", true), - new SvgIconSource("frm_icon", "com/fine/theme/icon/filetree/frm_icon.svg", true), - new SvgIconSource("fvs_icon", "com/fine/theme/icon/filetree/fvs_icon.svg", true), - new SvgIconSource("excel_icon", "com/fine/theme/icon/filetree/excel_icon.svg", true), - new SvgIconSource("minus", "com/fine/theme/icon/filetree/minus.svg", true), - new SvgIconSource("plus", "com/fine/theme/icon/filetree/plus.svg", true), - new SvgIconSource("locate", "com/fine/theme/icon/filetree/locate.svg", true), - new SvgIconSource("rename", "com/fine/theme/icon/filetree/rename.svg", true), - new SvgIconSource("collapse_all", "com/fine/theme/icon/filetree/collapse_all.svg", true), - new SvgIconSource("vcs_list", "com/fine/theme/icon/filetree/vcs_list.svg", true), - new SvgIconSource("view_folder", "com/fine/theme/icon/filetree/view_folder.svg", true), - new SvgIconSource("refresh", "com/fine/theme/icon/filetree/refresh.svg", true), - new SvgIconSource("new_folder", "com/fine/theme/icon/filetree/new_folder.svg", true), - - // 文件类型 - new SvgIconSource("add_report", "com/fine/theme/icon/filetree/filetype/add_report.svg", true), - new SvgIconSource("add_word", "com/fine/theme/icon/filetree/filetype/add_word.svg", true), - new SvgIconSource("bmpFile", "com/fine/theme/icon/filetree/filetype/bmpFile.svg", true), - new SvgIconSource("chtFile", "com/fine/theme/icon/filetree/filetype/chtFile.svg", true), - new SvgIconSource("classFile", "com/fine/theme/icon/filetree/filetype/classFile.svg", true), - new SvgIconSource("cpt_locked", "com/fine/theme/icon/filetree/filetype/cpt_locked.svg", true), - new SvgIconSource("excel_import", "com/fine/theme/icon/filetree/filetype/excel_import.svg", true), - new SvgIconSource("excelFile", "com/fine/theme/icon/filetree/filetype/excelFile.svg", true), - new SvgIconSource("flashFile", "com/fine/theme/icon/filetree/filetype/flashFile.svg", true), - new SvgIconSource("frm_locked", "com/fine/theme/icon/filetree/filetype/frm_locked.svg", true), - new SvgIconSource("gifFile", "com/fine/theme/icon/filetree/filetype/gifFile.svg", true), - new SvgIconSource("htmlFile", "com/fine/theme/icon/filetree/filetype/htmlFile.svg", true), - new SvgIconSource("jarFile", "com/fine/theme/icon/filetree/filetype/jarFile.svg", true), - new SvgIconSource("javaFile", "com/fine/theme/icon/filetree/filetype/javaFile.svg", true), - new SvgIconSource("jpgFile", "com/fine/theme/icon/filetree/filetype/jpgFile.svg", true), - new SvgIconSource("jsFile", "com/fine/theme/icon/filetree/filetype/jsFile.svg", true), - new SvgIconSource("jspFile", "com/fine/theme/icon/filetree/filetype/jspFile.svg", true), - new SvgIconSource("pdfFile", "com/fine/theme/icon/filetree/filetype/pdfFile.svg", true), - new SvgIconSource("pngFile", "com/fine/theme/icon/filetree/filetype/pngFile.svg", true), - new SvgIconSource("sqlFile", "com/fine/theme/icon/filetree/filetype/sqlFile.svg", true), - new SvgIconSource("wordFile", "com/fine/theme/icon/filetree/filetype/wordFile.svg", true), - new SvgIconSource("xlsFile", "com/fine/theme/icon/filetree/filetype/xlsFile.svg", true), - new SvgIconSource("xmlFile", "com/fine/theme/icon/filetree/filetype/xmlFile.svg", true), - - // 属性面板Icon - new SvgIconSource("cellattr", "com/fine/theme/icon/propertiestab/cellattr.svg", false, 18), - new SvgIconSource("cellattr_disabled", "com/fine/theme/icon/propertiestab/cellattr_disabled.svg", false, 18), - new SvgIconSource("cellattr_selected", "com/fine/theme/icon/propertiestab/cellattr_selected.svg", false, 18), - new SvgIconSource("cellelement", "com/fine/theme/icon/propertiestab/cellelement.svg", false, 18), - new SvgIconSource("cellelement_disabled", "com/fine/theme/icon/propertiestab/cellelement_disabled.svg", false, 18), - new SvgIconSource("cellelement_selected", "com/fine/theme/icon/propertiestab/cellelement_selected.svg", false, 18), - new SvgIconSource("conditionattr", "com/fine/theme/icon/propertiestab/conditionattr.svg", false, 18), - new SvgIconSource("conditionattr_disabled", "com/fine/theme/icon/propertiestab/conditionattr_disabled.svg", false, 18), - new SvgIconSource("conditionattr_selected", "com/fine/theme/icon/propertiestab/conditionattr_selected.svg", false, 18), - new SvgIconSource("floatelement", "com/fine/theme/icon/propertiestab/floatelement.svg", false, 18), - new SvgIconSource("floatelement_disabled", "com/fine/theme/icon/propertiestab/floatelement_disabled.svg", false, 18), - new SvgIconSource("floatelement_selected", "com/fine/theme/icon/propertiestab/floatelement_selected.svg", false, 18), - new SvgIconSource("hyperlink", "com/fine/theme/icon/propertiestab/hyperlink.svg", false, 18), - new SvgIconSource("hyperlink_disabled", "com/fine/theme/icon/propertiestab/hyperlink_disabled.svg", false, 18), - new SvgIconSource("hyperlink_selected", "com/fine/theme/icon/propertiestab/hyperlink_selected.svg", false, 18), - new SvgIconSource("widgetlib", "com/fine/theme/icon/propertiestab/widgetlib.svg", false, 18), - new SvgIconSource("widgetlib_disabled", "com/fine/theme/icon/propertiestab/widgetlib_disabled.svg", false, 18), - new SvgIconSource("widgetlib_selected", "com/fine/theme/icon/propertiestab/widgetlib_selected.svg", false, 18), - new SvgIconSource("widgetsettings", "com/fine/theme/icon/propertiestab/widgetsettings.svg", false, 18), - new SvgIconSource("widgetsettings_disabled", "com/fine/theme/icon/propertiestab/widgetsettings_disabled.svg", false, 18), - new SvgIconSource("widgetsettings_selected", "com/fine/theme/icon/propertiestab/widgetsettings_selected.svg", false, 18), - new SvgIconSource("configuredroles", "com/fine/theme/icon/propertiestab/configuredroles.svg", false, 18), - new SvgIconSource("configuredroles_selected", "com/fine/theme/icon/propertiestab/configuredroles_selected.svg", false, 18), - new SvgIconSource("configuredroles_disabled", "com/fine/theme/icon/propertiestab/configuredroles_disabled.svg", false, 18), - new SvgIconSource("authorityedit", "com/fine/theme/icon/propertiestab/authorityedit.svg", false, 18), - new SvgIconSource("authorityedit_disabled", "com/fine/theme/icon/propertiestab/authorityedit_disabled.svg", false, 18), - new SvgIconSource("authorityedit_selected", "com/fine/theme/icon/propertiestab/authorityedit_selected.svg", false, 18), - - - // sheet标签栏相关icon - new SvgIconSource("add_worksheet", "com/fine/theme/icon/sheet/add_sheet.svg", true), - // TODO: 待视觉提供后替换 - new SvgIconSource("add_polysheet", "com/fine/theme/icon/sheet/add_frm.svg", true), - - // CheckBox相关Icon - new SvgIconSource("checkbox_checked", "com/fine/theme/icon/checkbox/checked.svg", true), - new SvgIconSource("checkbox_unchecked", "com/fine/theme/icon/checkbox/unchecked.svg", true), - new SvgIconSource("checkbox_part_checked", "com/fine/theme/icon/checkbox/part_checked.svg", true), - new SvgIconSource("checkbox_hovered", "com/fine/theme/icon/checkbox/hovered.svg", true), - - // radioButton相关icon - new SvgIconSource("radio_selected", "com/fine/theme/icon/radio/radio_selected.svg", true), - new SvgIconSource("radio_unselected", "com/fine/theme/icon/radio/radio_unselected.svg", true), - - // 菜单栏Icon - new SvgIconSource("bold", "com/fine/theme/icon/font/bold.svg"), - new SvgIconSource("italic", "com/fine/theme/icon/font/italic.svg"), - new SvgIconSource("underline", "com/fine/theme/icon/font/underline.svg"), - new SvgIconSource("foreground", "com/fine/theme/icon/font/foreground.svg"), - new SvgIconSource("background", "com/fine/theme/icon/font/background.svg"), - new SvgIconSource("h_left", "com/fine/theme/icon/cellstyle/h_left.svg"), - new SvgIconSource("h_center", "com/fine/theme/icon/cellstyle/h_center.svg"), - new SvgIconSource("h_right", "com/fine/theme/icon/cellstyle/h_right.svg"), - new SvgIconSource("h_justify", "com/fine/theme/icon/cellstyle/h_justify.svg"), - new SvgIconSource("h_normal", "com/fine/theme/icon/cellstyle/h_normal.svg"), - new SvgIconSource("v_top", "com/fine/theme/icon/cellstyle/v_top.svg"), - new SvgIconSource("v_center", "com/fine/theme/icon/cellstyle/v_center.svg"), - new SvgIconSource("v_bottom", "com/fine/theme/icon/cellstyle/v_bottom.svg"), - new SvgIconSource("noboder", "com/fine/theme/icon/noboder.svg", true), - new SvgIconSource("merge", "com/fine/theme/icon/merge/merge.svg", true), - new SvgIconSource("unmerge", "com/fine/theme/icon/merge/unmerge.svg", true), - new SvgIconSource("bind_column", "com/fine/theme/icon/bindcolumn/bind_column.svg", true), - new SvgIconSource("text", "com/fine/theme/icon/insert/text.svg", true), - new SvgIconSource("richtext", "com/fine/theme/icon/insert/richtext.svg", true), - new SvgIconSource("formula", "com/fine/theme/icon/insert/formula.svg", true), - new SvgIconSource("chart", "com/fine/theme/icon/insert/chart.svg", true), - new SvgIconSource("image", "com/fine/theme/icon/insert/image.svg", true), - new SvgIconSource("bias", "com/fine/theme/icon/insert/bias.svg", true), - new SvgIconSource("sub_report", "com/fine/theme/icon/insert/sub_report.svg", true), - new SvgIconSource("chart_line", "com/fine/theme/icon/chart/chart_line.svg", true), - new SvgIconSource("popup", "com/fine/theme/icon/popup/popup.svg", true), - new SvgIconSource("clear", "com/fine/theme/icon/clear.svg", true), - new SvgIconSource("clear_hover", "com/fine/theme/icon/clear_hover.svg", true), - - // 工具栏 - new SvgIconSource("tool_copy", "com/fine/theme/icon/toolbar/copy.svg", true), - new SvgIconSource("move_down", "com/fine/theme/icon/toolbar/move_down.svg", true), - new SvgIconSource("move_up", "com/fine/theme/icon/toolbar/move_up.svg", true), - new SvgIconSource("move_left", "com/fine/theme/icon/toolbar/move_left.svg", true), - new SvgIconSource("move_right", "com/fine/theme/icon/toolbar/move_right.svg", true), - new SvgIconSource("to_top", "com/fine/theme/icon/toolbar/to_top.svg", true), - new SvgIconSource("to_bottom", "com/fine/theme/icon/toolbar/to_bottom.svg", true), - new SvgIconSource("tool_edit", "com/fine/theme/icon/toolbar/edit.svg", true), - new SvgIconSource("tool_edit_white", "com/fine/theme/icon/toolbar/edit_white.svg", true), - new SvgIconSource("tool_more", "com/fine/theme/icon/toolbar/more.svg", true), - new SvgIconSource("tool_more_hover", "com/fine/theme/icon/toolbar/more_hover.svg"), - new SvgIconSource("tool_config", "com/fine/theme/icon/toolbar/config.svg", true), - new SvgIconSource("add_popup", "com/fine/theme/icon/toolbar/add_popup.svg", true), - new SvgIconSource("bracket", "com/fine/theme/icon/toolbar/bracket.svg", true), - new SvgIconSource("unBracket", "com/fine/theme/icon/toolbar/unBracket.svg", true), - - // 参数面板 - new SvgIconSource("param_edit", "com/fine/theme/icon/param/edit.svg", true, 24), - new SvgIconSource("param_edit_pressed", "com/fine/theme/icon/param/edit_pressed.svg", true, 24), - new SvgIconSource("param_hide", "com/fine/theme/icon/param/hide.svg", true, 24), - new SvgIconSource("param_hide_pressed", "com/fine/theme/icon/param/hide_pressed.svg", true, 24), - new SvgIconSource("param_view", "com/fine/theme/icon/param/view.svg", true, 18), - new SvgIconSource("param", "com/fine/theme/icon/param/param.svg", true), - new SvgIconSource("locked", "com/fine/theme/icon/lock/locked.svg", true, 16), - new SvgIconSource("unlocked", "com/fine/theme/icon/lock/unlocked.svg", true, 16), - - // 北区菜单栏 - //文件 - new SvgIconSource("notification", "com/fine/theme/icon/notification/notification.svg"), - new SvgIconSource("notification_dot", "com/fine/theme/icon/notification/notification_dot.svg"), - new SvgIconSource("createCpt", "com/fine/theme/icon/toolbar/createCpt.svg", true), - new SvgIconSource("createOther", "com/fine/theme/icon/toolbar/createOther.svg", true), - new SvgIconSource("openTemplate", "com/fine/theme/icon/toolbar/openTemplate.svg", true), - new SvgIconSource("switchEnv", "com/fine/theme/icon/toolbar/switchEnv.svg", true), - new SvgIconSource("export", "com/fine/theme/icon/toolbar/export.svg", true), - new SvgIconSource("monochrome_undo", "com/fine/theme/icon/toolbar/monochrome_undo.svg", true), - new SvgIconSource("monochrome_redo", "com/fine/theme/icon/toolbar/monochrome_redo.svg", true), - new SvgIconSource("saveAs", "com/fine/theme/icon/toolbar/saveAs.svg", true), - // 模板 - new SvgIconSource("widgetThemeMenu", "com/fine/theme/icon/toolbar/widgetThemeMenu.svg", true), - new SvgIconSource("datasource", "com/fine/theme/icon/toolbar/datasource.svg", true), - new SvgIconSource("webReportAttribute", "com/fine/theme/icon/toolbar/webReportAttribute.svg", true), - new SvgIconSource("reportParameter", "com/fine/theme/icon/toolbar/reportParameter.svg", true), - new SvgIconSource("reportFit", "com/fine/theme/icon/toolbar/reportFit.svg", true), - new SvgIconSource("mobileAttr", "com/fine/theme/icon/toolbar/mobileAttr.svg", true), - new SvgIconSource("watermark", "com/fine/theme/icon/toolbar/watermark.svg", true), - new SvgIconSource("print", "com/fine/theme/icon/toolbar/print.svg", true), - new SvgIconSource("pageSetup", "com/fine/theme/icon/toolbar/pageSetup.svg", true), - new SvgIconSource("reportHeader", "com/fine/theme/icon/toolbar/reportHeader.svg", true), - new SvgIconSource("reportFooter", "com/fine/theme/icon/toolbar/reportFooter.svg", true), - new SvgIconSource("reportBackground", "com/fine/theme/icon/toolbar/reportBackground.svg", true), - new SvgIconSource("reportWriteAttr", "com/fine/theme/icon/toolbar/reportWriteAttr.svg", true), - new SvgIconSource("linearAttr", "com/fine/theme/icon/toolbar/linearAttr.svg", true), - new SvgIconSource("repeatAndFrozen", "com/fine/theme/icon/toolbar/repeatAndFrozen.svg", true), - new SvgIconSource("reportEngineAttr", "com/fine/theme/icon/toolbar/reportEngineAttr.svg", true), - new SvgIconSource("allowAuthorityEdit", "com/fine/theme/icon/toolbar/allowAuthorityEdit.svg", true), - new SvgIconSource("replace", "com/fine/theme/icon/toolbar/replace.svg", true), - // 服务器 - new SvgIconSource("monochromeServerDatabase", "com/fine/theme/icon/toolbar/monochromeServerDatabase.svg", true), - new SvgIconSource("platform", "com/fine/theme/icon/toolbar/platform.svg", true), - new SvgIconSource("pluginManager", "com/fine/theme/icon/toolbar/pluginManager.svg", true), - new SvgIconSource("functionManager", "com/fine/theme/icon/toolbar/functionManager.svg", true), - new SvgIconSource("serverConfigManager", "com/fine/theme/icon/toolbar/serverConfigManager.svg", true), - new SvgIconSource("widgetManager", "com/fine/theme/icon/toolbar/widgetManager.svg", true), - new SvgIconSource("chartPreStyle", "com/fine/theme/icon/toolbar/chartPreStyle.svg", true), - new SvgIconSource("chartEmptyDataStyle", "com/fine/theme/icon/toolbar/chartEmptyDataStyle.svg", true), - new SvgIconSource("charMapData", "com/fine/theme/icon/toolbar/charMapData.svg", true), - // 帮助 - new SvgIconSource("demo", "com/fine/theme/icon/toolbar/demo.svg", true), - new SvgIconSource("update", "com/fine/theme/icon/toolbar/update.svg", true), - new SvgIconSource("envDetect", "com/fine/theme/icon/toolbar/envDetect.svg", true), - new SvgIconSource("servicePlatform", "com/fine/theme/icon/toolbar/servicePlatform.svg", true), - // 社区 - new SvgIconSource("bbs", "com/fine/theme/icon/toolbar/bbs.svg", true), - new SvgIconSource("video", "com/fine/theme/icon/toolbar/video.svg", true), - new SvgIconSource("help", "com/fine/theme/icon/toolbar/help.svg", true), - new SvgIconSource("studyPlan", "com/fine/theme/icon/toolbar/studyPlan.svg", true), - new SvgIconSource("question", "com/fine/theme/icon/toolbar/question.svg", true), - new SvgIconSource("solution", "com/fine/theme/icon/toolbar/solution.svg", true), - new SvgIconSource("templateStore", "com/fine/theme/icon/toolbar/templateStore.svg", true), - new SvgIconSource("bug", "com/fine/theme/icon/toolbar/bug.svg", true), - new SvgIconSource("need", "com/fine/theme/icon/toolbar/need.svg", true), - new SvgIconSource("workOrderCenter", "com/fine/theme/icon/toolbar/workOrderCenter.svg", true), - new SvgIconSource("actCenter", "com/fine/theme/icon/toolbar/actCenter.svg", true), - new SvgIconSource("sign", "com/fine/theme/icon/toolbar/sign.svg", true), - - //东区面板 - new SvgIconSource("cellelement_small", "com/fine/theme/icon/cellelement.svg"), - new SvgIconSource("forbid", "com/fine/theme/icon/expand/forbid.svg"), - new SvgIconSource("horizontal_expand", "com/fine/theme/icon/expand/horizontal.svg"), - new SvgIconSource("vertical_expand", "com/fine/theme/icon/expand/vertical.svg"), - - // 三角 - new SvgIconSource("triangle_down", "com/fine/theme/icon/triangle/triangle_down.svg"), - new SvgIconSource("triangle_down_small", "com/fine/theme/icon/triangle/triangle_down_small.svg"), - new SvgIconSource("triangle_left", "com/fine/theme/icon/triangle/triangle_left.svg"), - new SvgIconSource("triangle_left_small", "com/fine/theme/icon/triangle/triangle_left_small.svg"), - new SvgIconSource("triangle_right", "com/fine/theme/icon/triangle/triangle_right.svg"), - new SvgIconSource("triangle_right_small", "com/fine/theme/icon/triangle/triangle_right_small.svg"), - - // 滚动条 - new SvgIconSource("zoomIn", "com/fine/theme/icon/zoom/zoomIn.svg", true), - new SvgIconSource("zoomOut", "com/fine/theme/icon/zoom/zoomOut.svg", true), - - //排序 - new SvgIconSource("sort_asc", "com/fine/theme/icon/sort/sort_asc.svg", true), - new SvgIconSource("sort_desc", "com/fine/theme/icon/sort/sort_desc.svg", true), - new SvgIconSource("nosort", "com/fine/theme/icon/sort/nosort.svg", true), - - // 关闭 - new SvgIconSource("close", "com/fine/theme/icon/close/close.svg", true), - new SvgIconSource("close_round", "com/fine/theme/icon/close/close_round.svg", true), - - // 文字样式 - new SvgIconSource("add_parenthesis", "com/fine/theme/icon/font/add_parenthesis.svg", true), - new SvgIconSource("remove_parenthesis", "com/fine/theme/icon/font/remove_parenthesis.svg", true), - new SvgIconSource("shadow", "com/fine/theme/icon/font/shadow.svg", true), - new SvgIconSource("strike", "com/fine/theme/icon/font/strike.svg", true), - new SvgIconSource("sub", "com/fine/theme/icon/font/sub.svg", true), - new SvgIconSource("super", "com/fine/theme/icon/font/super.svg", true), - - new SvgIconSource("dot", "com/fine/theme/icon/dot.svg", true), - new SvgIconSource("expand_popup", "com/fine/theme/icon/popup/expand_popup.svg"), - new SvgIconSource("collapse_popup", "com/fine/theme/icon/popup/collapse_popup.svg"), - - new SvgIconSource("logMsg", "com/fine/theme/icon/log/logMsg.svg", true), - new SvgIconSource("logMsg_dot", "com/fine/theme/icon/log/logMsg_dot.svg", true), - - // 右键弹窗 - new SvgIconSource("cellClear", "com/fine/theme/icon/cell/cellClear.svg", true), - new SvgIconSource("cellExpandAttr", "com/fine/theme/icon/cell/cellExpandAttr.svg", true), - new SvgIconSource("cellStyleAttr", "com/fine/theme/icon/cell/cellStyleAttr.svg", true), - new SvgIconSource("cellOtherAttr", "com/fine/theme/icon/cell/cellOtherAttr.svg", true), - new SvgIconSource("cellWidgetAttr", "com/fine/theme/icon/cell/cellWidgetAttr.svg", true), - new SvgIconSource("cellConditionalAttr", "com/fine/theme/icon/cell/cellConditionalAttr.svg", true), - new SvgIconSource("cellHyperLinkAttr", "com/fine/theme/icon/cell/cellHyperLinkAttr.svg", true), - new SvgIconSource("cellPresentAttr", "com/fine/theme/icon/cell/cellPresentAttr.svg", true), - new SvgIconSource("cellElementAttr", "com/fine/theme/icon/cell/cellElementAttr.svg", true), - new SvgIconSource("move", "com/fine/theme/icon/filetree/move.svg", true), - new SvgIconSource("monochrome_copy", "com/fine/theme/icon/filetree/monochrome_copy.svg", true), - new SvgIconSource("monochrome_paste", "com/fine/theme/icon/filetree/monochrome_paste.svg", true), - new SvgIconSource("monochrome_cut", "com/fine/theme/icon/filetree/monochrome_cut.svg", true), - - // 控件 - new SvgIconSource("button", "com/fine/theme/icon/widget/button.svg", true), - new SvgIconSource("button_group", "com/fine/theme/icon/widget/button_group.svg", true), - new SvgIconSource("check_box", "com/fine/theme/icon/widget/checkbox.svg", true), - new SvgIconSource("checkbox_group", "com/fine/theme/icon/widget/checkbox_group.svg", true), - new SvgIconSource("combo_box", "com/fine/theme/icon/widget/combo_box.svg", true), - new SvgIconSource("combo_check", "com/fine/theme/icon/widget/combo_check.svg", true), - new SvgIconSource("comboboxtree", "com/fine/theme/icon/widget/comboboxtree.svg", true), - new SvgIconSource("date", "com/fine/theme/icon/widget/date.svg", true), - new SvgIconSource("files_up", "com/fine/theme/icon/widget/files_up.svg", true), - new SvgIconSource("iframe", "com/fine/theme/icon/widget/iframe.svg", true), - new SvgIconSource("label", "com/fine/theme/icon/widget/label.svg", true), - new SvgIconSource("number_field", "com/fine/theme/icon/widget/number_field.svg", true), - new SvgIconSource("password_field", "com/fine/theme/icon/widget/password_field.svg", true), - new SvgIconSource("picture", "com/fine/theme/icon/widget/picture.svg", true), - new SvgIconSource("widget_preview", "com/fine/theme/icon/widget/preview.svg", true), - new SvgIconSource("prewidget", "com/fine/theme/icon/widget/prewidget.svg", true), - new SvgIconSource("tab", "com/fine/theme/icon/widget/tab.svg", true), - new SvgIconSource("text_area", "com/fine/theme/icon/widget/text_area.svg", true), - new SvgIconSource("text_field", "com/fine/theme/icon/widget/text_field.svg", true), - new SvgIconSource("widget_tree", "com/fine/theme/icon/widget/tree.svg", true) - - ); +public class FineLightIconSet extends JsonIconSet { + public FineLightIconSet() { + super(new UrlIconResource("com/fine/theme/light/ui/fine_light.icon.json")); } } diff --git a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java index c0903f644c..7a64b47c22 100644 --- a/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java +++ b/designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java @@ -6,16 +6,15 @@ import com.fr.base.vcs.DesignerMode; import com.fr.design.base.mode.DesignModeContext; import com.fr.design.constants.UIConstants; import com.fr.design.gui.ibutton.UIButton; -import com.fr.design.gui.ibutton.UIButtonUI; import com.fr.design.gui.ilable.UILabel; import com.fr.design.mainframe.DesignerContext; import com.fr.design.utils.gui.GUICoreUtils; +import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLayeredPane; import javax.swing.JPanel; -import javax.swing.Icon; import javax.swing.UIManager; import javax.swing.plaf.basic.BasicButtonUI; import java.awt.AlphaComposite; @@ -33,6 +32,7 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; public class UIModeControlContainer extends JLayeredPane { + private static final int ICON_WIDTH = 18; private static int DIM_HEIGHT = 30; private static final int NUM32 = 32; private static final int NUM5 = 5; @@ -287,7 +287,8 @@ public class UIModeControlContainer extends JLayeredPane { setLayout(new FlowLayout(FlowLayout.CENTER, 10, -3)); setBackground(UIConstants.NORMAL_BACKGROUND); add(new UILabel("" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel") + "")); - UIButton viewButton = new LargeButton(new LazyIcon("param_view"), new LazyIcon("param_view"), new LazyIcon("param_view")) { + LazyIcon paramViewIcon = new LazyIcon("param_view", ICON_WIDTH); + UIButton viewButton = new LargeButton(paramViewIcon, paramViewIcon, paramViewIcon) { @Override public Dimension getPreferredSize() { return new Dimension(32, 32); @@ -378,8 +379,8 @@ public class UIModeControlContainer extends JLayeredPane { } }); - editButton = new LargeButton(new LazyIcon("param_edit"), new LazyIcon("param_edit_pressed"), new LazyIcon("param_edit_pressed")); - hideButton = new LargeButton(new LazyIcon("param_hide"), new LazyIcon("param_hide_pressed"), new LazyIcon("param_hide_pressed")); + editButton = new LargeButton(new LazyIcon("param_edit", 24), new LazyIcon("param_edit_pressed", 24), new LazyIcon("param_edit_pressed", 24)); + hideButton = new LargeButton(new LazyIcon("param_hide", 24), new LazyIcon("param_hide_pressed", 24), new LazyIcon("param_hide_pressed", 24)); editButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { diff --git a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java index 6f891afc7b..b47d162a27 100644 --- a/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java +++ b/designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java @@ -47,6 +47,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, private final Insets defaultInsets = new Insets(0, 6, 0, 6); private final int defaultButtonSize = 24; + private final int ICON_WIDTH = 12; protected double value; private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2; private UINumberField textField; @@ -173,6 +174,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, /** * 赋值但不触发保存,只是展现,一般是populate的时候用 + * * @param value */ public void setValueWithoutEvent(double value) { @@ -196,7 +198,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, } } - protected void setTextField(double value){ + protected void setTextField(double value) { textField.getDocument().removeDocumentListener(docListener); textField.setValue(value); textField.getDocument().addDocumentListener(docListener); @@ -219,7 +221,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, /** * 设置Spinner内的数字输入框列数 - * @param numberFieldColumns 输入框列数 + * + * @param numberFieldColumns 输入框列数 */ public void setNumberFieldColumns(int numberFieldColumns) { textField.setColumns(numberFieldColumns); @@ -286,8 +289,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, textField.setOpaque(false); setValue(value); - preButton = createArrowButton(new LazyIcon("up_arrow_12")); - nextButton = createArrowButton(new LazyIcon("down_arrow_12")); + preButton = createArrowButton(new LazyIcon("up_arrow", ICON_WIDTH)); + nextButton = createArrowButton(new LazyIcon("down_arrow", ICON_WIDTH)); setLayout(new BorderLayout()); add(textField, BorderLayout.CENTER); JPanel arrowPane = new JPanel(); @@ -315,6 +318,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, /** * 设置最大值 + * * @param maxValue 最大值 */ public void setMaxValue(double maxValue) { @@ -357,7 +361,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver, initTextFiledListeners(); } - protected void initTextFiledListeners(){ + protected void initTextFiledListeners() { textField.getDocument().removeDocumentListener(docListener); textField.getDocument().addDocumentListener(docListener); textField.addFocusListener(new FocusAdapter() { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java index 0b564ced10..6d33c5946b 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java @@ -72,6 +72,7 @@ import java.util.Set; import static com.fine.theme.utils.FineUIStyle.STYLE_TEXT; import static com.fine.theme.utils.FineUIStyle.setStyle; +import static com.fr.design.i18n.Toolkit.i18nText; public class EastRegionContainerPane extends UIEastResizableContainer { private static volatile EastRegionContainerPane THIS; @@ -111,13 +112,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer { public enum PropertyMode { REPORT, // 报表 REPORT_PARA_WIDGET, //报表参数面板中的控件 - REPORT_PARA(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 报表参数面板 + REPORT_PARA(i18nText("Fine-Design_Basic_Component_Settings")), // 报表参数面板 REPORT_FLOAT, // 报表悬浮元素 - FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单 + FORM(i18nText("Fine-Design_Basic_Component_Settings")), // 表单 FORM_REPORT, // 表单报表块 POLY, // 聚合报表 POLY_REPORT, // 聚合报表-报表块 - POLY_CHART(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 聚合报表-图表块 + POLY_CHART(i18nText("Fine-Design_Basic_Component_Settings")), // 聚合报表-图表块 AUTHORITY_EDITION, // 权限编辑 AUTHORITY_EDITION_DISABLED, // 权限编辑 DUCHAMP_REPORT; @@ -125,7 +126,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private String title; PropertyMode() { - this.title = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Settings"); + this.title = i18nText("Fine-Design_Basic_Widget_Settings"); } PropertyMode(String title) { @@ -167,8 +168,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private EastRegionContainerPane() { super(); initPropertyItemList(); - defaultPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No_Settings_Available")); - defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); + defaultPane = getDefaultPane(i18nText("Fine-Design_Basic_No_Settings_Available")); + defaultAuthorityPane = getDefaultPane(i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); switchMode(PropertyMode.REPORT); setContainerWidth(CONTAINER_WIDTH); @@ -284,19 +285,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer { propertyItemMap = new LinkedHashMap<>(); // 有序map // 单元格元素 - PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Element"), + PropertyItem cellElement = new PropertyItem(KEY_CELL_ELEMENT, i18nText("Fine-Design_Basic_Cell_Element"), "cellelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 单元格属性 - PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Cell_Attributes"), + PropertyItem cellAttr = new PropertyItem(KEY_CELL_ATTR, i18nText("Fine-Design_Basic_Cell_Attributes"), "cellattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 悬浮元素 - PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Float_Element"), + PropertyItem floatElement = new PropertyItem(KEY_FLOAT_ELEMENT, i18nText("Fine-Design_Basic_Float_Element"), "floatelement", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.POLY_REPORT}); // 控件设置 - PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings"), + PropertyItem widgetSettings = new PropertyItem(KEY_WIDGET_SETTINGS, i18nText("Fine-Design_Basic_Component_Settings"), "widgetsettings", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.FORM, PropertyMode.POLY}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}, new ActionListener() { @Override @@ -305,18 +306,18 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } }); // 条件属性 - PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Condition_Attributes"), + PropertyItem conditionAttr = new PropertyItem(KEY_CONDITION_ATTR, i18nText("Fine-Design_Basic_Condition_Attributes"), "conditionattr", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 超级链接 - PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Hyperlink"), + PropertyItem hyperlink = new PropertyItem(KEY_HYPERLINK, i18nText("Fine-Design_Report_Hyperlink"), "hyperlink", new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.REPORT_FLOAT, PropertyMode.POLY, PropertyMode.POLY_CHART}, new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT}); // 组件库 widgetLibSnapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT); PropertyItem widgetLib = new PropertyItem( KEY_WIDGET_LIB, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"), + i18nText("Fine-Design_Basic_Widget_Library"), "widgetlib", new PropertyMode[]{PropertyMode.FORM}, new PropertyMode[]{PropertyMode.FORM}, @@ -330,11 +331,11 @@ public class EastRegionContainerPane extends UIEastResizableContainer { } }); // 权限编辑 - PropertyItem authorityEdition = new PropertyItem(KEY_AUTHORITY_EDITION, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Permissions_Edition"), + PropertyItem authorityEdition = new PropertyItem(KEY_AUTHORITY_EDITION, i18nText("Fine-Design_Report_Permissions_Edition"), "authorityedit", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION_DISABLED}, new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); // 已配置角色 - PropertyItem configuredRoles = new PropertyItem(KEY_CONFIGURED_ROLES, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Configured_Roles"), + PropertyItem configuredRoles = new PropertyItem(KEY_CONFIGURED_ROLES, i18nText("Fine-Design_Basic_Configured_Roles"), "configuredroles", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION_DISABLED}, new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); @@ -975,7 +976,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { button.setBackground(new Color(0, 0, 0, 0)); if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { iconSuffix = ICON_SUFFIX_NORMAL; - button.setIcon(new LazyIcon(getBtnIconId())); + button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH)); button.setOpaque(false); } else if (ICON_SUFFIX_SELECTED_DEPRECATED.equals(iconSuffix)) { iconSuffix = ICON_SUFFIX_NORMAL_DEPRECATED; @@ -988,7 +989,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { resetPropertyIcons(); if (StringUtils.isEmpty(iconBaseDir)) { iconSuffix = ICON_SUFFIX_SELECTED; - button.setIcon(new LazyIcon(getBtnIconId())); + button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH)); } else { iconSuffix = ICON_SUFFIX_SELECTED_DEPRECATED; button.setIcon(IconUtils.readIcon(getBtnIconUrl())); @@ -1033,8 +1034,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer { private void initButtonIcon() { if (StringUtils.isEmpty(iconBaseDir)) { - button.setIcon(new LazyIcon(getBtnIconId())); - button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED)); + button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH)); + button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED, ICON_WIDTH)); } else { button.setIcon(IconUtils.readIcon(getBtnIconUrl())); button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED_DEPRECATED)); @@ -1371,7 +1372,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer { initListener(); this.setVisible(true); - defaultPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No_Settings_Available")); + defaultPane = getDefaultPane(i18nText("Fine-Design_Basic_No_Settings_Available")); } public void showDefaultPane() { diff --git a/designer-base/src/main/resources/com/fine/theme/icon/default.svg b/designer-base/src/main/resources/com/fine/theme/icon/default.svg new file mode 100644 index 0000000000..d27d416384 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/default.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json new file mode 100644 index 0000000000..b0a6aca0b7 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -0,0 +1,278 @@ +{ + "name": "Fine light", + "dark": false, + "author": "fine", + "base": "com/fine/theme/icon/", + "icons": { + "cut": "cut.svg", + "save": "save.svg", + "copy": "copy.svg", + "formatBrush": "formatBrush.svg", + "paste": "paste.svg", + "undo": "undo.svg", + "redo": "redo.svg", + "version_save": "version_save.svg", + "font_miss_check": "font_miss_check.svg", + "template_theme": "template_theme.svg", + "remove": "remove.svg", + "search": "search.svg", + "add": "add.svg", + "drag_left": "drag_left.svg", + "drag_right": "drag_right.svg", + "down_arrow": "down_arrow.svg", + "up_arrow": "up_arrow.svg", + "select": "select.svg", + "database": "dataset/database.svg", + "preview": "dataset/preview.svg", + "connection": "dataset/connection.svg", + "class_table_data": "dataset/class_table_data.svg", + "data_table": "dataset/data_table.svg", + "multi": "dataset/multi.svg", + "file": "dataset/file.svg", + "tree": "dataset/tree.svg", + "store_procedure": "dataset/store_procedure.svg", + "batch_esd_on": "dataset/batch_esd_on.svg", + "batch_esd_off": "dataset/batch_esd_off.svg", + "edit": "dataset/edit.svg", + "server_database": "dataset/server_database.svg", + "field": "dataset/field.svg", + "folder": "filetree/folder.svg", + "folder_open": "filetree/folder_open.svg", + "cpt_icon": "filetree/cpt_icon.svg", + "frm_icon": "filetree/frm_icon.svg", + "fvs_icon": "filetree/fvs_icon.svg", + "excel_icon": "filetree/excel_icon.svg", + "minus": "filetree/minus.svg", + "plus": "filetree/plus.svg", + "locate": "filetree/locate.svg", + "rename": "filetree/rename.svg", + "collapse_all": "filetree/collapse_all.svg", + "vcs_list": "filetree/vcs_list.svg", + "view_folder": "filetree/view_folder.svg", + "refresh": "filetree/refresh.svg", + "new_folder": "filetree/new_folder.svg", + "add_report": "filetree/filetype/add_report.svg", + "add_word": "filetree/filetype/add_word.svg", + "bmpFile": "filetree/filetype/bmpFile.svg", + "chtFile": "filetree/filetype/chtFile.svg", + "classFile": "filetree/filetype/classFile.svg", + "cpt_locked": "filetree/filetype/cpt_locked.svg", + "excel_import": "filetree/filetype/excel_import.svg", + "excelFile": "filetree/filetype/excelFile.svg", + "flashFile": "filetree/filetype/flashFile.svg", + "frm_locked": "filetree/filetype/frm_locked.svg", + "gifFile": "filetree/filetype/gifFile.svg", + "htmlFile": "filetree/filetype/htmlFile.svg", + "jarFile": "filetree/filetype/jarFile.svg", + "javaFile": "filetree/filetype/javaFile.svg", + "jpgFile": "filetree/filetype/jpgFile.svg", + "jsFile": "filetree/filetype/jsFile.svg", + "jspFile": "filetree/filetype/jspFile.svg", + "pdfFile": "filetree/filetype/pdfFile.svg", + "pngFile": "filetree/filetype/pngFile.svg", + "sqlFile": "filetree/filetype/sqlFile.svg", + "wordFile": "filetree/filetype/wordFile.svg", + "xlsFile": "filetree/filetype/xlsFile.svg", + "xmlFile": "filetree/filetype/xmlFile.svg", + "cellattr": "propertiestab/cellattr.svg", + "cellattr_disabled": "propertiestab/cellattr_disabled.svg", + "cellattr_selected": "propertiestab/cellattr_selected.svg", + "cellelement": "propertiestab/cellelement.svg", + "cellelement_disabled": "propertiestab/cellelement_disabled.svg", + "cellelement_selected": "propertiestab/cellelement_selected.svg", + "conditionattr": "propertiestab/conditionattr.svg", + "conditionattr_disabled": "propertiestab/conditionattr_disabled.svg", + "conditionattr_selected": "propertiestab/conditionattr_selected.svg", + "floatelement": "propertiestab/floatelement.svg", + "floatelement_disabled": "propertiestab/floatelement_disabled.svg", + "floatelement_selected": "propertiestab/floatelement_selected.svg", + "hyperlink": "propertiestab/hyperlink.svg", + "hyperlink_disabled": "propertiestab/hyperlink_disabled.svg", + "hyperlink_selected": "propertiestab/hyperlink_selected.svg", + "widgetlib": "propertiestab/widgetlib.svg", + "widgetlib_disabled": "propertiestab/widgetlib_disabled.svg", + "widgetlib_selected": "propertiestab/widgetlib_selected.svg", + "widgetsettings": "propertiestab/widgetsettings.svg", + "widgetsettings_disabled": "propertiestab/widgetsettings_disabled.svg", + "widgetsettings_selected": "propertiestab/widgetsettings_selected.svg", + "configuredroles": "propertiestab/configuredroles.svg", + "configuredroles_selected": "propertiestab/configuredroles_selected.svg", + "configuredroles_disabled": "propertiestab/configuredroles_disabled.svg", + "authorityedit": "propertiestab/authorityedit.svg", + "authorityedit_disabled": "propertiestab/authorityedit_disabled.svg", + "authorityedit_selected": "propertiestab/authorityedit_selected.svg", + "add_worksheet": "sheet/add_sheet.svg", + "add_polysheet": "sheet/add_frm.svg", + "checkbox_checked": "checkbox/checked.svg", + "checkbox_unchecked": "checkbox/unchecked.svg", + "checkbox_part_checked": "checkbox/part_checked.svg", + "checkbox_hovered": "checkbox/hovered.svg", + "radio_selected": "radio/radio_selected.svg", + "radio_unselected": "radio/radio_unselected.svg", + "bold": "font/bold.svg", + "italic": "font/italic.svg", + "underline": "font/underline.svg", + "foreground": "font/foreground.svg", + "background": "font/background.svg", + "h_left": "cellstyle/h_left.svg", + "h_center": "cellstyle/h_center.svg", + "h_right": "cellstyle/h_right.svg", + "h_justify": "cellstyle/h_justify.svg", + "h_normal": "cellstyle/h_normal.svg", + "v_top": "cellstyle/v_top.svg", + "v_center": "cellstyle/v_center.svg", + "v_bottom": "cellstyle/v_bottom.svg", + "noboder": "noboder.svg", + "merge": "merge/merge.svg", + "unmerge": "merge/unmerge.svg", + "bind_column": "bindcolumn/bind_column.svg", + "text": "insert/text.svg", + "richtext": "insert/richtext.svg", + "formula": "insert/formula.svg", + "chart": "insert/chart.svg", + "image": "insert/image.svg", + "bias": "insert/bias.svg", + "sub_report": "insert/sub_report.svg", + "chart_line": "chart/chart_line.svg", + "popup": "popup/popup.svg", + "clear": "clear.svg", + "clear_hover": "clear_hover.svg", + "tool_copy": "toolbar/copy.svg", + "move_down": "toolbar/move_down.svg", + "move_up": "toolbar/move_up.svg", + "move_left": "toolbar/move_left.svg", + "move_right": "toolbar/move_right.svg", + "to_top": "toolbar/to_top.svg", + "to_bottom": "toolbar/to_bottom.svg", + "tool_edit": "toolbar/edit.svg", + "tool_edit_white": "toolbar/edit_white.svg", + "tool_more": "toolbar/more.svg", + "tool_more_hover": "toolbar/more_hover.svg", + "tool_config": "toolbar/config.svg", + "add_popup": "toolbar/add_popup.svg", + "bracket": "toolbar/bracket.svg", + "unBracket": "toolbar/unBracket.svg", + "param_edit": "param/edit.svg", + "param_edit_pressed": "param/edit_pressed.svg", + "param_hide": "param/hide.svg", + "param_hide_pressed": "param/hide_pressed.svg", + "param_view": "param/view.svg", + "param": "param/param.svg", + "locked": "lock/locked.svg", + "unlocked": "lock/unlocked.svg", + "notification": "notification/notification.svg", + "notification_dot": "notification/notification_dot.svg", + "createCpt": "toolbar/createCpt.svg", + "createOther": "toolbar/createOther.svg", + "openTemplate": "toolbar/openTemplate.svg", + "switchEnv": "toolbar/switchEnv.svg", + "export": "toolbar/export.svg", + "monochrome_undo": "toolbar/monochrome_undo.svg", + "monochrome_redo": "toolbar/monochrome_redo.svg", + "saveAs": "toolbar/saveAs.svg", + "widgetThemeMenu": "toolbar/widgetThemeMenu.svg", + "datasource": "toolbar/datasource.svg", + "webReportAttribute": "toolbar/webReportAttribute.svg", + "reportParameter": "toolbar/reportParameter.svg", + "reportFit": "toolbar/reportFit.svg", + "mobileAttr": "toolbar/mobileAttr.svg", + "watermark": "toolbar/watermark.svg", + "print": "toolbar/print.svg", + "pageSetup": "toolbar/pageSetup.svg", + "reportHeader": "toolbar/reportHeader.svg", + "reportFooter": "toolbar/reportFooter.svg", + "reportBackground": "toolbar/reportBackground.svg", + "reportWriteAttr": "toolbar/reportWriteAttr.svg", + "linearAttr": "toolbar/linearAttr.svg", + "repeatAndFrozen": "toolbar/repeatAndFrozen.svg", + "reportEngineAttr": "toolbar/reportEngineAttr.svg", + "allowAuthorityEdit": "toolbar/allowAuthorityEdit.svg", + "replace": "toolbar/replace.svg", + "monochromeServerDatabase": "toolbar/monochromeServerDatabase.svg", + "platform": "toolbar/platform.svg", + "pluginManager": "toolbar/pluginManager.svg", + "functionManager": "toolbar/functionManager.svg", + "serverConfigManager": "toolbar/serverConfigManager.svg", + "widgetManager": "toolbar/widgetManager.svg", + "chartPreStyle": "toolbar/chartPreStyle.svg", + "chartEmptyDataStyle": "toolbar/chartEmptyDataStyle.svg", + "charMapData": "toolbar/charMapData.svg", + "demo": "toolbar/demo.svg", + "update": "toolbar/update.svg", + "envDetect": "toolbar/envDetect.svg", + "servicePlatform": "toolbar/servicePlatform.svg", + "bbs": "toolbar/bbs.svg", + "video": "toolbar/video.svg", + "help": "toolbar/help.svg", + "studyPlan": "toolbar/studyPlan.svg", + "question": "toolbar/question.svg", + "solution": "toolbar/solution.svg", + "templateStore": "toolbar/templateStore.svg", + "bug": "toolbar/bug.svg", + "need": "toolbar/need.svg", + "workOrderCenter": "toolbar/workOrderCenter.svg", + "actCenter": "toolbar/actCenter.svg", + "sign": "toolbar/sign.svg", + "cellelement_small": "cellelement.svg", + "forbid": "expand/forbid.svg", + "horizontal_expand": "expand/horizontal.svg", + "vertical_expand": "expand/vertical.svg", + "triangle_down": "triangle/triangle_down.svg", + "triangle_down_small": "triangle/triangle_down_small.svg", + "triangle_left": "triangle/triangle_left.svg", + "triangle_left_small": "triangle/triangle_left_small.svg", + "triangle_right": "triangle/triangle_right.svg", + "triangle_right_small": "triangle/triangle_right_small.svg", + "zoomIn": "zoom/zoomIn.svg", + "zoomOut": "zoom/zoomOut.svg", + "sort_asc": "sort/sort_asc.svg", + "sort_desc": "sort/sort_desc.svg", + "nosort": "sort/nosort.svg", + "close": "close/close.svg", + "close_round": "close/close_round.svg", + "add_parenthesis": "font/add_parenthesis.svg", + "remove_parenthesis": "font/remove_parenthesis.svg", + "shadow": "font/shadow.svg", + "strike": "font/strike.svg", + "sub": "font/sub.svg", + "super": "font/super.svg", + "dot": "dot.svg", + "expand_popup": "popup/expand_popup.svg", + "collapse_popup": "popup/collapse_popup.svg", + "logMsg": "log/logMsg.svg", + "logMsg_dot": "log/logMsg_dot.svg", + "cellClear": "cell/cellClear.svg", + "cellExpandAttr": "cell/cellExpandAttr.svg", + "cellStyleAttr": "cell/cellStyleAttr.svg", + "cellOtherAttr": "cell/cellOtherAttr.svg", + "cellWidgetAttr": "cell/cellWidgetAttr.svg", + "cellConditionalAttr": "cell/cellConditionalAttr.svg", + "cellHyperLinkAttr": "cell/cellHyperLinkAttr.svg", + "cellPresentAttr": "cell/cellPresentAttr.svg", + "cellElementAttr": "cell/cellElementAttr.svg", + "move": "filetree/move.svg", + "monochrome_copy": "filetree/monochrome_copy.svg", + "monochrome_paste": "filetree/monochrome_paste.svg", + "monochrome_cut": "filetree/monochrome_cut.svg", + "button": "widget/button.svg", + "button_group": "widget/button_group.svg", + "check_box": "widget/checkbox.svg", + "checkbox_group": "widget/checkbox_group.svg", + "combo_box": "widget/combo_box.svg", + "combo_check": "widget/combo_check.svg", + "comboboxtree": "widget/comboboxtree.svg", + "date": "widget/date.svg", + "files_up": "widget/files_up.svg", + "iframe": "widget/iframe.svg", + "label": "widget/label.svg", + "number_field": "widget/number_field.svg", + "password_field": "widget/password_field.svg", + "picture": "widget/picture.svg", + "widget_preview": "widget/preview.svg", + "prewidget": "widget/prewidget.svg", + "tab": "widget/tab.svg", + "text_area": "widget/text_area.svg", + "text_field": "widget/text_field.svg", + "widget_tree": "widget/tree.svg" + } +} diff --git a/designer-realize/src/main/java/com/fr/start/MainDesigner.java b/designer-realize/src/main/java/com/fr/start/MainDesigner.java index 315c624efa..739571ad96 100644 --- a/designer-realize/src/main/java/com/fr/start/MainDesigner.java +++ b/designer-realize/src/main/java/com/fr/start/MainDesigner.java @@ -84,7 +84,6 @@ import java.awt.Dimension; import java.awt.FlowLayout; import java.io.File; import java.util.ArrayList; -import java.util.concurrent.CompletableFuture; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; @@ -166,9 +165,7 @@ public class MainDesigner extends BaseDesigner { * 在 {@link FineRuntime#start()} 运行后 */ private static void startPreload1() { - - CompletableFuture initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel); - PreLoadService.getInstance().addUIFuture(initLookAndFeel); + DesignUtils.initLookAndFeel(); DesignerLaunchStatus.setStatusAndAsyncFire(DesignerLaunchStatus.UI_PRE_INIT_COMPLETE); } From 2936dc76b51cc313e9bd00635643e60149bd881b Mon Sep 17 00:00:00 2001 From: vito Date: Thu, 9 May 2024 21:08:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fine/theme/icon/IconManager.java | 9 --------- .../java/com/fine/theme/light/ui/laf/FineDarkLaf.java | 2 +- .../java/com/fine/theme/light/ui/laf/FineLightLaf.java | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/designer-base/src/main/java/com/fine/theme/icon/IconManager.java b/designer-base/src/main/java/com/fine/theme/icon/IconManager.java index e887e48553..acb9f1fd76 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/IconManager.java +++ b/designer-base/src/main/java/com/fine/theme/icon/IconManager.java @@ -19,15 +19,6 @@ import java.util.HashMap; * 2. 提供图标缓存 * 3. 查找图标 * 4. 配合 {@link LazyIcon} 实现图标懒加载 - * 5. - *

- * IconSource - 表示实际 Icon 的源的接口。 - * 目前有两种实现可用: ImageIconSource 和 SvgIconSource . - *

- * IconSet - 表示不同可用图标集实现的接口。 - * 目前有两种实现可用: XmlIconSet 和 RuntimeIconSet . - *

- * IconManager 可用于在运行时添加/删除 IconSet 并检索实际 Icon。 * * @author vito * @since 11.0 diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java index 5150df2dd3..e568f5af32 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java @@ -25,7 +25,7 @@ public class FineDarkLaf extends FineLaf { * @return 是否安装成功 */ public static boolean setup() { - IconManager.addSet(new FineLightIconSet("fine-dark")); + IconManager.addSet(new FineLightIconSet()); Layouts.setScaleFactor(UIScale.getUserScaleFactor()); UIScale.addPropertyChangeListener(evt -> { if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) { diff --git a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java index e3ae21a413..9e95b76f7e 100644 --- a/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java +++ b/designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java @@ -25,7 +25,7 @@ public class FineLightLaf extends FineLaf { * @return 是否安装成功 */ public static boolean setup() { - IconManager.addSet(new FineLightIconSet("fine-light")); + IconManager.addSet(new FineLightIconSet()); Layouts.setScaleFactor(UIScale.getUserScaleFactor()); UIScale.addPropertyChangeListener(evt -> { if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) {