Browse Source

Pull request #8836: REPORT-67316 决策报表-客户模板是绝对布局固定大小的,复制客户模板里的tab到一个新建的绝对布局固定大小frm,保存关闭再打开新建模板,tab下的报表块尺寸变了

Merge in DESIGN/design from ~KERRY/design_10.0:feature/x to feature/x

* commit 'f2931631f0f7b431d9b2fccde552890cda885c99':
  REPORT-67316 优化重复代码
  REPORT-67316 决策报表-客户模板是绝对布局固定大小的,复制客户模板里的tab到一个新建的绝对布局固定大小frm,保存关闭再打开新建模板,tab下的报表块尺寸变了
feature/x
kerry 3 years ago
parent
commit
ef3fc95cb3
  1. 17
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  2. 16
      designer-form/src/main/java/com/fr/design/mainframe/FormArea.java
  3. 5
      designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java

17
designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java

@ -472,4 +472,21 @@ public class XCreatorUtils {
} }
return container; return container;
} }
/**
* 循环遍历组件调整组件间隙
* @param creator
*/
public static void traverAndAdjust(XCreator creator) {
for (int i = 0; i < creator.getComponentCount(); i++) {
Object object = creator.getComponent(i);
if (object instanceof XCreator) {
XCreator temp = (XCreator) object;
temp.adjustCompSize(0.0);
traverAndAdjust(temp);
}
}
}
} }

16
designer-form/src/main/java/com/fr/design/mainframe/FormArea.java

@ -4,6 +4,7 @@ import com.fr.design.actions.UpdateAction;
import com.fr.design.constants.UIConstants; import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.events.DesignerEvent; import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWBorderLayout; import com.fr.design.designer.creator.XWBorderLayout;
import com.fr.design.designer.creator.XWFitLayout; import com.fr.design.designer.creator.XWFitLayout;
@ -447,7 +448,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
XLayoutContainer root = FormArea.this.designer.getRootComponent(); XLayoutContainer root = FormArea.this.designer.getRootComponent();
if (root.acceptType(XWFitLayout.class)) { if (root.acceptType(XWFitLayout.class)) {
XWFitLayout layout = (XWFitLayout) root; XWFitLayout layout = (XWFitLayout) root;
traverAndAdjust(layout, 0.0); XCreatorUtils.traverAndAdjust(layout);
layout.adjustCreatorsWhileSlide(0.0); layout.adjustCreatorsWhileSlide(0.0);
// 拖动滑块,先将内部组件百分比大小计算,再计算容器大小 // 拖动滑块,先将内部组件百分比大小计算,再计算容器大小
Dimension d = new Dimension(layout.getWidth(), layout.getHeight()); Dimension d = new Dimension(layout.getWidth(), layout.getHeight());
@ -469,19 +470,6 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
} }
} }
//循环遍历布局,按百分比调整子组件大小
private void traverAndAdjust(XCreator creator, double percent) {
for (int i = 0; i < creator.getComponentCount(); i++) {
Object object = creator.getComponent(i);
if (object instanceof XCreator) {
XCreator temp = (XCreator) object;
temp.adjustCompSize(percent);
traverAndAdjust(temp, percent);
}
}
}
/** /**
* 增加刻度条 * 增加刻度条
*/ */

5
designer-form/src/main/java/com/fr/design/mainframe/FormSelectionUtils.java

@ -16,6 +16,7 @@ import com.fr.design.designer.creator.XWTitleLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.fun.FormWidgetOptionProvider; import com.fr.design.fun.FormWidgetOptionProvider;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WTitleLayout; import com.fr.form.ui.container.WTitleLayout;
@ -290,11 +291,15 @@ public class FormSelectionUtils {
public static XCreator copyXcreator(Form form, XCreator xCreator) throws CloneNotSupportedException{ public static XCreator copyXcreator(Form form, XCreator xCreator) throws CloneNotSupportedException{
Widget copied = (Widget) xCreator.toData().clone(); Widget copied = (Widget) xCreator.toData().clone();
XCreator copiedCreator = XCreatorUtils.createXCreator(copied, xCreator.getSize()); XCreator copiedCreator = XCreatorUtils.createXCreator(copied, xCreator.getSize());
//主要用来处理组件间隔和padding,保证界面上展示的组件尺寸是计算过padding和组件间隔的
LayoutUtils.layoutContainer(copiedCreator);
XCreatorUtils.traverAndAdjust(copiedCreator);
ArrayList<String> nameSpace = new ArrayList<>(); ArrayList<String> nameSpace = new ArrayList<>();
copyWidgetName(form, nameSpace, copiedCreator); copyWidgetName(form, nameSpace, copiedCreator);
return copiedCreator; return copiedCreator;
} }
/** /**
* 拷贝组件 * 拷贝组件
* @param form 当前表单 * @param form 当前表单

Loading…
Cancel
Save