@ -31,7 +31,6 @@ import java.awt.Color;
import java.awt.Cursor ;
import java.awt.Cursor ;
import java.awt.Dimension ;
import java.awt.Dimension ;
import java.awt.FlowLayout ;
import java.awt.FlowLayout ;
import java.awt.Font ;
import java.awt.Frame ;
import java.awt.Frame ;
import java.awt.Graphics ;
import java.awt.Graphics ;
import java.awt.Graphics2D ;
import java.awt.Graphics2D ;
@ -241,16 +240,42 @@ public abstract class UIControlPane extends JControlPane {
}
}
private void hideDialog ( ) {
private void hideDialog ( ) {
if ( needToHidePopupEditDialog ( ) ) {
saveSettings ( ) ;
setVisible ( false ) ;
PopupDialogSaveAction saveAction = OSSupportCenter . getAction ( PopupDialogSaveAction . class ) ;
saveAction . unregister ( ) ;
}
}
private void initListener ( ) {
addWindowFocusListener ( new WindowAdapter ( ) {
@Override
public void windowLostFocus ( WindowEvent e ) {
//在Linux上拉回焦点,不然导致一些面板关不掉
if ( OperatingSystem . isLinux ( ) ) {
requestFocus ( ) ;
}
hideDialog ( ) ;
}
} ) ;
}
}
/ * *
* 是否需要隐藏popupEditDialog
* /
protected boolean needToHidePopupEditDialog ( ) {
// 检查是否有子弹窗,如果有,则不隐藏
// 检查是否有子弹窗,如果有,则不隐藏
for ( Window window : getOwnedWindows ( ) ) {
for ( Window window : popupEditDialog . getOwnedWindows ( ) ) {
if ( window . isVisible ( ) ) {
if ( window . isVisible ( ) ) {
return ;
return false ;
}
}
}
}
// 如果有可见模态对话框,则不隐藏
// 如果有可见模态对话框,则不隐藏
for ( Window window : DesignerContext . getDesignerFrame ( ) . getOwnedWindows ( ) ) {
for ( Window window : DesignerContext . getDesignerFrame ( ) . getOwnedWindows ( ) ) {
if ( window instanceof JDialog & & window . isVisible ( ) & & ( ( JDialog ) window ) . isModal ( ) ) {
if ( window instanceof JDialog & & window . isVisible ( ) & & ( ( JDialog ) window ) . isModal ( ) ) {
return ;
return false ;
}
}
}
}
@ -260,7 +285,7 @@ public abstract class UIControlPane extends JControlPane {
for ( Window window : sharedOwnerFrame . getOwnedWindows ( ) ) {
for ( Window window : sharedOwnerFrame . getOwnedWindows ( ) ) {
if ( window instanceof JDialog & & window . isVisible ( ) & & ( ( JDialog ) window ) . isModal ( ) ) {
if ( window instanceof JDialog & & window . isVisible ( ) & & ( ( JDialog ) window ) . isModal ( ) ) {
// 如果有可见模态对话框,则不隐藏
// 如果有可见模态对话框,则不隐藏
return ;
return false ;
}
}
}
}
} catch ( Exception ignore ) {
} catch ( Exception ignore ) {
@ -273,33 +298,16 @@ public abstract class UIControlPane extends JControlPane {
checkValid ( ) ;
checkValid ( ) ;
} catch ( Exception exp ) {
} catch ( Exception exp ) {
// 存在非法输入 拒绝隐藏
// 存在非法输入 拒绝隐藏
this . setAlwaysOnTop ( true ) ;
popupEditDialog . setAlwaysOnTop ( true ) ;
FineJOptionPane . showMessageDialog ( this , exp . getMessage ( ) ) ;
FineJOptionPane . showMessageDialog ( this , exp . getMessage ( ) ) ;
this . requestFocus ( ) ;
popupEditDialog . requestFocus ( ) ;
return ;
return false ;
}
}
if ( JavaFxNativeFileChooser . isShowDialogState ( ) ) {
if ( JavaFxNativeFileChooser . isShowDialogState ( ) ) {
JavaFxNativeFileChooser . setShowDialogState ( false ) ;
JavaFxNativeFileChooser . setShowDialogState ( false ) ;
return ;
return false ;
}
saveSettings ( ) ;
setVisible ( false ) ;
PopupDialogSaveAction saveAction = OSSupportCenter . getAction ( PopupDialogSaveAction . class ) ;
saveAction . unregister ( ) ;
}
private void initListener ( ) {
addWindowFocusListener ( new WindowAdapter ( ) {
@Override
public void windowLostFocus ( WindowEvent e ) {
//在Linux上拉回焦点,不然导致一些面板关不掉
if ( OperatingSystem . isLinux ( ) ) {
requestFocus ( ) ;
}
hideDialog ( ) ;
}
} ) ;
}
}
return true ;
}
}
// 移动弹出编辑面板的工具条
// 移动弹出编辑面板的工具条