Browse Source

Merge branch 'release/10.0' of https://code.fineres.com/scm/~qinghui.liu/design into release/10.0

feature/big-screen
Qinghui.Liu 4 years ago
parent
commit
a5f532187b
  1. 14
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java
  2. 7
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  3. 2
      designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java

14
designer-base/src/main/java/com/fr/design/data/datapane/TableDataPaneListPane.java

@ -24,11 +24,13 @@ import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* TableDataList Pane.
@ -49,8 +51,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
//说明双击之后又取消了,啥也不用做
return;
}
TableDataSource source = DesignTableDataManager.getEditingTableDataSource();
String[] allDSNames = DesignTableDataManager.getAllDSNames(source);
Set<String> allDSNames = DesignTableDataManager.getGlobalDataSet().keySet();
String[] allListNames = nameableList.getAllNames();
allListNames[editingIndex] = StringUtils.EMPTY;
@ -73,7 +74,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
setIllegalIndex(editingIndex);
return;
}
boolean isRepeated = isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName);
boolean isRepeated = isNameRepeated(new Collection[]{allDSNames, Arrays.asList(allListNames)}, tempName);
if (isRepeated) {
isNamePermitted = false;
nameableList.stopEditing();
@ -98,11 +99,16 @@ public class TableDataPaneListPane extends JListControlPane implements TableData
for (Map.Entry<String, String> entry : dsNameChangedMap.entrySet()) {
if (StringUtils.equals(oldName, entry.getValue())) {
oldName = entry.getKey();
break;
}
}
if (StringUtils.equals(oldName, newName)) {
//a -> b;b -> a,说明没改
dsNameChangedMap.remove(oldName);
} else {
dsNameChangedMap.put(oldName, newName);
}
}
/**
* 名字是否允许

7
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -27,6 +27,7 @@ import java.awt.Component;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Collection;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List";
@ -190,9 +191,9 @@ public abstract class JListControlPane extends JControlPane implements ListContr
return getHelper().getSelectedName();
}
protected boolean isNameRepeated(java.util.List[] list, String name) {
for (int i = 0; i < list.length; i++) {
if (list[i].contains(name)) {
protected boolean isNameRepeated(Collection[] collections, String name) {
for (int i = 0; i < collections.length; i++) {
if (collections[i].contains(name)) {
isNameRepeated = true;
return true;
}

2
designer-base/src/test/java/com/fr/design/data/datapane/TableDataPaneListPaneTest.java

@ -20,5 +20,7 @@ public class TableDataPaneListPaneTest {
listPane.rename("222", "333");
Map<String, String> dsNameChangedMap = listPane.getDsNameChangedMap();
assertEquals(1, dsNameChangedMap.size());
listPane.rename("333","111");
assertEquals(0, dsNameChangedMap.size());
}
}
Loading…
Cancel
Save