Browse Source

Merge pull request #4648 in DESIGN/design from bugfix/10.0 to feature/10.0

* commit '49323541f1fc264e75bfa75fb44cf8deeac22a8b':
  CHART-19556 富文本轻量级加载,使用完之后销毁
feature/10.0
superman 3 years ago
parent
commit
1af2cc0805
  1. 10
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java
  2. 11
      designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java

10
designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartTooltipContentPane.java

@ -39,6 +39,10 @@ import com.fr.van.chart.designer.style.VanChartStylePane;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.CardLayout; import java.awt.CardLayout;
import java.awt.Component; import java.awt.Component;
@ -47,10 +51,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** /**
* 数据点提示内容界面含有通用设置富文本编辑器自定义JS界面 * 数据点提示内容界面含有通用设置富文本编辑器自定义JS界面
@ -411,10 +411,12 @@ public class VanChartTooltipContentPane extends BasicBeanPane<AttrTooltipContent
updateTooltipFormat(richTextTooltipContent, temporary); updateTooltipFormat(richTextTooltipContent, temporary);
SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false);
VanChartRichEditorPane.checkDispose();
} }
public void doCancel() { public void doCancel() {
SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false); SwingUtilities.getWindowAncestor(richEditorPane).setVisible(false);
VanChartRichEditorPane.checkDispose();
} }
}); });

11
designer-chart/src/main/java/com/fr/van/chart/designer/component/richText/VanChartRichEditorPane.java

@ -48,6 +48,8 @@ public class VanChartRichEditorPane {
private static Browser browser; private static Browser browser;
private static List<String> fieldNames; private static List<String> fieldNames;
private static final boolean USE_LIGHT_WEIGHT = SystemUtils.IS_OS_WINDOWS_10;
public static List<String> getFieldNames() { public static List<String> getFieldNames() {
return fieldNames; return fieldNames;
} }
@ -154,7 +156,7 @@ public class VanChartRichEditorPane {
} }
public static ModernUIPane<VanChartRichEditorModel> initPane(VanChartRichEditorModel model) { public static ModernUIPane<VanChartRichEditorModel> initPane(VanChartRichEditorModel model) {
BrowserType type = SystemUtils.IS_OS_WINDOWS_10 ? BrowserType.LIGHTWEIGHT : BrowserType.HEAVYWEIGHT; BrowserType type = USE_LIGHT_WEIGHT ? BrowserType.LIGHTWEIGHT : BrowserType.HEAVYWEIGHT;
return new ModernUIPane.Builder<VanChartRichEditorModel>(type) return new ModernUIPane.Builder<VanChartRichEditorModel>(type)
.prepare(new ScriptContextAdapter() { .prepare(new ScriptContextAdapter() {
public void onScriptContextCreated(ScriptContextEvent event) { public void onScriptContextCreated(ScriptContextEvent event) {
@ -232,4 +234,11 @@ public class VanChartRichEditorPane {
return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());"; return "!(function () { window.transformI18n && window.transformI18n('" + language + "' || 'zh_CN'); }());";
} }
public static void checkDispose() {
if (USE_LIGHT_WEIGHT) {
browser.dispose();
richEditorPane = null;
}
}
} }

Loading…
Cancel
Save