Browse Source

Pull request #3967: REPORT-49686 决策报表自适应布局,添加参数面板后,无法通过右侧设置面板调整绝对画布块的大小

Merge in DESIGN/design from ~YVAN/design:bugfix/10.0 to bugfix/10.0

* commit '009735a50441b864d1faa090eb50dec56da92664':
  REPORT-49686 决策报表自适应布局,添加参数面板后,无法通过右侧设置面板调整绝对画布块的大小 【问题原因】这里绝对画布块的高度调整要分为两种方式,一种是拖拽改变,另一种是在右侧面板中改变高度数值,问题的原因是此前REPORT-7588中,拖拽时会走到FormSelection#fixCreator(),这里面为绝对画布块做特殊处理时,漏算了参数面板的高度,然后在REPORT-34739中,FRFitLayoutAdapter#fix()方法中处理了一下参数面板造成的偏移,所以拖拽的逻辑都正常;但是如果在右侧面板中改变高度时,会直接走到FRFitLayoutAdapter#fix()中,此时是没有漏算参数面板高度的,因此经过处理之后,反而组件的backupBound会多了个参数面板高度,这样会造成每次改变都加上这个高度,就出现了bug现象 【改动思路】把判断参数面板是否漏算的逻辑放到FormSelection#fixCreator()中
bugfix/10.0
Yvan 4 years ago
parent
commit
18d9268b24
  1. 10
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  2. 18
      designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

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

@ -347,15 +347,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//拖拽组件原大小、位置 //拖拽组件原大小、位置
Rectangle backupBound = creator.getBackupBound(); Rectangle backupBound = creator.getBackupBound();
backupBound.x -= container.getX(); backupBound.x -= container.getX();
// REPORT-34739 对绝对画布块的backupBound.y的调整还需要考虑一下参数面板块的高度造成的偏移 backupBound.y -= container.getY();
int paraHeight = 0;
if (creator.acceptType(XWAbsoluteLayout.class)) {
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate instanceof JForm) {
paraHeight = ((JForm) jTemplate).getFormDesign().getParaHeight();
}
}
backupBound.y -= (container.getY() - paraHeight);
//当前拖拽组件的位置 //当前拖拽组件的位置
int x = creator.getX(); int x = creator.getX();
int y = creator.getY(); int y = creator.getY();

18
designer-form/src/main/java/com/fr/design/mainframe/FormSelection.java

@ -12,6 +12,7 @@ import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.XWParameterLayout; import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout; import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.file.HistoryTemplateListCache;
import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
@ -270,7 +271,9 @@ public class FormSelection {
LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator); LayoutAdapter layoutAdapter = AdapterBus.searchLayoutAdapter(designer, creator);
if (layoutAdapter != null) { if (layoutAdapter != null) {
if (creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i) { if (creator.acceptType(XWAbsoluteLayout.class) && recs.size() > i) {
creator.setBackupBound(recs.get(i)); Rectangle rectangle = recs.get(i);
check4ParaPane(rectangle);
creator.setBackupBound(rectangle);
} else { } else {
creator.setBackupBound(backupBounds); creator.setBackupBound(backupBounds);
} }
@ -280,6 +283,19 @@ public class FormSelection {
} }
} }
/**
* 检查下有没有参数面板如果存在处理下参数面板造成的偏移量
* @param rectangle
*/
private void check4ParaPane(Rectangle rectangle) {
int paraHeight = 0;
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate();
if (jTemplate instanceof JForm) {
paraHeight = ((JForm) jTemplate).getFormDesign().getParaHeight();
}
rectangle.y += paraHeight;
}
private void removeCreatorFromContainer(XCreator creator) { private void removeCreatorFromContainer(XCreator creator) {
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator); XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(creator);
if (parent == null) { if (parent == null) {

Loading…
Cancel
Save