Browse Source

REPORT-841 表单数据集重命名报表块内容联动

master
zack 8 years ago
parent
commit
0cde4e2591
  1. 6
      designer_base/src/com/fr/design/data/BasicTableDataTreePane.java
  2. 8
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java
  3. 5
      designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

6
designer_base/src/com/fr/design/data/BasicTableDataTreePane.java

@ -428,11 +428,11 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
}
/**
* 合并数据集
* 合并数据集并返回自动更改数据集名字的新老名字键值对
* @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集
*/
public void addTableData(String srcName, TableDataSource tableDataSource) {
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) {
return new HashMap<>(0);
}
}

8
designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

@ -275,13 +275,15 @@ public class TableDataTreePane extends BasicTableDataTreePane {
* @param srcName 数据集来源(比如报表块就是报表块的名称)
* @param tableDataSource 数据集
*/
public void addTableData(String srcName, TableDataSource tableDataSource) {
public Map<String, String> addTableData(String srcName, TableDataSource tableDataSource) {
Map<String,String> tdNameMap=new HashMap<>();
allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook());
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
TableDataSource tds = tc.getBook();
Iterator tdIterator = tableDataSource.getTableDataNameIterator();
while (tdIterator.hasNext()) {
String tdName = (String) tdIterator.next();
String oldName = tdName;
TableData td = tableDataSource.getTableData(tdName);
if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称
tdName = srcName + tdName;
@ -292,8 +294,12 @@ public class TableDataTreePane extends BasicTableDataTreePane {
tdName += i;
}
tds.putTableData(tdName, td);
if (!ComparatorUtils.equals(oldName, tdName)) {
tdNameMap.put(oldName, tdName);
}
}
tc.parameterChanged();
dataTree.refresh();
return tdNameMap;
}
}

5
designer_form/src/com/fr/design/mainframe/FormCreatorDropTarget.java

@ -26,6 +26,7 @@ import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetDragEvent;
import java.awt.dnd.DropTargetDropEvent;
import java.awt.dnd.DropTargetEvent;
import java.util.Map;
/**
* 添加模式下鼠标事件处理器
@ -88,7 +89,9 @@ public class FormCreatorDropTarget extends DropTarget {
SharableElementCaseEditor sharableEditor = ShareLoader.getLoader().getSharedElCaseEditorById(shareId);
ElCaseBindInfo bindInfo = ShareLoader.getLoader().getElCaseBindInfoById(shareId);
if (sharableEditor != null && bindInfo != null) {
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(),sharableEditor.getTableDataSource());
Map<String, String> tdNameMap = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()).addTableData(bindInfo.getName(), sharableEditor.getTableDataSource());
//合并数据集之后,可能会有数据集名称变化,做一下联动
sharableEditor.batchRenameTdName(tdNameMap);
}
}
Widget widget = (addingXCreator.getTopLayout() != null) ? (addingXCreator.getTopLayout().toData()) : addingXCreator.toData();

Loading…
Cancel
Save