Browse Source

REPORT-61610 fix:插件重新加载 图表配置界面报错 A.class can not cast to A.class

zheng-1641779399395
shine 3 years ago
parent
commit
103beaec4c
  1. 34
      designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

34
designer-chart/src/main/java/com/fr/design/mainframe/ChartPropertyPane.java

@ -10,12 +10,22 @@ import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.charttypes.ChartTypeManager; import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chartx.attr.ChartProvider; import com.fr.chartx.attr.ChartProvider;
import com.fr.design.ChartTypeInterfaceManager; import com.fr.design.ChartTypeInterfaceManager;
import com.fr.design.chart.fun.ChartTypeUIProvider;
import com.fr.design.designer.TargetComponent; import com.fr.design.designer.TargetComponent;
import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.ChartEditPaneProvider; import com.fr.design.gui.chart.ChartEditPaneProvider;
import com.fr.design.gui.frpane.UITitlePanel; import com.fr.design.gui.frpane.UITitlePanel;
import com.fr.design.mainframe.chart.ChartEditPane; import com.fr.design.mainframe.chart.ChartEditPane;
import com.fr.design.module.DesignModuleFactory;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.GeneralContext;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.injectable.PluginModule;
import com.fr.plugin.injectable.SpecialLevel;
import com.fr.plugin.manage.PluginFilter;
import com.fr.plugin.observer.PluginEvent;
import com.fr.plugin.observer.PluginEventListener;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.AssistUtils; import com.fr.stable.AssistUtils;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
@ -39,8 +49,11 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
//ID一样的话 不用新建chartEditPane //ID一样的话 不用新建chartEditPane
private String currentID; private String currentID;
private static PluginEventListener pluginEventListener;
private ChartPropertyPane() { private ChartPropertyPane() {
initComponent(); initComponent();
addListener();
} }
protected void initComponent() { protected void initComponent() {
@ -48,6 +61,27 @@ public class ChartPropertyPane extends BaseChartPropertyPane {
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
} }
private void addListener() {
if (pluginEventListener != null) {
GeneralContext.stopListenPlugin(pluginEventListener);
}
pluginEventListener = new PluginEventListener() {
@Override
public void on(PluginEvent event) {
//禁用启用图表插件 这边id置空。这样展示图表配置属性不管和上一个id是否一样 都新建chartEditPane
currentID = null;
}
};
GeneralContext.listenPlugin(PluginEventType.AfterRun, pluginEventListener, new PluginFilter() {
@Override
public boolean accept(PluginContext context) {
return context.contain(PluginModule.ExtraChartDesign);
}
});
}
@Override @Override
public void updateChartEditPane(String plotID) { public void updateChartEditPane(String plotID) {
if (!AssistUtils.equals(currentID, plotID)) { if (!AssistUtils.equals(currentID, plotID)) {

Loading…
Cancel
Save