From 23a94b9371a68a360c33d87d0a683c8f6dbfb4c5 Mon Sep 17 00:00:00 2001 From: hades Date: Tue, 21 Jul 2020 12:43:27 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-34878=20&&=20REPORT-34936=20=20linux?= =?UTF-8?q?=E4=B8=8B=E6=9D=A1=E4=BB=B6=E5=B1=9E=E6=80=A7=E5=92=8C=E8=B6=85?= =?UTF-8?q?=E9=93=BE=E4=BF=9D=E5=AD=98=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/gui/controlpane/UIControlPane.java | 4 ++ .../gui/controlpane/UIListControlPane.java | 4 ++ .../design/os/impl/PopupDialogSaveAction.java | 39 +++++++++++++++++++ .../java/com/fr/grid/GridMouseAdapter.java | 7 +++- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java 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 747dbe32f0..04427b3378 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 @@ -9,12 +9,14 @@ import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.ShortCut; +import com.fr.design.os.impl.PopupDialogSaveAction; 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 com.fr.stable.os.support.OSSupportCenter; import javax.swing.BorderFactory; import javax.swing.JComponent; @@ -273,6 +275,8 @@ abstract class UIControlPane extends JControlPane { } saveSettings(); setVisible(false); + PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class); + saveAction.unregister(); } private void initListener() { diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java index 0dec124219..786eb2d305 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/UIListControlPane.java @@ -7,9 +7,11 @@ import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.UINameEdList; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.os.impl.PopupDialogSaveAction; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.stable.ArrayUtils; import com.fr.stable.Nameable; +import com.fr.stable.os.support.OSSupportCenter; import javax.swing.DefaultListModel; import javax.swing.JList; @@ -216,6 +218,8 @@ public abstract class UIListControlPane extends UIControlPane implements ListCon ((PopupEditDialog)popupEditDialog).setTitle(getSelectedName()); } popupEditDialog.setVisible(true); + PopupDialogSaveAction osBasedAction = OSSupportCenter.getAction(PopupDialogSaveAction.class); + osBasedAction.execute(this, popupEditDialog); } } diff --git a/designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java b/designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java new file mode 100644 index 0000000000..019ee3d97e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/os/impl/PopupDialogSaveAction.java @@ -0,0 +1,39 @@ +package com.fr.design.os.impl; + +import com.fr.design.gui.controlpane.UIListControlPane; +import com.fr.stable.os.OperatingSystem; +import com.fr.stable.os.support.OSBasedAction; + +import java.awt.*; + +/** + * linux下超链弹窗等保存问题 + * + * @author hades + * @version 10.0 + * Created by hades on 2020/7/21 + */ +public class PopupDialogSaveAction implements OSBasedAction { + + private UIListControlPane currentControlPane; + private Window popupDialog; + + @Override + public void execute(Object... objects) { + boolean canSave = OperatingSystem.isLinux() && popupDialog != null && popupDialog.isVisible() && currentControlPane != null; + if (canSave) { + currentControlPane.saveSettings(); + } + } + + public void register(UIListControlPane currentControlPane, Window popupDialog) { + this.currentControlPane = currentControlPane; + this.popupDialog = popupDialog; + } + + public void unregister() { + this.currentControlPane = null; + this.popupDialog = null; + } + +} diff --git a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java index ae230a5319..86ed09161b 100644 --- a/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java +++ b/designer-realize/src/main/java/com/fr/grid/GridMouseAdapter.java @@ -10,7 +10,7 @@ import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.ElementCasePane; import com.fr.design.mainframe.JSliderPane; -import com.fr.design.present.CellWriteAttrPane; +import com.fr.design.os.impl.PopupDialogSaveAction; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.grid.selection.CellSelection; import com.fr.grid.selection.FloatSelection; @@ -26,6 +26,7 @@ import com.fr.report.elementcase.TemplateElementCase; import com.fr.stable.ArrayUtils; import com.fr.stable.ColumnRow; import com.fr.stable.StringUtils; +import com.fr.stable.os.support.OSSupportCenter; import com.fr.stable.unit.FU; import javax.swing.*; @@ -93,7 +94,9 @@ public class GridMouseAdapter implements MouseListener, MouseWheelListener, Mous if (!grid.hasFocus() && grid.isRequestFocusEnabled()) { grid.requestFocus(); } - + // linux下 点击单元格时 失焦之前立即触发保存 + PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class); + saveAction.execute(); if (SwingUtilities.isRightMouseButton(evt)) { doWithRightButtonPressed(); } else {