Browse Source

Merge pull request #3657 in DESIGN/design from release/10.0 to bugfix/10.0

* commit 'a79e34d78726a81f542b313c3329635d8f4b82c0':
  CHART-18181 设置启动参数
  REPORT-48354 【10.0.14二轮冒烟】本地打开模板,切换到远程环境,预览模板保存成功后未跳到预览页面
bugfix/10.0
superman 4 years ago
parent
commit
98f67e05db
  1. 16
      designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java
  2. 11
      designer-base/src/main/java/com/fr/design/ui/Assistant.java
  3. 14
      designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

16
designer-base/src/main/java/com/fr/design/actions/file/WebPreviewUtils.java

@ -73,6 +73,22 @@ public final class WebPreviewUtils {
FILE currentTemplate = jt.getEditingFILE();
// carl:是否是保存在运行环境下的模板,不是就不能被预览
if (currentTemplate instanceof FileNodeFILE) {
// 判断下模板是否存在 不存在先提示
if (!currentTemplate.exists()) {
int selVal = showConfirmDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Basic_Web_Preview_Message"),
Toolkit.i18nText("Fine-Design_Basic_Preview_Tool_Tips"),
OK_CANCEL_OPTION,
WARNING_MESSAGE
);
if (OK_OPTION == selVal) {
if (!jt.saveAsTemplate()) {
return;
}
}
currentTemplate = jt.getEditingFILE();
}
browseUrl(currentTemplate, baseRoute, map, actionType, jt);
} else {
// 说明模板没有保存在报表运行环境下面,提示用户

11
designer-base/src/main/java/com/fr/design/ui/Assistant.java

@ -3,6 +3,7 @@ package com.fr.design.ui;
import com.fr.stable.StringUtils;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserContext;
import com.teamdev.jxbrowser.chromium.BrowserPreferences;
import com.teamdev.jxbrowser.chromium.ProtocolService;
import com.teamdev.jxbrowser.chromium.URLResponse;
@ -12,6 +13,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
/**
* @author richie
@ -20,6 +23,14 @@ import java.nio.file.Path;
*/
public class Assistant {
public static void addChromiumSwitches(String... switches) {
List<String> list = BrowserPreferences.getChromiumSwitches();
Collections.addAll(list, switches);
BrowserPreferences.setChromiumSwitches((list.toArray(new String[0])));
}
public static URLResponse inputStream2Response(InputStream inputStream, String filePath) throws Exception {
URLResponse response = new URLResponse();
DataInputStream stream = new DataInputStream(inputStream);

14
designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java

@ -8,18 +8,18 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.web.struct.AssembleComponent;
import com.teamdev.jxbrowser.chromium.Browser;
import com.teamdev.jxbrowser.chromium.BrowserPreferences;
import com.teamdev.jxbrowser.chromium.JSValue;
import com.teamdev.jxbrowser.chromium.events.FinishLoadingEvent;
import com.teamdev.jxbrowser.chromium.events.LoadAdapter;
import com.teamdev.jxbrowser.chromium.events.LoadListener;
import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import com.teamdev.jxbrowser.chromium.events.ScriptContextListener;
import com.teamdev.jxbrowser.chromium.swing.BrowserView;
import javax.swing.*;
import java.awt.*;
import javax.swing.JDialog;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Map;
@ -44,7 +44,7 @@ public class ModernUIPane<T> extends BasicPane {
private void initialize() {
if (browser == null) {
setLayout(new BorderLayout());
BrowserPreferences.setChromiumSwitches("--disable-google-traffic");
Assistant.addChromiumSwitches("--disable-google-traffic");
if (DesignerEnvManager.getEnvManager().isOpenDebug()) {
UIToolbar toolbar = new UIToolbar();
add(toolbar, BorderLayout.NORTH);
@ -75,7 +75,7 @@ public class ModernUIPane<T> extends BasicPane {
SwingUtilities.getWindowAncestor(ModernUIPane.this).setVisible(false);
}
});
BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222");
Assistant.addChromiumSwitches("--remote-debugging-port=9222");
initializeBrowser();
add(new BrowserView(browser), BorderLayout.CENTER);
} else {

Loading…
Cancel
Save