From 331effa629e41f6d4486fc639bcb322831b7cf56 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 18 Oct 2021 13:49:19 +0800 Subject: [PATCH 1/5] =?UTF-8?q?REPORT-60158=E3=80=90=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=B8=83=E5=B1=80-=E5=8E=9F=E5=B8=83=E5=B1=80=E6=8E=A8?= =?UTF-8?q?=E8=8D=904.1=E3=80=91=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8-?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=B8=83=E5=B1=80=E4=B8=8B=E5=BE=80=E7=BB=9D?= =?UTF-8?q?=E5=AF=B9=E7=94=BB=E5=B8=83=E5=9D=97=E4=B8=8A=E6=8B=96=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E6=95=88=E6=9E=9C=E4=B8=8D=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/mainframe/FormDesignerUI.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java b/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java index db5367ee9..9284554dc 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormDesignerUI.java +++ b/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() { - @Override - protected Void doInBackground() throws Exception { - designer.getPainter().paint(g, designer.getArea().getHorizontalValue(), - designer.getArea().getVerticalValue() + designer.getParaHeight()); - return null; - } - }.execute(); + designer.getPainter().paint(g, designer.getArea().getHorizontalValue(), + designer.getArea().getVerticalValue() + designer.getParaHeight()); } AddingModel addingModel = designer.getAddingModel(); From 5d45db5d3665dcff9a30c43dd760981ec0679a0c Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 18 Oct 2021 15:41:55 +0800 Subject: [PATCH 2/5] =?UTF-8?q?REPORT-60895=E3=80=90=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=B8=83=E5=B1=80-=E5=8E=9F=E5=B8=83=E5=B1=80=E6=8E=A8?= =?UTF-8?q?=E8=8D=904.1=E3=80=91=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8-?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83=E5=B1=80-=E9=9D=9E?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E5=B8=83=E5=B1=80=E6=A8=A1=E6=9D=BF=E5=88=9A?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=97=B6=EF=BC=8C=E9=80=89=E4=B8=AD=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E7=BB=84=E4=BB=B6=E4=B8=8D=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=82=A3=E4=B8=AA=E5=8F=AF=E6=8B=96=E6=8B=BD=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=B0=BA=E5=AF=B8=E7=9A=84=E5=B0=8F=E7=99=BD=E6=96=B9=E6=A1=86?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=B0=9D=E8=AF=95=E6=94=B9=E5=8F=98?= =?UTF-8?q?=E6=95=B4=E4=B8=AA=E5=B8=83=E5=B1=80=E7=9A=84=E8=AF=9D=EF=BC=8C?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=BB=84=E4=BB=B6=E6=97=B6=E4=BC=9A=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=99=BD=E6=96=B9=E6=A1=86=EF=BC=9B=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E7=9A=84=E8=A7=A6=E5=8F=91=E8=A7=84=E5=88=99=E6=98=AF=E4=BB=80?= =?UTF-8?q?=E4=B9=88=E5=91=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/designer/creator/XWFitLayout.java | 1 + 1 file changed, 1 insertion(+) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java index 71aa6f990..da4d235f0 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XWFitLayout.java +++ b/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(); From f227a27e94767b38f4698d3aff5d4cdb84981f2d Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 18 Oct 2021 16:26:33 +0800 Subject: [PATCH 3/5] =?UTF-8?q?REPORT-60894=E3=80=90=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=B8=83=E5=B1=80-=E5=8E=9F=E5=B8=83=E5=B1=80=E6=8E=A8?= =?UTF-8?q?=E8=8D=904.1=E3=80=91=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8-?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83=E5=B1=80-body=E7=9A=84?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E9=97=B4=E9=9A=94=E8=B0=83=E7=9A=84=E6=AF=94?= =?UTF-8?q?=E8=BE=83=E5=A4=A7=E6=97=B6=EF=BC=8C=E5=9B=BA=E5=AE=9A=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E4=B8=8B=EF=BC=8C=E5=B0=BA=E5=AF=B8=E8=BE=83=E5=B0=8F?= =?UTF-8?q?=E7=9A=84=E5=8D=A0=E4=BD=8D=E5=9D=97=E4=B9=8B=E9=97=B4=E5=B0=9D?= =?UTF-8?q?=E8=AF=95=E5=AF=B9=E8=B0=83=E7=BB=84=E4=BB=B6=EF=BC=8C=E6=8B=96?= =?UTF-8?q?=E6=8B=BDA=E5=88=B0B=E7=9A=84=E8=8C=83=E5=9B=B4=E5=86=85?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E9=BC=A0=E6=A0=87=EF=BC=8C=E7=BB=84=E4=BB=B6?= =?UTF-8?q?A=E4=BC=9A=E6=B6=88=E5=A4=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapters/layout/FRFitLayoutAdapter.java | 21 +-------- .../adapters/layout/FRNoFixLayoutAdapter.java | 43 ++++++++++++++++--- 2 files changed, 40 insertions(+), 24 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java index 84013aadf..d17e9689e 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java +++ b/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) { diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java index bdf67e00e..aaeedfc8d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRNoFixLayoutAdapter.java +++ b/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 @@ -79,7 +86,7 @@ public class FRNoFixLayoutAdapter extends AbstractLayoutAdapter { public void delete(XCreator creator, int creatorWidth, int creatorHeight) { int x = creator.getX(); int y = creator.getY(); - ((FRFitLayoutAdapter)parentLayoutAdapter).recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true); + ((FRFitLayoutAdapter) parentLayoutAdapter).recalculateChildrenSize(x, y, creatorWidth, creatorHeight, true); } @@ -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 From 039ec2ffdcfbb1248cd70d8edb2c0ce7b1d29201 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 18 Oct 2021 17:20:51 +0800 Subject: [PATCH 4/5] =?UTF-8?q?REPORT-60901=E3=80=90=E5=9B=BA=E5=AE=9A?= =?UTF-8?q?=E5=B8=83=E5=B1=80-=E5=8E=9F=E5=B8=83=E5=B1=80=E6=8E=A8?= =?UTF-8?q?=E8=8D=904.1=E3=80=91=E5=86=B3=E7=AD=96=E6=8A=A5=E8=A1=A8-?= =?UTF-8?q?=E8=87=AA=E9=80=82=E5=BA=94=E5=B8=83=E5=B1=80-jaimme=E9=82=A3?= =?UTF-8?q?=E8=BE=B9=E5=87=BA=E7=8E=B0=E4=BA=86=EF=BC=8C=E6=8B=96=E6=8B=BD?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=88=B0=E7=A9=BA=E7=99=BD=E5=9D=97=E4=B8=AD?= =?UTF-8?q?=E8=93=9D=E8=89=B2=E9=98=B4=E5=BD=B1=E6=98=BE=E7=A4=BA=E5=81=8F?= =?UTF-8?q?=E7=A7=BB=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../designer/beans/painters/FRFixLayoutPainter.java | 8 ++++---- .../designer/beans/painters/FROccupiedLayoutPainter.java | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java b/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java index f450a437a..0f0aa2a6d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/painters/FRFixLayoutPainter.java +++ b/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; @@ -36,8 +35,8 @@ public class FRFixLayoutPainter extends AbstractPainter { @Override public void paint(Graphics g, int startX, int startY) { super.paint(g, startX, startY); - int x = hotspot.x - hotspot_bounds.x; - int y = hotspot.y - hotspot_bounds.y; + int x = hotspot.x - hotspot_bounds.x ; + int y = hotspot.y - hotspot_bounds.y ; Component currentComp = container.getComponentAt(x, y); if (currentComp == null) { return; @@ -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}; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java b/designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java index 33a809a89..3a973b116 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/painters/FROccupiedLayoutPainter.java +++ b/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); @@ -53,4 +53,4 @@ public class FROccupiedLayoutPainter extends AbstractPainter { } -} \ No newline at end of file +} From 8f1bc9599e83c1d22650db6ab5ced7aef82814a4 Mon Sep 17 00:00:00 2001 From: kerry Date: Mon, 18 Oct 2021 17:31:59 +0800 Subject: [PATCH 5/5] =?UTF-8?q?REPORT-60889=20=E4=B8=BB=E9=A2=98=E5=88=87?= =?UTF-8?q?=E6=8D=A2=EF=BC=8C=E8=A7=86=E8=A7=89=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/theme/preview/ecpreview/ECReportPreviewPane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java b/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java index a933f3948..63d75449d 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/theme/preview/ecpreview/ECReportPreviewPane.java +++ b/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();