Browse Source

REPORT-59906【固定布局-原布局推荐4.1】决策报表-自适应布局-绝对画布块包含子组件的复用组件,拖入到占位块后,整体缩小了,但里面的子组件没有等比例缩小

research/11.0
kerry 3 years ago
parent
commit
20978231b8
  1. 6
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  2. 8
      designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java
  3. 18
      designer-form/src/main/java/com/fr/design/designer/creator/XCreatorUtils.java
  4. 1
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  5. 14
      designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

6
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

@ -160,8 +160,10 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//布局控件要先判断是不是可编辑 //布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout(); XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble(); boolean access = topLayout != null && !isMatchEdge && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
if (access) { //topLayout.getParent() != container说明当前增加的组件所在容器是嵌套在外部的自适应容器内部的,此时需要判断增加组件所在容器是否可编辑,不可编辑的话就直接返回 false
//否则说明就是往当前自适应容器内部添加组件,不需要判断其是否可编辑
if (access && (topLayout.getParent() != container && !topLayout.isEditable())) {
return false; return false;
} }

8
designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java

@ -4,8 +4,8 @@ import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.adapters.component.CompositeComponentAdapter; import com.fr.design.designer.beans.adapters.component.CompositeComponentAdapter;
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.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
@ -124,11 +124,10 @@ public class AddingModel {
*/ */
public boolean add2Container(FormDesigner designer, XLayoutContainer container, int x, int y) { public boolean add2Container(FormDesigner designer, XLayoutContainer container, int x, int y) {
//考虑不同布局嵌套的情况,获取顶层容器 //考虑不同布局嵌套的情况,获取顶层容器
XLayoutContainer xLayoutContainer = container.getTopLayout(); XLayoutContainer xLayoutContainer = XCreatorUtils.getTopEditableContainer(container);
if (xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class)) { if (xLayoutContainer != null) {
container = xLayoutContainer; container = xLayoutContainer;
} }
Rectangle rect = ComponentUtils.getRelativeBounds(container); Rectangle rect = ComponentUtils.getRelativeBounds(container);
if (!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())) { if (!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())) {
added = container.getLayoutAdapter().addBean(creator, added = container.getLayoutAdapter().addBean(creator,
@ -141,4 +140,5 @@ public class AddingModel {
y + designer.getVerticalScaleValue() - rect.y); y + designer.getVerticalScaleValue() - rect.y);
return added; return added;
} }
} }

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

@ -402,4 +402,22 @@ public class XCreatorUtils {
FineColorFlushUtils.replaceCacheObject(container.toData(), colorGather); FineColorFlushUtils.replaceCacheObject(container.toData(), colorGather);
FineColorManager.traverse(container.toData(), colorGather); FineColorManager.traverse(container.toData(), colorGather);
} }
/**
* 获取容器组件的顶层正编辑的组件
*/
@Nullable
public static XLayoutContainer getTopEditableContainer(XLayoutContainer container) {
if (container == null) {
return null;
}
XLayoutContainer xLayoutContainer = container.getTopLayout();
if (xLayoutContainer != null && xLayoutContainer.getParent() != null) {
if (!xLayoutContainer.isEditable()) {
return (XLayoutContainer) xLayoutContainer.getParent();
}
}
return null;
}
} }

1
designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java

@ -796,6 +796,7 @@ public class XWFitLayout extends XLayoutContainer {
layout.setContainerHeight(containerHeight); layout.setContainerHeight(containerHeight);
layout.setContainerWidth(containerWidth); layout.setContainerWidth(containerWidth);
addCompInterval(getAcualInterval()); addCompInterval(getAcualInterval());
LayoutUtils.layoutContainer(this);
// REPORT-54410: 决策报表,模板中其他组件的宽高修改会影响绝对画布块中组件的宽高和位置 // REPORT-54410: 决策报表,模板中其他组件的宽高修改会影响绝对画布块中组件的宽高和位置
// 绝对布局内的组件尺寸调整需要在绝对布局的bound排除GAP后进行,否则计算出的 // 绝对布局内的组件尺寸调整需要在绝对布局的bound排除GAP后进行,否则计算出的

14
designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -193,7 +193,6 @@ public class FormCreatorDropTarget extends DropTarget {
private void dealWithContainer(int x, int y, XLayoutContainer container) { private void dealWithContainer(int x, int y, XLayoutContainer container) {
HoverPainter painter = null; HoverPainter painter = null;
if (container != current || designer.getPainter() == null) { if (container != current || designer.getPainter() == null) {
// 如果焦点容器不是当前容器 // 如果焦点容器不是当前容器
if (current != null) { if (current != null) {
@ -204,15 +203,9 @@ public class FormCreatorDropTarget extends DropTarget {
throw new IllegalArgumentException("container can not be null!"); throw new IllegalArgumentException("container can not be null!");
} }
//获取painter的时候要考虑布局之间嵌套的问题 //获取painter的时候要考虑布局之间嵌套的问题
XLayoutContainer xLayoutContainer = container.getTopLayout(); XLayoutContainer xLayoutContainer = XCreatorUtils.getTopEditableContainer(container);
if (xLayoutContainer != null && xLayoutContainer.getParent() != null
&& ((XLayoutContainer) xLayoutContainer.getParent()).acceptType(XWAbsoluteLayout.class)) {
if (!xLayoutContainer.isEditable()) {
xLayoutContainer = (XLayoutContainer) xLayoutContainer.getParent();
}
}
painter = AdapterBus.getContainerPainter(designer, painter = AdapterBus.getContainerPainter(designer,
xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class) ? xLayoutContainer : container); xLayoutContainer != null ? xLayoutContainer : container);
// 为界面设计器设置提示渲染提示器 // 为界面设计器设置提示渲染提示器
designer.setPainter(painter); designer.setPainter(painter);
@ -227,8 +220,9 @@ public class FormCreatorDropTarget extends DropTarget {
} }
} }
if (painter != null) { if (painter != null) {
XLayoutContainer xLayoutContainer = XCreatorUtils.getTopEditableContainer(container);
// 为提示渲染器设置焦点位置、区域等渲染参数 // 为提示渲染器设置焦点位置、区域等渲染参数
Rectangle rect = ComponentUtils.getRelativeBounds(container); Rectangle rect = ComponentUtils.getRelativeBounds(xLayoutContainer != null ? xLayoutContainer : container);
rect.x -= designer.getArea().getHorizontalValue(); rect.x -= designer.getArea().getHorizontalValue();
rect.y -= designer.getArea().getVerticalValue(); rect.y -= designer.getArea().getVerticalValue();
painter.setRenderingBounds(rect); painter.setRenderingBounds(rect);

Loading…
Cancel
Save