From b5250119666718e467923119d59ec1e6a2a7bf3f Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 15 Nov 2017 18:46:14 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-5409=20=E3=80=90=E9=9A=BE=E8=BF=98?= =?UTF-8?q?=E5=8E=9F=E3=80=91=E8=A1=A8=E5=8D=95=E7=BB=84=E4=BB=B6=E5=9C=A8?= =?UTF-8?q?=E6=8B=96=E5=8A=A8=E8=BF=87=E7=A8=8B=E4=B8=ADbody=E7=9A=84?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83=E5=B1=80=E5=A4=B1=E6=95=88?= =?UTF-8?q?=20REPORT-4225=20=E6=89=93=E5=BC=80=E9=AB=98=E7=89=88=E6=9C=ACc?= =?UTF-8?q?pt=EF=BC=8C=E5=BC=B9=E5=87=BA=E7=9A=84=E6=8A=A5=E9=94=99?= =?UTF-8?q?=E6=A1=86=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/dialog/InformationWarnPane.java | 1 - .../adapters/layout/FRFitLayoutAdapter.java | 35 +++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/designer_base/src/com/fr/design/dialog/InformationWarnPane.java b/designer_base/src/com/fr/design/dialog/InformationWarnPane.java index e5dd4fd9fb..eeb809cf28 100644 --- a/designer_base/src/com/fr/design/dialog/InformationWarnPane.java +++ b/designer_base/src/com/fr/design/dialog/InformationWarnPane.java @@ -143,7 +143,6 @@ public class InformationWarnPane extends JPanel{ contentPane.add(InformationWarnPane.this); contentPane.add(this.createControlButtonPane()); this.setModal(true); - this.pack(); GUICoreUtils.centerWindow(this); } 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 3a030f7f2b..c293042927 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 @@ -722,7 +722,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { protected void delete(XCreator creator, int creatorWidth, int creatorHeight) { int x = creator.getX(); int y = creator.getY(); - recalculateChildrenSize(x, y, creatorWidth, creatorHeight); + recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true); } /** @@ -734,6 +734,19 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * @param creatorHeight 删除的组件之前所在布局的高度 */ public void recalculateChildrenSize(int x, int y, int creatorWidth, int creatorHeight) { + recalculateChildrenSize(x, y, creatorWidth, creatorHeight, false); + } + + /** + * 重新计算内部组件大小 + * + * @param x 坐标x + * @param y 坐标y + * @param creatorWidth 删除的组件之前所在布局的宽度 + * @param creatorHeight 删除的组件之前所在布局的高度 + * @param isDel 删除操作 + */ + public void recalculateChildrenSize(int x, int y, int creatorWidth, int creatorHeight, boolean isDel) { if (container.getComponentCount() == 0) { return; } else { @@ -744,11 +757,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { if (!rightComps.isEmpty() && getAllHeight(rightComps) == height) { calculateRightRelatComponent(x, width + actualVal); } else if (!leftComps.isEmpty() && getAllHeight(leftComps) == height) { - calculateLefttRelatComponent(width + actualVal); + calculateLefttRelatComponent(width + actualVal, isDel); } else if (!downComps.isEmpty() && getAllWidth(downComps) == width) { calculateDownRelatComponent(y, height + actualVal); } else if (!upComps.isEmpty() && getAllWidth(upComps) == width) { - calculateUpRelatComponent(height + actualVal); + calculateUpRelatComponent(height + actualVal, isDel); } else { // 由于布局三等分的存在,可能会出现删除组件时,找不到关联的组件填充,此时特殊处理 calculateNoRelatedComponent(x, y, width, height); @@ -823,7 +836,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { return; } } - recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); + recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height, true); } private void calculateNoRelatedWhileRightBott(Rectangle bound, Component rcomp) { @@ -858,7 +871,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { return; } } - recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height); + recalculateChildrenSize(bound.x, bound.y, bound.width, bound.height, true); } private int getMinWidth(List comps) { @@ -1095,7 +1108,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除或拉伸控件左边框时 调整左侧的组件位置大小; */ protected boolean calculateLefttRelatComponent(int objWidth) { - if (isBeyondAdjustWidthScope(objWidth)) { + return calculateLefttRelatComponent(objWidth, false); + } + + protected boolean calculateLefttRelatComponent(int objWidth, boolean isDel) { + if (!isDel && isBeyondAdjustWidthScope(objWidth)) { return false; } int count = leftComps.size(); @@ -1153,7 +1170,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除或拉伸上边框 调整上方的组件位置大小 */ protected boolean calculateUpRelatComponent(int objHeight) { - if (isBeyondAdjustHeightScope(objHeight)) { + return calculateUpRelatComponent(objHeight, false); + } + + protected boolean calculateUpRelatComponent(int objHeight, boolean isDel) { + if (!isDel && isBeyondAdjustHeightScope(objHeight)) { return false; } int count = upComps.size();