Browse Source

Pull request #10890: REPORT-85754 fix:扩展图表场景设置-js-高级编辑界面不应该置底

Merge in DESIGN/design from ~CARLSON/design:release/11.0 to release/11.0

* commit 'fcd0863d2909e9caefdb664a3383a2f92b380424':
  REPORT-85754 fix:参考cpt图表的类似写法,引入焦点丢失事件
  REPORT-85754 fix:扩展图表场景设置-js-高级编辑界面不应该置底
newui
Carlson-洪金阳 2 years ago
parent
commit
07da201c0c
  1. 62
      designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java
  2. 9
      designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java
  3. 13
      designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java
  4. 12
      designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java
  5. 11
      designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java

62
designer-base/src/main/java/com/fr/design/gui/controlpane/UIControlPane.java

@ -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;
} }
// 移动弹出编辑面板的工具条 // 移动弹出编辑面板的工具条

9
designer-base/src/main/java/com/fr/design/javascript/JSContentPane.java

@ -24,9 +24,12 @@ import com.fr.design.javascript.jsapi.JSImplUpdateAction;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.js.JavaScriptImpl; import com.fr.js.JavaScriptImpl;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
@ -36,10 +39,6 @@ import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.ArrayList; import java.util.ArrayList;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingConstants;
import javax.swing.SwingWorker;
public class JSContentPane extends BasicPane { public class JSContentPane extends BasicPane {
protected RSyntaxTextArea contentTextArea; protected RSyntaxTextArea contentTextArea;

13
designer-base/src/main/java/com/fr/design/javascript/JavaScriptImplPane.java

@ -14,21 +14,18 @@ import com.fr.design.javascript.jsapi.JSImplUpdateAction;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.scrollruler.ModLineBorder; import com.fr.design.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.js.JavaScriptImpl; import com.fr.js.JavaScriptImpl;
import com.fr.stable.ParameterProvider; import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridLayout;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.event.TableModelEvent; import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener; import javax.swing.event.TableModelListener;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridLayout;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -149,8 +146,6 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
return importedJsPane; return importedJsPane;
} }
/** /**
* 参数改变 * 参数改变
* *

12
designer-chart/src/main/java/com/fr/van/chart/custom/component/VanChartHyperLinkPane.java

@ -39,6 +39,8 @@ import com.fr.stable.Nameable;
import com.fr.stable.bridge.StableFactory; import com.fr.stable.bridge.StableFactory;
import com.fr.van.chart.designer.component.VanChartUIListControlPane; import com.fr.van.chart.designer.component.VanChartUIListControlPane;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
@ -186,6 +188,16 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
} }
this.populate(nameObjects.toArray(new NameObject[nameObjects.size()])); this.populate(nameObjects.toArray(new NameObject[nameObjects.size()]));
if (popupEditDialog instanceof HyperDialog) {
popupEditDialog.addWindowFocusListener(new WindowAdapter() {
@Override
public void windowLostFocus(WindowEvent e) {
if (needToHidePopupEditDialog()) {
popupEditDialog.setVisible(false);
}
}
});
}
doLayout(); doLayout();
} }

11
designer-realize/src/main/java/com/fr/design/condition/HyperlinkPane.java

@ -9,12 +9,16 @@ import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl; import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl;
import com.fr.js.EmailJavaScript;
import com.fr.js.*; import com.fr.js.JavaScript;
import com.fr.js.JavaScriptImpl;
import com.fr.js.NameJavaScriptGroup;
import com.fr.js.ReportletHyperlink;
import com.fr.js.WebHyperlink;
import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.report.cell.cellattr.highlight.HighlightAction;
import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction; import com.fr.report.cell.cellattr.highlight.HyperlinkHighlightAction;
import javax.swing.*; import javax.swing.SwingUtilities;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
@ -47,6 +51,7 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane<HighlightAct
setText(); setText();
} }
}); });
dialog.setModal(false);
dialog.setVisible(true); dialog.setVisible(true);
} }
}); });

Loading…
Cancel
Save