Browse Source

Pull request #6030: REPORT-59906 && REPORT-60158 【固定布局-原布局推荐4.1】决策报表-固定布局下往绝对画布块上拖的时候效果不对;【固定布局-原布局推荐4.1】决策报表-自适应布局-绝对画布块包含子组件的复用组件,拖入到占位块后,整体缩小了,但里面的子组件没有等比例缩小

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

* commit 'a1bb9bc52de1b777de11ad96ae28716b23960222':
  更新下布局模板
  REPORT-59906【固定布局-原布局推荐4.1】决策报表-自适应布局-绝对画布块包含子组件的复用组件,拖入到占位块后,整体缩小了,但里面的子组件没有等比例缩小
research/11.0
kerry 3 years ago
parent
commit
27ecb2831a
  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. 37
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/5.frm
  7. 56
      designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/6.frm

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();
boolean access = topLayout != null && !isMatchEdge && !topLayout.isEditable() && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
if (access) {
boolean access = topLayout != null && !isMatchEdge && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
//topLayout.getParent() != container说明当前增加的组件所在容器是嵌套在外部的自适应容器内部的,此时需要判断增加组件所在容器是否可编辑,不可编辑的话就直接返回 false
//否则说明就是往当前自适应容器内部添加组件,不需要判断其是否可编辑
if (access && (topLayout.getParent() != container && !topLayout.isEditable())) {
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.adapters.component.CompositeComponentAdapter;
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.XWAbsoluteLayout;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.utils.ComponentUtils;
@ -124,11 +124,10 @@ public class AddingModel {
*/
public boolean add2Container(FormDesigner designer, XLayoutContainer container, int x, int y) {
//考虑不同布局嵌套的情况,获取顶层容器
XLayoutContainer xLayoutContainer = container.getTopLayout();
if (xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class)) {
XLayoutContainer xLayoutContainer = XCreatorUtils.getTopEditableContainer(container);
if (xLayoutContainer != null) {
container = xLayoutContainer;
}
Rectangle rect = ComponentUtils.getRelativeBounds(container);
if (!ComparatorUtils.equals(container.getOuterLayout(), container.getBackupParent())) {
added = container.getLayoutAdapter().addBean(creator,
@ -141,4 +140,5 @@ public class AddingModel {
y + designer.getVerticalScaleValue() - rect.y);
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);
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.setContainerWidth(containerWidth);
addCompInterval(getAcualInterval());
LayoutUtils.layoutContainer(this);
// REPORT-54410: 决策报表,模板中其他组件的宽高修改会影响绝对画布块中组件的宽高和位置
// 绝对布局内的组件尺寸调整需要在绝对布局的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) {
HoverPainter painter = null;
if (container != current || designer.getPainter() == null) {
// 如果焦点容器不是当前容器
if (current != null) {
@ -204,15 +203,9 @@ public class FormCreatorDropTarget extends DropTarget {
throw new IllegalArgumentException("container can not be null!");
}
//获取painter的时候要考虑布局之间嵌套的问题
XLayoutContainer xLayoutContainer = container.getTopLayout();
if (xLayoutContainer != null && xLayoutContainer.getParent() != null
&& ((XLayoutContainer) xLayoutContainer.getParent()).acceptType(XWAbsoluteLayout.class)) {
if (!xLayoutContainer.isEditable()) {
xLayoutContainer = (XLayoutContainer) xLayoutContainer.getParent();
}
}
XLayoutContainer xLayoutContainer = XCreatorUtils.getTopEditableContainer(container);
painter = AdapterBus.getContainerPainter(designer,
xLayoutContainer != null && xLayoutContainer.acceptType(XWAbsoluteLayout.class) ? xLayoutContainer : container);
xLayoutContainer != null ? xLayoutContainer : container);
// 为界面设计器设置提示渲染提示器
designer.setPainter(painter);
@ -227,8 +220,9 @@ public class FormCreatorDropTarget extends DropTarget {
}
}
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.y -= designer.getArea().getVerticalValue();
painter.setRenderingBounds(rect);

37
designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/5.frm

@ -59,7 +59,7 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box5"/>
<WidgetName name="box7"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="0" y="183" width="480" height="197"/>
@ -67,7 +67,7 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box4"/>
<WidgetName name="box6"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="480" y="183" width="480" height="197"/>
@ -83,7 +83,7 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box9"/>
<WidgetName name="box10"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="637" y="380" width="323" height="160"/>
@ -91,7 +91,7 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box7"/>
<WidgetName name="box8"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="0" y="380" width="323" height="160"/>
@ -99,7 +99,7 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box8"/>
<WidgetName name="box9"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="323" y="380" width="314" height="160"/>
@ -107,10 +107,18 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box6"/>
<WidgetName name="box5"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="764" y="75" width="196" height="108"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box1"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="0" y="75" width="244" height="108"/>
<BoundsAttr x="0" y="75" width="196" height="108"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
@ -118,37 +126,38 @@
<WidgetName name="box3"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="716" y="75" width="244" height="108"/>
<BoundsAttr x="384" y="75" width="192" height="108"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box2"/>
<WidgetName name="box4"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="480" y="75" width="236" height="108"/>
<BoundsAttr x="576" y="75" width="188" height="108"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box1"/>
<WidgetName name="box2"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="244" y="75" width="236" height="108"/>
<BoundsAttr x="196" y="75" width="188" height="108"/>
</Widget>
<ShowBookmarks showBookmarks="true"/>
<Sorted sorted="false"/>
<MobileWidgetList>
<Widget widgetName="box0"/>
<Widget widgetName="box6"/>
<Widget widgetName="box1"/>
<Widget widgetName="box2"/>
<Widget widgetName="box3"/>
<Widget widgetName="box5"/>
<Widget widgetName="box4"/>
<Widget widgetName="box5"/>
<Widget widgetName="box7"/>
<Widget widgetName="box6"/>
<Widget widgetName="box8"/>
<Widget widgetName="box9"/>
<Widget widgetName="box10"/>
</MobileWidgetList>
<FrozenWidgets/>
<MobileBookMarkStyle class="com.fr.form.ui.mobile.impl.DefaultMobileBookMarkStyle"/>

56
designer-form/src/main/resources/com/fr/design/form/layouts/templates/multi/6.frm

@ -75,7 +75,7 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box10"/>
<WidgetName name="box8"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="0" y="337" width="295" height="203"/>
@ -83,7 +83,7 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box8"/>
<WidgetName name="box6"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="665" y="337" width="295" height="203"/>
@ -91,23 +91,23 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box9"/>
<WidgetName name="box5"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="0" y="142" width="295" height="195"/>
<BoundsAttr x="665" y="142" width="295" height="195"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box5"/>
<WidgetName name="box3"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="665" y="142" width="295" height="195"/>
<BoundsAttr x="0" y="142" width="295" height="195"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box6"/>
<WidgetName name="box4"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="295" y="142" width="370" height="101"/>
@ -115,49 +115,67 @@
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box4"/>
<WidgetName name="box12"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="716" y="75" width="244" height="67"/>
<BoundsAttr x="796" y="75" width="164" height="67"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box1"/>
<WidgetName name="box2"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="0" y="75" width="244" height="67"/>
<BoundsAttr x="0" y="75" width="164" height="67"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box3"/>
<WidgetName name="box10"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="480" y="75" width="236" height="67"/>
<BoundsAttr x="480" y="75" width="160" height="67"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box2"/>
<WidgetName name="box9"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="244" y="75" width="236" height="67"/>
<BoundsAttr x="320" y="75" width="160" height="67"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box11"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="640" y="75" width="156" height="67"/>
</Widget>
<Widget class="com.fr.form.ui.container.WAbsoluteLayout$BoundsWidget">
<InnerWidget class="com.fr.form.ui.container.OccupiedLayout">
<OccupiedLayout>
<WidgetName name="box1"/>
</OccupiedLayout>
</InnerWidget>
<BoundsAttr x="164" y="75" width="156" height="67"/>
</Widget>
<ShowBookmarks showBookmarks="true"/>
<Sorted sorted="false"/>
<MobileWidgetList>
<Widget widgetName="box0"/>
<Widget widgetName="box1"/>
<Widget widgetName="box2"/>
<Widget widgetName="box1"/>
<Widget widgetName="box9"/>
<Widget widgetName="box10"/>
<Widget widgetName="box11"/>
<Widget widgetName="box12"/>
<Widget widgetName="box3"/>
<Widget widgetName="box4"/>
<Widget widgetName="box9"/>
<Widget widgetName="box6"/>
<Widget widgetName="box5"/>
<Widget widgetName="box7"/>
<Widget widgetName="box10"/>
<Widget widgetName="box8"/>
<Widget widgetName="box6"/>
</MobileWidgetList>
<FrozenWidgets/>
<MobileBookMarkStyle class="com.fr.form.ui.mobile.impl.DefaultMobileBookMarkStyle"/>

Loading…
Cancel
Save