From f63aca162419cd0e6c4819d827b5f06879ebb0cb Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 16 Jan 2020 09:45:07 +0800 Subject: [PATCH 1/2] =?UTF-8?q?CHART-12406=20=E5=BC=B9=E5=87=BA=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=96=87=E4=BB=B6=E9=80=89=E6=8B=A9=E6=A1=86=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E4=B8=8D=E5=BA=94=E8=AF=A5=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/UIControlPane.java | 31 ++++++++++++++----- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index 28df89b80a..b41e4283f7 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -11,9 +11,18 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.ShortCut; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.widget.FRWidgetFactory; +import com.fr.invoke.Reflect; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; import com.fr.stable.os.OperatingSystem; + +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; +import javax.swing.border.EmptyBorder; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Cursor; @@ -27,14 +36,6 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.Window; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JDialog; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.border.EmptyBorder; - import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; @@ -244,6 +245,20 @@ abstract class UIControlPane extends JControlPane { return; } } + + try { + //没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame() + Window sharedWindow = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get(); + for (Window window : sharedWindow.getOwnedWindows()) { + if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) { + // 如果有可见模态对话框,则不隐藏 + return; + } + } + } catch (Exception ignore) { + //do nothing + } + // 要隐藏 先检查有没有非法输入 // 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框 try { From f9e58113c1001e09ca11966949a8653ccbeb42f7 Mon Sep 17 00:00:00 2001 From: shine Date: Thu, 16 Jan 2020 09:51:35 +0800 Subject: [PATCH 2/2] update --- .../java/com/fr/design/gui/controlpane/UIControlPane.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java index b41e4283f7..747dbe32f0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java @@ -29,6 +29,7 @@ import java.awt.Cursor; import java.awt.Dimension; import java.awt.FlowLayout; import java.awt.Font; +import java.awt.Frame; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.GraphicsEnvironment; @@ -248,8 +249,8 @@ abstract class UIControlPane extends JControlPane { try { //没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame() - Window sharedWindow = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get(); - for (Window window : sharedWindow.getOwnedWindows()) { + Frame sharedOwnerFrame = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get(); + for (Window window : sharedOwnerFrame.getOwnedWindows()) { if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) { // 如果有可见模态对话框,则不隐藏 return;