From 8ec9b02ad222ff9522a9e62f44953e4d9e4b8d85 Mon Sep 17 00:00:00 2001 From: zack Date: Mon, 14 Nov 2016 17:24:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A0JIRA=E4=BB=BB=E5=8A=A1=20release?= =?UTF-8?q?=E7=9A=84=E6=94=B9=E5=8A=A8=E5=90=8C=E6=AD=A5=E4=B8=8Bdev(?= =?UTF-8?q?=E5=85=B1=E4=BA=AB=E7=BB=84=E4=BB=B6=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E5=92=8C=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0=E6=8D=AE=E9=9B=86?= =?UTF-8?q?=E5=90=8C=E5=90=8D=E5=8E=BB=E9=87=8D=E9=97=AE=E9=A2=98)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fr/design/data/BasicTableDataTreePane.java | 18 ++++++++++-------- .../data/datapane/TableDataTreePane.java | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java b/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java index 45cd0cea70..a76d4a1059 100644 --- a/designer_base/src/com/fr/design/data/BasicTableDataTreePane.java +++ b/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)) { nPanel.setShowText(Inter.getLocText(new String[]{"DS-TableData", "ISEMPTY", "PLEASE", "GIVE-NAME"}, new String[]{"", ",", "", "!"})); 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[] sign = new String[]{tempName, ",", "", "!"}; nPanel.setShowText(Inter.getLocText(waring, sign)); @@ -324,20 +324,22 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp private String createDsName(String prefix) { int count = 1; allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); - while (isDsNameRepeaded(prefix + count, allDSNames)) { + while (isDsNameRepeaded(prefix + count)) { count++; } return prefix + count; } - private boolean isDsNameRepeaded(String name, String[] names) { - boolean repeat = false; - for (int i = 0; i < names.length; i++) { - if (ComparatorUtils.equals(name, names[i])) { - repeat = true; + protected boolean isDsNameRepeaded(String name) { + if (allDSNames == null) { + allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); + } + 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) { diff --git a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java index 2e605cafcf..219093c6d9 100644 --- a/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer_base/src/com/fr/design/data/datapane/TableDataTreePane.java @@ -276,13 +276,14 @@ public class TableDataTreePane extends BasicTableDataTreePane { * @param tableDataSource 数据集 */ public void addTableData(String srcName, TableDataSource tableDataSource) { + 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(); TableData td = tableDataSource.getTableData(tdName); - if (tds.getTableData(tdName) != null) {//如果有同名的就拼上来源名称 + if (tds.getTableData(tdName) != null || isDsNameRepeaded(tdName)) {//如果有同名的就拼上来源名称 tdName = srcName + tdName; } int i = 0;