From ad8555b4e1d413f9af427cdb6aa43ba75b9bf2ef Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 14 Nov 2017 16:37:26 +0800 Subject: [PATCH 1/5] =?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?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../beans/adapters/layout/FRFitLayoutAdapter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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..fd256cc828 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 @@ -40,6 +40,8 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { private HoverPainter painter; //区分拖拽和编辑宽高 private boolean isEdit; + //区分拖拽边框和 删除 + private boolean isDel; public boolean isEdit() { return isEdit; @@ -720,9 +722,11 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除组件或者重新拖动时,其它组件重新计算位置大小 */ protected void delete(XCreator creator, int creatorWidth, int creatorHeight) { + isDel = true; int x = creator.getX(); int y = creator.getY(); recalculateChildrenSize(x, y, creatorWidth, creatorHeight); + isDel = false; } /** @@ -1095,7 +1099,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除或拉伸控件左边框时 调整左侧的组件位置大小; */ protected boolean calculateLefttRelatComponent(int objWidth) { - if (isBeyondAdjustWidthScope(objWidth)) { + if (!isDel && isBeyondAdjustWidthScope(objWidth)) { return false; } int count = leftComps.size(); @@ -1153,7 +1157,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除或拉伸上边框 调整上方的组件位置大小 */ protected boolean calculateUpRelatComponent(int objHeight) { - if (isBeyondAdjustHeightScope(objHeight)) { + if (!isDel && isBeyondAdjustHeightScope(objHeight)) { return false; } int count = upComps.size(); From be047e3b2eec217ea405cdde7c7ffb22249b2481 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Tue, 14 Nov 2017 17:44:45 +0800 Subject: [PATCH 2/5] PMD --- .../adapters/layout/FRFitLayoutAdapter.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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 fd256cc828..d04e3a4a71 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,11 +722,23 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除组件或者重新拖动时,其它组件重新计算位置大小 */ protected void delete(XCreator creator, int creatorWidth, int creatorHeight) { - isDel = true; + recalculateBeforeDelete(); int x = creator.getX(); int y = creator.getY(); recalculateChildrenSize(x, y, creatorWidth, creatorHeight); - isDel = false; + recalculateAfterDelete(); + } + + private void recalculateBeforeDelete() { + setDel(false); + } + + private void recalculateAfterDelete() { + setDel(true); + } + + public void setDel(boolean del) { + isDel = del; } /** From 35a117c230bfa00ed23ac4781782ce011577c516 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 15 Nov 2017 16:05:19 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-4225=20=E6=89=93=E5=BC=80=E9=AB=98?= =?UTF-8?q?=E7=89=88=E6=9C=ACcpt=EF=BC=8C=E5=BC=B9=E5=87=BA=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E6=A1=86=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- designer_base/src/com/fr/design/dialog/InformationWarnPane.java | 1 - 1 file changed, 1 deletion(-) 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); } From 69fcc97f9999f1361d1300abaf6ec390a9f55a37 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 15 Nov 2017 17:50:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?PMD,=E9=9A=8F=E4=BE=BF=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E4=B8=8B=E9=A1=BA=E6=97=B6=E9=92=88=E6=8E=92=E7=89=88=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=B8=AD=E9=97=B4=E7=BB=84=E4=BB=B6=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRFitLayoutAdapter.java | 33 +++++++++++++++---- 1 file changed, 26 insertions(+), 7 deletions(-) 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 d04e3a4a71..a6e00639cc 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,11 +722,9 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除组件或者重新拖动时,其它组件重新计算位置大小 */ protected void delete(XCreator creator, int creatorWidth, int creatorHeight) { - recalculateBeforeDelete(); int x = creator.getX(); int y = creator.getY(); - recalculateChildrenSize(x, y, creatorWidth, creatorHeight); - recalculateAfterDelete(); + recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true); } private void recalculateBeforeDelete() { @@ -750,6 +748,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 { @@ -760,11 +771,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); @@ -839,7 +850,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) { @@ -874,7 +885,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) { @@ -1111,6 +1122,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除或拉伸控件左边框时 调整左侧的组件位置大小; */ protected boolean calculateLefttRelatComponent(int objWidth) { + return calculateLefttRelatComponent(objWidth, false); + } + + protected boolean calculateLefttRelatComponent(int objWidth, boolean isDel) { if (!isDel && isBeyondAdjustWidthScope(objWidth)) { return false; } @@ -1169,6 +1184,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { * 删除或拉伸上边框 调整上方的组件位置大小 */ protected boolean calculateUpRelatComponent(int objHeight) { + return calculateUpRelatComponent(objHeight, false); + } + + protected boolean calculateUpRelatComponent(int objHeight, boolean isDel) { if (!isDel && isBeyondAdjustHeightScope(objHeight)) { return false; } From 99bc698f7870f219b8eb6006ab025ae7b744f360 Mon Sep 17 00:00:00 2001 From: MoMeak Date: Wed, 15 Nov 2017 18:20:36 +0800 Subject: [PATCH 5/5] PMD --- .../beans/adapters/layout/FRFitLayoutAdapter.java | 14 -------------- 1 file changed, 14 deletions(-) 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 a6e00639cc..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 @@ -40,8 +40,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { private HoverPainter painter; //区分拖拽和编辑宽高 private boolean isEdit; - //区分拖拽边框和 删除 - private boolean isDel; public boolean isEdit() { return isEdit; @@ -727,18 +725,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter { recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true); } - private void recalculateBeforeDelete() { - setDel(false); - } - - private void recalculateAfterDelete() { - setDel(true); - } - - public void setDel(boolean del) { - isDel = del; - } - /** * 重新计算内部组件大小 *