From f7b05c896eaae670a010e1a471b755d25ad4ef66 Mon Sep 17 00:00:00 2001 From: zack Date: Thu, 27 Apr 2017 15:01:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20master?= =?UTF-8?q?=E7=9A=84boundsWidget=E5=88=B0release?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/ConnectorCreator.java | 9 ++--- .../adapters/layout/FRFitLayoutAdapter.java | 4 +- .../beans/location/AccessDirection.java | 2 +- .../design/designer/beans/location/Inner.java | 2 +- .../designer/creator/XWAbsoluteLayout.java | 40 ++++++++++++------- .../design/designer/creator/XWFitLayout.java | 18 ++++----- .../designer/creator/XWScaleLayout.java | 9 ++--- .../designer/creator/XWTitleLayout.java | 2 +- .../cardlayout/XWCardMainBorderLayout.java | 11 ++--- .../creator/cardlayout/XWTabFitLayout.java | 2 +- .../fr/design/mainframe/ConnectorHelper.java | 15 +++---- 11 files changed, 58 insertions(+), 56 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/beans/ConnectorCreator.java b/designer_form/src/com/fr/design/designer/beans/ConnectorCreator.java index 350235d45..ed83c12d6 100644 --- a/designer_form/src/com/fr/design/designer/beans/ConnectorCreator.java +++ b/designer_form/src/com/fr/design/designer/beans/ConnectorCreator.java @@ -1,13 +1,12 @@ package com.fr.design.designer.beans; -import java.awt.Point; -import java.awt.Rectangle; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; +import com.fr.form.ui.container.WLayout; + +import java.awt.*; import java.util.ArrayList; import java.util.PriorityQueue; -import com.fr.form.ui.container.WLayout; -import com.fr.form.ui.widget.BoundsWidget; - public class ConnectorCreator { public static final int UNIT = 10; diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 12e53ccdd..74a69e525 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java @@ -16,13 +16,11 @@ import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.properties.FRFitLayoutConstraints; import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; -import com.fr.design.file.HistoryTemplateListPane; -import com.fr.design.mainframe.JForm; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.LayoutBorderStyle; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; -import com.fr.form.ui.widget.BoundsWidget; import com.fr.general.ComparatorUtils; import java.awt.*; diff --git a/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java b/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java index 088f29a0a..c39dfc4db 100644 --- a/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java +++ b/designer_form/src/com/fr/design/designer/beans/location/AccessDirection.java @@ -10,7 +10,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.widget.BoundsWidget; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import java.awt.*; diff --git a/designer_form/src/com/fr/design/designer/beans/location/Inner.java b/designer_form/src/com/fr/design/designer/beans/location/Inner.java index 4f475adf0..c90924489 100644 --- a/designer_form/src/com/fr/design/designer/beans/location/Inner.java +++ b/designer_form/src/com/fr/design/designer/beans/location/Inner.java @@ -9,7 +9,7 @@ import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormSelection; import com.fr.design.utils.ComponentUtils; import com.fr.form.ui.container.WAbsoluteLayout; -import com.fr.form.ui.widget.BoundsWidget; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.stable.ArrayUtils; import java.awt.*; diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 1854b91f4..852cdf122 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -3,31 +3,35 @@ */ package com.fr.design.designer.creator; -import java.awt.*; -import java.awt.event.ContainerEvent; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import java.beans.IntrospectionException; -import java.util.HashMap; - import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; 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.beans.models.SelectionModel; +import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.form.layout.FRAbsoluteLayout; import com.fr.design.icon.IconPathConstants; -import com.fr.design.mainframe.*; +import com.fr.design.mainframe.EditingMouseListener; +import com.fr.design.mainframe.FormArea; +import com.fr.design.mainframe.FormDesigner; import com.fr.form.ui.Connector; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WLayout; -import com.fr.form.ui.widget.BoundsWidget; import com.fr.general.FRScreen; import com.fr.general.IOUtils; import com.fr.general.Inter; +import java.awt.*; +import java.awt.event.ContainerEvent; +import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; +import java.beans.IntrospectionException; +import java.util.ArrayList; +import java.util.HashMap; + /** * @author richer * @since 6.5.3 @@ -159,7 +163,15 @@ public class XWAbsoluteLayout extends XLayoutContainer { if (xCreator.acceptType(XWAbsoluteLayout.class)) { ((XWAbsoluteLayout) xCreator).updateBoundsWidget(); } - BoundsWidget boundsWidget = layout.getBoundsWidget(xCreator.toData()); + // 如果子组件时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(); + } + } + BoundsWidget boundsWidget = (BoundsWidget) layout.getBoundsWidget(xCreator.toData()); Rectangle rectangle = dealWidgetBound(xCreator.getBounds()); } @@ -184,7 +196,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { double percentH = ((double) backupBound.height / (double) currentBound.height); for (int index = 0, n = this.getComponentCount(); index < n; index++) { XCreator creator = (XCreator) this.getComponent(index); - BoundsWidget wgt = layout.getBoundsWidget(creator.toData()); + BoundsWidget wgt = (BoundsWidget) layout.getBoundsWidget(creator.toData()); // 用当前的显示大小计算后调正具体位置 Rectangle wgtBound = creator.getBounds(); Rectangle rec = calculateBound(wgtBound, percentW, percentH); @@ -217,7 +229,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { rec.y = (int) (rec.y / prevContainerPercent * containerPercent); rec.height = (int) (rec.height / prevContainerPercent * containerPercent); rec.width = (int) (rec.width / prevContainerPercent * containerPercent); - BoundsWidget wgt = toData().getBoundsWidget(creator.toData()); + BoundsWidget wgt = (BoundsWidget) toData().getBoundsWidget(creator.toData()); wgt.setBounds(rec); creator.setBounds(rec); creator.updateChildBound(minHeight); @@ -481,7 +493,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { XCreator xCreator = (XCreator) getComponent(i); Rectangle rectangle = xCreator.getBounds(); xCreator.setBounds((int) (rectangle.x * percent), rectangle.y, (int) (rectangle.width * percent), rectangle.height); - BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); + BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(xCreator.toData()); widget.setBounds(xCreator.getBounds()); } } @@ -498,7 +510,7 @@ public class XWAbsoluteLayout extends XLayoutContainer { XCreator xCreator = (XCreator) getComponent(i); Rectangle rectangle = xCreator.getBounds(); xCreator.setBounds(rectangle.x, (int) (rectangle.y * percent), rectangle.width, (int) (rectangle.height * percent)); - BoundsWidget widget = toData().getBoundsWidget(xCreator.toData()); + BoundsWidget widget = (BoundsWidget) toData().getBoundsWidget(xCreator.toData()); widget.setBounds(xCreator.getBounds()); } } diff --git a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java index 340ec9cd1..2ab891022 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java @@ -1,14 +1,5 @@ package com.fr.design.designer.creator; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.awt.event.ContainerEvent; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; import com.fr.design.designer.beans.location.Direction; @@ -20,14 +11,19 @@ import com.fr.design.mainframe.FormArea; import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WLayout; -import com.fr.form.ui.widget.BoundsWidget; import com.fr.general.FRScreen; -import com.fr.general.Inter; import com.fr.stable.ArrayUtils; +import java.awt.*; +import java.awt.event.ContainerEvent; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + /** * @author jim * @date 2014-6-23 diff --git a/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java b/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java index 8dad2c7f0..2c592cc21 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWScaleLayout.java @@ -3,16 +3,15 @@ */ package com.fr.design.designer.creator; -import java.awt.Dimension; -import java.awt.Rectangle; -import java.awt.event.ContainerEvent; - import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRScaleLayoutAdapter; import com.fr.design.form.layout.FRScaleLayout; import com.fr.form.ui.Widget; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WScaleLayout; -import com.fr.form.ui.widget.BoundsWidget; + +import java.awt.*; +import java.awt.event.ContainerEvent; /** * 自适应布局中添加组件时,部分控件如数字文本下拉等需要保持控件默认高度21, 用此容器来实现 diff --git a/designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java b/designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java index 0e1a293bd..7b9a5380c 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWTitleLayout.java @@ -11,7 +11,7 @@ import com.fr.form.ui.Label; import com.fr.form.ui.Widget; import com.fr.form.ui.WidgetTitle; import com.fr.form.ui.container.WTitleLayout; -import com.fr.form.ui.widget.BoundsWidget; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.general.ComparatorUtils; import java.awt.*; diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 9b778f850..94dfaf92e 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -3,10 +3,6 @@ */ package com.fr.design.designer.creator.cardlayout; -import java.awt.*; -import java.awt.event.MouseEvent; -import java.awt.image.BufferedImage; -import java.util.ArrayList; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.models.SelectionModel; @@ -17,12 +13,17 @@ import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.cardlayout.WCardMainBorderLayout; -import com.fr.form.ui.widget.BoundsWidget; import com.fr.general.IOUtils; import com.fr.general.Inter; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; +import java.util.ArrayList; + /** * card布局主体框架 * diff --git a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java index c0d1a06ed..5a2afa00c 100644 --- a/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java @@ -18,7 +18,7 @@ import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.ui.CardSwitchButton; import com.fr.form.ui.container.cardlayout.WCardTagLayout; import com.fr.form.ui.container.cardlayout.WTabFitLayout; -import com.fr.form.ui.widget.BoundsWidget; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.general.Background; import com.fr.general.FRLogger; import com.fr.general.Inter; diff --git a/designer_form/src/com/fr/design/mainframe/ConnectorHelper.java b/designer_form/src/com/fr/design/mainframe/ConnectorHelper.java index a64005812..93add3634 100644 --- a/designer_form/src/com/fr/design/mainframe/ConnectorHelper.java +++ b/designer_form/src/com/fr/design/mainframe/ConnectorHelper.java @@ -1,18 +1,15 @@ package com.fr.design.mainframe; -import java.awt.Color; -import java.awt.Graphics; -import java.awt.Point; -import java.awt.Rectangle; -import java.awt.event.MouseEvent; -import java.util.ArrayList; - -import com.fr.form.ui.widget.BoundsWidget; -import com.fr.stable.Constants; import com.fr.base.GraphHelper; import com.fr.design.designer.beans.ConnectorCreator; import com.fr.design.designer.creator.XWAbsoluteLayout; import com.fr.form.ui.Connector; +import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; +import com.fr.stable.Constants; + +import java.awt.*; +import java.awt.event.MouseEvent; +import java.util.ArrayList; public class ConnectorHelper { //这个类是用来画连接线的,暂时用不到