Browse Source

Pull request #9952: REPORT-79881 多结果数据集树节点图标查找性能问题

Merge in DESIGN/design from ~RINOUX/design:final/11.0 to final/11.0

* commit '89fc3da190a751c60d542036e2deef72aa9ec8bf':
  import
  REPORT-79881 多结果数据集树节点图标查找性能问题
new-design
rinoux-杨锐 2 years ago
parent
commit
c59d3e6a67
  1. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataNameWrapper.java
  2. 11
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java
  3. 54
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapperHelper.java

10
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataNameWrapper.java

@ -4,11 +4,8 @@ import com.fr.base.TableData;
import com.fr.data.MultiResultTableData;
import com.fr.data.impl.NameDataModel;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataCreatorProducer;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import com.fr.workspace.WorkContext;
@ -68,12 +65,7 @@ public final class MultiResultTableDataNameWrapper implements TableDataWrapper {
@Override
public Icon getIcon() {
for (TableDataNameObjectCreator creator : TableDataCreatorProducer.getInstance().createReportTableDataCreator()) {
if (creator.createObject().getClass().isAssignableFrom(this.tableData.getClass())) {
return IOUtils.readIcon(creator.getIconPath());
}
}
return IOUtils.readIcon("/com/fr/design/images/data/multi.png");
return MultiResultTableDataWrapperHelper.getIcon(this.tableData.getClass());
}
private void createResult(boolean needLoadingBar) {

11
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java

@ -6,8 +6,6 @@ import com.fr.data.impl.NameDataModel;
import com.fr.data.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.data.datapane.TableDataCreatorProducer;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar;
@ -15,7 +13,6 @@ import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode;
import com.fr.design.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory;
import javax.swing.Icon;
@ -163,12 +160,7 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
@Override
public Icon getIcon() {
for (TableDataNameObjectCreator creator : TableDataCreatorProducer.getInstance().createReportTableDataCreator()) {
if (creator.createObject().getClass().isAssignableFrom(this.tableData.getClass())) {
return IOUtils.readIcon(creator.getIconPath());
}
}
return IOUtils.readIcon("/com/fr/design/images/data/multi.png");
return MultiResultTableDataWrapperHelper.getIcon(this.tableData.getClass());
}
/**
@ -303,6 +295,7 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
/**
* 获取当前节点所属可编辑的数据集名称
*
* @return
*/
public String getMultiResultTableDataName() {

54
designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapperHelper.java

@ -0,0 +1,54 @@
package com.fr.design.data.tabledata.wrapper;
import com.fr.base.TableData;
import com.fr.design.data.datapane.TableDataCreatorProducer;
import com.fr.design.data.datapane.TableDataNameObjectCreator;
import com.fr.design.fun.ServerTableDataDefineProvider;
import com.fr.design.fun.TableDataDefineProvider;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
import com.fr.general.IOUtils;
import com.fr.plugin.context.PluginContext;
import com.fr.plugin.observer.PluginEventType;
import com.fr.stable.Filter;
import org.jetbrains.annotations.NotNull;
import javax.swing.Icon;
import java.util.HashMap;
import java.util.Map;
/**
* @author rinoux
* @version 11.0
* Created by rinoux on 2022/9/7
*/
class MultiResultTableDataWrapperHelper {
private static final Map<Class<? extends TableData>, Icon> TABLE_DATA_ICON_PATHS = new HashMap<>();
private static final String DEFAULT_MULTI_RESULT_TD_ICON = "/com/fr/design/images/data/multi.png";
static {
Listener<PluginContext> listener = new Listener<PluginContext>() {
@Override
public void on(Event event, PluginContext param) {
TABLE_DATA_ICON_PATHS.clear();
}
};
Filter<PluginContext> filter = pluginContext -> pluginContext.contain(TableDataDefineProvider.XML_TAG) || pluginContext.contain(ServerTableDataDefineProvider.XML_TAG);
EventDispatcher.listen(PluginEventType.AfterRun, listener, filter);
EventDispatcher.listen(PluginEventType.BeforeStop, listener, filter);
}
public static @NotNull Icon getIcon(@NotNull Class<? extends TableData> tableDataClass) {
return TABLE_DATA_ICON_PATHS.computeIfAbsent(tableDataClass, cls -> {
for (TableDataNameObjectCreator creator : TableDataCreatorProducer.getInstance().createReportTableDataCreator()) {
if (creator.createObject().getClass().isAssignableFrom(tableDataClass)) {
return IOUtils.readIcon(creator.getIconPath());
}
}
return IOUtils.readIcon(DEFAULT_MULTI_RESULT_TD_ICON);
});
}
}
Loading…
Cancel
Save