From 08f98ea0f2bc5f0be43bb2ece31993d182837446 Mon Sep 17 00:00:00 2001 From: author Date: Wed, 11 Sep 2019 10:55:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=EF=BC=8Csonar?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormArea.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java index b42d1b41e..991240b9c 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormArea.java @@ -23,6 +23,7 @@ import com.fr.design.utils.gui.LayoutUtils; import com.fr.form.main.mobile.FormMobileAttr; import com.fr.form.ui.container.WBorderLayout; import com.fr.general.FRScreen; +import com.fr.stable.AssistUtils; import javax.swing.JComponent; @@ -226,7 +227,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { // slidePane.populateBean(screenValue); if (root.acceptType(XWFitLayout.class)) { XWFitLayout layout = (XWFitLayout) root; - if (screenValue != DEFAULT_SLIDER) { + if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) { reCalculateRoot(screenValue, true); } else { // 组件间隔啊 @@ -354,7 +355,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { // double value = slidePane.updateBean(); //重置滑块的值为默认值100 START_VALUE = DEFAULT_SLIDER; - if (screenValue == DEFAULT_SLIDER) { + if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) { layout.getParent().setSize(width, height + designer.getParaHeight()); FormArea.this.validate(); } else { @@ -370,7 +371,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent { * @param value */ private void reCalculateRoot(double value, boolean needCalculateParaHeight) { - if (value == START_VALUE) { + if ( AssistUtils.equals(value, START_VALUE) ) { return; } double percent = (value - START_VALUE) / START_VALUE; @@ -734,15 +735,15 @@ public class FormArea extends JComponent implements ScrollRulerComponent { this.horicalMax = (int) totalSize.getHeight(); // 撤销时会refreshRoot,导致layout大小变为默认大小 // 按照之前设置的宽高和百分比重置下容器size - if (width != widthPane.getValue()) { + if ( !AssistUtils.equals(width, widthPane.getValue()) ) { widthPane.setValue(width); reCalculateWidth((int) width); } - if (height != heightPane.getValue()) { + if ( !AssistUtils.equals(height, heightPane.getValue()) ) { heightPane.setValue(height); reCalculateHeight((int) height); } - if (designer.getRootComponent().acceptType(XWFitLayout.class) && slide == DEFAULT_SLIDER) { + if (designer.getRootComponent().acceptType(XWFitLayout.class) && AssistUtils.equals(slide, DEFAULT_SLIDER) ) { XWFitLayout layout = (XWFitLayout) designer.getRootComponent(); // 撤销时先refreshRoot了,此处去掉内边距再增加间隔 layout.moveContainerMargin(); @@ -817,6 +818,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent { Rectangle rec = new Rectangle(left + (right - DESIGNERWIDTH) / 2, TOPGAP, right, bottom); //是否为表单 if (isValid) { + if (hbarPreferredSize == null) { + throw new IllegalArgumentException("hbarPreferredSize can not be null!"); + } int maxHeight = bottom - hbarPreferredSize.height - resize.height - TOPGAP * 2; int maxWidth = right - vbarPreferredSize.width; DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH;