Browse Source

REPORT-41333

【冒烟】全局参数添加两个参数p1p2,将p2重命名为p1,不会有参数名重复的提醒
final/10.0
Yyming 4 years ago
parent
commit
5e1308a268
  1. 20
      designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java

20
designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java

@ -7,7 +7,7 @@ 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.controlpane.NameableSelfCreator; import com.fr.design.gui.controlpane.NameableSelfCreator;
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; import com.fr.design.gui.controlpane.UnrepeatedNameHelper;
import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
@ -21,23 +21,19 @@ public class ParameterArrayPane extends JListControlPane {
/** /**
* Constructor. * Constructor.
*/ */
/**/
public ParameterArrayPane() { public ParameterArrayPane() {
super(); super();
this.addModNameActionListener(new ModNameActionListener() { this.addModNameActionListener((index, oldName, newName) -> populateSelectedValue());
public void nameModed(int index, String oldName, String newName) {
populateSelectedValue();
}
});
this.addEditingListener(new PropertyChangeAdapter() { this.addEditingListener(new PropertyChangeAdapter() {
public void propertyChange() { public void propertyChange() {
Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters();
String[] allListNames = nameableList.getAllNames(); String[] allListNames = nameableList.getAllNames();
allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; allListNames[editingIndex] = StringUtils.EMPTY;
String tempName = getEditingName(); String tempName = getEditingName();
if (StringUtils.isEmpty(tempName)) { if (StringUtils.isEmpty(tempName)) {
nameableList.stopEditing(); nameableList.stopEditing();
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name"));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
return; return;
} }
@ -45,7 +41,7 @@ public class ParameterArrayPane extends JListControlPane {
&& isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) {
nameableList.stopEditing(); nameableList.stopEditing();
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this),
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name")); Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name"));
setIllegalIndex(editingIndex); setIllegalIndex(editingIndex);
} }
} }
@ -55,7 +51,7 @@ public class ParameterArrayPane extends JListControlPane {
@Override @Override
protected String title4PopupWindow() { protected String title4PopupWindow() {
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Schedule_Template_Parameter"); return Toolkit.i18nText("Fine-Design_Basic_Engine_Schedule_Template_Parameter");
} }
/** /**
@ -65,7 +61,7 @@ public class ParameterArrayPane extends JListControlPane {
*/ */
public NameableCreator[] createNameableCreators() { public NameableCreator[] createNameableCreators() {
return new NameableCreator[]{ return new NameableCreator[]{
new NameableSelfCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) { new NameableSelfCreator(Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) {
public Parameter createNameable(UnrepeatedNameHelper helper) { public Parameter createNameable(UnrepeatedNameHelper helper) {
// 返回参数设置面板. // 返回参数设置面板.
return new Parameter(helper.createUnrepeatedName("p")); return new Parameter(helper.createUnrepeatedName("p"));

Loading…
Cancel
Save