From 5e1308a268047bbd1445c9f2e39b8bed57588271 Mon Sep 17 00:00:00 2001 From: Yyming Date: Fri, 16 Oct 2020 17:08:55 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-41333=20=E3=80=90=E5=86=92=E7=83=9F?= =?UTF-8?q?=E3=80=91=E5=85=A8=E5=B1=80=E5=8F=82=E6=95=B0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E5=8F=82=E6=95=B0p1p2=EF=BC=8C=E5=B0=86p2?= =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D=E4=B8=BAp1=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E4=BC=9A=E6=9C=89=E5=8F=82=E6=95=B0=E5=90=8D=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E7=9A=84=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../design/parameter/ParameterArrayPane.java | 130 +++++++++--------- 1 file changed, 63 insertions(+), 67 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java b/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java index d3efcae4a..6014db3f3 100644 --- a/designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java +++ b/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.NameableSelfCreator; 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.stable.Nameable; import com.fr.stable.StringUtils; @@ -18,79 +18,75 @@ import java.util.Arrays; import java.util.List; public class ParameterArrayPane extends JListControlPane { - /** - * Constructor. - */ - public ParameterArrayPane() { - super(); - this.addModNameActionListener(new ModNameActionListener() { - public void nameModed(int index, String oldName, String newName) { - populateSelectedValue(); - } + /** + * Constructor. + */ + /**/ + public ParameterArrayPane() { + super(); + this.addModNameActionListener((index, oldName, newName) -> populateSelectedValue()); + this.addEditingListener(new PropertyChangeAdapter() { + public void propertyChange() { + Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); + String[] allListNames = nameableList.getAllNames(); + allListNames[editingIndex] = StringUtils.EMPTY; + String tempName = getEditingName(); + if (StringUtils.isEmpty(tempName)) { + nameableList.stopEditing(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); + setIllegalIndex(editingIndex); + return; + } + if (!ComparatorUtils.equals(tempName, selectedName) + && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { + nameableList.stopEditing(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), + Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name")); + setIllegalIndex(editingIndex); + } + } + }); + } - }); - this.addEditingListener(new PropertyChangeAdapter() { - public void propertyChange() { - Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); - String[] allListNames = nameableList.getAllNames(); - allListNames[nameableList.getSelectedIndex()] = StringUtils.EMPTY; - String tempName = getEditingName(); - if (StringUtils.isEmpty(tempName)) { - nameableList.stopEditing(); - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Empty_Parameter_Name")); - setIllegalIndex(editingIndex); - return; - } - if (!ComparatorUtils.equals(tempName, selectedName) - && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { - nameableList.stopEditing(); - FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(ParameterArrayPane.this), - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name")); - setIllegalIndex(editingIndex); - } - } - }); - } + @Override + protected String title4PopupWindow() { + return Toolkit.i18nText("Fine-Design_Basic_Engine_Schedule_Template_Parameter"); + } - @Override - protected String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Schedule_Template_Parameter"); - } - - /** - * 创建模板参数设置组件 - * - * @return 模板参数设置组件 - */ - public NameableCreator[] createNameableCreators() { - return new NameableCreator[]{ - new NameableSelfCreator(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) { - public Parameter createNameable(UnrepeatedNameHelper helper) { - // 返回参数设置面板. - return new Parameter(helper.createUnrepeatedName("p")); - } + /** + * 创建模板参数设置组件 + * + * @return 模板参数设置组件 + */ + public NameableCreator[] createNameableCreators() { + return new NameableCreator[]{ + new NameableSelfCreator(Toolkit.i18nText("Fine-Design_Basic_Engine_Parameter_Name"), Parameter.class, ParameterPane.class) { + public Parameter createNameable(UnrepeatedNameHelper helper) { + // 返回参数设置面板. + return new Parameter(helper.createUnrepeatedName("p")); + } - @Override - public String createTooltip() { - return null; - } - } - }; - } + @Override + public String createTooltip() { + return null; + } + } + }; + } - /** - * 更新参数 + /** + * 更新参数 * * @return 更新后的参数 - */ - public Parameter[] updateParameters() { - // Nameable[]居然不能强转成Parameter[],一定要这么写... - Nameable[] res = this.update(); - Parameter[] res_array = new Parameter[res.length]; - java.util.Arrays.asList(res).toArray(res_array); + */ + public Parameter[] updateParameters() { + // Nameable[]居然不能强转成Parameter[],一定要这么写... + Nameable[] res = this.update(); + Parameter[] res_array = new Parameter[res.length]; + java.util.Arrays.asList(res).toArray(res_array); - return res_array; - } + return res_array; + } }