|
|
@ -139,15 +139,9 @@ public class CRPropertyDescriptorPane { |
|
|
|
try { |
|
|
|
try { |
|
|
|
Object value = propertyEditor.getValue(); |
|
|
|
Object value = propertyEditor.getValue(); |
|
|
|
Method m = crPropertyDescriptor.getWriteMethod(); |
|
|
|
Method m = crPropertyDescriptor.getWriteMethod(); |
|
|
|
if (ComparatorUtils.equals(m.getName(), "setWidgetName")) { |
|
|
|
if (ComparatorUtils.equals(m.getName(), "setWidgetName") && value != null) { |
|
|
|
String toSetWidgetName = value.toString(); |
|
|
|
if (!isWidgetNameValid(value, widget)) { |
|
|
|
String currentWidgetName = widget.getWidgetName(); |
|
|
|
value = widget.getWidgetName(); |
|
|
|
boolean exist = designer.getTarget().isNameExist(toSetWidgetName) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); |
|
|
|
|
|
|
|
if (toSetWidgetName.isEmpty()) { |
|
|
|
|
|
|
|
value = currentWidgetName; |
|
|
|
|
|
|
|
} else if (exist) { |
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
m.invoke(widget, value); |
|
|
|
m.invoke(widget, value); |
|
|
@ -157,4 +151,20 @@ public class CRPropertyDescriptorPane { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 设置控件名之前校验一下,不能为空,不能重名 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public boolean isWidgetNameValid(Object value, Widget widget) { |
|
|
|
|
|
|
|
String toSetWidgetName = value.toString(); |
|
|
|
|
|
|
|
String currentWidgetName = widget.getWidgetName(); |
|
|
|
|
|
|
|
boolean exist = designer.getTarget().isNameExist(toSetWidgetName) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName); |
|
|
|
|
|
|
|
if (toSetWidgetName.isEmpty()) { |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} else if (exist) { |
|
|
|
|
|
|
|
//控件重名,弹出提示
|
|
|
|
|
|
|
|
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Rename_Failure"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Joption_News"), JOptionPane.ERROR_MESSAGE, IOUtils.readIcon("com/fr/design/form/images/joption_failure.png")); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|