Browse Source

REPORT-58584 FR11-二轮回归-设计器菜单栏-服务器-控件管理-预定义控件重名时没有提示

bugfix/11.0
方磊 3 years ago
parent
commit
65a21b3de2
  1. 31
      designer-realize/src/main/java/com/fr/design/widget/WidgetConfigPane.java

31
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组件
*

Loading…
Cancel
Save