Browse Source

Merge pull request #490 in BA/design from ~ZACK/design:dev to dev

* commit '8ec9b02ad222ff9522a9e62f44953e4d9e4b8d85':
  无JIRA任务 release的改动同步下dev(共享组件数据集和服务器数据集同名去重问题)
master
superman 8 years ago
parent
commit
03cb3299be
  1. 18
      designer_base/src/com/fr/design/data/BasicTableDataTreePane.java
  2. 3
      designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java

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

@ -118,7 +118,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
if (StringUtils.isBlank(tempName)) { if (StringUtils.isBlank(tempName)) {
nPanel.setShowText(Inter.getLocText(new String[]{"DS-TableData", "ISEMPTY", "PLEASE", "GIVE-NAME"}, new String[]{"", ",", "", "!"})); nPanel.setShowText(Inter.getLocText(new String[]{"DS-TableData", "ISEMPTY", "PLEASE", "GIVE-NAME"}, new String[]{"", ",", "", "!"}));
dg.setButtonEnabled(false); dg.setButtonEnabled(false);
} else if (!ComparatorUtils.equals(oldName, tempName) && isDsNameRepeaded(tempName, allDSNames)) { } else if (!ComparatorUtils.equals(oldName, tempName) && isDsNameRepeaded(tempName)) {
String[] waring = new String[]{"DS-TableData", "Utils-has_been_existed", "PLEASE", "Rename"}; String[] waring = new String[]{"DS-TableData", "Utils-has_been_existed", "PLEASE", "Rename"};
String[] sign = new String[]{tempName, ",", "", "!"}; String[] sign = new String[]{tempName, ",", "", "!"};
nPanel.setShowText(Inter.getLocText(waring, sign)); nPanel.setShowText(Inter.getLocText(waring, sign));
@ -324,20 +324,22 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp
private String createDsName(String prefix) { private String createDsName(String prefix) {
int count = 1; int count = 1;
allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook());
while (isDsNameRepeaded(prefix + count, allDSNames)) { while (isDsNameRepeaded(prefix + count)) {
count++; count++;
} }
return prefix + count; return prefix + count;
} }
private boolean isDsNameRepeaded(String name, String[] names) { protected boolean isDsNameRepeaded(String name) {
boolean repeat = false; if (allDSNames == null) {
for (int i = 0; i < names.length; i++) { allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook());
if (ComparatorUtils.equals(name, names[i])) { }
repeat = true; for (int i = 0; i < allDSNames.length; i++) {
if (ComparatorUtils.equals(name, allDSNames[i])) {
return true;
} }
} }
return repeat; return false;
} }
protected KeyAdapter getTableTreeNodeListener(final UpdateAction editAction, final UpdateAction previewTableDataAction, final UpdateAction removeAction, final TableDataSourceOP op, final TableDataTree dataTree) { protected KeyAdapter getTableTreeNodeListener(final UpdateAction editAction, final UpdateAction previewTableDataAction, final UpdateAction removeAction, final TableDataSourceOP op, final TableDataTree dataTree) {

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

@ -276,13 +276,14 @@ public class TableDataTreePane extends BasicTableDataTreePane {
* @param tableDataSource 数据集 * @param tableDataSource 数据集
*/ */
public void addTableData(String srcName, TableDataSource tableDataSource) { public void addTableData(String srcName, TableDataSource tableDataSource) {
allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook());
DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER);
TableDataSource tds = tc.getBook(); TableDataSource tds = tc.getBook();
Iterator tdIterator = tableDataSource.getTableDataNameIterator(); Iterator tdIterator = tableDataSource.getTableDataNameIterator();
while (tdIterator.hasNext()) { while (tdIterator.hasNext()) {
String tdName = (String) tdIterator.next(); String tdName = (String) tdIterator.next();
TableData td = tableDataSource.getTableData(tdName); TableData td = tableDataSource.getTableData(tdName);
if (tds.getTableData(tdName) != null) {//如果有同名的就拼上来源名称 if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称
tdName = srcName + tdName; tdName = srcName + tdName;
} }
int i = 0; int i = 0;

Loading…
Cancel
Save