Browse Source

Merge pull request #10921 in DESIGN/design from bugfix/11.0 to feature/x

* commit '42eebc6f11e45cafc61b134d42b375f95f4fcb33':
  REPORT-85754 fix:参考cpt图表的类似写法,引入焦点丢失事件
  REPORT-85754 fix:扩展图表场景设置-js-高级编辑界面不应该置底
feature/x
superman 2 years ago
parent
commit
1fb44eee5f
  1. 98
      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

98
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.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
@ -241,51 +240,12 @@ public abstract class UIControlPane extends JControlPane {
}
private void hideDialog() {
// 检查是否有子弹窗,如果有,则不隐藏
for (Window window : getOwnedWindows()) {
if (window.isVisible()) {
return;
}
}
// 如果有可见模态对话框,则不隐藏
for (Window window : DesignerContext.getDesignerFrame().getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
return;
}
}
try {
//没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame()
Frame sharedOwnerFrame = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get();
for (Window window : sharedOwnerFrame.getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
// 如果有可见模态对话框,则不隐藏
return;
}
}
} catch (Exception ignore) {
//do nothing
}
// 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try {
checkValid();
} catch (Exception exp) {
// 存在非法输入 拒绝隐藏
this.setAlwaysOnTop(true);
FineJOptionPane.showMessageDialog(this, exp.getMessage());
this.requestFocus();
return;
}
if (JavaFxNativeFileChooser.isShowDialogState()) {
JavaFxNativeFileChooser.setShowDialogState(false);
return;
if (needToHidePopupEditDialog()) {
saveSettings();
setVisible(false);
PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
saveAction.unregister();
}
saveSettings();
setVisible(false);
PopupDialogSaveAction saveAction = OSSupportCenter.getAction(PopupDialogSaveAction.class);
saveAction.unregister();
}
private void initListener() {
@ -302,6 +262,54 @@ public abstract class UIControlPane extends JControlPane {
}
}
/**
* 是否需要隐藏popupEditDialog
*/
protected boolean needToHidePopupEditDialog() {
// 检查是否有子弹窗,如果有,则不隐藏
for (Window window : popupEditDialog.getOwnedWindows()) {
if (window.isVisible()) {
return false;
}
}
// 如果有可见模态对话框,则不隐藏
for (Window window : DesignerContext.getDesignerFrame().getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
return false;
}
}
try {
//没有指定owner的弹出框用的是SwingUtilities.getSharedOwnerFrame()
Frame sharedOwnerFrame = Reflect.on(SwingUtilities.class).call("getSharedOwnerFrame").get();
for (Window window : sharedOwnerFrame.getOwnedWindows()) {
if (window instanceof JDialog && window.isVisible() && ((JDialog) window).isModal()) {
// 如果有可见模态对话框,则不隐藏
return false;
}
}
} catch (Exception ignore) {
//do nothing
}
// 要隐藏 先检查有没有非法输入
// 非法输入检查放在最后,因为可能出现面板弹出新弹框而失去焦点的情况,比如 输入公式时,弹出公式编辑对话框
try {
checkValid();
} catch (Exception exp) {
// 存在非法输入 拒绝隐藏
popupEditDialog.setAlwaysOnTop(true);
FineJOptionPane.showMessageDialog(this, exp.getMessage());
popupEditDialog.requestFocus();
return false;
}
if (JavaFxNativeFileChooser.isShowDialogState()) {
JavaFxNativeFileChooser.setShowDialogState(false);
return false;
}
return true;
}
// 移动弹出编辑面板的工具条
private class PopupToolPane extends JPanel {
private JDialog parentDialog; // 如果不在对话框中,值为null

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.mainframe.DesignerContext;
import com.fr.general.IOUtils;
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.Cursor;
import java.awt.Dimension;
@ -36,10 +39,6 @@ import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
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 {
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.scrollruler.ModLineBorder;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.js.JavaScriptImpl;
import com.fr.stable.ParameterProvider;
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.JPanel;
import javax.swing.event.TableModelEvent;
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.HashSet;
import java.util.List;
@ -149,8 +146,6 @@ public class JavaScriptImplPane extends AbstractHyperLinkPane<JavaScriptImpl> {
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.van.chart.designer.component.VanChartUIListControlPane;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
@ -186,6 +188,16 @@ public class VanChartHyperLinkPane extends VanChartUIListControlPane {
}
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();
}

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.mainframe.DesignerContext;
import com.fr.design.mainframe.HyperlinkGroupPaneActionImpl;
import com.fr.js.*;
import com.fr.js.EmailJavaScript;
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.HyperlinkHighlightAction;
import javax.swing.*;
import javax.swing.SwingUtilities;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@ -47,6 +51,7 @@ public class HyperlinkPane extends ConditionAttrSingleConditionPane<HighlightAct
setText();
}
});
dialog.setModal(false);
dialog.setVisible(true);
}
});

Loading…
Cancel
Save