diff --git a/designer-realize/src/main/java/com/fr/design/widget/WidgetConfigPane.java b/designer-realize/src/main/java/com/fr/design/widget/WidgetConfigPane.java index 0a981a90fa..78fd57d5da 100644 --- a/designer-realize/src/main/java/com/fr/design/widget/WidgetConfigPane.java +++ b/designer-realize/src/main/java/com/fr/design/widget/WidgetConfigPane.java @@ -1,24 +1,55 @@ package com.fr.design.widget; +import com.fr.base.Parameter; +import com.fr.base.ParameterConfig; +import com.fr.design.dialog.FineJOptionPane; import com.fr.design.gui.controlpane.JListControlPane; import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.core.WidgetConstants; +import com.fr.design.i18n.Toolkit; import com.fr.form.ui.UserDefinedWidgetConfig; import com.fr.form.ui.WidgetConfig; import com.fr.form.ui.WidgetInfoConfig; +import com.fr.general.ComparatorUtils; import com.fr.general.NameObject; import com.fr.stable.Nameable; +import com.fr.stable.StringUtils; +import com.fr.stable.core.PropertyChangeAdapter; +import javax.swing.SwingUtilities; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; +import static javax.swing.JOptionPane.WARNING_MESSAGE; + /** * Widget配置面板 */ public class WidgetConfigPane extends JListControlPane { + public WidgetConfigPane() { + this.addEditingListener(new PropertyChangeAdapter() { + public void propertyChange() { + Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); + String[] allListNames = nameableList.getAllNames(); + allListNames[editingIndex] = StringUtils.EMPTY; + String tempName = getEditingName(); + if (!ComparatorUtils.equals(tempName, selectedName) + && isNameRepeated(new List[]{Arrays.asList(parameters), Arrays.asList(allListNames)}, tempName)) { + nameableList.stopEditing(); + FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(WidgetConfigPane.this), + Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), + Toolkit.i18nText("Fine-Design_Basic_Alert"), + WARNING_MESSAGE); + setIllegalIndex(editingIndex); + } + } + }); + } + /** * 创建用户自定义widget组件 *