From 4c2f04c16d55e795386939cef9a0589238c33f32 Mon Sep 17 00:00:00 2001 From: hades Date: Mon, 19 Jul 2021 11:16:02 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-55227=20=E3=80=90=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=88=86=E7=A6=BB=E3=80=91=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=A4=8D=E7=94=A8-=E7=BB=84=E4=BB=B6=E6=82=AC=E5=81=9C1s?= =?UTF-8?q?=E5=90=8E=E5=88=A4=E6=96=AD=E7=BB=84=E4=BB=B6=E7=A7=BB=E5=85=A5?= =?UTF-8?q?tab=E5=86=85=E9=83=A8=EF=BC=8C=E8=BF=99=E6=97=B6=E5=80=99?= =?UTF-8?q?=E7=9A=84tab=E5=9D=97=E6=B2=A1=E6=9C=89=E9=A2=84=E6=9C=9F?= =?UTF-8?q?=E7=9A=84=E8=93=9D=E8=89=B2=E9=98=B4=E5=BD=B1=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cardlayout/XWCardMainBorderLayout.java | 10 ++++++++ .../mainframe/FormCreatorDropTarget.java | 4 ++++ .../fr/design/mainframe/FormDesignerUI.java | 23 ++++++++++++++++++- .../com/fr/design/mainframe/TabDragInner.java | 1 + 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java index 992fa00cc..a762c59f4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/cardlayout/XWCardMainBorderLayout.java @@ -3,6 +3,7 @@ */ package com.fr.design.designer.creator.cardlayout; +import com.fr.base.GraphHelper; import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.LayoutAdapter; @@ -32,6 +33,8 @@ import com.fr.general.ComparatorUtils; import com.fr.general.act.BorderPacker; +import com.fr.stable.Constants; +import java.awt.Color; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; @@ -50,6 +53,9 @@ import java.util.List; */ public class XWCardMainBorderLayout extends XWBorderLayout { + private static final int BORDER_WIDTH = 4; + private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30); + private static final int CENTER = 1; private static final int NORTH = 0; private static final int TITLE_STYLE = 2; @@ -345,6 +351,10 @@ public class XWCardMainBorderLayout extends XWBorderLayout { @Override public void paintBorder(Graphics g, Rectangle bounds){ + if (isDragInAble()) { + g.setColor(OUTER_BORDER_COLOR); + GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 3, bounds.height + BORDER_WIDTH + 3), Constants.LINE_LARGE); + } if (!isMouseEnter) { super.paintBorder(g, bounds); } diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java index 2fdbb5a29..11fa1dc3b 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormCreatorDropTarget.java @@ -335,4 +335,8 @@ public class FormCreatorDropTarget extends DropTarget { } } } + + public TabDragInner getTabDragInner() { + return this.tabDragInner; + } } 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 893297081..c48c88101 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 @@ -13,7 +13,7 @@ import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.XWFitLayout; -import com.fr.design.designer.creator.XWTitleLayout; +import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout; import com.fr.design.form.util.XCreatorConstants; import com.fr.design.roleAuthority.ReportAndFSManagePane; import com.fr.design.utils.ComponentUtils; @@ -24,6 +24,7 @@ import com.fr.report.core.ReportUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.Constants; +import java.awt.dnd.DropTarget; import javax.swing.*; import javax.swing.plaf.ComponentUI; import java.awt.AlphaComposite; @@ -94,6 +95,7 @@ public class FormDesignerUI extends ComponentUI { } paintBorder(g); paintSelection(g); + paintDropBorderShadow(g); if (DesignerMode.isAuthorityEditing()) { paintAuthorityDetails(g, designer.getRootComponent()); @@ -330,6 +332,25 @@ public class FormDesignerUI extends ComponentUI { } } + /** + * 绘制可拖拽进tab块之前的阴影 + * + * @param g + */ + private void paintDropBorderShadow(Graphics g) { + DropTarget dropTarget = designer.getDropTarget(); + if (dropTarget instanceof FormCreatorDropTarget) { + FormCreatorDropTarget target = (FormCreatorDropTarget) dropTarget; + XLayoutContainer layoutContainer = target.getTabDragInner().getBelowXLayoutContainer(); + if (layoutContainer != null && layoutContainer.acceptType(XWCardMainBorderLayout.class)) { + Rectangle creatorBounds = ComponentUtils.getRelativeBounds(layoutContainer); + creatorBounds.x -= designer.getHorizontalScaleValue(); + creatorBounds.y -= designer.getVerticalScaleValue(); + layoutContainer.paintBorder(g, creatorBounds); + } + } + } + /** * 初始为自适应时,处理选中的范围 * @param bound diff --git a/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java b/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java index ce98d9d55..fb6608c43 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/TabDragInner.java @@ -71,6 +71,7 @@ public class TabDragInner { ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); if (adapter != null) { editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); + belowXLayoutContainer.setDragInAble(false); } } }