Browse Source

REPORT-58584

bugfix/11.0
方磊 3 years ago
parent
commit
91523213fd
  1. 33
      designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java
  2. 24
      designer-base/src/main/java/com/fr/design/parameter/ParameterArrayPane.java
  3. 24
      designer-realize/src/main/java/com/fr/design/widget/WidgetConfigPane.java

33
designer-base/src/main/java/com/fr/design/gui/controlpane/JListControlPane.java

@ -1,10 +1,14 @@
package com.fr.design.gui.controlpane; package com.fr.design.gui.controlpane;
import com.fr.base.Parameter;
import com.fr.base.ParameterConfig;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.FineJOptionPane;
import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.design.gui.ilist.JNameEdList; import com.fr.design.gui.ilist.JNameEdList;
import com.fr.design.gui.ilist.ListModelElement; import com.fr.design.gui.ilist.ListModelElement;
import com.fr.design.gui.ilist.ModNameActionListener; import com.fr.design.gui.ilist.ModNameActionListener;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.form.event.Listener; import com.fr.form.event.Listener;
import com.fr.general.ComparatorUtils; import com.fr.general.ComparatorUtils;
@ -12,6 +16,7 @@ import com.fr.general.IOUtils;
import com.fr.invoke.Reflect; import com.fr.invoke.Reflect;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
@ -23,12 +28,16 @@ import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Component; import java.awt.Component;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseListener; import java.awt.event.MouseListener;
import java.util.List;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider { public abstract class JListControlPane extends JControlPane implements ListControlPaneProvider {
private static final String LIST_NAME = "JControl_List"; private static final String LIST_NAME = "JControl_List";
@ -424,4 +433,28 @@ public abstract class JListControlPane extends JControlPane implements ListContr
} }
public void showTipWithIllegalName(String tip) {
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(JListControlPane.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(JListControlPane.this),
tip,
Toolkit.i18nText("Fine-Design_Basic_Alert"),
WARNING_MESSAGE);
setIllegalIndex(editingIndex);
}
}
} }

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

@ -1,21 +1,15 @@
package com.fr.design.parameter; package com.fr.design.parameter;
import com.fr.base.Parameter; 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.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.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.general.ComparatorUtils;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
public class ParameterArrayPane extends JListControlPane { public class ParameterArrayPane extends JListControlPane {
@ -29,23 +23,7 @@ public class ParameterArrayPane extends JListControlPane {
this.addModNameActionListener((index, oldName, newName) -> populateSelectedValue()); this.addModNameActionListener((index, oldName, newName) -> populateSelectedValue());
this.addEditingListener(new PropertyChangeAdapter() { this.addEditingListener(new PropertyChangeAdapter() {
public void propertyChange() { public void propertyChange() {
Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); showTipWithIllegalName(Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name"));
String[] allListNames = nameableList.getAllNames();
allListNames[editingIndex] = 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),
Toolkit.i18nText("Fine-Design_Basic_Duplicate_Parameter_Name"));
setIllegalIndex(editingIndex);
}
} }
}); });
} }

24
designer-realize/src/main/java/com/fr/design/widget/WidgetConfigPane.java

@ -1,8 +1,5 @@
package com.fr.design.widget; 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.JListControlPane;
import com.fr.design.gui.controlpane.NameObjectCreator; import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator; import com.fr.design.gui.controlpane.NameableCreator;
@ -11,41 +8,24 @@ import com.fr.design.i18n.Toolkit;
import com.fr.form.ui.UserDefinedWidgetConfig; import com.fr.form.ui.UserDefinedWidgetConfig;
import com.fr.form.ui.WidgetConfig; import com.fr.form.ui.WidgetConfig;
import com.fr.form.ui.WidgetInfoConfig; import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.ComparatorUtils;
import com.fr.general.NameObject; import com.fr.general.NameObject;
import com.fr.stable.Nameable; import com.fr.stable.Nameable;
import com.fr.stable.StringUtils;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
import javax.swing.SwingUtilities;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import static javax.swing.JOptionPane.WARNING_MESSAGE;
/** /**
* Widget配置面板 * Widget配置面板
*/ */
public class WidgetConfigPane extends JListControlPane { public class WidgetConfigPane extends JListControlPane {
public WidgetConfigPane() { public WidgetConfigPane() {
super();
this.addEditingListener(new PropertyChangeAdapter() { this.addEditingListener(new PropertyChangeAdapter() {
public void propertyChange() { public void propertyChange() {
Parameter[] parameters = ParameterConfig.getInstance().getGlobalParameters(); showTipWithIllegalName(Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"));
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);
}
} }
}); });
} }

Loading…
Cancel
Save