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 992fa00cc9..22698ef5b9 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,12 @@ public class XWCardMainBorderLayout extends XWBorderLayout { @Override public void paintBorder(Graphics g, Rectangle bounds){ + if (isDragInAble()) { + Color oldColor = g.getColor(); + 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); + g.setColor(oldColor); + } 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 2fdbb5a29a..11fa1dc3bf 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 893297081c..c48c881010 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 ce98d9d55b..fb6608c43a 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); } } }