From 0b8c85a005527180cf35191d373220d0d0ee7a0e Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 15 Nov 2016 15:34:16 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-578=20=E8=87=AA=E9=80=82=E5=BA=94?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E4=B8=8B=E9=9C=80=E8=A6=81=E8=80=83=E8=99=91?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../properties/FRFitLayoutConstraints.java | 36 +++++++++++-------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java index 6a9202c1c..b58850eaa 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java @@ -2,8 +2,6 @@ package com.fr.design.designer.properties; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; @@ -12,8 +10,9 @@ import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.utils.ComponentUtils; -import com.fr.form.ui.Widget; +import com.fr.form.ui.PaddingMargin; import com.fr.form.ui.container.WFitLayout; +import com.fr.form.ui.container.WLayout; import com.fr.general.Inter; import javax.swing.*; @@ -30,8 +29,8 @@ import java.awt.*; */ //控件在自适应布局中宽度、高度属性,7.1.1不可编辑 public class FRFitLayoutConstraints implements ConstraintsGroupModel { - private static final int MINHEIGHT = XCreator.SMALL_PREFERRED_SIZE.height; - private static final int MINWIDTH = XCreator.SMALL_PREFERRED_SIZE.width; + private static final int MINHEIGHT = WLayout.MIN_HEIGHT; + private static final int MINWIDTH = WLayout.MIN_WIDTH; private static final int ROWNUM = 2; private DefaultTableCellRenderer renderer; @@ -91,31 +90,39 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { int v = value == null ? 0 : ((Number) value).intValue(); int difference = 0; Rectangle bounds = getBounds(); + Rectangle rec = ComponentUtils.getRelativeBounds(parent); + WFitLayout wFitLayout = parent.toData(); + int minHeight = (int)(MINHEIGHT * wFitLayout.getResolutionScaling()); + int minWidth = (int)(MINWIDTH * wFitLayout.getResolutionScaling()); + PaddingMargin margin= wFitLayout.getMargin(); switch (row) { case 0: - if(v < MINWIDTH){ - JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Width") + Integer.toString(MINWIDTH)); - v = xCreator.getWidth(); - } if (bounds.width == v){ return false; } + if(bounds.width == rec.width - margin.getLeft() - margin.getRight()){ + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); + }else if(v < minWidth){ + JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Width") + Integer.toString(minWidth)); + v = xCreator.getWidth(); + } difference = bounds.width - v; bounds.width = v; break; case 1: - if(v < MINHEIGHT){ - JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Height") + Integer.toString(MINHEIGHT)); - v = xCreator.getHeight(); - } if (bounds.height == v){ return false; } + if(bounds.height == rec.height - margin.getTop() - margin.getBottom()){ + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); + }else if(v < minHeight){ + JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Height") + Integer.toString(minHeight)); + v = xCreator.getHeight(); + } difference = bounds.height - v; bounds.height = v; break; } - WFitLayout wFitLayout = parent.toData(); wFitLayout.setBounds(xCreator.toData(),bounds); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); Rectangle backupBounds = getBounds(); @@ -131,7 +138,6 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { public Rectangle getBounds(){ Rectangle bounds = new Rectangle(xCreator.getBounds()); - XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator); if (parent == null) { return bounds; } From be778943f137a69ddc2e7c218070f85196649b71 Mon Sep 17 00:00:00 2001 From: kerry Date: Tue, 15 Nov 2016 16:48:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-578=20=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/properties/FRFitLayoutConstraints.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java index b58850eaa..cf177f791 100644 --- a/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java +++ b/designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java @@ -47,7 +47,7 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { @Override public String getGroupName() { - return Inter.getLocText("Widget-Size"); + return Inter.getLocText("FR-Designer-Widget_Size"); } @Override @@ -70,9 +70,9 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { if (column == 0) { switch (row) { case 0: - return Inter.getLocText("Tree-Width"); + return Inter.getLocText("FR-Designer-Tree_Width"); default: - return Inter.getLocText("Tree-Height"); + return Inter.getLocText("FR-Designer-Tree_Height"); } } else { switch (row) { @@ -103,7 +103,7 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { if(bounds.width == rec.width - margin.getLeft() - margin.getRight()){ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); }else if(v < minWidth){ - JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Width") + Integer.toString(minWidth)); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Width") + Integer.toString(minWidth)); v = xCreator.getWidth(); } difference = bounds.width - v; @@ -116,7 +116,7 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel { if(bounds.height == rec.height - margin.getTop() - margin.getBottom()){ JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds")); }else if(v < minHeight){ - JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Height") + Integer.toString(minHeight)); + JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Height") + Integer.toString(minHeight)); v = xCreator.getHeight(); } difference = bounds.height - v;