diff --git a/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java b/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java index 98601b0bba..2ced39c685 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java +++ b/designer-base/src/main/java/com/fine/theme/icon/AbstractIconSource.java @@ -24,8 +24,6 @@ import java.awt.Dimension; @Immutable public abstract class AbstractIconSource implements IconSource { - public static final String ICON_DISABLE_SUFFIX = "_disable"; - protected String id; protected final IconResource resource; @@ -98,13 +96,6 @@ public abstract class AbstractIconSource implements IconSource implements IconSource ICON_SETS = new ArrayList<>(2); private static final HashMap> CACHE = new HashMap<>(64); @@ -149,4 +150,15 @@ public class IconManager { public static void clearCache() { CACHE.clear(); } + + /** + * 查找灰化图标 + * + * @param path 原始路径 + * @return 灰化路径 + */ + public static String findDisablePath(String path) { + int i = path.lastIndexOf('.'); + return path.substring(0, i) + ICON_DISABLE_SUFFIX + path.substring(i); + } } diff --git a/designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java b/designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java index f341317d0c..a7b774d0f4 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java +++ b/designer-base/src/main/java/com/fine/theme/icon/JsonIconSet.java @@ -60,7 +60,12 @@ public class JsonIconSet extends AbstractIconSet { if (value instanceof String) { String path = (String) value; if (IconManager.isSvgIcon(path)) { - addIcon(new SvgIconSource(key, base + path)); + // 默认字符串提供正常图和灰化图 + addIcon(new SvgIconSource(key, + base + path, + IconManager.findDisablePath(base + path), + null + )); } else if (IconManager.isImageIcon(path)) { addIcon(new ImageIconSource(key, base + path)); } @@ -74,21 +79,20 @@ public class JsonIconSet extends AbstractIconSet { if (IconManager.isSvgIcon(normalPath)) { addIcon(new SvgIconSource(key, base + normalPath, - base + disablePath, - base + whitePath + StringUtils.isNotBlank(disablePath) ? base + disablePath : null, + StringUtils.isNotBlank(whitePath) ? base + whitePath : null )); } else if (IconManager.isImageIcon(normalPath)) { addIcon(new ImageIconSource(key, base + normalPath, - base + disablePath, - base + whitePath + StringUtils.isNotBlank(disablePath) ? base + disablePath : null, + StringUtils.isNotBlank(whitePath) ? base + whitePath : null )); } } } - @Override public boolean equals(Object o) { if (this == o) { diff --git a/designer-base/src/main/java/com/fine/theme/icon/UrlIconResource.java b/designer-base/src/main/java/com/fine/theme/icon/UrlIconResource.java index 8a7874ab4e..61746e3bf5 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/UrlIconResource.java +++ b/designer-base/src/main/java/com/fine/theme/icon/UrlIconResource.java @@ -28,30 +28,14 @@ public class UrlIconResource implements IconResource { return path; } - /** - * 资源是否可访问 - * - * @return 是否可访问 - */ - public boolean isReachable() { - try (InputStream inputStream = getInputStream(path)) { - return inputStream != null; - } catch (Exception e) { - return false; - } - } - @Override @NotNull public InputStream getInputStream() { - try (InputStream inputStream = getInputStream(path)) { - if (inputStream == null) { - throw new IconException("Icon load failed: " + path); - } - return inputStream; - } catch (Exception e) { + InputStream inputStream = getInputStream(path); + if (inputStream == null) { throw new IconException("Icon load failed: " + path); } + return inputStream; } diff --git a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java index bac68dc4a6..331c028a17 100644 --- a/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java +++ b/designer-base/src/main/java/com/fine/theme/icon/svg/SvgIcon.java @@ -1,8 +1,8 @@ package com.fine.theme.icon.svg; -import com.fine.theme.icon.AbstractIconSource; import com.fine.theme.icon.DisabledIcon; import com.fine.theme.icon.GraphicsFilter; +import com.fine.theme.icon.IconManager; import com.fine.theme.icon.IconResource; import com.fine.theme.icon.IconType; import com.fine.theme.icon.UrlIconResource; @@ -26,7 +26,6 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.image.RGBImageFilter; -import java.util.Objects; import java.util.StringJoiner; import static com.fine.theme.utils.FineUIScale.scale; @@ -50,6 +49,7 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { private final IconResource resource; private final IconType type; + private final static NullableLazyValue defaultDoc = NullableLazyValue.createValue(SvgIcon::loadDefault); private final NullableLazyValue svgDocument = NullableLazyValue.createValue(() -> load(IconType.normal)); private final NullableLazyValue whiteSvgDocument = NullableLazyValue.createValue(() -> load(IconType.white)); @@ -84,8 +84,8 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { private void fallbackRender(Component c, Graphics g, int x, int y) { if (resource instanceof UrlIconResource) { String path = ((UrlIconResource) resource).getPath(); - String[] names = path.split(AbstractIconSource.ICON_DISABLE_SUFFIX); - if (path.contains(AbstractIconSource.ICON_DISABLE_SUFFIX) && names.length > 1) { + String[] names = path.split(IconManager.ICON_DISABLE_SUFFIX); + if (path.contains(IconManager.ICON_DISABLE_SUFFIX) && names.length == 2) { SVGLoader loader = new SVGLoader(); SVGDocument document = loader.load(new UrlIconResource(names[0] + names[1]).getInputStream()); if (document != null) { @@ -116,20 +116,29 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { } private void render(Component c, Graphics g, int x, int y, FallbackRender fallbackRender) { + SVGDocument document; try { if (type == IconType.white) { - Objects.requireNonNull(whiteSvgDocument.getValue()) - .render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, scaleSize.width, scaleSize.height)); + document = whiteSvgDocument.getValue(); } else { - Objects.requireNonNull(svgDocument.getValue()) - .render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, scaleSize.width, scaleSize.height)); + document = svgDocument.getValue(); } + if (document == null) { + document = defaultDoc.getValue(); + } + document.render((JComponent) c, (Graphics2D) g, new ViewBox(x, y, scaleSize.width, scaleSize.height)); } catch (Exception e) { FineLoggerFactory.getLogger().error("SvgIcon from url: " + resource + "can not paint.", e); fallbackRender.render(c, g, x, y); } } + private static SVGDocument loadDefault() { + SVGLoader loader = new SVGLoader(); + UrlIconResource iconResource = new UrlIconResource("com/fine/theme/icon/default.svg"); + return loader.load(iconResource.getInputStream()); + } + private SVGDocument load(IconType type) { SVGLoader loader = new SVGLoader(); @@ -138,7 +147,6 @@ public class SvgIcon implements DisabledIcon, WhiteIcon, Icon { : loader.load(resource.getInputStream()); } - @Override public String toString() { return new StringJoiner(", ", SvgIcon.class.getSimpleName() + "[", "]") diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report.svg old mode 100755 new mode 100644 index 6cb73b6991..ad9e75210d --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report.svg @@ -1,5 +1,5 @@ - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_report_disable.svg old mode 100755 new mode 100644 diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word.svg old mode 100755 new mode 100644 index d2aa41ea80..6f9d1f6d6c --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word.svg @@ -1,7 +1,7 @@ - + - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word_disable.svg old mode 100755 new mode 100644 index f8f711c520..ae6a0a3fa4 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/add_word_disable.svg @@ -1,7 +1,12 @@ + + + + + + - diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile.svg old mode 100755 new mode 100644 index fc346b19de..01e6c412ae --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile.svg @@ -1,8 +1,10 @@ + - - - + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile_disable.svg old mode 100755 new mode 100644 index ec09f32baa..16e2c4117f --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/bmpFile_disable.svg @@ -1,8 +1,8 @@ - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile.svg old mode 100755 new mode 100644 index cda2a6cb93..2422bcf307 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile.svg @@ -1,4 +1,5 @@ + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/chtFile_disable.svg old mode 100755 new mode 100644 diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile.svg old mode 100755 new mode 100644 index e3e9893bba..4fc380e73a --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile.svg @@ -1,6 +1,7 @@ + - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile_disable.svg old mode 100755 new mode 100644 index 3201b3d581..ed15882e48 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/classFile_disable.svg @@ -1,6 +1,6 @@ - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked.svg old mode 100755 new mode 100644 index 9c5f01a364..18791ee41d --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked.svg @@ -1,6 +1,7 @@ - + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/cpt_locked_disable.svg old mode 100755 new mode 100644 diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/csvFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/csvFile.svg new file mode 100644 index 0000000000..6cce0ba0a7 --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/csvFile.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/csvFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/csvFile_disable.svg new file mode 100644 index 0000000000..ede1cbc16a --- /dev/null +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/csvFile_disable.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile.svg old mode 100755 new mode 100644 index 8143080cac..5dd91fb6a7 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile.svg @@ -1,6 +1,7 @@ + - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile_disable.svg old mode 100755 new mode 100644 index fad1fa2a1c..fc89982901 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excelFile_disable.svg @@ -1,6 +1,6 @@ + - diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import.svg old mode 100755 new mode 100644 index 3faf981f21..2a21450f81 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import.svg @@ -3,5 +3,5 @@ - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import_disable.svg old mode 100755 new mode 100644 index 04fd0b9b4a..c4fdb4b49f --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/excel_import_disable.svg @@ -1,7 +1,7 @@ + - diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile.svg old mode 100755 new mode 100644 index 70e75f46c7..f1408b67f2 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile.svg @@ -1,8 +1,8 @@ + - - - + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile_disable.svg old mode 100755 new mode 100644 index 712692d1bd..00d288d930 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/flashFile_disable.svg @@ -1,7 +1,7 @@ + + - - diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked.svg old mode 100755 new mode 100644 index 8bd63be484..a602e102cb --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked.svg @@ -4,6 +4,6 @@ - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked_disable.svg old mode 100755 new mode 100644 index b2fb1bc31a..77eeb6f351 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/frm_locked_disable.svg @@ -4,6 +4,6 @@ - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile.svg old mode 100755 new mode 100644 index 6c64fd7241..945e988e75 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile.svg @@ -1,8 +1,9 @@ + - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile_disable.svg old mode 100755 new mode 100644 index 709124b0d6..b4e60659d4 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/gifFile_disable.svg @@ -1,8 +1,8 @@ + + + - - - diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile.svg old mode 100755 new mode 100644 index 6a65b848ba..a593de1653 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile.svg @@ -1,11 +1,10 @@ + - - - - - - + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile_disable.svg old mode 100755 new mode 100644 index 809c5f12e7..597eaadfa0 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/htmlFile_disable.svg @@ -1,10 +1,9 @@ - - - - + + + + - diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile.svg old mode 100755 new mode 100644 index cb3bfd8924..8cf93ffc01 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile.svg @@ -1,8 +1,9 @@ + - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile_disable.svg old mode 100755 new mode 100644 index 0b1d5f818b..a2b58b1e96 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jarFile_disable.svg @@ -1,8 +1,8 @@ - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile.svg old mode 100755 new mode 100644 index f2e2e3c2f8..185bc71a87 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile.svg @@ -1,9 +1,10 @@ + - - - - + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile_disable.svg old mode 100755 new mode 100644 index 53acf3252e..7d94b54e8c --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/javaFile_disable.svg @@ -1,9 +1,9 @@ - - - - + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile.svg old mode 100755 new mode 100644 index 32e7d50fd2..0f0065ecf3 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile.svg @@ -1,8 +1,9 @@ + - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile_disable.svg old mode 100755 new mode 100644 index 5ddc6a39cf..2a9c644837 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jpgFile_disable.svg @@ -1,8 +1,8 @@ - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile.svg old mode 100755 new mode 100644 index 97756c235c..596cac7d7c --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile.svg @@ -1,7 +1,8 @@ + - - + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile_disable.svg old mode 100755 new mode 100644 index 4c05097233..7777d71f41 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jsFile_disable.svg @@ -1,7 +1,7 @@ - - + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile.svg old mode 100755 new mode 100644 index 27be0dcb20..d029535ad9 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile.svg @@ -1,8 +1,9 @@ + - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile_disable.svg old mode 100755 new mode 100644 index dc1ad39412..2d00642e09 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/jspFile_disable.svg @@ -1,8 +1,8 @@ - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile.svg old mode 100755 new mode 100644 index 9146d94cc6..9ec5ffb81f --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile.svg @@ -1,8 +1,9 @@ + - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile_disable.svg old mode 100755 new mode 100644 index 6f97ecfc05..bd3c767845 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pdfFile_disable.svg @@ -1,8 +1,8 @@ - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile.svg old mode 100755 new mode 100644 index 527e0a204e..cf2cb0dd9b --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile.svg @@ -1,8 +1,9 @@ + - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile_disable.svg old mode 100755 new mode 100644 index 37a41dc9d5..83adf9d2cd --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/pngFile_disable.svg @@ -1,8 +1,8 @@ + + + - - - diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile.svg old mode 100755 new mode 100644 index f24f8bb647..432938f062 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile.svg @@ -1,11 +1,12 @@ - - - - - - - - - + + + + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile_disable.svg old mode 100755 new mode 100644 index 441ed97a70..3dedd47e58 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/sqlFile_disable.svg @@ -1,10 +1,9 @@ - - - - - - - - + + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile.svg old mode 100755 new mode 100644 index 6dc5bab611..2ca4ef17f7 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile.svg @@ -1,6 +1,6 @@ - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile_disable.svg old mode 100755 new mode 100644 index 80ae82c64d..c46e574960 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/wordFile_disable.svg @@ -1,6 +1,11 @@ - + + + + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile.svg old mode 100755 new mode 100644 index ea58c34918..135b429b03 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile.svg @@ -3,5 +3,5 @@ - + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile_disable.svg old mode 100755 new mode 100644 index ccd9aae917..687ed47b4b --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xlsFile_disable.svg @@ -1,7 +1,7 @@ - - + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile.svg old mode 100755 new mode 100644 index c5b68c24d0..af5aecd593 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile.svg @@ -1,9 +1,9 @@ + - - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile_disable.svg b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile_disable.svg old mode 100755 new mode 100644 index 4aaa3dfc2c..9257262130 --- a/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile_disable.svg +++ b/designer-base/src/main/resources/com/fine/theme/icon/filetree/filetype/xmlFile_disable.svg @@ -1,8 +1,8 @@ - - - + + + diff --git a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json index 19f4d0900a..d86b0292d9 100644 --- a/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json +++ b/designer-base/src/main/resources/com/fine/theme/light/ui/fine_light.icon.json @@ -135,7 +135,9 @@ "bias": "insert/bias.svg", "sub_report": "insert/sub_report.svg", "chart_line": "chart/chart_line.svg", - "popup": "popup/popup.svg", + "popup": { + "normal": "popup/popup.svg" + }, "clear": "clear.svg", "clear_hover": "clear_hover.svg", "tool_copy": "toolbar/copy.svg", diff --git a/designer-base/src/test/java/com/fr/design/gui/storybook/components/IconStoryBoard.java b/designer-base/src/test/java/com/fr/design/gui/storybook/components/IconStoryBoard.java index aefcb16d5a..e86582dd5f 100644 --- a/designer-base/src/test/java/com/fr/design/gui/storybook/components/IconStoryBoard.java +++ b/designer-base/src/test/java/com/fr/design/gui/storybook/components/IconStoryBoard.java @@ -1,15 +1,18 @@ package com.fr.design.gui.storybook.components; +import com.fine.swing.ui.layout.Layouts; import com.fine.theme.icon.LazyIcon; +import com.fine.theme.light.ui.FineLightIconSet; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.storybook.Story; import com.fr.design.gui.storybook.StoryBoard; import javax.swing.JLabel; +import javax.swing.SwingConstants; import static com.fine.swing.ui.layout.Layouts.cell; +import static com.fine.swing.ui.layout.Layouts.column; import static com.fine.swing.ui.layout.Layouts.fix; -import static com.fine.swing.ui.layout.Layouts.flex; import static com.fine.swing.ui.layout.Layouts.row; /** @@ -19,42 +22,50 @@ import static com.fine.swing.ui.layout.Layouts.row; */ @Story public class IconStoryBoard extends StoryBoard { + private FineLightIconSet iconSet = new FineLightIconSet(); + public IconStoryBoard() { super("图标"); - add( - cell(new UILabel("普通图标")).with(this::h3), - row(10, - cell(new JLabel(new LazyIcon("cut"))), - cell(new JLabel(new LazyIcon("save"))), - cell(new JLabel(new LazyIcon("copy"))), - cell(new JLabel(new LazyIcon("formatBrush"))), - cell(new JLabel(new LazyIcon("paste"))), - cell(new JLabel(new LazyIcon("undo"))), - cell(new JLabel(new LazyIcon("redo"))) + add(row( + column(10, + cell(new UILabel("普通图标")).with(this::h3), + icons() ), fix(5), - cell(new UILabel("禁用图标")).with(this::h3), - row(10, - cell(new JLabel(new LazyIcon("cut").disabled())), - cell(new JLabel(new LazyIcon("save").disabled())), - cell(new JLabel(new LazyIcon("copy").disabled())), - cell(new JLabel(new LazyIcon("formatBrush").disabled())), - cell(new JLabel(new LazyIcon("paste").disabled())), - cell(new JLabel(new LazyIcon("undo").disabled())), - cell(new JLabel(new LazyIcon("redo").disabled())) + column(10, + cell(new UILabel("禁用图标")).with(this::h3), + disableIcons() ), fix(5), - cell(new UILabel("白化图标")).with(this::h3), - row(10, - cell(new JLabel(new LazyIcon("cut").white())), - cell(new JLabel(new LazyIcon("save").white())), - cell(new JLabel(new LazyIcon("copy").white())), - cell(new JLabel(new LazyIcon("formatBrush").white())), - cell(new JLabel(new LazyIcon("paste").white())), - cell(new JLabel(new LazyIcon("undo").white())), - cell(new JLabel(new LazyIcon("redo").white())) - ), - flex() + column(10, + cell(new UILabel("白化图标")).with(this::h3), + whiteIcons() + )) ); } + + private Layouts.Cell icons() { + return column(10, + iconSet.getIds().stream().sorted() + .map(id -> cell(new JLabel(id, new LazyIcon(id), SwingConstants.LEFT))) + .toArray(Layouts.Cell[]::new)); + } + + private Layouts.Cell disableIcons() { + return column(10, + iconSet.getIds().stream().sorted() + .map(id -> cell(new JLabel(id, new LazyIcon(id).disabled(), SwingConstants.LEFT)) + .with(it -> { + it.setDisabledIcon(new LazyIcon(id).disabled()); + it.setEnabled(false); + })) + .toArray(Layouts.Cell[]::new)); + } + + private Layouts.Cell whiteIcons() { + return column(10, + iconSet.getIds().stream().sorted() + .map(id -> cell(new JLabel(id, new LazyIcon(id).white(), SwingConstants.LEFT))) + .toArray(Layouts.Cell[]::new)); + } }