|
|
@ -9,7 +9,6 @@ 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; |
|
|
@ -25,18 +24,18 @@ import com.fr.stable.ArrayUtils; |
|
|
|
import com.fr.stable.Nameable; |
|
|
|
import com.fr.stable.Nameable; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
import com.fr.stable.core.PropertyChangeAdapter; |
|
|
|
|
|
|
|
|
|
|
|
import com.fr.third.org.apache.commons.collections4.MapUtils; |
|
|
|
import com.fr.third.org.apache.commons.collections4.MapUtils; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import javax.swing.*; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.DefaultListModel; |
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
|
|
|
import javax.swing.SwingUtilities; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.Iterator; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* TableDataList Pane. |
|
|
|
* TableDataList Pane. |
|
|
@ -52,15 +51,12 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void propertyChange() { |
|
|
|
public void propertyChange() { |
|
|
|
isNamePermitted = true; |
|
|
|
isNamePermitted = true; |
|
|
|
String tempName = getEditingName(); |
|
|
|
if (!checkName()) { |
|
|
|
if (ComparatorUtils.equals(tempName, selectedName)) { |
|
|
|
isNamePermitted = false; |
|
|
|
//说明双击之后又取消了,啥也不用做
|
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
Set<String> allDSNames = DesignTableDataManager.getGlobalDataSet().keySet(); |
|
|
|
|
|
|
|
String[] allListNames = nameableList.getAllNames(); |
|
|
|
|
|
|
|
allListNames[editingIndex] = StringUtils.EMPTY; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String tempName = getEditingName(); |
|
|
|
Object editingType = getEditingType(); |
|
|
|
Object editingType = getEditingType(); |
|
|
|
|
|
|
|
|
|
|
|
if (!BasicTableDataUtils.checkName(tempName)) { |
|
|
|
if (!BasicTableDataUtils.checkName(tempName)) { |
|
|
@ -70,35 +66,36 @@ public class TableDataPaneListPane extends JListControlPane implements TableData |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(tempName)) { |
|
|
|
if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) { |
|
|
|
isNamePermitted = false; |
|
|
|
|
|
|
|
nameableList.stopEditing(); |
|
|
|
|
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), |
|
|
|
|
|
|
|
Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"), |
|
|
|
|
|
|
|
Toolkit.i18nText("Fine-Design_Report_Alert"), |
|
|
|
|
|
|
|
JOptionPane.WARNING_MESSAGE); |
|
|
|
|
|
|
|
setIllegalIndex(editingIndex); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
boolean isRepeated = isNameRepeated(new Collection[]{allDSNames, Arrays.asList(allListNames)}, tempName); |
|
|
|
|
|
|
|
if (isRepeated) { |
|
|
|
|
|
|
|
isNamePermitted = false; |
|
|
|
|
|
|
|
nameableList.stopEditing(); |
|
|
|
|
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", tempName)); |
|
|
|
|
|
|
|
setIllegalIndex(editingIndex); |
|
|
|
|
|
|
|
} else if (editingType instanceof StoreProcedure && isIncludeUnderline(tempName)) { |
|
|
|
|
|
|
|
isNamePermitted = false; |
|
|
|
isNamePermitted = false; |
|
|
|
nameableList.stopEditing(); |
|
|
|
nameableList.stopEditing(); |
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips")); |
|
|
|
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(TableDataPaneListPane.this), Toolkit.i18nText("Fine-Design_Basic_Stored_Procedure_Name_Tips")); |
|
|
|
setIllegalIndex(editingIndex); |
|
|
|
setIllegalIndex(editingIndex); |
|
|
|
|
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (nameableList.getSelectedValue() instanceof ListModelElement) { |
|
|
|
if (nameableList.getSelectedValue() instanceof ListModelElement) { |
|
|
|
rename(selectedName, isRepeated ? NameInspector.ILLEGAL_NAME_HOLDER : tempName); |
|
|
|
rename(selectedName, tempName); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String getEmptyNameTip() { |
|
|
|
|
|
|
|
return Toolkit.i18nText("Fine-Design_Basic_Table_Data_Empty_Name_Tips"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public String getDuplicatedNameTip() { |
|
|
|
|
|
|
|
return Toolkit.i18nText("Fine-Design_Basic_Table_Data_Duplicate_Name_Tips", getEditingName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Collection getExtraItemsToCheckNameRepeat() { |
|
|
|
|
|
|
|
return DesignTableDataManager.getGlobalDataSet().keySet(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void rename(String oldName, String newName) { |
|
|
|
public void rename(String oldName, String newName) { |
|
|
|
//如果a改成了b,b又被改成了c,就认为是a改成了c
|
|
|
|
//如果a改成了b,b又被改成了c,就认为是a改成了c
|
|
|
|