From 6026f0d575fd41c4ce7f68da6ee22e5f63bf8e82 Mon Sep 17 00:00:00 2001 From: hades Date: Wed, 3 Nov 2021 15:47:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-60887=20MAC=20OS=20x=E7=94=B5?= =?UTF-8?q?=E8=84=91=E4=B8=8A=20=E7=BC=96=E8=BE=91=E6=8C=89=E9=92=AE?= =?UTF-8?q?=E9=A3=98=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/designer/creator/XCreator.java | 3 ++ .../designer/ui/PopupDialogContext.java | 47 +++++++++++++++++++ .../designer/ui/SelectedPopupDialog.java | 17 +++++++ 3 files changed, 67 insertions(+) create mode 100644 designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java diff --git a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java index 87a1926cbb..86db17a11d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java +++ b/designer-form/src/main/java/com/fr/design/designer/creator/XCreator.java @@ -11,6 +11,7 @@ import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.models.SelectionModel; +import com.fr.design.designer.ui.PopupDialogContext; import com.fr.design.designer.ui.SelectedPopupDialog; import com.fr.design.fun.ShareWidgetUIProcessor; import com.fr.design.fun.WidgetPropertyUIProvider; @@ -778,6 +779,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo if (popup == null) { popup = new SelectedPopupDialog(this, designer); } + PopupDialogContext.checkSelectedPop(this); JFrame frame = LogMessageBar.getInstance().getLogFrame(); if (frame!= null && frame.isActive()) { return; @@ -876,6 +878,7 @@ public abstract class XCreator extends JPanel implements XComponent, XCreatorToo if (popup != null) { popup.setVisible(false); } + PopupDialogContext.checkSelectedPop(this); } public void processPopup(boolean canVisible) { diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java b/designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java new file mode 100644 index 0000000000..06fb2cb765 --- /dev/null +++ b/designer-form/src/main/java/com/fr/design/designer/ui/PopupDialogContext.java @@ -0,0 +1,47 @@ +package com.fr.design.designer.ui; + +import com.fr.design.designer.creator.XCreator; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + + +/** + * 把弹窗统一管理起来 防止出现异常情况下游离的弹窗 + * + * @author hades + * @version 10.0 + * Created by hades on 2021/11/02 + */ +public class PopupDialogContext { + + private static List dialogs = new ArrayList<>(); + + public static void add(SelectedPopupDialog selectedPopupDialog) { + if (dialogs.contains(selectedPopupDialog)) { + return; + } + dialogs.add(selectedPopupDialog); + } + + public static void remove(SelectedPopupDialog selectedPopupDialog) { + dialogs.remove(selectedPopupDialog); + } + + public static void checkSelectedPop(XCreator creator) { + Iterator iterator = dialogs.iterator(); + List removedDialog = new ArrayList<>(); + while (iterator.hasNext()) { + SelectedPopupDialog dialog = iterator.next(); + if (dialog.isVisible() && creator != dialog.getCreator()) { + iterator.remove(); + removedDialog.add(dialog); + } + } + for (SelectedPopupDialog dialog : removedDialog) { + dialog.setVisible(false); + } + } + +} diff --git a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java index 44978ad667..22f0d3760d 100644 --- a/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java +++ b/designer-form/src/main/java/com/fr/design/designer/ui/SelectedPopupDialog.java @@ -25,11 +25,14 @@ public class SelectedPopupDialog extends JDialog { private boolean canVisible = true; + private final XCreator creator; + public SelectedPopupDialog(XCreator creator, FormDesigner designer) { super(OperatingSystem.isMacos() ? new JFrame() : DesignerContext.getDesignerFrame()); this.setUndecorated(true); this.setModal(false); this.setFocusableWindowState(false); + this.creator = creator; controlPanel = new PopupControlPanel(creator, designer); this.getContentPane().add(controlPanel); this.setSize(controlPanel.getDefaultDimension()); @@ -44,6 +47,16 @@ public class SelectedPopupDialog extends JDialog { return controlPanel.hasVisibleButtons(); } + @Override + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + PopupDialogContext.add(this); + } else { + PopupDialogContext.remove(this); + } + } + public void setRelativeBounds(Rectangle rectangle) { this.controlPanel.setRelativeBounds(rectangle); } @@ -55,4 +68,8 @@ public class SelectedPopupDialog extends JDialog { public void setCanVisible(boolean canVisible) { this.canVisible = canVisible; } + + public XCreator getCreator() { + return this.creator; + } } From 9df5abe79cdb5a4b4334afbe0aae157db6139750 Mon Sep 17 00:00:00 2001 From: pengda Date: Thu, 4 Nov 2021 10:22:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-61306=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E6=97=B6=EF=BC=8C=E6=98=BE=E7=A4=BA=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E7=9A=84=E5=BC=B9=E7=AA=97=E6=9C=AA=E8=B7=9F=E9=9A=8F?= =?UTF-8?q?=E8=AE=BE=E8=AE=A1=E5=99=A8=E5=86=85=E9=83=A8=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=EF=BC=8C=E8=80=8C=E6=98=AF=E5=9B=BA=E5=AE=9A=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9C=A8=E5=8F=B3=E4=BE=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/notification/ui/NotificationCenterDialog.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java index 10e10ecdbb..2541d04b43 100644 --- a/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java +++ b/designer-base/src/main/java/com/fr/design/notification/ui/NotificationCenterDialog.java @@ -2,6 +2,7 @@ package com.fr.design.notification.ui; import com.fr.design.gui.ilable.UILabel; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignerContext; import com.fr.design.notification.Notification; import com.fr.design.notification.NotificationCenter; import java.awt.BorderLayout; @@ -119,7 +120,7 @@ public class NotificationCenterDialog extends JDialog { if (winSize.width > screenSize.width) { winSize.width = screenSize.width; } - //这里设置位置:水平居中,竖直偏上 - win.setLocation(screenSize.width - winSize.width - 90, 50); + win.setLocation((DesignerContext.getDesignerFrame().getWidth() - winSize.width - 100 + DesignerContext.getDesignerFrame().getX()), + DesignerContext.getDesignerFrame().getY() + winSize.height); } }