From 1c836a495ecf67632ce873bef2731e4f560c81a2 Mon Sep 17 00:00:00 2001 From: Yvan Date: Thu, 7 Jan 2021 15:15:11 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-46683=20=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9F=A5=E8=AF=A2=EF=BC=8C?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E8=A1=A8=E5=B9=B6=E6=8B=96=E5=8A=A8=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E5=BC=B9=E7=AA=97=E5=8F=98=E5=8C=96?= =?UTF-8?q?=E4=BA=86=20=E5=9C=A8UIConstants=E4=B8=AD=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=80=E4=B8=AAEMPTY=5FICON=E4=BB=A3=E8=A1=A8=E6=97=A0?= =?UTF-8?q?=E5=9B=BE=E6=A0=87=EF=BC=8C=E7=84=B6=E5=90=8E=E5=9C=A8UpdateAct?= =?UTF-8?q?ion=E7=9A=84setSmallIcon=E6=96=B9=E6=B3=95=E4=B8=AD=E5=AF=B9?= =?UTF-8?q?=E4=BC=A0=E8=BF=87=E6=9D=A5=E7=9A=84=E8=B5=84=E6=BA=90=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E8=BF=9B=E8=A1=8C=E5=88=A4=E6=96=AD=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E4=B8=BA""=EF=BC=8C=E5=B0=B1=E6=8A=8Anull=E4=BD=9C?= =?UTF-8?q?=E4=B8=BAIcon=20=E7=9A=84Value=E5=80=BCput=E5=88=B0map=E4=B8=AD?= =?UTF-8?q?=EF=BC=8C=E4=B8=8E=E4=B9=8B=E5=89=8D=E7=9A=84=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/actions/UpdateAction.java | 8 +++++++- .../main/java/com/fr/design/constants/UIConstants.java | 4 ++++ .../com/fr/design/data/datapane/sqlpane/SQLEditPane.java | 6 +++--- .../com/fr/quickeditor/cellquick/CellDSColumnEditor.java | 2 +- .../com/fr/quickeditor/cellquick/CellRichTextEditor.java | 2 +- .../com/fr/quickeditor/cellquick/CellSubReportEditor.java | 2 +- 6 files changed, 17 insertions(+), 7 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java index 1fc6e14440..bb4ba4cccc 100644 --- a/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/UpdateAction.java @@ -180,9 +180,15 @@ public abstract class UpdateAction extends ShortCut implements Action { * 如果a_disabled.svg或者a_pressed.svg缺失,则不会被设置成灰化状态或者按压状态图标 * 如果a_normal.svg缺失,则会读到a.png,这也就不是一个SVGIcon了 * 如果连 a.png 也不存在,那么这个action的图标就是空白的 - * @param resource + * + * 如果想让这个Action没有图标,可以传入"" + * @param resource 图标资源路径 */ public void setSmallIcon(String resource) { + if (StringUtils.equals(resource, StringUtils.EMPTY)) { + this.putValue(Action.SMALL_ICON, null); + return; + } this.putValue(Action.SMALL_ICON, IconUtils.readIcon(resource)); this.putValue(UpdateAction.DISABLED_ICON, IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_DISABLED)); } diff --git a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java index 8887f79866..fdc92a9371 100644 --- a/designer-base/src/main/java/com/fr/design/constants/UIConstants.java +++ b/designer-base/src/main/java/com/fr/design/constants/UIConstants.java @@ -4,11 +4,14 @@ package com.fr.design.constants; import com.fr.base.svg.IconUtils; +import com.fr.base.svg.SVGIcon; import com.fr.general.IOUtils; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import javax.swing.BorderFactory; import javax.swing.Icon; +import javax.swing.ImageIcon; import javax.swing.border.Border; import java.awt.BasicStroke; import java.awt.Color; @@ -26,6 +29,7 @@ public interface UIConstants { public static final Icon CPT_ICON = IOUtils.readIcon("/com/fr/base/images/oem/cpt.png"); public static final Icon BLACK_ICON = IOUtils.readIcon("/com/fr/base/images/cell/blank.gif"); + public static final String EMPTY_ICON = StringUtils.EMPTY; public static final Image APPFIT_V0 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V0.png"); public static final Image APPFIT_V1 = IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png"); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java index fa928b05cd..7f5d083004 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/sqlpane/SQLEditPane.java @@ -125,7 +125,7 @@ public class SQLEditPane extends RSyntaxTextArea { this.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Name")); this.setMnemonic('N'); - this.setSmallIcon((Icon) null); + this.setSmallIcon(UIConstants.EMPTY_ICON); } public void actionPerformed(ActionEvent evt) { @@ -146,7 +146,7 @@ public class SQLEditPane extends RSyntaxTextArea { this.setName("SELECT *"); this.setMnemonic('s'); - this.setSmallIcon((Icon) null); + this.setSmallIcon(UIConstants.EMPTY_ICON); } public void actionPerformed(ActionEvent evt) { @@ -165,7 +165,7 @@ public class SQLEditPane extends RSyntaxTextArea { this.setName("CALL PROCEDURE "); this.setMnemonic('s'); - this.setSmallIcon((Icon) null); + this.setSmallIcon(UIConstants.EMPTY_ICON); } public void actionPerformed(ActionEvent evt) { diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java index f9427a5a8f..dc6b0490fd 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellDSColumnEditor.java @@ -260,7 +260,7 @@ public class CellDSColumnEditor extends CellQuickEditor { condition.setEditingComponent(tc); } //丢掉icon,修改按钮名称为编辑 - condition.setSmallIcon((Icon) null); + condition.setSmallIcon(UIConstants.EMPTY_ICON); condition.setName(Toolkit.i18nText("Fine-Design_Basic_Edit")); conditionUIButton = new UIButton(condition); Component[][] components = new Component[][]{ diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java index 0550e23ffc..efddda0adf 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellRichTextEditor.java @@ -49,7 +49,7 @@ public class CellRichTextEditor extends CellQuickEditor { protected void refreshDetails() { RichTextCellAction subReportCellAction = new RichTextCellAction(tc); subReportCellAction.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - subReportCellAction.setSmallIcon((Icon) null); + subReportCellAction.setSmallIcon(UIConstants.EMPTY_ICON); richTextButton.setAction(subReportCellAction); } diff --git a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java index 3614c3be0d..d44380a5b8 100644 --- a/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java +++ b/designer-realize/src/main/java/com/fr/quickeditor/cellquick/CellSubReportEditor.java @@ -45,7 +45,7 @@ public class CellSubReportEditor extends CellQuickEditor { protected void refreshDetails() { SubReportCellAction subReportCellAction = new SubReportCellAction(tc); subReportCellAction.setName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Edit")); - subReportCellAction.setSmallIcon((Icon) null); + subReportCellAction.setSmallIcon(UIConstants.EMPTY_ICON); subReportButton.setAction(subReportCellAction); }