From 035d74bdafed8d060b2bbb515699c8550f9c26f7 Mon Sep 17 00:00:00 2001 From: "Qinghui.Liu" Date: Thu, 5 Nov 2020 16:45:16 +0800 Subject: [PATCH] =?UTF-8?q?CHART-16493=20=E5=8A=A0=E8=BD=BD=E5=9B=BE?= =?UTF-8?q?=E8=A1=A8=E6=A8=A1=E5=9D=97=E6=97=B6=EF=BC=8C=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E5=AF=8C=E6=96=87=E6=9C=AC=E7=BC=96=E8=BE=91=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/chart/ChartDesignerActivator.java | 3 ++ .../component/VanChartRichEditorPane.java | 36 ++++++++++++++++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java index 0cd81f783..9b6f2e02e 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java @@ -18,6 +18,7 @@ import com.fr.plugin.chart.vanchart.export.ImagePainter; import com.fr.stable.bridge.StableFactory; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.van.chart.DownloadOnlineSourcesHelper; +import com.fr.van.chart.designer.component.VanChartRichEditorPane; /** * Created by juhaoyu on 2018/6/27. @@ -47,6 +48,8 @@ public class ChartDesignerActivator extends Activator implements Prepare { ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance()); + VanChartRichEditorPane.initRichEditorPane(); + ChartTypeInterfaceManager.addPluginChangedListener(); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java index 622d2a0ee..1ccc146c1 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java @@ -1,6 +1,8 @@ package com.fr.van.chart.designer.component; +import com.fr.concurrent.NamedThreadFactory; import com.fr.design.ui.ModernUIPane; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.type.TextAlign; import com.fr.stable.StringUtils; @@ -10,6 +12,8 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; public class VanChartRichEditorPane { @@ -21,6 +25,25 @@ public class VanChartRichEditorPane { private static ModernUIPane richEditorPane; private static Browser browser; + public static void initRichEditorPane() { + ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor(new NamedThreadFactory("VanChartRichEditor")); + + try { + singleThreadExecutor.submit(new Runnable() { + @Override + public void run() { + try { + richEditorPane = initPane(new RichEditorModel()); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + }); + } finally { + singleThreadExecutor.shutdown(); + } + } + public static ModernUIPane createRichEditorPane(AttrTooltipRichText richEditor) { RichEditorModel model = getRichEditorModel(richEditor); @@ -88,11 +111,14 @@ public class VanChartRichEditorPane { } public static class RichEditorModel { - private String content; - private boolean auto; - private String params; - private String initParams; - private String align; + private String content = StringUtils.EMPTY; + private boolean auto = true; + private String params = StringUtils.EMPTY; + private String initParams = StringUtils.EMPTY; + private String align = TextAlign.LEFT.getAlign(); + + public RichEditorModel() { + } public RichEditorModel(String content, boolean auto, String params, String initParams, String align) { this.content = content;