From 6e396f6a89a4232f6d45fa93a2beb5cc993977c8 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 9 Mar 2021 14:42:36 +0800 Subject: [PATCH 1/4] =?UTF-8?q?REPORT-47438=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=9C=A8=E5=A4=9A=E5=B1=8F=E6=83=85=E5=86=B5?= =?UTF-8?q?=E4=B8=8B=E9=83=A8=E5=88=86=E5=BC=B9=E7=AA=97=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E5=9C=A8=E5=8F=A6=E4=B8=80=E5=9D=97=E5=B1=8F=E5=B9=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datapane/preview/PreviewTablePane.java | 1 - .../com/fr/design/extra/PluginWebBridge.java | 2 ++ .../java/com/fr/design/extra/ShopDialog.java | 2 ++ .../exe/callback/ModifyStatusCallback.java | 5 +++-- .../design/plugin/DesignerPluginContext.java | 21 +++++++++++++++++++ .../java/com/fr/design/upm/UpmFinder.java | 2 ++ .../java/com/fr/design/upm/UpmShowDialog.java | 2 ++ .../com/fr/design/utils/gui/GUICoreUtils.java | 7 ++++++- 8 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/plugin/DesignerPluginContext.java diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java index da87c10f6..e95a5999a 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/PreviewTablePane.java @@ -169,7 +169,6 @@ public class PreviewTablePane extends BasicPane { this.add(new JScrollPane(preveiwTable), BorderLayout.CENTER); if (this.dialog == null) { this.dialog = this.showWindow(new JFrame()); - GUICoreUtils.centerWindow(DesignerContext.getDesignerFrame(), this.dialog); } progressBar = new AutoProgressBar(this, Toolkit.i18nText("Fine-Design_Basic_Loading_Data"), "", 0, 100) { public void doMonitorCanceled() { diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java index d70901350..ba7c0092d 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java @@ -16,6 +16,7 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.locale.impl.BbsRegisterMark; import com.fr.design.locale.impl.BbsResetMark; import com.fr.design.locale.impl.BbsSpaceMark; +import com.fr.design.plugin.DesignerPluginContext; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.general.CloudCenter; import com.fr.general.locale.LocaleCenter; @@ -401,6 +402,7 @@ public class PluginWebBridge { if (uiDialog != null) { uiDialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); uiDialog.setVisible(false); + DesignerPluginContext.setPluginDialog(null); } } diff --git a/designer-base/src/main/java/com/fr/design/extra/ShopDialog.java b/designer-base/src/main/java/com/fr/design/extra/ShopDialog.java index e0170cef8..fed317989 100644 --- a/designer-base/src/main/java/com/fr/design/extra/ShopDialog.java +++ b/designer-base/src/main/java/com/fr/design/extra/ShopDialog.java @@ -3,6 +3,7 @@ package com.fr.design.extra; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; import com.fr.design.jdk.JdkVersion; +import com.fr.design.plugin.DesignerPluginContext; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.StableUtils; @@ -25,6 +26,7 @@ public class ShopDialog extends UIDialog { setSize(createDefaultDimension()); GUICoreUtils.centerWindow(this); setResizable(false); + DesignerPluginContext.setPluginDialog(this); } private Dimension createDefaultDimension() { diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java index 8015e00fb..78e338f8c 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java @@ -5,6 +5,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.extra.PluginOperateUtils; import com.fr.design.i18n.Toolkit; +import com.fr.design.plugin.DesignerPluginContext; import com.fr.log.FineLoggerFactory; import com.fr.plugin.manage.control.PluginTaskCallback; import com.fr.plugin.manage.control.PluginTaskResult; @@ -31,9 +32,9 @@ public class ModifyStatusCallback implements PluginTaskCallback{ pluginInfo + Toolkit.i18nText("Fine-Design_Basic_Plugin_Has_Been_Disabled_Duplicate") : pluginInfo + Toolkit.i18nText("Fine-Design_Plugin_Has_Been_Actived_Duplicate"); FineLoggerFactory.getLogger().info(modifyMessage); - FineJOptionPane.showMessageDialog(null, modifyMessage); + FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(), modifyMessage); } else { - FineJOptionPane.showMessageDialog(null, pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); + FineJOptionPane.showMessageDialog(DesignerPluginContext.getPluginDialog(), pluginInfo, Toolkit.i18nText("Fine-Design_Basic_Plugin_Warning"), JOptionPane.ERROR_MESSAGE); } } diff --git a/designer-base/src/main/java/com/fr/design/plugin/DesignerPluginContext.java b/designer-base/src/main/java/com/fr/design/plugin/DesignerPluginContext.java new file mode 100644 index 000000000..404477ff4 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/plugin/DesignerPluginContext.java @@ -0,0 +1,21 @@ +package com.fr.design.plugin; + +import com.fr.design.dialog.UIDialog; + +/** + * @author hades + * @version 10.0 + * Created by hades on 2021/3/8 + */ +public class DesignerPluginContext { + + private static UIDialog DIALOG; + + public static UIDialog getPluginDialog() { + return DIALOG; + } + + public static void setPluginDialog(UIDialog pluginDialog) { + DesignerPluginContext.DIALOG = pluginDialog; + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java index 4424d9d74..36e558d17 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -6,6 +6,7 @@ import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.UIDialog; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.plugin.DesignerPluginContext; import com.fr.design.update.ui.dialog.UpdateMainDialog; import com.fr.event.Event; import com.fr.event.EventDispatcher; @@ -114,6 +115,7 @@ public class UpmFinder { dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setVisible(false); dialog = null; + DesignerPluginContext.setPluginDialog(null); } } } diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java b/designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java index d5f132e98..f0c6c6d49 100644 --- a/designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java +++ b/designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java @@ -2,6 +2,7 @@ package com.fr.design.upm; import com.fr.design.dialog.BasicPane; import com.fr.design.dialog.UIDialog; +import com.fr.design.plugin.DesignerPluginContext; import com.fr.design.utils.gui.GUICoreUtils; import javax.swing.*; @@ -25,6 +26,7 @@ public class UpmShowDialog extends UIDialog { setSize(DEFAULT_SHOP); GUICoreUtils.centerWindow(this); setResizable(false); + DesignerPluginContext.setPluginDialog(this); } @Override diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index d55382c49..b65550ea7 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -318,7 +318,12 @@ public final class GUICoreUtils { public static void centerWindow(Window win) { // Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小 // getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标 - Rectangle rectangle = win.getGraphicsConfiguration().getBounds(); + Rectangle rectangle; + if (DesignerContext.getDesignerFrame() != null) { + rectangle = DesignerContext.getDesignerFrame().getGraphicsConfiguration().getBounds(); + } else { + rectangle = win.getGraphicsConfiguration().getBounds(); + } centerWindow(win, rectangle); } From 4aa18921dc4f58e42c9ebfed6d0ff51dccbe50b1 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 9 Mar 2021 14:52:32 +0800 Subject: [PATCH 2/4] =?UTF-8?q?REPORT-47438=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E9=83=A8=E5=88=86=E5=BC=B9=E7=AA=97=E4=B8=8D?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E4=B8=BB=E5=B1=8F=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/utils/gui/GUICoreUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index b65550ea7..ab40f0fd0 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -319,7 +319,7 @@ public final class GUICoreUtils { // Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小 // getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标 Rectangle rectangle; - if (DesignerContext.getDesignerFrame() != null) { + if (DesignerContext.getDesignerFrame() != null && win.getParent() == null) { rectangle = DesignerContext.getDesignerFrame().getGraphicsConfiguration().getBounds(); } else { rectangle = win.getGraphicsConfiguration().getBounds(); From 7ca88aa36e907277c8730866ad138e2f6730e70e Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 9 Mar 2021 15:07:54 +0800 Subject: [PATCH 3/4] =?UTF-8?q?REPORT-47438=20=E8=AE=BE=E8=AE=A1=E5=99=A8?= =?UTF-8?q?=E5=BC=B9=E7=AA=97=E9=83=A8=E5=88=86=E5=BC=B9=E7=AA=97=E4=B8=8D?= =?UTF-8?q?=E8=B7=9F=E9=9A=8F=E4=B8=BB=E5=B1=8F=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/utils/gui/GUICoreUtils.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index ab40f0fd0..763823465 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -38,6 +38,7 @@ import com.fr.stable.Constants; import com.fr.stable.OperatingSystem; import com.fr.stable.StringUtils; +import java.awt.Container; import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.BorderFactory; @@ -319,7 +320,9 @@ public final class GUICoreUtils { // Toolkit.getDefaultToolkit().getScreenSize()在有多个显示器也只能获取到主屏的大小 // getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标 Rectangle rectangle; - if (DesignerContext.getDesignerFrame() != null && win.getParent() == null) { + Container parent = win.getParent(); + boolean displayByDesignerFrame = (DesignerContext.getDesignerFrame() != null && parent == null) || (parent != null && !parent.isVisible()); + if (displayByDesignerFrame) { rectangle = DesignerContext.getDesignerFrame().getGraphicsConfiguration().getBounds(); } else { rectangle = win.getGraphicsConfiguration().getBounds(); From 352edc342e14313eb7d9849ba3178dc192e88a29 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 9 Mar 2021 17:13:02 +0800 Subject: [PATCH 4/4] =?UTF-8?q?REPORT-47438=20=E5=88=A4=E6=96=AD=E8=B7=9F?= =?UTF-8?q?=E9=9A=8F=E8=87=AA=E4=B8=BB=E7=95=8C=E9=9D=A2=E7=9A=84=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E5=86=8D=E4=BC=98=E5=8C=96=E8=A1=A5=E5=85=85=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/fr/design/utils/gui/GUICoreUtils.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java index 763823465..a89e367d6 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/GUICoreUtils.java @@ -321,7 +321,7 @@ public final class GUICoreUtils { // getGraphicsConfiguration().getBounds()能获取多个屏时 设计器主体界面所在屏的大小和对应的坐标 Rectangle rectangle; Container parent = win.getParent(); - boolean displayByDesignerFrame = (DesignerContext.getDesignerFrame() != null && parent == null) || (parent != null && !parent.isVisible()); + boolean displayByDesignerFrame = (DesignerContext.getDesignerFrame() != null && parent == null) || (parent != null && !parent.isVisible() && DesignerContext.getDesignerFrame() != null); if (displayByDesignerFrame) { rectangle = DesignerContext.getDesignerFrame().getGraphicsConfiguration().getBounds(); } else {