diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 8f03b1cfc4..e425751772 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -19,6 +19,7 @@ import com.fr.design.data.datapane.management.search.pane.TreeSearchToolbarPane; import com.fr.design.data.datapane.management.search.searcher.TableDataSearchMode; import com.fr.design.data.datapane.management.search.TableDataTreeSearchManager; import com.fr.design.data.tabledata.StoreProcedureWorkerListener; +import com.fr.design.data.tabledata.paste.TableDataFollowingPasteUtils; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; import com.fr.design.data.tabledata.tabledatapane.DBTableDataPane; import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; @@ -1132,8 +1133,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { // 处理数据集名称 String dsName = getNoRepeatedDsName4Paste(dataWrapperEntry.getKey()); AbstractTableDataWrapper wrapper = dataWrapperEntry.getValue(); - AbstractTableDataPane tableDataPane = wrapper.creatTableDataPane(); - addDataPane(tableDataPane, dsName); + addDataPane(TableDataFollowingPasteUtils.generateTableDataPaneWhenPaste(wrapper), dsName); } } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java index f69312d47f..e90b8a4208 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/paste/TableDataFollowingPasteUtils.java @@ -3,10 +3,12 @@ package com.fr.design.data.tabledata.paste; import com.fr.base.TableData; import com.fr.base.chart.BaseChartCollection; import com.fr.data.TableDataSource; +import com.fr.data.impl.storeproc.StoreProcedure; import com.fr.design.DesignModelAdapter; import com.fr.design.data.DesignTableDataManager; import com.fr.design.data.datapane.TableDataTreePane; import com.fr.design.data.tabledata.tabledatapane.AbstractTableDataPane; +import com.fr.design.data.tabledata.tabledatapane.ProcedureDataPane; import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; @@ -63,8 +65,7 @@ public class TableDataFollowingPasteUtils { continue; } AbstractTableDataWrapper tableDataWrapper = new TemplateTableDataWrapper(dataWrapperEntry.getValue(), dsName); - AbstractTableDataPane tableDataPane = tableDataWrapper.creatTableDataPane(); - tableDataTreePane.addDataPane(tableDataPane, dsName); + tableDataTreePane.addDataPane(generateTableDataPaneWhenPaste(tableDataWrapper), dsName); } } @@ -337,4 +338,19 @@ public class TableDataFollowingPasteUtils { return templeteDataSet; } + /** + * 生成粘贴(新建)时使用的AbstractTableDataPane + * 主要是为了处理StoreProcedure,它在远程情况下,无法及时获取参数。这边因为是复制粘贴,所以直接用原TableData的参数即可 + * @param tableDataWrapper wrapper + * @return AbstractTableDataPane + */ + public static AbstractTableDataPane generateTableDataPaneWhenPaste(AbstractTableDataWrapper tableDataWrapper) { + AbstractTableDataPane tableDataPane = tableDataWrapper.creatTableDataPane(); + TableData tableData = tableDataWrapper.getTableData(); + if (tableData instanceof StoreProcedure) { + StoreProcedure storeProcedure = (StoreProcedure) tableData; + ((ProcedureDataPane) tableDataPane).populateParameters(storeProcedure.getParameters()); + } + return tableDataPane; + } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java index d2a1918d4f..a2a279b60e 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/ProcedureDataPane.java @@ -225,6 +225,14 @@ public class ProcedureDataPane extends AbstractTableDataPane imp } + /** + * 手动更新参数,用于上面populateBean方法中SwingWorker查询来不及的情况 + * @param procedureParameters + */ + public void populateParameters(StoreProcedureParameter[] procedureParameters) { + this.editorPane.populate(procedureParameters); + } + /** * 增加存储过程监听器 *