Browse Source

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

Merge in DESIGN/design from ~QINGHUI.LIU/design:release/10.0 to release/10.0

* commit '94a9bb0ea69bdf5fd90ad5f8295e10718f67346a':
  CHART-16493 加载图表模块时,初始化富文本编辑器
feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
c316a584f0
  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.bridge.StableFactory;
import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider; import com.fr.stable.plugin.ExtraChartDesignClassManagerProvider;
import com.fr.van.chart.DownloadOnlineSourcesHelper; import com.fr.van.chart.DownloadOnlineSourcesHelper;
import com.fr.van.chart.designer.component.VanChartRichEditorPane;
/** /**
* Created by juhaoyu on 2018/6/27. * Created by juhaoyu on 2018/6/27.
@ -47,6 +48,8 @@ public class ChartDesignerActivator extends Activator implements Prepare {
ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper()); ImagePainter.registerDownloadSourcesEvent(new DownloadOnlineSourcesHelper());
ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance()); ImagePainter.registerDefaultCallbackEvent(HistoryTemplateListCache.getInstance());
VanChartRichEditorPane.initRichEditorPane();
ChartTypeInterfaceManager.addPluginChangedListener(); 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; package com.fr.van.chart.designer.component;
import com.fr.concurrent.NamedThreadFactory;
import com.fr.design.ui.ModernUIPane; import com.fr.design.ui.ModernUIPane;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.chart.base.AttrTooltipRichText; import com.fr.plugin.chart.base.AttrTooltipRichText;
import com.fr.plugin.chart.type.TextAlign; import com.fr.plugin.chart.type.TextAlign;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -10,6 +12,8 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter;
import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class VanChartRichEditorPane { public class VanChartRichEditorPane {
@ -21,6 +25,25 @@ public class VanChartRichEditorPane {
private static ModernUIPane<RichEditorModel> richEditorPane; private static ModernUIPane<RichEditorModel> richEditorPane;
private static Browser browser; 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) { public static ModernUIPane<RichEditorModel> createRichEditorPane(AttrTooltipRichText richEditor) {
RichEditorModel model = getRichEditorModel(richEditor); RichEditorModel model = getRichEditorModel(richEditor);
@ -88,11 +111,14 @@ public class VanChartRichEditorPane {
} }
public static class RichEditorModel { public static class RichEditorModel {
private String content; private String content = StringUtils.EMPTY;
private boolean auto; private boolean auto = true;
private String params; private String params = StringUtils.EMPTY;
private String initParams; private String initParams = StringUtils.EMPTY;
private String align; private String align = TextAlign.LEFT.getAlign();
public RichEditorModel() {
}
public RichEditorModel(String content, boolean auto, String params, String initParams, String align) { public RichEditorModel(String content, boolean auto, String params, String initParams, String align) {
this.content = content; this.content = content;

Loading…
Cancel
Save