From 19b7fcb536e8ef99218cca5827601eeb6c8ea46e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=96=B9=E7=A3=8A?= <294531121@qq.com> Date: Fri, 19 Nov 2021 17:24:37 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-62275=20tab=E9=AB=98=E5=BA=A6=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=92=A4=E9=94=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layout/FRCardMainBorderLayoutAdapter.java | 8 +++++++- .../designer/beans/models/AddingModel.java | 9 +++++++++ .../design/mainframe/FormCreatorDropTarget.java | 16 +++++++++------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java index 7e30b9840..13910f7d4 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/adapters/layout/FRCardMainBorderLayoutAdapter.java @@ -1,13 +1,15 @@ package com.fr.design.designer.beans.adapters.layout; +import com.fr.design.designer.beans.models.AddingModel; import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XLayoutContainer; import com.fr.design.designer.creator.cardlayout.XWCardTagLayout; import com.fr.design.dialog.FineJOptionPane; import com.fr.design.file.HistoryTemplateListPane; import com.fr.design.form.layout.FRBorderLayout; +import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.JTemplate; -import com.fr.design.ui.util.UIUtil; +import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.general.ComparatorUtils; import java.awt.BorderLayout; @@ -68,6 +70,10 @@ public class FRCardMainBorderLayoutAdapter extends FRBorderLayoutAdapter { if (jt != null) { jt.undoToCurrent(); } + + FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); + AddingModel model = formDesigner.getAddingModel(); + model.setAddedIllegal(true); return true; } else { return false; diff --git a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java index c0b6cd400..edc5ca998 100644 --- a/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java +++ b/designer-form/src/main/java/com/fr/design/designer/beans/models/AddingModel.java @@ -24,6 +24,7 @@ public class AddingModel { private int currentX; private int currentY; private boolean added; + private boolean addedIllegal = false; // 有时候是添加完成了,但是添加会造成某些控件size不合法,例如tab public AddingModel(FormDesigner designer, XCreator xCreator) { this.creator = xCreator; @@ -142,4 +143,12 @@ public class AddingModel { y + designer.getVerticalScaleValue() - rect.y); return added; } + + public boolean isAddedIllegal() { + return addedIllegal; + } + + public void setAddedIllegal(boolean addedIllegal) { + this.addedIllegal = addedIllegal; + } } 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 7a6a73f4b..a2c1ba66c 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 @@ -27,19 +27,16 @@ import com.fr.design.mod.bean.ContentChangeItem; import com.fr.design.mod.event.TableDataModifyEvent; import com.fr.design.utils.ComponentUtils; import com.fr.event.EventDispatcher; -import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.share.SharableWidgetProvider; import com.fr.form.share.ShareLoader; +import com.fr.form.share.editor.SharableEditorProvider; import com.fr.form.ui.Widget; import com.fr.stable.Constants; import com.fr.stable.StringUtils; -import java.util.Collections; -import java.util.HashMap; import javax.swing.BorderFactory; import javax.swing.JWindow; -import java.util.List; -import java.util.Map; +import javax.swing.SwingUtilities; import java.awt.Color; import java.awt.Component; import java.awt.Point; @@ -49,7 +46,10 @@ import java.awt.dnd.DropTarget; import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetEvent; -import javax.swing.SwingUtilities; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 添加模式下鼠标事件处理器。 @@ -141,7 +141,9 @@ public class FormCreatorDropTarget extends DropTarget { } designer.getSelectionModel().setSelectedCreators( FormSelectionUtils.rebuildSelection(xCreator, new Widget[]{widget})); - designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + if (!addingModel.isAddedIllegal()) { + designer.getEditListenerTable().fireCreatorModified(addingModel.getXCreator(), DesignerEvent.CREATOR_ADDED); + } tabDragInner.tryDragIn(); } else { Toolkit.getDefaultToolkit().beep();