Browse Source

Merge pull request #405 in BA/design from ~ZHOUPING/design:release to release

* commit 'c4e1dedba902ee9cb045fb0db94468f3172e0b20':
  REPORT-533 表单初始化布局新功能 bugfix:修复scalelayout类的控件在布局间切换出现问题的情况
master
superman 8 years ago
parent
commit
fb71e41b1a
  1. 17
      designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  2. 12
      designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java

17
designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java

@ -1,8 +1,6 @@
package com.fr.design.designer.properties;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils;
@ -106,10 +104,16 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
xfl.toData().setLayoutType(WBodyLayoutType.FIT);
for (Component comp : components) {
xfl.add(comp);
XCreator xCreator = (XCreator)comp;
if (xCreator.shouldScaleCreator()){
XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight());
xfl.add(parentPanel, xCreator.toData().getWidgetName());
continue;
}
xfl.add(xCreator);
}
//这边计算的时候会先把组件间隔去掉
moveComponents2FitLayout(xfl, components);
moveComponents2FitLayout(xfl);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreator(xfl);
xfl.convert();
@ -159,8 +163,9 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
}
//把绝对布局中的元素按规则移动到自适应布局中
private void moveComponents2FitLayout(XWFitLayout xwFitLayout, Component[] components) {
private void moveComponents2FitLayout(XWFitLayout xwFitLayout) {
int eachRowCount = 4;
Component[] components = xwFitLayout.getComponents();
if (components.length <= 1){
return;
}

12
designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java

@ -4,9 +4,7 @@
package com.fr.design.designer.properties;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.*;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.WidgetPropertyPane;
@ -156,6 +154,14 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0,0));
xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
for (Component component : components) {
XCreator xCreator = (XCreator)component;
//部分控件被ScaleLayout包裹着,绝对布局里面要放出来
if (xCreator.acceptType(XWScaleLayout.class)){
if (xCreator.getComponentCount() > 0 && ((XCreator)xCreator.getComponent(0)).shouldScaleCreator()) {
component = xCreator.getComponent(0);
component.setBounds(xCreator.getBounds());
}
}
xwAbsoluteBodyLayout.add(component);
}
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();

Loading…
Cancel
Save