|
|
|
@ -14,6 +14,7 @@ import com.fr.file.ProcedureConfig;
|
|
|
|
|
import com.fr.file.TableDataConfig; |
|
|
|
|
import com.fr.general.ComparatorUtils; |
|
|
|
|
import com.fr.general.NameObject; |
|
|
|
|
import com.fr.stable.ArrayUtils; |
|
|
|
|
import com.fr.stable.Nameable; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
@ -133,36 +134,28 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
|
|
|
|
|
return super.createUnrepeatedName(prefix); |
|
|
|
|
} |
|
|
|
|
String[] allDsNames = DesignTableDataManager.getAllDSNames(source); |
|
|
|
|
|
|
|
|
|
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
|
|
|
|
|
int count = 1; |
|
|
|
|
while (isDsNameRepeated(prefix + count, allDsNames)) { |
|
|
|
|
count++; |
|
|
|
|
} |
|
|
|
|
return prefix + count; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private boolean isDsNameRepeated(String name, String[] allDsNames) { |
|
|
|
|
DefaultListModel model = this.getModel(); |
|
|
|
|
Nameable[] all = new Nameable[model.getSize()]; |
|
|
|
|
for (int i = 0; i < model.size(); i++) { |
|
|
|
|
all[i] = ((ListModelElement) model.get(i)).wrapper; |
|
|
|
|
} |
|
|
|
|
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
|
|
|
|
|
int count = all.length + 1; |
|
|
|
|
while (true) { |
|
|
|
|
String name_test = prefix + count; |
|
|
|
|
boolean repeated = false; |
|
|
|
|
for (int i = 0, len = model.size(); i < len; i++) { |
|
|
|
|
Nameable nameable = all[i]; |
|
|
|
|
if (ComparatorUtils.equals(nameable.getName(), name_test)) { |
|
|
|
|
repeated = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (String dsname : allDsNames) { |
|
|
|
|
if (ComparatorUtils.equals(dsname, name_test)) { |
|
|
|
|
repeated = true; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
for (int i = 0, len = model.size(); i < len; i++) { |
|
|
|
|
Nameable nameable = all[i]; |
|
|
|
|
if (ComparatorUtils.equals(nameable.getName(), name)) { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!repeated) { |
|
|
|
|
return name_test; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
count++; |
|
|
|
|
} |
|
|
|
|
return ArrayUtils.contains(allDsNames, name); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|