Browse Source

REPORT-39772 提示控件/组件名称不能为空

feature/big-screen
pengda 4 years ago
parent
commit
161e1b7cab
  1. 11
      designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java

11
designer-form/src/main/java/com/fr/design/designer/creator/CRPropertyDescriptorPane.java

@ -139,7 +139,7 @@ public class CRPropertyDescriptorPane {
try {
Object value = propertyEditor.getValue();
Method m = crPropertyDescriptor.getWriteMethod();
if (ComparatorUtils.equals(m.getName(), "setWidgetName") && value != null) {
if (ComparatorUtils.equals(m.getName(), "setWidgetName")) {
if (!isWidgetNameValid(value, widget)) {
value = widget.getWidgetName();
}
@ -154,8 +154,13 @@ public class CRPropertyDescriptorPane {
/**
* 设置控件名之前校验一下不能为空不能重名
*/
public boolean isWidgetNameValid(Object value, Widget widget) {
String toSetWidgetName = value.toString();
private boolean isWidgetNameValid(Object value, Widget widget) {
String toSetWidgetName;
if (value != null) {
toSetWidgetName = value.toString();
} else {
return false;
}
String currentWidgetName = widget.getWidgetName();
boolean exist = designer.getTarget().isNameExist(toSetWidgetName) && !ComparatorUtils.equals(toSetWidgetName, currentWidgetName);
if (toSetWidgetName.isEmpty()) {

Loading…
Cancel
Save