Browse Source

Merge pull request #9963 in DESIGN/design from final/11.0 to release/11.0

* commit 'e19fa1e976f5726f44de6d35c2171583152c7af1':
  REPORT-79889 远程设计下存储过程结果列表缓存刷新的问题
  import
  REPORT-79881 多结果数据集树节点图标查找性能问题
  REPORT-79845 同一个多结果数据集equals为false的问题
release/11.0
superman 2 years ago
parent
commit
cc5e547ca2
  1. 2
      designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java
  2. 6
      designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java
  3. 10
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataNameWrapper.java
  4. 30
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapper.java
  5. 54
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/MultiResultTableDataWrapperHelper.java

2
designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java

@ -444,7 +444,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
((MultiResultTableData<?>) (((TableDataWrapper) data).getTableData())).resetDataModelList(); ((MultiResultTableData<?>) (((TableDataWrapper) data).getTableData())).resetDataModelList();
if (data instanceof MultiResultTableDataWrapper) { if (data instanceof MultiResultTableDataWrapper) {
MultiResultTableDataWrapper oldSdw = ((MultiResultTableDataWrapper) data); MultiResultTableDataWrapper oldSdw = ((MultiResultTableDataWrapper) data);
MultiResultTableDataWrapper newSdw = new MultiResultTableDataWrapper((MultiResultTableData<?>) oldSdw.getTableData(), oldSdw.getTableDataName(), oldSdw.getDataModelName()); MultiResultTableDataWrapper newSdw = new MultiResultTableDataWrapper((MultiResultTableData<?>) oldSdw.getTableData(), oldSdw.getMultiResultTableDataName(), oldSdw.getTableDataName());
newSdw.previewData(MultiResultTableDataWrapper.PREVIEW_ONE); newSdw.previewData(MultiResultTableDataWrapper.PREVIEW_ONE);
} else { } else {
MultiResultTableData<?> tableData = (MultiResultTableData<?>) ((TableDataWrapper) data).getTableData(); MultiResultTableData<?> tableData = (MultiResultTableData<?>) ((TableDataWrapper) data).getTableData();

6
designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java

@ -289,16 +289,16 @@ public class ProcedureDataPane extends AbstractTableDataPane<StoreProcedure> imp
@Override @Override
protected Void doInBackground() throws Exception { protected Void doInBackground() throws Exception {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
// sp.setCalculating(true); sp.setCalculating(true);
ProcedureDataModel[] dataModels = (ProcedureDataModel[]) DesignTableDataManager.createLazyDataModel(sp, false); ProcedureDataModel[] dataModels = (ProcedureDataModel[]) DesignTableDataManager.createLazyDataModel(sp, false);
//sp.refreshDataModelListAndResultNames(dataModels); sp.refreshResults(dataModels);
return null; return null;
} }
@Override @Override
public void done() { public void done() {
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
// sp.setCalculating(false); sp.setCalculating(false);
doAfterProcudureDone(); doAfterProcudureDone();
fireDSChanged(); fireDSChanged();
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter());

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

30
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.impl.storeproc.StoreProcedure;
import com.fr.data.operator.DataOperator; import com.fr.data.operator.DataOperator;
import com.fr.design.data.DesignTableDataManager; 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.data.datapane.preview.PreviewTablePane;
import com.fr.design.dialog.FineJOptionPane; import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.iprogressbar.AutoProgressBar; 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.i18n.Toolkit;
import com.fr.design.mainframe.DesignerContext; import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.log.FineLoggerFactory; import com.fr.log.FineLoggerFactory;
import javax.swing.Icon; import javax.swing.Icon;
@ -163,12 +160,7 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
@Override @Override
public Icon getIcon() { public Icon getIcon() {
for (TableDataNameObjectCreator creator : TableDataCreatorProducer.getInstance().createReportTableDataCreator()) { return MultiResultTableDataWrapperHelper.getIcon(this.tableData.getClass());
if (creator.createObject().getClass().isAssignableFrom(this.tableData.getClass())) {
return IOUtils.readIcon(creator.getIconPath());
}
}
return IOUtils.readIcon("/com/fr/design/images/data/multi.png");
} }
/** /**
@ -287,7 +279,8 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
@Override @Override
public String getTableDataName() { public String getTableDataName() {
return tableDataName; // todo 这里返回数据集结果名称,带_的
return dataModelName;
} }
public String getDataModelName() { public String getDataModelName() {
@ -299,6 +292,16 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
return tableData; return tableData;
} }
/**
* 获取当前节点所属可编辑的数据集名称
*
* @return
*/
public String getMultiResultTableDataName() {
return tableDataName;
}
/** /**
* 是否异常 * 是否异常
* *
@ -312,9 +315,10 @@ public final class MultiResultTableDataWrapper implements TableDataWrapper {
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
return obj instanceof MultiResultTableDataWrapper return obj instanceof MultiResultTableDataWrapper
&& ComparatorUtils.equals(this.dataModelName, ((MultiResultTableDataWrapper) obj).getTableDataName()) && ComparatorUtils.equals(this.getDataModelName(), ((MultiResultTableDataWrapper) obj).getDataModelName())
&& ComparatorUtils.equals(this.tableData, ((MultiResultTableDataWrapper) obj).getTableData()) && ComparatorUtils.equals(this.getTableData(), ((MultiResultTableDataWrapper) obj).getTableData())
&& ComparatorUtils.equals(this.tableDataName, ((MultiResultTableDataWrapper) obj).getTableDataName()); && ComparatorUtils.equals(this.getMultiResultTableDataName(), ((MultiResultTableDataWrapper) obj).getMultiResultTableDataName())
&& ComparatorUtils.equals(this.getTableDataName(), ((MultiResultTableDataWrapper) obj).getTableDataName());
} }

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