From 8dff071b0ad4a72dcdb62056da391b50dd127fd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=2EYing-=E5=BA=94=E5=BF=97=E6=B5=A9?= Date: Fri, 30 Dec 2022 10:49:32 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-87787=2010.0=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E6=8A=A5=E9=94=99=EF=BC=8CFile=20not=20exist?= =?UTF-8?q?s:/com/fr/design/images/platform/platform?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/actions/UpdateAction.java | 14 +++++++++++++- .../mainframe/platform/ServicePlatformAction.java | 2 +- 2 files changed, 14 insertions(+), 2 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 5c12ff29c3..72001a5624 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 @@ -185,12 +185,24 @@ public abstract class UpdateAction extends ShortCut implements Action { * @param resource 图标资源路径 */ public void setSmallIcon(String resource) { + setSmallIcon(resource, true); + } + + /** + * 使用传入资源url的方式设置Icon,会自动设置_normal.svg,然后通过needDisable参数判断是否需要自动设置_disable.svg + * 因为有些地方是不需要设置灰化图标的,所以不存在灰化图标资源,这边如果一并设置,就会报错文件找不到 + * @param resource + * @param needDisable + */ + public void setSmallIcon(String resource, boolean needDisable) { 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)); + if (needDisable) { + this.putValue(UpdateAction.DISABLED_ICON, IconUtils.readSVGIcon(resource, IconUtils.ICON_TYPE_DISABLED)); + } } public void setSmallIcon(Icon[] smallIcon, boolean white) { diff --git a/designer-base/src/main/java/com/fr/design/mainframe/platform/ServicePlatformAction.java b/designer-base/src/main/java/com/fr/design/mainframe/platform/ServicePlatformAction.java index 7912354501..c6dc9a9b66 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/platform/ServicePlatformAction.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/platform/ServicePlatformAction.java @@ -20,7 +20,7 @@ import java.net.URI; public class ServicePlatformAction extends UpdateAction { public ServicePlatformAction() { this.setName(Toolkit.i18nText("Fine-Design_Basic_Service_Platform_Title")); - this.setSmallIcon("/com/fr/design/images/platform/platform"); + this.setSmallIcon("/com/fr/design/images/platform/platform", false); } @Override From c03397291792dbd1ab65b68f6ee24388b7692346 Mon Sep 17 00:00:00 2001 From: kerry Date: Fri, 30 Dec 2022 11:25:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-87779=20FR10=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=9A=E4=B8=8D=E5=90=8Ctablayout=E4=BC=9A?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E5=90=8C=E5=90=8Dtab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/models/ModelUtil.java | 22 +++++++++++++------ .../creator/cardlayout/XWCardLayout.java | 11 +++++++++- .../cardlayout/XWCardMainBorderLayout.java | 13 ++++++++++- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java index dda70b96f8..8c4d9c494e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/ModelUtil.java @@ -19,15 +19,15 @@ import java.util.Set; * created by Harrison on 2020/06/05 **/ public abstract class ModelUtil { - + public static void renameWidgetName(Form form, XCreator xCreator) { - + Set duplicated = new HashSet<>(); recursiveRenameWidgetName(form, xCreator, duplicated); } - + private static void recursiveRenameWidgetName(Form form, XCreator xCreator, Set duplicated) { - + Set nameRelatedCreators = new HashSet<>(); //直接遍历出来目标值,然后按需处理 xCreator.traversalNameRelatedXCreators(nameRelatedCreators); @@ -50,9 +50,9 @@ public abstract class ModelUtil { duplicated.add(xCreator.toData().getWidgetName()); } } - + private static String uniqueName(Form form, XCreator xCreator, Set duplicated) { - + if (xCreator.acceptType(XWParameterLayout.class)) { return xCreator.createDefaultName(); } @@ -61,6 +61,15 @@ public abstract class ModelUtil { if (StringUtils.isEmpty(widgetName)) { widgetName = xCreator.createDefaultName(); } + //先保存默认名字 + return uniqueName(form, widgetName, duplicated); + } + + public static String uniqueName(Form form, String widgetName) { + return uniqueName(form, widgetName, new HashSet<>()); + } + + private static String uniqueName(Form form, String widgetName, Set duplicated) { //先保存默认名字 String raw = widgetName; int i = 0; @@ -74,5 +83,4 @@ public abstract class ModelUtil { duplicated.add(widgetName); return widgetName; } - } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java index 578b509ec0..1f9eb4572e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardLayout.java @@ -7,6 +7,7 @@ import com.fr.base.background.ColorBackground; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRCardLayoutAdapter; import com.fr.design.designer.beans.events.DesignerEvent; +import com.fr.design.designer.beans.models.ModelUtil; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.XCreator; @@ -21,6 +22,7 @@ import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.CardTagWLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.DoubleEditor; +import com.fr.form.main.Form; import com.fr.form.ui.CardAddButton; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.LayoutBorderStyle; @@ -39,6 +41,7 @@ import com.fr.general.cardtag.DefaultTemplateStyle; import com.fr.general.cardtag.TemplateStyle; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; +import com.fr.stable.StringUtils; import com.fr.stable.core.PropertyChangeAdapter; import javax.swing.border.Border; @@ -246,7 +249,13 @@ public class XWCardLayout extends XLayoutContainer { */ @Override protected void setWrapperName(XLayoutContainer parentPanel, String widgetName) { - parentPanel.toData().setWidgetName("tablayout" + widgetName.replaceAll(createDefaultName(), "")); + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + Form form = formDesigner.getTarget(); + String name = "tablayout" + widgetName.replaceAll(createDefaultName(), StringUtils.EMPTY); + if (form.isNameExist(name)) { + name = ModelUtil.uniqueName(formDesigner.getTarget(), parentPanel.createDefaultName()); + } + parentPanel.toData().setWidgetName(name); } /** diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 31fc59d987..4e32eb1bdf 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -52,7 +52,7 @@ import java.util.List; * @date: 2014-12-9-下午9:59:31 */ public class XWCardMainBorderLayout extends XWBorderLayout { - + private static final String DEFAULT_NAME = "tablayout"; private static final int BORDER_WIDTH = 4; private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30); @@ -85,6 +85,17 @@ public class XWCardMainBorderLayout extends XWBorderLayout { return (WCardMainBorderLayout) super.toData(); } + /** + * 获取默认名字 + * + * @return 默认名 + * @date 2014-11-25-下午6:22:40 + */ + @Override + public String createDefaultName() { + return DEFAULT_NAME; + } + /** * 添加标题区域 *