Browse Source

Pull request #6246: REPORT-60158【固定布局-原布局推荐4.1】决策报表-固定布局下往绝对画布块上拖的时候效果不对

Merge in DESIGN/design from ~KERRY/design_10.0:release/11.0 to release/11.0

* commit '8f1bc9599e83c1d22650db6ab5ced7aef82814a4':
  REPORT-60889 主题切换,视觉修改
  REPORT-60901【固定布局-原布局推荐4.1】决策报表-自适应布局-jaimme那边出现了,拖拽组件到空白块中蓝色阴影显示偏移了
  REPORT-60894【固定布局-原布局推荐4.1】决策报表-自适应布局-body的组件间隔调的比较大时,固定布局下,尺寸较小的占位块之间尝试对调组件,拖拽A到B的范围内释放鼠标,组件A会消失
  REPORT-60895【固定布局-原布局推荐4.1】决策报表-自适应布局-非固定布局模板刚创建时,选中组件,组件不显示那个可拖拽调整尺寸的小白方框,如果尝试改变整个布局的话,选中组件时会出现白方框;这个的触发规则是什么呢
  REPORT-60158【固定布局-原布局推荐4.1】决策报表-固定布局下往绝对画布块上拖的时候效果不对
bugfix/11.0
kerry 3 years ago
parent
commit
1964311cde
  1. 2
      designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java
  2. 21
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  3. 41
      designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java
  4. 4
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java
  5. 4
      designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java
  6. 1
      designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java
  7. 7
      designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

2
designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java

@ -49,7 +49,7 @@ public class ECReportPreviewPane extends UINoOpaquePanel implements ThemePreview
public PreviewPane() {
this.setPreferredSize(new Dimension(517, 270));
this.setBorder(BorderFactory.createEmptyBorder(7, 10, 5, 10));
this.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel northPane = createNorthPane();

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

@ -68,7 +68,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
public FRFitLayoutAdapter(XLayoutContainer container) {
super(container);
initMinSize();
this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minHeight);
this.frLayoutState = new FRNoFixLayoutAdapter(this, container, minWidth, minHeight, actualVal);
painter = this.frLayoutState.getPainter();
}
@ -151,13 +151,6 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
//如果当前处于边缘地带, 那么就把他贴到父容器上
boolean isMatchEdge = matchEdge(x, y);
int componentHeight = comp.getHeight();
int componentWidth = comp.getWidth();
//上半部分高度
int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY();
//下半部分高度
int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY();
//布局控件要先判断是不是可编辑
XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer((XCreator) comp).getTopLayout();
boolean access = topLayout != null && !isMatchEdge && !topLayout.acceptType(XWAbsoluteLayout.class) && !isExtraContainer(comp) && !topLayout.isDragInAble();
@ -167,17 +160,7 @@ public class FRFitLayoutAdapter extends FRBodyLayoutAdapter {
return false;
}
if (isCrossPointArea(comp, x, y)) {
return canAcceptWhileCrossPoint(comp, x, y);
}
if (isTrisectionArea(comp, x, y)) {
return canAcceptWhileTrisection(comp, x, y);
}
boolean horizonValid = componentWidth >= minWidth * 2 + actualVal;
boolean verticalValid = componentHeight >= minHeight * 2 + actualVal;
return y > upHeight && y < downHeight ? horizonValid : verticalValid;
return this.frLayoutState.accept(creator, x, y);
}
private boolean isExtraContainer(Component comp) {

41
designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java

@ -12,13 +12,20 @@ import java.awt.Component;
import java.util.ArrayList;
public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
private int minHeight;
private FRBodyLayoutAdapter parentLayoutAdapter;
private static final double TOP_HALF = 0.25;
private static final double BOTTOM_HALF = 0.75;
private final int minWidth;
private final int minHeight;
private final int actualVal;
private final FRBodyLayoutAdapter parentLayoutAdapter;
public FRNoFixLayoutAdapter(FRBodyLayoutAdapter parentLayoutAdapter, XLayoutContainer container, int minHeight) {
public FRNoFixLayoutAdapter(FRBodyLayoutAdapter parentLayoutAdapter, XLayoutContainer container, int minWidth, int minHeight, int actualVal) {
super(container);
this.parentLayoutAdapter = parentLayoutAdapter;
this.minWidth = minWidth;
this.minHeight = minHeight;
this.actualVal = actualVal;
}
@Override
@ -100,7 +107,33 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter {
@Override
public boolean accept(XCreator creator, int x, int y) {
return true;
Component comp = container.getComponentAt(x, y);
if (comp == null || checkInterval(comp)) {
return false;
}
int componentHeight = comp.getHeight();
int componentWidth = comp.getWidth();
//上半部分高度
int upHeight = (int) (componentHeight * TOP_HALF) + comp.getY();
//下半部分高度
int downHeight = (int) (componentHeight * BOTTOM_HALF) + comp.getY();
if (parentLayoutAdapter.isCrossPointArea(comp, x, y)) {
return parentLayoutAdapter.canAcceptWhileCrossPoint(comp, x, y);
}
if (parentLayoutAdapter.isTrisectionArea(comp, x, y)) {
return parentLayoutAdapter.canAcceptWhileTrisection(comp, x, y);
}
boolean horizonValid = componentWidth >= minWidth * 2 + actualVal;
boolean verticalValid = componentHeight >= minHeight * 2 + actualVal;
return y > upHeight && y < downHeight ? horizonValid : verticalValid;
}
// 间隔区域
private boolean checkInterval(Component comp) {
return container.getComponentCount() > 0 && comp == container;
}
@Override

4
designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java

@ -1,6 +1,5 @@
package com.fr.design.designer.beans.painters;
import com.fr.design.designer.beans.painters.AbstractPainter;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XOccupiedLayout;
@ -50,7 +49,8 @@ public class FRFixLayoutPainter extends AbstractPainter {
} else if (!((XCreator) currentComp).acceptType(XOccupiedLayout.class)) {
state = OperateState.COMPONENT_REPLACE;
}
state.paint(g, creator.getBackupRectangle(), currentComp.getBounds(), new Rectangle(x, y, creator.initEditorSize().width, ((XCreator) currentComp).initEditorSize().height));
Rectangle currentCompRec = new Rectangle(currentComp.getX() - startX, currentComp.getY() - startY, currentComp.getWidth(), currentComp.getHeight());
state.paint(g, creator.getBackupRectangle(), currentCompRec, new Rectangle(x, y, creator.initEditorSize().width, ((XCreator) currentComp).initEditorSize().height));
} else {
Color bColor = XCreatorConstants.LAYOUT_FORBIDDEN_COLOR;
int[] hot_rec = new int[]{x, y, 0, 0};

4
designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java

@ -40,11 +40,11 @@ public class FROccupiedLayoutPainter extends AbstractPainter {
Composite backupComposite = g2d.getComposite();
g2d.setColor(XCreatorConstants.DRAG_IN_OCCUPIED_LAYOUT_COLOR);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.05f));
g2d.fillRect(container.getX(), container.getY(), container.getWidth(), container.getHeight());
g2d.fillRect(container.getX() - startX, container.getY() - startY, container.getWidth(), container.getHeight());
g2d.setStroke(XCreatorConstants.DASH_STROKE);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.2f));
g2d.drawRect(container.getX() + 1, container.getY() + 1, container.getWidth() - 2, container.getHeight() - 2);
g2d.drawRect(container.getX() - startX + 1, container.getY() - startY + 1, container.getWidth() - 2, container.getHeight() - 2);
g2d.setStroke(backupStroke);
g2d.setComposite(backupComposite);
g2d.setColor(backupColor);

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

@ -886,6 +886,7 @@ public class XWFitLayout extends XLayoutContainer {
isRefreshing = true;
this.remove(oldCreator);
this.add(newCreator);
dealDirections(newCreator, false);
//对于新增的绝对布局的组件,需要更新下内部组件的大小
if (newCreator.acceptType(XWAbsoluteLayout.class)){
((XWAbsoluteLayout) newCreator).updateBoundsWidget();

7
designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java

@ -25,7 +25,6 @@ import com.fr.stable.Constants;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.plaf.ComponentUI;
import java.awt.AlphaComposite;
import java.awt.Color;
@ -114,14 +113,8 @@ public class FormDesignerUI extends ComponentUI {
if (designer.getPainter() != null) {
// ComponentAdapter和LayoutAdapter提供的额外的Painter,该Painter一般用于提示作用,
// 相当于一个浮动层, 要考虑参数面板的高度
new SwingWorker<Void, Void>() {
@Override
protected Void doInBackground() throws Exception {
designer.getPainter().paint(g, designer.getArea().getHorizontalValue(),
designer.getArea().getVerticalValue() + designer.getParaHeight());
return null;
}
}.execute();
}
AddingModel addingModel = designer.getAddingModel();

Loading…
Cancel
Save