From a5d4c13be6d0126a748edb971592f28a0cc079ca Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 29 Jun 2021 17:44:38 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-54155=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E9=9D=A2=E6=9D=BF=E4=B8=8ATab=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=8B=96=E6=8B=BD=E4=BC=98=E5=8C=96=20update-?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=8B=E6=96=B9=E6=B3=95=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mainframe/FormCreatorDropTarget.java | 23 ++---------------- .../com/fr/design/mainframe/TabDragInner.java | 24 ++++++++++++++++--- 2 files changed, 23 insertions(+), 24 deletions(-) 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 515fd209e..222165a53 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 @@ -8,7 +8,6 @@ import com.fr.design.DesignModelAdapter; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.designer.beans.AdapterBus; -import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.Painter; import com.fr.design.designer.beans.events.DesignerEvent; @@ -132,7 +131,7 @@ public class FormCreatorDropTarget extends DropTarget { designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); - tryEditTabContainer(); + tabDragInner.tryDragIn(); } else { Toolkit.getDefaultToolkit().beep(); } @@ -142,24 +141,6 @@ public class FormCreatorDropTarget extends DropTarget { designer.stopAddingState(); } - /** - * 尝试进入tab编辑 - */ - private void tryEditTabContainer() { - XLayoutContainer belowXLayoutContainer = tabDragInner.getBelowXLayoutContainer(); - if (belowXLayoutContainer != null && belowXLayoutContainer.isDragInAble()) { - EditingMouseListener editingMouseListener = new EditingMouseListener(designer); - editingMouseListener.refreshTopXCreator(); - belowXLayoutContainer.setEditable(true); - if (editingMouseListener.stopEditing() && belowXLayoutContainer != designer.getRootComponent()) { - ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); - if (adapter != null) { - editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); - } - } - } - } - private void entering(int x, int y) { // 将要添加的组件图标移动到鼠标下的位置 addingModel.moveTo(x, y); @@ -289,7 +270,7 @@ public class FormCreatorDropTarget extends DropTarget { int x = designer.getRelativeX(loc.x); int y = designer.getRelativeY(loc.y); hovering(x, y); - tabDragInner.dragIn(designer.getComponentAt(x, y), x, y); + tabDragInner.canDragIn(designer.getComponentAt(x, y), x, y); } /** 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 1b0b976a9..ce98d9d55 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 @@ -1,5 +1,7 @@ package com.fr.design.mainframe; +import com.fr.design.designer.beans.AdapterBus; +import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreatorUtils; import com.fr.design.designer.creator.XLayoutContainer; @@ -36,9 +38,8 @@ public class TabDragInner { * @param x * @param y */ - public void dragIn(XCreator creator, int x, int y) { - XCreator xCreator = designer.getComponentAt(x, y); - XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(xCreator).getTopLayout(); + public void canDragIn(XCreator creator, int x, int y) { + XLayoutContainer topLayout = XCreatorUtils.getHotspotContainer(creator).getTopLayout(); boolean dragInAble = false; if (topLayout != null && topLayout.acceptType(XWCardMainBorderLayout.class) && belowXLayoutContainer == null) { belowXLayoutContainer = topLayout; @@ -58,6 +59,23 @@ public class TabDragInner { oldY = y; } + /** + * 尝试进入tab编辑 + */ + public void tryDragIn() { + if (belowXLayoutContainer != null && belowXLayoutContainer.isDragInAble()) { + EditingMouseListener editingMouseListener = new EditingMouseListener(designer); + editingMouseListener.refreshTopXCreator(); + belowXLayoutContainer.setEditable(true); + if (editingMouseListener.stopEditing() && belowXLayoutContainer != designer.getRootComponent()) { + ComponentAdapter adapter = AdapterBus.getComponentAdapter(designer, belowXLayoutContainer); + if (adapter != null) { + editingMouseListener.startEditing(belowXLayoutContainer, adapter.getDesignerEditor(), adapter); + } + } + } + } + public XLayoutContainer getBelowXLayoutContainer() { return belowXLayoutContainer;