|
|
@ -7,6 +7,7 @@ import com.fr.data.impl.storeproc.StoreProcedure; |
|
|
|
import com.fr.design.data.BasicTableDataUtils; |
|
|
|
import com.fr.design.data.BasicTableDataUtils; |
|
|
|
import com.fr.design.data.DesignTableDataManager; |
|
|
|
import com.fr.design.data.DesignTableDataManager; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
import com.fr.design.dialog.FineJOptionPane; |
|
|
|
|
|
|
|
import com.fr.design.gui.NameInspector; |
|
|
|
import com.fr.design.gui.controlpane.JListControlPane; |
|
|
|
import com.fr.design.gui.controlpane.JListControlPane; |
|
|
|
import com.fr.design.gui.controlpane.NameableCreator; |
|
|
|
import com.fr.design.gui.controlpane.NameableCreator; |
|
|
|
import com.fr.design.gui.ilist.ListModelElement; |
|
|
|
import com.fr.design.gui.ilist.ListModelElement; |
|
|
@ -34,7 +35,7 @@ import java.util.Map; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public class TableDataPaneListPane extends JListControlPane implements TableDataPaneController { |
|
|
|
public class TableDataPaneListPane extends JListControlPane implements TableDataPaneController { |
|
|
|
private boolean isNamePermitted = true; |
|
|
|
private boolean isNamePermitted = true; |
|
|
|
private Map<String, String> dsNameChangedMap = new HashMap<String, String>(); |
|
|
|
private Map<String, String> dsNameChangedMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
public TableDataPaneListPane() { |
|
|
|
public TableDataPaneListPane() { |
|
|
|
super(); |
|
|
|
super(); |
|
|
@ -43,11 +44,16 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void propertyChange() { |
|
|
|
public void propertyChange() { |
|
|
|
isNamePermitted = true; |
|
|
|
isNamePermitted = true; |
|
|
|
|
|
|
|
String tempName = getEditingName(); |
|
|
|
|
|
|
|
if (ComparatorUtils.equals(tempName, selectedName)) { |
|
|
|
|
|
|
|
//说明双击之后又取消了,啥也不用做
|
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
TableDataSource source = DesignTableDataManager.getEditingTableDataSource(); |
|
|
|
TableDataSource source = DesignTableDataManager.getEditingTableDataSource(); |
|
|
|
String[] allDSNames = DesignTableDataManager.getAllDSNames(source); |
|
|
|
String[] allDSNames = DesignTableDataManager.getAllDSNames(source); |
|
|
|
String[] allListNames = nameableList.getAllNames(); |
|
|
|
String[] allListNames = nameableList.getAllNames(); |
|
|
|
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; |
|
|
|
allListNames[editingIndex] = StringUtils.EMPTY; |
|
|
|
String tempName = getEditingName(); |
|
|
|
|
|
|
|
Object editingType = getEditingType(); |
|
|
|
Object editingType = getEditingType(); |
|
|
|
|
|
|
|
|
|
|
|
if (!BasicTableDataUtils.checkName(tempName)) { |
|
|
|
if (!BasicTableDataUtils.checkName(tempName)) { |
|
|
@ -61,15 +67,14 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
isNamePermitted = false; |
|
|
|
isNamePermitted = false; |
|
|
|
nameableList.stopEditing(); |
|
|
|
nameableList.stopEditing(); |
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), |
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), |
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"), |
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"), |
|
|
|
Toolkit.i18nText("Fine-Design_Report_Alert"), |
|
|
|
Toolkit.i18nText("Fine-Design_Report_Alert"), |
|
|
|
JOptionPane.WARNING_MESSAGE); |
|
|
|
JOptionPane.WARNING_MESSAGE); |
|
|
|
setIllegalIndex(editingIndex); |
|
|
|
setIllegalIndex(editingIndex); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
boolean isRepeated = isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName); |
|
|
|
if (!ComparatorUtils.equals(tempName, selectedName) |
|
|
|
if (isRepeated) { |
|
|
|
&& isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) { |
|
|
|
|
|
|
|
isNamePermitted = false; |
|
|
|
isNamePermitted = false; |
|
|
|
nameableList.stopEditing(); |
|
|
|
nameableList.stopEditing(); |
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName)); |
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName)); |
|
|
@ -81,11 +86,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
setIllegalIndex(editingIndex); |
|
|
|
setIllegalIndex(editingIndex); |
|
|
|
} |
|
|
|
} |
|
|
|
if (nameableList.getSelectedValue() instanceof ListModelElement) { |
|
|
|
if (nameableList.getSelectedValue() instanceof ListModelElement) { |
|
|
|
Nameable selected = ((ListModelElement) nameableList.getSelectedValue()).wrapper; |
|
|
|
rename(selectedName, isRepeated ? NameInspector.ILLEGAL_NAME_HOLDER : tempName); |
|
|
|
if (!ComparatorUtils.equals(tempName, selected.getName()) && !isNameRepeated(new List[]{Arrays.asList(allDSNames), Arrays.asList(allListNames)}, tempName)) { |
|
|
|
|
|
|
|
rename(selected.getName(), tempName); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -93,6 +94,13 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void rename(String oldName, String newName) { |
|
|
|
public void rename(String oldName, String newName) { |
|
|
|
|
|
|
|
//如果a改成了b,b又被改成了c,就认为是a改成了c
|
|
|
|
|
|
|
|
for (Map.Entry<String, String> entry : dsNameChangedMap.entrySet()) { |
|
|
|
|
|
|
|
if (StringUtils.equals(oldName, entry.getValue())) { |
|
|
|
|
|
|
|
oldName = entry.getKey(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dsNameChangedMap.put(oldName, newName); |
|
|
|
dsNameChangedMap.put(oldName, newName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -148,7 +156,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
String[] allDsNames = DesignTableDataManager.getAllDSNames(source); |
|
|
|
String[] allDsNames = DesignTableDataManager.getAllDSNames(source); |
|
|
|
|
|
|
|
|
|
|
|
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
|
|
|
|
// richer:生成的名字从1开始. kunsnat: 添加属性从0开始.
|
|
|
|
int count = 1; |
|
|
|
int count = 1; |
|
|
|
while (isDsNameRepeated(prefix + count, allDsNames)) { |
|
|
|
while (isDsNameRepeated(prefix + count, allDsNames)) { |
|
|
|
count++; |
|
|
|
count++; |
|
|
|
} |
|
|
|
} |
|
|
@ -192,7 +200,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); |
|
|
|
populate(nameObjectList.toArray(new NameObject[0])); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -209,10 +217,10 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
} |
|
|
|
} |
|
|
|
while (procedurenameIt.hasNext()) { |
|
|
|
while (procedurenameIt.hasNext()) { |
|
|
|
String name = procedurenameIt.next(); |
|
|
|
String name = procedurenameIt.next(); |
|
|
|
nameObjectList.add(new NameObject(name, ProcedureConfig.getInstance().getProcedure(name))); |
|
|
|
nameObjectList.add(new NameObject(name, ProcedureConfig.getInstance().getProcedure(name))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); |
|
|
|
populate(nameObjectList.toArray(new NameObject[0])); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -220,7 +228,7 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
tableDataConfig.removeAllTableData(); |
|
|
|
tableDataConfig.removeAllTableData(); |
|
|
|
ProcedureConfig.getInstance().removeAllProcedure(); |
|
|
|
ProcedureConfig.getInstance().removeAllProcedure(); |
|
|
|
Nameable[] tableDataArray = this.update(); |
|
|
|
Nameable[] tableDataArray = this.update(); |
|
|
|
Map<String,TableData> tableDataMap = new LinkedHashMap<String,TableData>(); |
|
|
|
Map<String, TableData> tableDataMap = new LinkedHashMap<String, TableData>(); |
|
|
|
for (int i = 0; i < tableDataArray.length; i++) { |
|
|
|
for (int i = 0; i < tableDataArray.length; i++) { |
|
|
|
NameObject nameObject = (NameObject) tableDataArray[i]; |
|
|
|
NameObject nameObject = (NameObject) tableDataArray[i]; |
|
|
|
tableDataMap.put(nameObject.getName(), (TableData) nameObject.getObject()); |
|
|
|
tableDataMap.put(nameObject.getName(), (TableData) nameObject.getObject()); |
|
|
|