Browse Source

Pull request #13944: REPORT-114888 & REPORT-113994 feat: 图标管理器优化

Merge in DESIGN/design from ~VITO/c-design:newui to newui

* commit '2936dc76b51cc313e9bd00635643e60149bd881b':
  补充提交
  REPORT-114888 feat: 图标管理器优化 1. 支持png注册 2. 支持查找旧版图标 3. 新图标配置文件注册方式 3. 优化调用性能
newui
vito-刘恒霖 7 months ago
parent
commit
1e1d47b887
  1. 58
      designer-base/src/main/java/com/fine/theme/icon/AbstractIconSet.java
  2. 65
      designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java
  3. 142
      designer-base/src/main/java/com/fine/theme/icon/IconManager.java
  4. 25
      designer-base/src/main/java/com/fine/theme/icon/IconSet.java
  5. 5
      designer-base/src/main/java/com/fine/theme/icon/IconSource.java
  6. 1
      designer-base/src/main/java/com/fine/theme/icon/IconType.java
  7. 109
      designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java
  8. 46
      designer-base/src/main/java/com/fine/theme/icon/LazyIcon.java
  9. 58
      designer-base/src/main/java/com/fine/theme/icon/img/ImageIconSource.java
  10. 8
      designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java
  11. 61
      designer-base/src/main/java/com/fine/theme/icon/svg/SvgIconSource.java
  12. 160
      designer-base/src/main/java/com/fine/theme/icon/svg/batik/BatikSvgIcon.java
  13. 39
      designer-base/src/main/java/com/fine/theme/icon/svg/batik/SvgTranscoder.java
  14. 340
      designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java
  15. 2
      designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java
  16. 2
      designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java
  17. 11
      designer-base/src/main/java/com/fr/design/gui/icontainer/UIModeControlContainer.java
  18. 8
      designer-base/src/main/java/com/fr/design/gui/ispinner/UISpinner.java
  19. 41
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  20. 6
      designer-base/src/main/resources/com/fine/theme/icon/default.svg
  21. 279
      designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json
  22. 5
      designer-realize/src/main/java/com/fr/start/MainDesigner.java

58
designer-base/src/main/java/com/fine/theme/icon/AbstractIconSet.java

@ -1,10 +1,11 @@
package com.fine.theme.icon; 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.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.Dimension;
import java.util.Collection; import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
@ -19,68 +20,47 @@ import java.util.concurrent.ConcurrentHashMap;
@Immutable @Immutable
public abstract class AbstractIconSet implements IconSet { public abstract class AbstractIconSet implements IconSet {
private final String id; protected String name;
protected boolean dark;
private final Map<String, IconSource<? extends Icon>> map = new ConcurrentHashMap<>(64); private final Map<String, IconSource<? extends Icon>> iconSourceMap = new ConcurrentHashMap<>(64);
private final Map<String, Icon> cache = new ConcurrentHashMap<>(64); private final Map<String, Icon> iconCache = new ConcurrentHashMap<>(64);
private final Map<String, Icon> disableCache = new ConcurrentHashMap<>(64);
public AbstractIconSet(String id) { public AbstractIconSet() {
this.id = id;
} }
@Override @Override
public @NotNull String getId() { public @NotNull String getId() {
return id; return name;
} }
@Override @Override
public @NotNull Collection<String> getIds() { public @NotNull Collection<String> getIds() {
return map.keySet(); return iconSourceMap.keySet();
} }
@Override @Override
public void addIcon(@NotNull IconSource<? extends Icon> icon) { public void addIcon(@NotNull IconSource<? extends Icon> icon) {
map.put(icon.getId(), icon); iconSourceMap.put(icon.getId(), icon);
} }
@SafeVarargs
@Override @Override
public void addIcon(@NotNull IconSource<? extends Icon>... icons) { public final void addIcon(@NotNull IconSource<? extends Icon>... icons) {
for (IconSource<? extends Icon> icon : icons) { for (IconSource<? extends Icon> icon : icons) {
map.put(icon.getId(), icon); iconSourceMap.put(icon.getId(), icon);
} }
} }
@Override @Override
public @Nullable Icon findIcon(@NotNull String id) { public @Nullable Icon findIcon(@NotNull String id, @NotNull Dimension dimension, IconType type) {
Icon icon = cache.get(id); String cacheKey = IconManager.genCacheKey(id, dimension, type);
Icon icon = iconCache.get(cacheKey);
if (icon == null) { if (icon == null) {
IconSource<? extends Icon> iconSource = map.get(id); IconSource<? extends Icon> iconSource = iconSourceMap.get(id);
if (iconSource != null) { if (iconSource != null) {
icon = iconSource.loadIcon(); icon = iconSource.loadIcon(dimension, type);
cache.put(id, icon); iconCache.put(cacheKey, icon);
}
}
return icon;
}
@Override
public @Nullable Icon findWhiteIcon(@NotNull String id) {
IconSource<? extends Icon> 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<? extends Icon> iconSource = map.get(id);
if (iconSource != null) {
icon = iconSource.disabled();
disableCache.put(id, icon);
} }
} }
return icon; return icon;

65
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 org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.Dimension;
/** /**
* 抽象图标源 * 抽象图标源
* 能够根据图标源寻找灰化图标资源 * <p>
* 1. 记录图标来源的所有信息
* 2. 如果使用来源提供灰化和反白图标source负责提供图标的不同来源
* 3. 默认查找命名如图标名称为 path/pic.svg,根据以下规则自动查询灰化和反白图标
* 1). 灰化图 path/pic_disable.svg
* 2). 反白图 path/pic_white.svg
* *
* @author vito * @author vito
* @since 11.0 * @since 11.0
@ -17,7 +24,7 @@ import javax.swing.Icon;
@Immutable @Immutable
public abstract class AbstractIconSource<I extends Icon> implements IconSource<I> { public abstract class AbstractIconSource<I extends Icon> implements IconSource<I> {
public static final String ICON_DISABLE = "_disable"; private static final String ICON_DISABLE_SUFFIX = "_disable";
protected String id; protected String id;
@ -26,28 +33,24 @@ public abstract class AbstractIconSource<I extends Icon> implements IconSource<I
@Nullable @Nullable
protected IconResource grayResource; protected IconResource grayResource;
protected boolean autoFindDisable = false; @Nullable
protected IconResource whiteResource;
public AbstractIconSource(@NotNull final String id, @NotNull final IconResource resource) {
this.id = id;
this.resource = resource;
}
public AbstractIconSource(@NotNull final String id, public AbstractIconSource(@NotNull final String id, @NotNull final IconResource resource) {
@NotNull final IconResource resource,
final boolean autoFindDisable) {
this.id = id; this.id = id;
this.resource = resource; this.resource = resource;
this.autoFindDisable = autoFindDisable;
} }
public AbstractIconSource(@NotNull final String id, public AbstractIconSource(@NotNull final String id,
@NotNull final IconResource resource, @NotNull final IconResource resource,
@Nullable final IconResource grayResource) { @Nullable final IconResource grayResource,
@Nullable final IconResource whiteResource) {
this.id = id; this.id = id;
this.resource = resource; this.resource = resource;
this.grayResource = grayResource; this.grayResource = grayResource;
this.whiteResource = whiteResource;
} }
@NotNull @NotNull
@ -64,16 +67,24 @@ public abstract class AbstractIconSource<I extends Icon> implements IconSource<I
@NotNull @NotNull
@Override @Override
public I loadIcon() { public I loadIcon(Dimension dimension, IconType type) {
try { try {
return loadIcon(resource); switch (type) {
case disable:
return loadDisabledIcon(dimension);
case white:
return white(dimension);
default:
return loadIcon(resource, dimension, type);
}
} catch (final Exception e) { } catch (final Exception e) {
throw new IconException("Unable to load Icon: " + getId(), e); throw new IconException("Unable to load Icon: " + getId(), e);
} }
} }
@NotNull @NotNull
protected abstract I loadIcon(@NotNull IconResource resource); protected abstract I loadIcon(@NotNull IconResource resource, Dimension dimension, IconType type);
/** /**
@ -83,24 +94,28 @@ public abstract class AbstractIconSource<I extends Icon> implements IconSource<I
* *
* @return 灰化图 * @return 灰化图
*/ */
@Override private @NotNull I loadDisabledIcon(Dimension dimension) {
public @NotNull I disabled() {
if (grayResource != null) { if (grayResource != null) {
return loadIcon(grayResource); return loadIcon(grayResource, dimension, IconType.normal);
} }
if (autoFindDisable && resource instanceof UrlIconResource) { if (resource instanceof UrlIconResource) {
String disablePath = findDisablePath(((UrlIconResource) resource).getPath()); String disablePath = findDisablePath(((UrlIconResource) resource).getPath());
grayResource = new UrlIconResource(disablePath); grayResource = new UrlIconResource(disablePath);
return loadIcon(grayResource); return loadIcon(grayResource, dimension, IconType.normal);
}
return loadIcon(resource, dimension, IconType.disable);
} }
return loadDisableIcon();
private @NotNull I white(Dimension dimension) {
if (whiteResource != null) {
return loadIcon(whiteResource, dimension, IconType.normal);
}
// 反白图不进行自动查找,要么直接提供路径要么自动生成
return loadIcon(resource, dimension, IconType.white);
} }
private static String findDisablePath(String path) { private static String findDisablePath(String path) {
int i = path.lastIndexOf('.'); int i = path.lastIndexOf('.');
return path.substring(0, i) + ICON_DISABLE + path.substring(i); return path.substring(0, i) + ICON_DISABLE_SUFFIX + path.substring(i);
} }
@NotNull
protected abstract I loadDisableIcon();
} }

142
designer-base/src/main/java/com/fine/theme/icon/IconManager.java

@ -1,10 +1,14 @@
package com.fine.theme.icon; package com.fine.theme.icon;
import com.fr.base.extension.FileExtension;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.third.errorprone.annotations.Immutable; import com.fr.third.errorprone.annotations.Immutable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.Dimension;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -23,11 +27,9 @@ import java.util.HashMap;
@Immutable @Immutable
public class IconManager { public class IconManager {
public static final Dimension DEFAULT_DIMENSION = new Dimension(16, 16);
private static final ArrayList<IconSet> ICON_SETS = new ArrayList<>(2); private static final ArrayList<IconSet> ICON_SETS = new ArrayList<>(2);
private static final HashMap<String, WeakReference<Icon>> CACHE = new HashMap<>(64); private static final HashMap<String, WeakReference<Icon>> CACHE = new HashMap<>(64);
private static final HashMap<String, WeakReference<Icon>> DISABLE_CACHE = new HashMap<>(64);
private static final HashMap<String, WeakReference<Icon>> WHITE_CACHE = new HashMap<>(32);
/** /**
@ -51,103 +53,94 @@ public class IconManager {
* @param set 图标集 * @param set 图标集
*/ */
public static void addSet(@NotNull IconSet set) { public static void addSet(@NotNull IconSet set) {
if (!ICON_SETS.contains(set)) { ICON_SETS.remove(set);
ICON_SETS.add(set); ICON_SETS.add(set);
// 清理可能来自其他图集相同名称图标 clearCache();
clearIconSetCache(set);
} else {
throw new IconException("[IconManager] IconSet by id:" + set.getId() + "is added!");
}
} }
/** /**
* 根据图标ID获取图标 * 根据图标ID获取图标
* <p>
* 查找路径
* 1查找图集图标
* 2路径为图片图标从路径再查找
* 3提供默认svg图标
* *
* @param id 图标ID * @param id 图标ID
* @param <I> 图标类型 * @param <I> 图标类型
* @return 图标 * @return 图标
*/ */
@NotNull @NotNull
public static <I extends Icon> I getIcon(String id) { public static <I extends Icon> I getIcon(@NotNull final String id, @NotNull Dimension dimension, @NotNull IconType type) {
Icon icon = findIcon(id); Icon icon = findIcon(id, dimension, type);
if (icon == null) { 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; return (I) icon;
} }
/** private static Icon fallbackLegacyIcon(String id) {
* 获取灰化图标 return IOUtils.readIcon(id);
* }
* @param id 图标ID
* @param <I> 图标类型 @Nullable
* @return 图标 private static <I extends Icon> I findIcon(String id, Dimension dimension, IconType type) {
*/ String cacheKey = genCacheKey(id, dimension, type);
@NotNull final WeakReference<Icon> reference = CACHE.get(cacheKey);
public static <I extends Icon> I getWhiteIcon(String id) {
final WeakReference<Icon> reference = WHITE_CACHE.get(id);
I icon = reference != null ? (I) reference.get() : null; I icon = reference != null ? (I) reference.get() : null;
if (icon == null) { if (icon == null) {
for (IconSet set : ICON_SETS) { for (IconSet set : ICON_SETS) {
Icon f = set.findWhiteIcon(id); Icon f = set.findIcon(id, dimension, type);
if (f != null) { if (f != null) {
icon = (I) f; 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; return icon;
} }
/** /**
* 获取灰化图标 * 生成缓存key
* *
* @param id 图标ID * @param id id
* @param <I> 图标类型 * @param dimension 尺寸
* @return 图标 * @param type 图标类型
* @return 缓存key
*/ */
@NotNull public static @NotNull String genCacheKey(String id, Dimension dimension, IconType type) {
public static <I extends Icon> I getDisableIcon(String id) { if (DEFAULT_DIMENSION.equals(dimension)) {
Icon icon = findDisableIcon(id); return id + "_" + type;
if (icon == null) {
throw new IconException("[IconManager] Can not find icon by id: " + id);
} }
return (I) icon; return id + "_" + dimension.width + "_" + dimension.height + "_" + type;
} }
@Nullable /**
private static <I extends Icon> I findDisableIcon(String id) { * 是否SVG图标格式
final WeakReference<Icon> reference = DISABLE_CACHE.get(id); *
I icon = reference != null ? (I) reference.get() : null; * @param path 路径
if (icon == null) { * @return 是否SVG图标格式
for (IconSet set : ICON_SETS) { */
Icon f = set.findDisableIcon(id); public static boolean isSvgIcon(String path) {
if (f != null) { return FileExtension.SVG.matchExtension(path);
icon = (I) f;
DISABLE_CACHE.put(id, new WeakReference<>(icon));
}
}
}
return icon;
} }
@Nullable /**
private static <I extends Icon> I findIcon(String id) { * 是否支持的图片图标格式目前只支持png和jpg
final WeakReference<Icon> reference = CACHE.get(id); *
I icon = reference != null ? (I) reference.get() : null; * @param path 路径
if (icon == null) { * @return 是否支持的图片图标格式
for (IconSet set : ICON_SETS) { */
Icon f = set.findIcon(id); public static boolean isImageIcon(String path) {
if (f != null) { return FileExtension.PNG.matchExtension(path)
icon = (I) f; || FileExtension.JPG.matchExtension(path);
CACHE.put(id, new WeakReference<>(icon));
}
}
}
return icon;
} }
/** /**
@ -155,24 +148,5 @@ public class IconManager {
*/ */
public static void clearCache() { public static void clearCache() {
CACHE.clear(); 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);
}
} }
} }

25
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 com.fr.third.errorprone.annotations.Immutable;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.Dimension;
import java.util.Collection; import java.util.Collection;
/** /**
@ -16,9 +16,6 @@ import java.util.Collection;
*/ */
@Immutable @Immutable
public interface IconSet extends Identifiable { public interface IconSet extends Identifiable {
@NotNull
@Override
String getId();
/** /**
* 返回集合中所有 Icons id * 返回集合中所有 Icons id
@ -48,24 +45,6 @@ public interface IconSet extends Identifiable {
* @param id id * @param id id
* @return Icon * @return Icon
*/ */
@Nullable Icon findIcon(@NotNull String id, @NotNull Dimension dimension, IconType type);
Icon findIcon(@NotNull String id);
/**
* 返回指定 id Icon
*
* @param id id
* @return Icon
*/
@Nullable
Icon findWhiteIcon(@NotNull String id);
/**
* 返回指定 id Icon
*
* @param id id
* @return Icon
*/
@Nullable
Icon findDisableIcon(@NotNull String id);
} }

5
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 org.jetbrains.annotations.NotNull;
import javax.swing.Icon; import javax.swing.Icon;
import java.awt.Dimension;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -15,7 +16,7 @@ import java.io.Serializable;
* Created on 2023/11/6 * Created on 2023/11/6
*/ */
@Immutable @Immutable
public interface IconSource<I extends Icon> extends Identifiable, DisabledIcon, WhiteIcon, Cloneable, Serializable { public interface IconSource<I extends Icon> extends Identifiable, Cloneable, Serializable {
/** /**
* 获取图标资源 * 获取图标资源
@ -32,5 +33,5 @@ public interface IconSource<I extends Icon> extends Identifiable, DisabledIcon,
* @return 图标 * @return 图标
*/ */
@NotNull @NotNull
I loadIcon(); I loadIcon(Dimension dimension, IconType type);
} }

1
designer-base/src/main/java/com/fine/theme/icon/IconType.java

@ -20,4 +20,5 @@ public enum IconType {
* 原始图 * 原始图
*/ */
normal normal
} }

109
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<String, Object> json;
try (InputStream in = resource.getInputStream()) {
try (Reader reader = new InputStreamReader(in, StandardCharsets.UTF_8)) {
json = (Map<String, Object>) 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<String, Object> icons = (Map<String, Object>) json.get("icons");
for (Map.Entry<String, Object> 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<String, Object> iconObj = (Map<String, Object>) 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);
}
}

46
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 javax.swing.Icon;
import java.awt.Component; import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics; import java.awt.Graphics;
import java.util.StringJoiner; import java.util.StringJoiner;
import static com.fine.theme.utils.FineUIScale.scale;
/** /**
* 懒加载图标 * 懒加载图标
* 非常懒宽高都不想算
* *
* @author vito * @author vito
* @since 11.0 * @since 11.0
@ -20,15 +24,37 @@ public class LazyIcon implements Identifiable, DisabledIcon, WhiteIcon, Icon {
@NotNull @NotNull
private final String id; private final String id;
private final Dimension dimension;
private final IconType type; private final IconType type;
public LazyIcon(@NotNull final String id) { public LazyIcon(@NotNull final String id) {
this.id = 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; this.type = IconType.normal;
} }
private LazyIcon(@NotNull final String id, IconType type) { public LazyIcon(@NotNull final String id, @NotNull Dimension dimension) {
this.id = id; this.id = id;
this.dimension = dimension;
this.type = IconType.normal;
}
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; this.type = type;
} }
@ -46,25 +72,18 @@ public class LazyIcon implements Identifiable, DisabledIcon, WhiteIcon, Icon {
@Override @Override
public int getIconWidth() { public int getIconWidth() {
return getIcon().getIconWidth(); return scale(dimension.width);
} }
@Override @Override
public int getIconHeight() { public int getIconHeight() {
return getIcon().getIconHeight(); return scale(dimension.height);
} }
@NotNull @NotNull
public <I extends Icon> I getIcon() { public <I extends Icon> I getIcon() {
switch (type) { return IconManager.getIcon(getId(), dimension, type);
case white:
return IconManager.getWhiteIcon(getId());
case disable:
return IconManager.getDisableIcon(getId());
default:
return IconManager.getIcon(getId());
}
} }
/** /**
@ -75,7 +94,7 @@ public class LazyIcon implements Identifiable, DisabledIcon, WhiteIcon, Icon {
@NotNull @NotNull
@Override @Override
public Icon disabled() { 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 @NotNull
@Override @Override
public Icon white() { 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() { public String toString() {
return new StringJoiner(", ", LazyIcon.class.getSimpleName() + "[", "]") return new StringJoiner(", ", LazyIcon.class.getSimpleName() + "[", "]")
.add("id='" + id + "'") .add("id='" + id + "'")
.add("size=" + "[w=" + scale(dimension.width) + ",h=" + scale(dimension.height) + "]")
.add("type=" + type) .add("type=" + type)
.toString(); .toString();
} }

58
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<ImageIcon> {
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);
}
}

8
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> svgDocument = NullableLazyValue.createValue(() -> load(IconType.normal)); private final NullableLazyValue<SVGDocument> svgDocument = NullableLazyValue.createValue(() -> load(IconType.normal));
private final NullableLazyValue<SVGDocument> whiteSvgDocument = NullableLazyValue.createValue(() -> load(IconType.white)); private final NullableLazyValue<SVGDocument> 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) { public SvgIcon(IconResource resource, Dimension size, IconType type) {
this.resource = resource; this.resource = resource;
this.size = size; this.size = size;
@ -63,10 +59,6 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon {
this.type = type; this.type = type;
} }
public SvgIcon(IconResource resource, int side) {
this(resource, new Dimension(side, side), IconType.normal);
}
/** /**
* 如果支持绘制Retina绘制则进行Retina绘制 * 如果支持绘制Retina绘制则进行Retina绘制
* 绘制结束不影响任何外部尺寸 * 绘制结束不影响任何外部尺寸

61
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.AbstractIconSource;
import com.fine.theme.icon.IconResource; import com.fine.theme.icon.IconResource;
import com.fine.theme.icon.IconType;
import com.fine.theme.icon.UrlIconResource; import com.fine.theme.icon.UrlIconResource;
import com.fr.clone.cloning.Immutable; import com.fr.clone.cloning.Immutable;
import com.fr.stable.StringUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.Icon;
import java.awt.Dimension; import java.awt.Dimension;
/** /**
@ -20,61 +21,23 @@ import java.awt.Dimension;
@Immutable @Immutable
public class SvgIconSource extends AbstractIconSource<SvgIcon> { public class SvgIconSource extends AbstractIconSource<SvgIcon> {
private static final int ICON_SIDE_LENGTH = 16;
private final Dimension size;
public SvgIconSource(@NotNull String id, @NotNull String resource) { public SvgIconSource(@NotNull String id, @NotNull String resource) {
this(id, new UrlIconResource(resource), null, new Dimension(ICON_SIDE_LENGTH, ICON_SIDE_LENGTH)); super(id, new UrlIconResource(resource));
}
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;
} }
public SvgIconSource(@NotNull String id, @NotNull IconResource resource, public SvgIconSource(@NotNull String id,
@Nullable IconResource grayResource, Dimension size) { @NotNull String resource,
super(id, resource, grayResource); @Nullable String grayResource,
this.size = size; @Nullable String whiteResource) {
super(id, new UrlIconResource(resource),
StringUtils.isEmpty(grayResource) ? null : new UrlIconResource(grayResource),
StringUtils.isEmpty(whiteResource) ? null : new UrlIconResource(whiteResource));
} }
@NotNull @NotNull
@Override @Override
protected SvgIcon loadIcon(@NotNull IconResource resource) { protected SvgIcon loadIcon(@NotNull IconResource resource, Dimension dimension, IconType type) {
return new SvgIcon(resource, size); return new SvgIcon(resource, dimension, type);
}
@Override
public @NotNull SvgIcon loadDisableIcon() {
return new SvgIcon(resource, size).disabled();
}
@Override
public @NotNull Icon white() {
return new SvgIcon(resource, size).white();
} }
} }

160
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);
}
}

39
designer-base/src/main/java/com/fine/theme/icon/svg/SvgTranscoder.java → 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.SVGAbstractTranscoder;
import org.apache.batik.transcoder.TranscoderException; import org.apache.batik.transcoder.TranscoderException;
@ -8,6 +8,9 @@ import org.apache.batik.transcoder.image.ImageTranscoder;
import java.awt.Color; import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.IndexColorModel;
import java.awt.image.Raster;
/** /**
* Svg图标转码器 * Svg图标转码器
@ -18,16 +21,20 @@ import java.awt.image.BufferedImage;
*/ */
public class SvgTranscoder extends ImageTranscoder { public class SvgTranscoder extends ImageTranscoder {
public enum Type {
gray, white, origin
}
private BufferedImage bufferedImage; private BufferedImage bufferedImage;
private boolean gray = false; private Type type = Type.origin;
public SvgTranscoder(Dimension size) { public SvgTranscoder(Dimension size) {
addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, (float) size.getWidth()); addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, (float) size.getWidth());
addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, (float) size.getHeight()); addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, (float) size.getHeight());
} }
public SvgTranscoder(Dimension size, Color background, boolean gray) { public SvgTranscoder(Dimension size, Color background, Type type) {
this.gray = gray; this.type = type;
addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, (float) size.getWidth()); addTranscodingHint(SVGAbstractTranscoder.KEY_WIDTH, (float) size.getWidth());
addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, (float) size.getHeight()); addTranscodingHint(SVGAbstractTranscoder.KEY_HEIGHT, (float) size.getHeight());
addTranscodingHint(ImageTranscoder.KEY_BACKGROUND_COLOR, background); addTranscodingHint(ImageTranscoder.KEY_BACKGROUND_COLOR, background);
@ -41,9 +48,14 @@ public class SvgTranscoder extends ImageTranscoder {
@Override @Override
public BufferedImage createImage(int width, int height) { public BufferedImage createImage(int width, int height) {
return gray ? switch (type) {
createGrayImage(width, height) : case gray:
new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); 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 @Override
public void writeImage(BufferedImage bufferedImage, TranscoderOutput transcoderOutput) throws TranscoderException { public void writeImage(BufferedImage bufferedImage, TranscoderOutput transcoderOutput) throws TranscoderException {
this.bufferedImage = bufferedImage; this.bufferedImage = bufferedImage;

340
designer-base/src/main/java/com/fine/theme/light/ui/FineLightIconSet.java

@ -1,345 +1,17 @@
package com.fine.theme.light.ui; package com.fine.theme.light.ui;
import com.fine.theme.icon.AbstractIconSet; import com.fine.theme.icon.JsonIconSet;
import com.fine.theme.icon.svg.SvgIconSource; import com.fine.theme.icon.UrlIconResource;
/** /**
* Fine 亮主题图标集 * Fine 亮主题图标集
* *
* @author vito * @author vito
* @since 11.0 * @since 11.0
* Created on 2023/11/17 * Created on 2024/5/7
*/ */
public class FineLightIconSet extends AbstractIconSet { public class FineLightIconSet extends JsonIconSet {
public FineLightIconSet() {
public FineLightIconSet(String id) { super(new UrlIconResource("com/fine/theme/light/ui/fine_light.icon.json"));
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),
new SvgIconSource("recycle", "com/fine/theme/icon/recycle.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)
);
} }
} }

2
designer-base/src/main/java/com/fine/theme/light/ui/laf/FineDarkLaf.java

@ -25,7 +25,7 @@ public class FineDarkLaf extends FineLaf {
* @return 是否安装成功 * @return 是否安装成功
*/ */
public static boolean setup() { public static boolean setup() {
IconManager.addSet(new FineLightIconSet("fine-dark")); IconManager.addSet(new FineLightIconSet());
Layouts.setScaleFactor(UIScale.getUserScaleFactor()); Layouts.setScaleFactor(UIScale.getUserScaleFactor());
UIScale.addPropertyChangeListener(evt -> { UIScale.addPropertyChangeListener(evt -> {
if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) { if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) {

2
designer-base/src/main/java/com/fine/theme/light/ui/laf/FineLightLaf.java

@ -25,7 +25,7 @@ public class FineLightLaf extends FineLaf {
* @return 是否安装成功 * @return 是否安装成功
*/ */
public static boolean setup() { public static boolean setup() {
IconManager.addSet(new FineLightIconSet("fine-light")); IconManager.addSet(new FineLightIconSet());
Layouts.setScaleFactor(UIScale.getUserScaleFactor()); Layouts.setScaleFactor(UIScale.getUserScaleFactor());
UIScale.addPropertyChangeListener(evt -> { UIScale.addPropertyChangeListener(evt -> {
if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) { if (StringUtils.equals(evt.getPropertyName(), USER_SCALE_FACTOR)) {

11
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.base.mode.DesignModeContext;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.gui.ibutton.UIButton; 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.gui.ilable.UILabel;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import javax.swing.Icon;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JLayeredPane; import javax.swing.JLayeredPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.Icon;
import javax.swing.UIManager; import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicButtonUI; import javax.swing.plaf.basic.BasicButtonUI;
import java.awt.AlphaComposite; import java.awt.AlphaComposite;
@ -33,6 +32,7 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener; import java.awt.event.MouseMotionListener;
public class UIModeControlContainer extends JLayeredPane { public class UIModeControlContainer extends JLayeredPane {
private static final int ICON_WIDTH = 18;
private static int DIM_HEIGHT = 30; private static int DIM_HEIGHT = 30;
private static final int NUM32 = 32; private static final int NUM32 = 32;
private static final int NUM5 = 5; private static final int NUM5 = 5;
@ -287,7 +287,8 @@ public class UIModeControlContainer extends JLayeredPane {
setLayout(new FlowLayout(FlowLayout.CENTER, 10, -3)); setLayout(new FlowLayout(FlowLayout.CENTER, 10, -3));
setBackground(UIConstants.NORMAL_BACKGROUND); setBackground(UIConstants.NORMAL_BACKGROUND);
add(new UILabel("<html><font size='5' face='Microsoft YaHei' color='#999999999'><B>" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel") + "</B></font></html>")); add(new UILabel("<html><font size='5' face='Microsoft YaHei' color='#999999999'><B>" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Parameter_Panel") + "</B></font></html>"));
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 @Override
public Dimension getPreferredSize() { public Dimension getPreferredSize() {
return new Dimension(32, 32); 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")); 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"), new LazyIcon("param_hide_pressed"), new LazyIcon("param_hide_pressed")); hideButton = new LargeButton(new LazyIcon("param_hide", 24), new LazyIcon("param_hide_pressed", 24), new LazyIcon("param_hide_pressed", 24));
editButton.addMouseListener(new MouseAdapter() { editButton.addMouseListener(new MouseAdapter() {
@Override @Override
public void mousePressed(MouseEvent e) { public void mousePressed(MouseEvent e) {

8
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 Insets defaultInsets = new Insets(0, 6, 0, 6);
private final int defaultButtonSize = 24; private final int defaultButtonSize = 24;
private final int ICON_WIDTH = 12;
protected double value; protected double value;
private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2; private static final int DEFAULT_NUMBERFIELD_COLUMNS = 2;
private UINumberField textField; private UINumberField textField;
@ -173,6 +174,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver,
/** /**
* 赋值但不触发保存,只是展现,一般是populate的时候用 * 赋值但不触发保存,只是展现,一般是populate的时候用
*
* @param value * @param value
*/ */
public void setValueWithoutEvent(double value) { public void setValueWithoutEvent(double value) {
@ -219,6 +221,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver,
/** /**
* 设置Spinner内的数字输入框列数 * 设置Spinner内的数字输入框列数
*
* @param numberFieldColumns 输入框列数 * @param numberFieldColumns 输入框列数
*/ */
public void setNumberFieldColumns(int numberFieldColumns) { public void setNumberFieldColumns(int numberFieldColumns) {
@ -286,8 +289,8 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver,
textField.setOpaque(false); textField.setOpaque(false);
setValue(value); setValue(value);
preButton = createArrowButton(new LazyIcon("up_arrow_12")); preButton = createArrowButton(new LazyIcon("up_arrow", ICON_WIDTH));
nextButton = createArrowButton(new LazyIcon("down_arrow_12")); nextButton = createArrowButton(new LazyIcon("down_arrow", ICON_WIDTH));
setLayout(new BorderLayout()); setLayout(new BorderLayout());
add(textField, BorderLayout.CENTER); add(textField, BorderLayout.CENTER);
JPanel arrowPane = new JPanel(); JPanel arrowPane = new JPanel();
@ -315,6 +318,7 @@ public class UISpinner extends JPanel implements UIObserver, GlobalNameObserver,
/** /**
* 设置最大值 * 设置最大值
*
* @param maxValue 最大值 * @param maxValue 最大值
*/ */
public void setMaxValue(double maxValue) { public void setMaxValue(double maxValue) {

41
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.STYLE_TEXT;
import static com.fine.theme.utils.FineUIStyle.setStyle; import static com.fine.theme.utils.FineUIStyle.setStyle;
import static com.fr.design.i18n.Toolkit.i18nText;
public class EastRegionContainerPane extends UIEastResizableContainer { public class EastRegionContainerPane extends UIEastResizableContainer {
private static volatile EastRegionContainerPane THIS; private static volatile EastRegionContainerPane THIS;
@ -111,13 +112,13 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
public enum PropertyMode { public enum PropertyMode {
REPORT, // 报表 REPORT, // 报表
REPORT_PARA_WIDGET, //报表参数面板中的控件 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, // 报表悬浮元素 REPORT_FLOAT, // 报表悬浮元素
FORM(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Component_Settings")), // 表单 FORM(i18nText("Fine-Design_Basic_Component_Settings")), // 表单
FORM_REPORT, // 表单报表块 FORM_REPORT, // 表单报表块
POLY, // 聚合报表 POLY, // 聚合报表
POLY_REPORT, // 聚合报表-报表块 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, // 权限编辑
AUTHORITY_EDITION_DISABLED, // 权限编辑 AUTHORITY_EDITION_DISABLED, // 权限编辑
DUCHAMP_REPORT; DUCHAMP_REPORT;
@ -125,7 +126,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private String title; private String title;
PropertyMode() { 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) { PropertyMode(String title) {
@ -167,8 +168,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private EastRegionContainerPane() { private EastRegionContainerPane() {
super(); super();
initPropertyItemList(); initPropertyItemList();
defaultPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_No_Settings_Available")); defaultPane = getDefaultPane(i18nText("Fine-Design_Basic_No_Settings_Available"));
defaultAuthorityPane = getDefaultPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Not_Support_Authority_Edit")); defaultAuthorityPane = getDefaultPane(i18nText("Fine-Design_Basic_Not_Support_Authority_Edit"));
switchMode(PropertyMode.REPORT); switchMode(PropertyMode.REPORT);
setContainerWidth(CONTAINER_WIDTH); setContainerWidth(CONTAINER_WIDTH);
@ -284,19 +285,19 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
propertyItemMap = new LinkedHashMap<>(); // 有序map 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}, "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}); 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}, "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}); 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}, "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}); 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}, "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() { new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_PARA, PropertyMode.REPORT_PARA_WIDGET, PropertyMode.FORM, PropertyMode.POLY_REPORT, PropertyMode.POLY_CHART}, new ActionListener() {
@Override @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}, "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}); 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}, "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}); new PropertyMode[]{PropertyMode.REPORT, PropertyMode.REPORT_FLOAT, PropertyMode.FORM_REPORT, PropertyMode.POLY_REPORT, PropertyMode.DUCHAMP_REPORT});
// 组件库 // 组件库
widgetLibSnapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT); widgetLibSnapChat = SnapChatFactory.createSnapChat(false, SnapChatKeys.COMPONENT);
PropertyItem widgetLib = new PropertyItem( PropertyItem widgetLib = new PropertyItem(
KEY_WIDGET_LIB, KEY_WIDGET_LIB,
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Widget_Library"), i18nText("Fine-Design_Basic_Widget_Library"),
"widgetlib", "widgetlib",
new PropertyMode[]{PropertyMode.FORM}, new PropertyMode[]{PropertyMode.FORM},
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}, "authorityedit", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION_DISABLED},
new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); 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}, "configuredroles", new PropertyMode[]{PropertyMode.AUTHORITY_EDITION_DISABLED},
new PropertyMode[]{PropertyMode.AUTHORITY_EDITION}); new PropertyMode[]{PropertyMode.AUTHORITY_EDITION});
@ -975,7 +976,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
button.setBackground(new Color(0, 0, 0, 0)); button.setBackground(new Color(0, 0, 0, 0));
if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) { if (iconSuffix.equals(ICON_SUFFIX_SELECTED)) {
iconSuffix = ICON_SUFFIX_NORMAL; iconSuffix = ICON_SUFFIX_NORMAL;
button.setIcon(new LazyIcon(getBtnIconId())); button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH));
button.setOpaque(false); button.setOpaque(false);
} else if (ICON_SUFFIX_SELECTED_DEPRECATED.equals(iconSuffix)) { } else if (ICON_SUFFIX_SELECTED_DEPRECATED.equals(iconSuffix)) {
iconSuffix = ICON_SUFFIX_NORMAL_DEPRECATED; iconSuffix = ICON_SUFFIX_NORMAL_DEPRECATED;
@ -988,7 +989,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
resetPropertyIcons(); resetPropertyIcons();
if (StringUtils.isEmpty(iconBaseDir)) { if (StringUtils.isEmpty(iconBaseDir)) {
iconSuffix = ICON_SUFFIX_SELECTED; iconSuffix = ICON_SUFFIX_SELECTED;
button.setIcon(new LazyIcon(getBtnIconId())); button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH));
} else { } else {
iconSuffix = ICON_SUFFIX_SELECTED_DEPRECATED; iconSuffix = ICON_SUFFIX_SELECTED_DEPRECATED;
button.setIcon(IconUtils.readIcon(getBtnIconUrl())); button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
@ -1033,8 +1034,8 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
private void initButtonIcon() { private void initButtonIcon() {
if (StringUtils.isEmpty(iconBaseDir)) { if (StringUtils.isEmpty(iconBaseDir)) {
button.setIcon(new LazyIcon(getBtnIconId())); button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH));
button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED)); button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED, ICON_WIDTH));
} else { } else {
button.setIcon(IconUtils.readIcon(getBtnIconUrl())); button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED_DEPRECATED)); button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED_DEPRECATED));
@ -1371,7 +1372,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
initListener(); initListener();
this.setVisible(true); 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() { public void showDefaultPane() {

6
designer-base/src/main/resources/com/fine/theme/icon/default.svg

@ -0,0 +1,6 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M2 0C0.895431 0 0 0.895431 0 2V26C0 27.1046 0.895431 28 2 28H26C27.1046 28 28 27.1046 28 26V2C28 0.895431 27.1046 0 26 0H2ZM25.9259 2H2.07407V26H25.9259V2Z" fill="#105DD1"/>
<rect x="2" y="2" width="24" height="24" fill="#5493F2"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8575 11.8667H16.1467C16.2063 11.8667 16.2546 11.9144 16.2546 11.9733V17.0933C16.2546 17.1522 16.2063 17.2 16.1467 17.2H10.8575V21.8933C10.8575 21.9522 10.8091 22 10.7495 22H6.10794C6.04833 22 6 21.9522 6 21.8933V9.73333C6 7.67147 7.69148 6 9.77802 6H10.7495C10.8091 6 10.8575 6.04776 10.8575 6.10667V11.8667Z" fill="white"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M21.9998 6.10667V18.2667C21.9998 20.3285 20.3083 22 18.2218 22H17.1423V10.8H11.8531C11.7935 10.8 11.7452 10.7522 11.7452 10.6933V6.10667C11.7452 6.04776 11.7935 6 11.8531 6H21.8919C21.9515 6 21.9998 6.04776 21.9998 6.10667Z" fill="white" fill-opacity="0.8"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

279
designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json

@ -0,0 +1,279 @@
{
"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",
"recycle": "recycle.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"
}
}

5
designer-realize/src/main/java/com/fr/start/MainDesigner.java

@ -84,7 +84,6 @@ import java.awt.Dimension;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
@ -166,9 +165,7 @@ public class MainDesigner extends BaseDesigner {
* {@link FineRuntime#start()} 运行后 * {@link FineRuntime#start()} 运行后
*/ */
private static void startPreload1() { private static void startPreload1() {
DesignUtils.initLookAndFeel();
CompletableFuture<Void> initLookAndFeel = CompletableFuture.runAsync(DesignUtils::initLookAndFeel);
PreLoadService.getInstance().addUIFuture(initLookAndFeel);
DesignerLaunchStatus.setStatusAndAsyncFire(DesignerLaunchStatus.UI_PRE_INIT_COMPLETE); DesignerLaunchStatus.setStatusAndAsyncFire(DesignerLaunchStatus.UI_PRE_INIT_COMPLETE);
} }

Loading…
Cancel
Save