From 9a81851dd178ad0334d26d58d66fcd55b6a79568 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 15 Jun 2022 11:36:11 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-73475=20FR11=E5=86=B3=E7=AD=96?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8-=E9=99=84=E4=BB=B6=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=EF=BC=8Ctablayout0=E7=9A=84Tab0=E4=B8=8B?= =?UTF-8?q?=E6=8B=96=E5=85=A5tab=E5=9D=97=EF=BC=8C=E4=BC=9A=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=B8=80=E4=B8=AA=E9=87=8D=E5=90=8D=E4=B8=BAtablayout?= =?UTF-8?q?0=E7=9A=84tab=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/beans/models/ModelUtil.java | 10 +++++++++- .../designer/creator/cardlayout/XWCardLayout.java | 11 ++++++++++- .../creator/cardlayout/XWCardMainBorderLayout.java | 13 +++++++++++++ 3 files changed, 32 insertions(+), 2 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..0e290c6212 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 @@ -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 e09b31fb09..bdefcc84a1 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,6 +52,8 @@ 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 +87,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; + } + /** * 添加标题区域 * From 3da899e0e5043aa2aad833cf616b454b71c773e9 Mon Sep 17 00:00:00 2001 From: kerry Date: Wed, 15 Jun 2022 15:05:14 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-72468=20=E5=86=B3=E7=AD=96=E6=8A=A5?= =?UTF-8?q?=E8=A1=A8-frm=E6=8B=96=E5=85=A5tab=E5=9D=97=EF=BC=8Ctab?= =?UTF-8?q?=E5=86=85=E6=8B=96=E5=85=A5=E4=B8=A4=E4=B8=AA=E5=9B=BE=E8=A1=A8?= =?UTF-8?q?=E5=9D=97=E5=92=8C=E4=B8=A4=E4=B8=AA=E6=96=87=E6=9C=AC=E5=9F=9F?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=EF=BC=8C=E9=87=8D=E5=A4=8D=E9=9A=8F=E6=9C=BA?= =?UTF-8?q?=E6=8B=96=E6=8B=BD=E8=B0=83=E6=95=B4=E7=BB=84=E4=BB=B6=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=EF=BC=8C=E4=BC=9A=E7=AA=81=E7=84=B6=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=87=8D=E5=8F=A0=E4=B8=94=E9=94=99=E4=B9=B1?= =?UTF-8?q?=E7=9A=84=E7=8E=B0=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/mainframe/FormArea.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index d989aae21f..7f9dbfc76d 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -771,15 +771,24 @@ public class FormArea extends JComponent implements ScrollRulerComponent { heightPane.setValue(height); reCalculateHeight((int) height); } - if (designer.getRootComponent().acceptType(XWFitLayout.class) ) { - XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); - // 撤销时先refreshRoot了,此处去掉内边距再增加间隔 - layout.moveContainerMargin(); - layout.addCompInterval(layout.getAcualInterval()); - } + traverAndAdjust(designer.getRootComponent()); this.slidePane.setShowValue((int) slide); } + // 撤销时先refreshRoot了,此处去掉内边距再增加间隔,循环遍历布局,调整fitlayout布局的间隔 + private void traverAndAdjust(XCreator creator) { + if (creator instanceof XWFitLayout) { + XWFitLayout temp = (XWFitLayout) creator; + temp.moveContainerMargin(); + temp.addCompInterval(temp.getAcualInterval()); + } + for (int i = 0; i < creator.getComponentCount(); i++) { + Object object = creator.getComponent(i); + if (object instanceof XCreator){ + traverAndAdjust((XCreator) object); + } + } + } /** * 计算滚动条的值和max