Browse Source

CHART-16493 加载图表模块时,初始化富文本编辑器

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
035d74bdaf
  1. 3
      designer-chart/src/main/java/com/fr/design/chart/ChartDesignerActivator.java
  2. 36
      designer-chart/src/main/java/com/fr/van/chart/designer/component/VanChartRichEditorPane.java

3
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();
}

36
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<RichEditorModel> 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<RichEditorModel> 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;

Loading…
Cancel
Save