Browse Source

无JIRA任务,sonar问题修复

research/11.0
author 5 years ago
parent
commit
08f98ea0f2
  1. 16
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

16
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.main.mobile.FormMobileAttr;
import com.fr.form.ui.container.WBorderLayout; import com.fr.form.ui.container.WBorderLayout;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.stable.AssistUtils;
import javax.swing.JComponent; import javax.swing.JComponent;
@ -226,7 +227,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
// slidePane.populateBean(screenValue); // slidePane.populateBean(screenValue);
if (root.acceptType(XWFitLayout.class)) { if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root; XWFitLayout layout = (XWFitLayout) root;
if (screenValue != DEFAULT_SLIDER) { if ( !AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
reCalculateRoot(screenValue, true); reCalculateRoot(screenValue, true);
} else { } else {
// 组件间隔啊 // 组件间隔啊
@ -354,7 +355,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
// double value = slidePane.updateBean(); // double value = slidePane.updateBean();
//重置滑块的值为默认值100 //重置滑块的值为默认值100
START_VALUE = DEFAULT_SLIDER; START_VALUE = DEFAULT_SLIDER;
if (screenValue == DEFAULT_SLIDER) { if ( AssistUtils.equals(screenValue, DEFAULT_SLIDER) ) {
layout.getParent().setSize(width, height + designer.getParaHeight()); layout.getParent().setSize(width, height + designer.getParaHeight());
FormArea.this.validate(); FormArea.this.validate();
} else { } else {
@ -370,7 +371,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
* @param value * @param value
*/ */
private void reCalculateRoot(double value, boolean needCalculateParaHeight) { private void reCalculateRoot(double value, boolean needCalculateParaHeight) {
if (value == START_VALUE) { if ( AssistUtils.equals(value, START_VALUE) ) {
return; return;
} }
double percent = (value - START_VALUE) / START_VALUE; double percent = (value - START_VALUE) / START_VALUE;
@ -734,15 +735,15 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
this.horicalMax = (int) totalSize.getHeight(); this.horicalMax = (int) totalSize.getHeight();
// 撤销时会refreshRoot,导致layout大小变为默认大小 // 撤销时会refreshRoot,导致layout大小变为默认大小
// 按照之前设置的宽高和百分比重置下容器size // 按照之前设置的宽高和百分比重置下容器size
if (width != widthPane.getValue()) { if ( !AssistUtils.equals(width, widthPane.getValue()) ) {
widthPane.setValue(width); widthPane.setValue(width);
reCalculateWidth((int) width); reCalculateWidth((int) width);
} }
if (height != heightPane.getValue()) { if ( !AssistUtils.equals(height, heightPane.getValue()) ) {
heightPane.setValue(height); heightPane.setValue(height);
reCalculateHeight((int) 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(); XWFitLayout layout = (XWFitLayout) designer.getRootComponent();
// 撤销时先refreshRoot了,此处去掉内边距再增加间隔 // 撤销时先refreshRoot了,此处去掉内边距再增加间隔
layout.moveContainerMargin(); layout.moveContainerMargin();
@ -817,6 +818,9 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
Rectangle rec = new Rectangle(left + (right - DESIGNERWIDTH) / 2, TOPGAP, right, bottom); Rectangle rec = new Rectangle(left + (right - DESIGNERWIDTH) / 2, TOPGAP, right, bottom);
//是否为表单 //是否为表单
if (isValid) { if (isValid) {
if (hbarPreferredSize == null) {
throw new IllegalArgumentException("hbarPreferredSize can not be null!");
}
int maxHeight = bottom - hbarPreferredSize.height - resize.height - TOPGAP * 2; int maxHeight = bottom - hbarPreferredSize.height - resize.height - TOPGAP * 2;
int maxWidth = right - vbarPreferredSize.width; int maxWidth = right - vbarPreferredSize.width;
DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH; DESIGNERWIDTH = DESIGNERWIDTH > maxWidth ? maxWidth : DESIGNERWIDTH;

Loading…
Cancel
Save