Browse Source
* commit 'cc5e547ca2687136bffd3989946bf391b8246fa6': REPORT-79889 远程设计下存储过程结果列表缓存刷新的问题 import REPORT-79881 多结果数据集树节点图标查找性能问题 REPORT-79845 同一个多结果数据集equals为false的问题 REPORT-79344【运营产品化二期】埋点暂不生效 1、release提交一份bugfix/11.0
superman
2 years ago
5 changed files with 76 additions and 26 deletions
@ -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…
Reference in new issue