From ee8ccd76c73933d1287b69b922f0463e18be2e54 Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 19 May 2022 15:43:28 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-67489=20tab=E6=A0=87=E9=A2=98=E9=AB=98?= =?UTF-8?q?=E5=BA=A6=E4=BF=AE=E6=94=B9=EF=BC=8C=E5=B8=83=E5=B1=80=E5=86=85?= =?UTF-8?q?=E9=83=A8=E7=BB=84=E4=BB=B6=E5=A4=A7=E5=B0=8F=E4=B8=8D=E4=BC=9A?= =?UTF-8?q?=E9=80=82=E5=BA=94=E7=BC=A9=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRCardMainBorderLayoutAdapter.java | 11 +++++++++++ .../fr/design/designer/creator/XWAbsoluteLayout.java | 11 +++-------- .../creator/cardlayout/XWCardMainBorderLayout.java | 12 ++++++++++++ .../designer/creator/cardlayout/XWCardTagLayout.java | 1 - 4 files changed, 26 insertions(+), 9 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index 13910f7d4..906742d29 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -3,6 +3,7 @@ package com.fr.design.designer.beans.adapters.layout; import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; @@ -10,6 +11,7 @@ import com.fr.design.form.layout.FRBorderLayout; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JTemplate; import com.fr.design.mainframe.WidgetPropertyPane; +import com.fr.design.utils.gui.LayoutUtils; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -41,6 +43,15 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (!beyondBounds) { super.fix(creator); } + + //对于Tab布局,内部的某个组件尺寸改变后,需要重新layout下其他关联的组件 + XLayoutContainer xLayoutContainer = creator.getTopLayout(); + if (xLayoutContainer.acceptType(XWCardMainBorderLayout.class)) { + XWCardMainBorderLayout cardMainBorderLayout = (XWCardMainBorderLayout) xLayoutContainer; + LayoutUtils.layoutContainer(cardMainBorderLayout); + cardMainBorderLayout.updateBoundsWidget(); + } + } private boolean calculateBeyondBounds(XCreator creator) { diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java index 5bec34d37..0067a50f5 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -7,7 +7,7 @@ import com.fr.base.GraphHelper; import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.location.Direction; -import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.properties.mobile.MobileBooKMarkUsePropertyUI; import com.fr.design.form.layout.FRAbsoluteLayout; import com.fr.design.form.util.FormDesignerUtils; @@ -34,7 +34,6 @@ import java.awt.Rectangle; import java.awt.event.ContainerEvent; import java.awt.event.MouseEvent; import java.beans.IntrospectionException; -import java.util.ArrayList; import java.util.HashMap; /** @@ -119,12 +118,8 @@ public class XWAbsoluteLayout extends XLayoutContainer { ((XWAbsoluteLayout) xCreator).updateBoundsWidget(); } // 如果子组件时tab布局,则tab布局内部的组件的wiget也要更新,否则保存后重新打开大小不对 - ArrayList childrenList = xCreator.getTargetChildrenList(); - if (!childrenList.isEmpty()) { - for (int i = 0; i < childrenList.size(); i++) { - XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(i); - tabLayout.updateBoundsWidget(); - } + if (xCreator.acceptType(XWCardMainBorderLayout.class)){ + ((XWCardMainBorderLayout) xCreator).updateBoundsWidget(); } } 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 e09b31fb0..081b5072a 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 @@ -17,6 +17,7 @@ import com.fr.design.designer.creator.XWidgetCreator; import com.fr.design.mainframe.CoverReportPane; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.event.Listener; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.LayoutBorderStyle; @@ -425,6 +426,7 @@ public class XWCardMainBorderLayout extends XWBorderLayout { } xwCardTitleLayout.setBounds(parentBounds); this.addCardPart((XWCardLayout)this.getComponent(0)); + LayoutUtils.layoutContainer(this); } @Override @@ -448,4 +450,14 @@ public class XWCardMainBorderLayout extends XWBorderLayout { public void setShowOuterShadowBorder(boolean showOuterShadowBorder) { this.showOuterShadowBorder = showOuterShadowBorder; } + + public void updateBoundsWidget() { + ArrayList childrenList = this.getTargetChildrenList(); + if (!childrenList.isEmpty()) { + for (int i = 0; i < childrenList.size(); i++) { + XWTabFitLayout tabLayout = (XWTabFitLayout) childrenList.get(i); + tabLayout.updateBoundsWidget(); + } + } + } } diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java index ec070ad86..dbffab21a 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardTagLayout.java @@ -278,7 +278,6 @@ public class XWCardTagLayout extends XWHorizontalBoxLayout { @Override public void doLayout() { - setTabsAndAdjust(); //设置布局 super.doLayout(); }