svn commit: r1170442 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1170442 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

jleroux@apache.org
Author: jleroux
Date: Wed Sep 14 06:18:26 2011
New Revision: 1170442

URL: http://svn.apache.org/viewvc?rev=1170442&view=rev
Log:
Continued refactoring (WIP...)
* UtilValidate.is(Not)Empty wherever possible
* Remove useless boiler plate code which makes things harder to read
 * if on one line w/out {}, it avoid future errors: you can't miss the block if you need to add a line
 * else on one line w/out {}, it avoid future errors: you can't miss the block if you need to add a line
 * no else when return in previous if
 The result is a much easier code to read. I'd recommend to use this style everywhere in OFBiz. Of course this suppose a screen with larger width than in 2000 years...

Modified:
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java?rev=1170442&r1=1170441&r2=1170442&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java Wed Sep 14 06:18:26 2011
@@ -165,9 +165,7 @@ public class ModelFormField {
 
         String positionStr = fieldElement.getAttribute("position");
         try {
-            if (UtilValidate.isNotEmpty(positionStr)) {
-                position = Integer.valueOf(positionStr);
-            }
+            if (UtilValidate.isNotEmpty(positionStr)) position = Integer.valueOf(positionStr);
         } catch (Exception e) {
             Debug.logError(
                 e,
@@ -179,167 +177,97 @@ public class ModelFormField {
         List<? extends Element> subElements = UtilXml.childElementList(fieldElement);
         for (Element subElement : subElements) {
             String subElementName = subElement.getTagName();
-            if (Debug.verboseOn())
-                Debug.logVerbose("Processing field " + this.name + " with type info tag " + subElementName, module);
+            if (Debug.verboseOn())  Debug.logVerbose("Processing field " + this.name + " with type info tag " + subElementName, module);
 
             if (UtilValidate.isEmpty(subElementName)) {
                 this.fieldInfo = null;
                 this.induceFieldInfo(null); //no defaultFieldType specified here, will default to edit
-            } else if ("display".equals(subElementName)) {
-                this.fieldInfo = new DisplayField(subElement, this);
-            } else if ("display-entity".equals(subElementName)) {
-                this.fieldInfo = new DisplayEntityField(subElement, this);
-            } else if ("hyperlink".equals(subElementName)) {
-                this.fieldInfo = new HyperlinkField(subElement, this);
-            } else if ("text".equals(subElementName)) {
-                this.fieldInfo = new TextField(subElement, this);
-            } else if ("textarea".equals(subElementName)) {
-                this.fieldInfo = new TextareaField(subElement, this);
-            } else if ("date-time".equals(subElementName)) {
-                this.fieldInfo = new DateTimeField(subElement, this);
-            } else if ("drop-down".equals(subElementName)) {
-                this.fieldInfo = new DropDownField(subElement, this);
-            } else if ("check".equals(subElementName)) {
-                this.fieldInfo = new CheckField(subElement, this);
-            } else if ("radio".equals(subElementName)) {
-                this.fieldInfo = new RadioField(subElement, this);
-            } else if ("submit".equals(subElementName)) {
-                this.fieldInfo = new SubmitField(subElement, this);
-            } else if ("reset".equals(subElementName)) {
-                this.fieldInfo = new ResetField(subElement, this);
-            } else if ("hidden".equals(subElementName)) {
-                this.fieldInfo = new HiddenField(subElement, this);
-            } else if ("ignored".equals(subElementName)) {
-                this.fieldInfo = new IgnoredField(subElement, this);
-            } else if ("text-find".equals(subElementName)) {
-                this.fieldInfo = new TextFindField(subElement, this);
-            } else if ("date-find".equals(subElementName)) {
-                this.fieldInfo = new DateFindField(subElement, this);
-            } else if ("range-find".equals(subElementName)) {
-                this.fieldInfo = new RangeFindField(subElement, this);
-            } else if ("lookup".equals(subElementName)) {
-                this.fieldInfo = new LookupField(subElement, this);
-            } else if ("file".equals(subElementName)) {
-                this.fieldInfo = new FileField(subElement, this);
-            } else if ("password".equals(subElementName)) {
-                this.fieldInfo = new PasswordField(subElement, this);
-            } else if ("image".equals(subElementName)) {
-                this.fieldInfo = new ImageField(subElement, this);
-            } else if ("container".equals(subElementName)) {
-                this.fieldInfo = new ContainerField(subElement, this);
-            } else if ("on-field-event-update-area".equals(subElementName)) {
-                addOnEventUpdateArea(new UpdateArea(subElement));
-            } else {
-                throw new IllegalArgumentException("The field sub-element with name " + subElementName + " is not supported");
-            }
+            } else if ("display".equals(subElementName)) this.fieldInfo = new DisplayField(subElement, this);
+            else if ("display-entity".equals(subElementName)) this.fieldInfo = new DisplayEntityField(subElement, this);
+            else if ("hyperlink".equals(subElementName)) this.fieldInfo = new HyperlinkField(subElement, this);
+            else if ("text".equals(subElementName)) this.fieldInfo = new TextField(subElement, this);
+            else if ("textarea".equals(subElementName)) this.fieldInfo = new TextareaField(subElement, this);
+            else if ("date-time".equals(subElementName)) this.fieldInfo = new DateTimeField(subElement, this);
+            else if ("drop-down".equals(subElementName)) this.fieldInfo = new DropDownField(subElement, this);
+            else if ("check".equals(subElementName)) this.fieldInfo = new CheckField(subElement, this);
+            else if ("radio".equals(subElementName)) this.fieldInfo = new RadioField(subElement, this);
+            else if ("submit".equals(subElementName)) this.fieldInfo = new SubmitField(subElement, this);
+            else if ("reset".equals(subElementName)) this.fieldInfo = new ResetField(subElement, this);
+            else if ("hidden".equals(subElementName)) this.fieldInfo = new HiddenField(subElement, this);
+            else if ("ignored".equals(subElementName)) this.fieldInfo = new IgnoredField(subElement, this);
+            else if ("text-find".equals(subElementName)) this.fieldInfo = new TextFindField(subElement, this);
+            else if ("date-find".equals(subElementName)) this.fieldInfo = new DateFindField(subElement, this);
+            else if ("range-find".equals(subElementName)) this.fieldInfo = new RangeFindField(subElement, this);
+            else if ("lookup".equals(subElementName)) this.fieldInfo = new LookupField(subElement, this);
+            else if ("file".equals(subElementName)) this.fieldInfo = new FileField(subElement, this);
+            else if ("password".equals(subElementName)) this.fieldInfo = new PasswordField(subElement, this);
+            else if ("image".equals(subElementName)) this.fieldInfo = new ImageField(subElement, this);
+            else if ("container".equals(subElementName)) this.fieldInfo = new ContainerField(subElement, this);
+            else if ("on-field-event-update-area".equals(subElementName)) addOnEventUpdateArea(new UpdateArea(subElement));
+            else throw new IllegalArgumentException("The field sub-element with name " + subElementName + " is not supported");
         }
     }
 
     public void addOnEventUpdateArea(UpdateArea updateArea) {
         // Event types are sorted as a convenience for the rendering classes
         Debug.logInfo(this.modelForm.getName() + ":" + this.name + " adding UpdateArea type " + updateArea.getEventType(), module);
-        if ("change".equals(updateArea.getEventType())) {
-            addOnChangeUpdateArea(updateArea);
-        } else if ("click".equals(updateArea.getEventType())) {
-            addOnClickUpdateArea(updateArea);
-        }
+        if ("change".equals(updateArea.getEventType()))  addOnChangeUpdateArea(updateArea);
+        else if ("click".equals(updateArea.getEventType())) addOnClickUpdateArea(updateArea);
     }
 
     protected void addOnChangeUpdateArea(UpdateArea updateArea) {
-        if (onChangeUpdateAreas == null) {
-            onChangeUpdateAreas = FastList.newInstance();
-        }
+        if (onChangeUpdateAreas == null) onChangeUpdateAreas = FastList.newInstance();        
         onChangeUpdateAreas.add(updateArea);
         Debug.logInfo(this.modelForm.getName() + ":" + this.name + " onChangeUpdateAreas size = " + onChangeUpdateAreas.size(), module);
     }
 
     protected void addOnClickUpdateArea(UpdateArea updateArea) {
-        if (onClickUpdateAreas == null) {
-            onClickUpdateAreas = FastList.newInstance();
-        }
+        if (onClickUpdateAreas == null) onClickUpdateAreas = FastList.newInstance();        
         onClickUpdateAreas.add(updateArea);
     }
 
     public void mergeOverrideModelFormField(ModelFormField overrideFormField) {
-        if (overrideFormField == null)
-            return;
+        if (overrideFormField == null) return;
+        
         // incorporate updates for values that are not empty in the overrideFormField
-        if (UtilValidate.isNotEmpty(overrideFormField.name))
-            this.name = overrideFormField.name;
-        if (overrideFormField.mapAcsr != null && !overrideFormField.mapAcsr.isEmpty()) {
-            //Debug.logInfo("overriding mapAcsr, old=" + (this.mapAcsr==null?"null":this.mapAcsr.getOriginalName()) + ", new=" + overrideFormField.mapAcsr.getOriginalName(), module);
-            this.mapAcsr = overrideFormField.mapAcsr;
-        }
-        if (UtilValidate.isNotEmpty(overrideFormField.entityName))
-            this.entityName = overrideFormField.entityName;
-        if (UtilValidate.isNotEmpty(overrideFormField.serviceName))
-            this.serviceName = overrideFormField.serviceName;
-        if (overrideFormField.entryAcsr != null && !overrideFormField.entryAcsr.isEmpty())
-            this.entryAcsr = overrideFormField.entryAcsr;
-        if (UtilValidate.isNotEmpty(overrideFormField.parameterName))
-            this.parameterName = overrideFormField.parameterName;
-        if (UtilValidate.isNotEmpty(overrideFormField.fieldName))
-            this.fieldName = overrideFormField.fieldName;
-        if (UtilValidate.isNotEmpty(overrideFormField.attributeName))
-            this.attributeName = overrideFormField.attributeName;
-        if (overrideFormField.title != null && !overrideFormField.title.isEmpty()) // title="" can be used to override the original value
-            this.title = overrideFormField.title;
-        if (overrideFormField.tooltip != null && !overrideFormField.tooltip.isEmpty())
-            this.tooltip = overrideFormField.tooltip;
-        if (overrideFormField.requiredField != null)
-            this.requiredField = overrideFormField.requiredField;
-        if (overrideFormField.sortField != null)
-            this.sortField = overrideFormField.sortField;
-        if (UtilValidate.isNotEmpty(overrideFormField.titleAreaStyle))
-            this.titleAreaStyle = overrideFormField.titleAreaStyle;
-        if (UtilValidate.isNotEmpty(overrideFormField.widgetAreaStyle))
-            this.widgetAreaStyle = overrideFormField.widgetAreaStyle;
-        if (UtilValidate.isNotEmpty(overrideFormField.titleStyle))
-            this.titleStyle = overrideFormField.titleStyle;
-        if (UtilValidate.isNotEmpty(overrideFormField.widgetStyle))
-            this.widgetStyle = overrideFormField.widgetStyle;
-        if (overrideFormField.position != null)
-            this.position = overrideFormField.position;
-        if (UtilValidate.isNotEmpty(overrideFormField.redWhen))
-            this.redWhen = overrideFormField.redWhen;
-        if (UtilValidate.isNotEmpty(overrideFormField.event))
-            this.event = overrideFormField.event;
-        if (overrideFormField.action != null && !overrideFormField.action.isEmpty())
-            this.action = overrideFormField.action;
-        if (overrideFormField.useWhen != null && !overrideFormField.useWhen.isEmpty())
-            this.useWhen = overrideFormField.useWhen;
-        if (overrideFormField.fieldInfo != null) {
-            this.setFieldInfo(overrideFormField.fieldInfo);
-        }
-        if (overrideFormField.fieldInfo != null) {
-            this.setHeaderLink(overrideFormField.headerLink);
-        }
-        if (UtilValidate.isNotEmpty(overrideFormField.idName)) {
-            this.idName = overrideFormField.idName;
-        }
-        if (overrideFormField.onChangeUpdateAreas != null) {
-            this.onChangeUpdateAreas = overrideFormField.onChangeUpdateAreas;
-        }
-        if (overrideFormField.onClickUpdateAreas != null) {
-            this.onClickUpdateAreas = overrideFormField.onClickUpdateAreas;
-        }
+        if (UtilValidate.isNotEmpty(overrideFormField.name)) this.name = overrideFormField.name;
+        if (UtilValidate.isNotEmpty(overrideFormField.mapAcsr)) this.mapAcsr = overrideFormField.mapAcsr; //Debug.logInfo("overriding mapAcsr, old=" + (this.mapAcsr==null?"null":this.mapAcsr.getOriginalName()) + ", new=" + overrideFormField.mapAcsr.getOriginalName(), module);
+        if (UtilValidate.isNotEmpty(overrideFormField.entityName)) this.entityName = overrideFormField.entityName;
+        if (UtilValidate.isNotEmpty(overrideFormField.serviceName)) this.serviceName = overrideFormField.serviceName;
+        if (UtilValidate.isNotEmpty(overrideFormField.entryAcsr)) this.entryAcsr = overrideFormField.entryAcsr;
+        if (UtilValidate.isNotEmpty(overrideFormField.parameterName)) this.parameterName = overrideFormField.parameterName;
+        if (UtilValidate.isNotEmpty(overrideFormField.fieldName)) this.fieldName = overrideFormField.fieldName;
+        if (UtilValidate.isNotEmpty(overrideFormField.attributeName)) this.attributeName = overrideFormField.attributeName;
+        if (UtilValidate.isNotEmpty(overrideFormField.title)) this.title = overrideFormField.title; // title="" can be used to override the original value
+        if (UtilValidate.isNotEmpty(overrideFormField.tooltip)) this.tooltip = overrideFormField.tooltip;
+        if (overrideFormField.requiredField != null) this.requiredField = overrideFormField.requiredField;
+        if (overrideFormField.sortField != null) this.sortField = overrideFormField.sortField;
+        if (UtilValidate.isNotEmpty(overrideFormField.titleAreaStyle)) this.titleAreaStyle = overrideFormField.titleAreaStyle;
+        if (UtilValidate.isNotEmpty(overrideFormField.widgetAreaStyle)) this.widgetAreaStyle = overrideFormField.widgetAreaStyle;
+        if (UtilValidate.isNotEmpty(overrideFormField.titleStyle)) this.titleStyle = overrideFormField.titleStyle;
+        if (UtilValidate.isNotEmpty(overrideFormField.widgetStyle)) this.widgetStyle = overrideFormField.widgetStyle;
+        if (overrideFormField.position != null) this.position = overrideFormField.position;
+        if (UtilValidate.isNotEmpty(overrideFormField.redWhen)) this.redWhen = overrideFormField.redWhen;
+        if (UtilValidate.isNotEmpty(overrideFormField.event)) this.event = overrideFormField.event;
+        if (UtilValidate.isNotEmpty(overrideFormField.action)) this.action = overrideFormField.action;
+        if (UtilValidate.isNotEmpty(overrideFormField.useWhen))this.useWhen = overrideFormField.useWhen;
+        if (overrideFormField.fieldInfo != null) this.setFieldInfo(overrideFormField.fieldInfo);
+        if (overrideFormField.headerLink != null) this.setHeaderLink(overrideFormField.headerLink);
+        if (UtilValidate.isNotEmpty(overrideFormField.idName)) this.idName = overrideFormField.idName;
+        if (overrideFormField.onChangeUpdateAreas != null) this.onChangeUpdateAreas = overrideFormField.onChangeUpdateAreas;
+        if (overrideFormField.onClickUpdateAreas != null) this.onClickUpdateAreas = overrideFormField.onClickUpdateAreas;
         this.encodeOutput = overrideFormField.encodeOutput;
     }
 
     public boolean induceFieldInfo(String defaultFieldType) {
-        if (this.induceFieldInfoFromEntityField(defaultFieldType)) {
-            return true;
-        }
-        if (this.induceFieldInfoFromServiceParam(defaultFieldType)) {
-            return true;
-        }
+        if (this.induceFieldInfoFromEntityField(defaultFieldType)) return true;
+        if (this.induceFieldInfoFromServiceParam(defaultFieldType)) return true;
         return false;
     }
 
     public boolean induceFieldInfoFromServiceParam(String defaultFieldType) {
-        if (UtilValidate.isEmpty(this.getServiceName()) || UtilValidate.isEmpty(this.getAttributeName())) {
-            return false;
-        }
+        if (UtilValidate.isEmpty(this.getServiceName()) || UtilValidate.isEmpty(this.getAttributeName()))  return false;
+
         DispatchContext dispatchContext = this.getModelForm().dispatchContext;
         try {
             ModelService modelService = dispatchContext.getModelService(this.getServiceName());
@@ -365,9 +293,7 @@ public class ModelFormField {
     }
 
     public boolean induceFieldInfoFromServiceParam(ModelService modelService, ModelParam modelParam, String defaultFieldType) {
-        if (modelService == null || modelParam == null) {
-            return false;
-        }
+        if (modelService == null || modelParam == null) return false;
 
         this.serviceName = modelService.name;
         this.attributeName = modelParam.name;
@@ -430,9 +356,8 @@ public class ModelFormField {
     }
 
     public boolean induceFieldInfoFromEntityField(String defaultFieldType) {
-        if (UtilValidate.isEmpty(this.getEntityName()) || UtilValidate.isEmpty(this.getFieldName())) {
-            return false;
-        }
+        if (UtilValidate.isEmpty(this.getEntityName()) || UtilValidate.isEmpty(this.getFieldName())) return false;
+        
         ModelReader entityModelReader = this.getModelForm().entityModelReader;
         try {
             ModelEntity modelEntity = entityModelReader.getModelEntity(this.getEntityName());
@@ -451,9 +376,7 @@ public class ModelFormField {
     }
 
     public boolean induceFieldInfoFromEntityField(ModelEntity modelEntity, ModelField modelField, String defaultFieldType) {
-        if (modelEntity == null || modelField == null) {
-            return false;
-        }
+        if (modelEntity == null || modelField == null) return false;
 
         this.entityName = modelEntity.getEntityName();
         this.fieldName = modelField.getName();
@@ -620,8 +543,7 @@ public class ModelFormField {
      * @param fieldInfo
      */
     public void setFieldInfo(FieldInfo fieldInfo) {
-        if (fieldInfo == null)
-            return;
+        if (fieldInfo == null)  return;
 
         // field info is a little different, check source for priority
         if (this.fieldInfo == null || (fieldInfo.getFieldSource() <= this.fieldInfo.getFieldSource())) {
@@ -638,27 +560,18 @@ public class ModelFormField {
      * @return returns the name of the Service Attribute
      */
     public String getAttributeName() {
-        if (UtilValidate.isNotEmpty(this.attributeName)) {
-            return this.attributeName;
-        } else {
-            return this.name;
-        }
+        if (UtilValidate.isNotEmpty(this.attributeName)) return this.attributeName;
+        return this.name;
     }
 
     public String getEntityName() {
-        if (UtilValidate.isNotEmpty(this.entityName)) {
-            return this.entityName;
-        } else {
-            return this.modelForm.getDefaultEntityName();
-        }
+        if (UtilValidate.isNotEmpty(this.entityName)) return this.entityName;
+        return this.modelForm.getDefaultEntityName();
     }
 
     public String getEntryName() {
-        if (this.entryAcsr != null && !this.entryAcsr.isEmpty()) {
-            return this.entryAcsr.getOriginalName();
-        } else {
-            return this.name;
-        }
+        if (UtilValidate.isNotEmpty(this.entryAcsr)) return this.entryAcsr.getOriginalName();
+        return this.name;
     }
 
     /**
@@ -713,7 +626,7 @@ public class ModelFormField {
                 dataMapIsContext = true;
             }
             Object retVal = null;
-            if (this.entryAcsr != null && !this.entryAcsr.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.entryAcsr)) {
                 //Debug.logInfo("Getting entry, using entryAcsr for field " + this.getName() + " of form " + this.modelForm.getName(), module);
                 if (dataMap instanceof GenericEntity) {
                     GenericEntity genEnt = (GenericEntity) dataMap;
@@ -735,11 +648,8 @@ public class ModelFormField {
             if (dataMapIsContext && retVal == null && !Boolean.FALSE.equals(useRequestParameters)) {
                 Map<String, ? extends Object> parameters = UtilGenerics.checkMap(context.get("parameters"));
                 if (parameters != null) {
-                    if (this.entryAcsr != null && !this.entryAcsr.isEmpty()) {
-                        retVal = this.entryAcsr.get(parameters);
-                    } else {
-                        retVal = parameters.get(this.name);
-                    }
+                    if (UtilValidate.isNotEmpty(this.entryAcsr))  retVal = this.entryAcsr.get(parameters);
+                    else retVal = parameters.get(this.name);
                 }
             }
 
@@ -771,29 +681,24 @@ public class ModelFormField {
 
         if (this.getEncodeOutput() && returnValue != null) {
             StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
-            if (simpleEncoder != null) {
-                returnValue = simpleEncoder.encode(returnValue);
-            }
+            if (simpleEncoder != null)  returnValue = simpleEncoder.encode(returnValue);
         }
         return returnValue;
     }
 
     public Map<String, ? extends Object> getMap(Map<String, ? extends Object> context) {
-        if (this.mapAcsr == null || this.mapAcsr.isEmpty()) {
-            //Debug.logInfo("Getting Map from default of the form because of no mapAcsr for field " + this.getName(), module);
-            return this.modelForm.getDefaultMap(context);
-        } else {
-            // Debug.logInfo("Getting Map from mapAcsr for field " + this.getName() + ", map-name=" + mapAcsr.getOriginalName() + ", context type=" + context.getClass().toString(), module);
-            Map<String, ? extends Object> result = null;
-            try {
-                result = mapAcsr.get(context);
-            } catch (java.lang.ClassCastException e) {
-                String errMsg = "Got an unexpected object type (not a Map) for map-name [" + mapAcsr.getOriginalName() + "] in field with name [" + this.getName() + "]: " + e.getMessage();
-                Debug.logError(errMsg, module);
-                throw new ClassCastException(errMsg);
-            }
-            return result;
+        if (UtilValidate.isEmpty(this.mapAcsr)) return this.modelForm.getDefaultMap(context); //Debug.logInfo("Getting Map from default of the form because of no mapAcsr for field " + this.getName(), module);
+            
+        // Debug.logInfo("Getting Map from mapAcsr for field " + this.getName() + ", map-name=" + mapAcsr.getOriginalName() + ", context type=" + context.getClass().toString(), module);
+        Map<String, ? extends Object> result = null;
+        try {
+            result = mapAcsr.get(context);
+        } catch (java.lang.ClassCastException e) {
+            String errMsg = "Got an unexpected object type (not a Map) for map-name [" + mapAcsr.getOriginalName() + "] in field with name [" + this.getName() + "]: " + e.getMessage();
+            Debug.logError(errMsg, module);
+            throw new ClassCastException(errMsg);
         }
+        return result;
     }
 
     /**
@@ -804,11 +709,8 @@ public class ModelFormField {
      * @return return the name of the Entity Field that corresponds with this field
      */
     public String getFieldName() {
-        if (UtilValidate.isNotEmpty(this.fieldName)) {
-            return this.fieldName;
-        } else {
+        if (UtilValidate.isNotEmpty(this.fieldName)) return this.fieldName;
             return this.name;
-        }
     }
 
     /** Get the name of the Map in the form context that contains the entry,
@@ -820,11 +722,8 @@ public class ModelFormField {
      * @return returns the name of the Map in the form context that contains the entry
      */
     public String getMapName() {
-        if (this.mapAcsr != null && !this.mapAcsr.isEmpty()) {
-            return this.mapAcsr.getOriginalName();
-        } else {
-            return this.modelForm.getDefaultMapName();
-        }
+        if (UtilValidate.isNotEmpty(this.mapAcsr)) return this.mapAcsr.getOriginalName();
+        return this.modelForm.getDefaultMapName();
     }
 
     public String getName() {
@@ -839,11 +738,8 @@ public class ModelFormField {
      */
     public String getParameterName(Map<String, ? extends Object> context) {
         String baseName;
-        if (UtilValidate.isNotEmpty(this.parameterName)) {
-            baseName = this.parameterName;
-        } else {
-            baseName = this.name;
-        }
+        if (UtilValidate.isNotEmpty(this.parameterName)) baseName = this.parameterName;
+        else baseName = this.name;
 
         Integer itemIndex = (Integer) context.get("itemIndex");
         if (itemIndex != null && "multi".equals(this.modelForm.getType())) {
@@ -854,11 +750,8 @@ public class ModelFormField {
     }
 
     public int getPosition() {
-        if (this.position == null) {
-            return 1;
-        } else {
-            return position.intValue();
-        }
+        if (this.position == null) return 1;
+        return position.intValue();
     }
 
     public String getRedWhen() {
@@ -871,11 +764,8 @@ public class ModelFormField {
     }
 
     public String getAction(Map<String, ? extends Object> context) {
-        if (this.action != null && !this.action.isEmpty()) {
-            return action.expandString(context);
-        } else {
-            return null;
-        }
+        if (UtilValidate.isNotEmpty(this.action)) return action.expandString(context);
+        return null;
     }
 
     /**
@@ -892,9 +782,7 @@ public class ModelFormField {
 
         String redCondition = this.redWhen;
 
-        if ("never".equals(redCondition)) {
-            return false;
-        }
+        if ("never".equals(redCondition)) return false;
 
         // for performance resaons we check this first, most fields will be eliminated here and the valueOfs will not be necessary
         if (UtilValidate.isEmpty(redCondition) || "by-name".equals(redCondition)) {
@@ -994,113 +882,84 @@ public class ModelFormField {
     }
 
     public String getServiceName() {
-        if (UtilValidate.isNotEmpty(this.serviceName)) {
-            return this.serviceName;
-        } else {
-            return this.modelForm.getDefaultServiceName();
-        }
+        if (UtilValidate.isNotEmpty(this.serviceName)) return this.serviceName;
+        return this.modelForm.getDefaultServiceName();
     }
 
     public String getTitle(Map<String, Object> context) {
-        if (this.title != null && !this.title.isEmpty()) {
-            return title.expandString(context);
-        } else {
-            // create a title from the name of this field; expecting a Java method/field style name, ie productName or productCategoryId
-            if (UtilValidate.isEmpty(this.name)) {
-                // this should never happen, ie name is required
-                return "";
-            }
+        if (UtilValidate.isNotEmpty(this.title)) return title.expandString(context);
+        
+        // create a title from the name of this field; expecting a Java method/field style name, ie productName or productCategoryId
+        if (UtilValidate.isEmpty(this.name)) return ""; // this should never happen, ie name is required
 
-            // search for a localized label for the field's name
-            Map<String, String> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap"));
-            if (uiLabelMap != null) {
-                String titleFieldName = "FormFieldTitle_" + this.name;
-                String localizedName = uiLabelMap.get(titleFieldName);
-                if (!localizedName.equals(titleFieldName)) {
-                    return localizedName;
-                }
-            } else {
-                Debug.logWarning("Could not find uiLabelMap in context while rendering form " + this.modelForm.getName(), module);
+        // search for a localized label for the field's name
+        Map<String, String> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap"));
+        if (uiLabelMap != null) {
+            String titleFieldName = "FormFieldTitle_" + this.name;
+            String localizedName = uiLabelMap.get(titleFieldName);
+            if (!localizedName.equals(titleFieldName)) {
+                return localizedName;
             }
+        } else {
+            Debug.logWarning("Could not find uiLabelMap in context while rendering form " + this.modelForm.getName(), module);
+        }
 
-            // create a title from the name of this field; expecting a Java method/field style name, ie productName or productCategoryId
-            StringBuilder autoTitlewriter = new StringBuilder();
+        // create a title from the name of this field; expecting a Java method/field style name, ie productName or productCategoryId
+        StringBuilder autoTitlewriter = new StringBuilder();
 
-            // always use upper case first letter...
-            autoTitlewriter.append(Character.toUpperCase(this.name.charAt(0)));
+        // always use upper case first letter...
+        autoTitlewriter.append(Character.toUpperCase(this.name.charAt(0)));
 
-            // just put spaces before the upper case letters
-            for (int i = 1; i < this.name.length(); i++) {
-                char curChar = this.name.charAt(i);
-                if (Character.isUpperCase(curChar)) {
-                    autoTitlewriter.append(' ');
-                }
-                autoTitlewriter.append(curChar);
+        // just put spaces before the upper case letters
+        for (int i = 1; i < this.name.length(); i++) {
+            char curChar = this.name.charAt(i);
+            if (Character.isUpperCase(curChar)) {
+                autoTitlewriter.append(' ');
             }
-
-            return autoTitlewriter.toString();
+            autoTitlewriter.append(curChar);
         }
+
+        return autoTitlewriter.toString();
     }
 
     public String getTitleAreaStyle() {
-        if (UtilValidate.isNotEmpty(this.titleAreaStyle)) {
-            return this.titleAreaStyle;
-        } else {
-            return this.modelForm.getDefaultTitleAreaStyle();
-        }
+        if (UtilValidate.isNotEmpty(this.titleAreaStyle)) return this.titleAreaStyle;
+        return this.modelForm.getDefaultTitleAreaStyle();
     }
 
     public String getTitleStyle() {
-        if (UtilValidate.isNotEmpty(this.titleStyle)) {
-            return this.titleStyle;
-        } else {
-            return this.modelForm.getDefaultTitleStyle();
-        }
+        if (UtilValidate.isNotEmpty(this.titleStyle)) return this.titleStyle;
+        return this.modelForm.getDefaultTitleStyle();
     }
 
     public String getRequiredFieldStyle() {
-        if (UtilValidate.isNotEmpty(this.requiredFieldStyle)) {
-            return this.requiredFieldStyle;
-        } else {
-            return this.modelForm.getDefaultRequiredFieldStyle();
-        }
+        if (UtilValidate.isNotEmpty(this.requiredFieldStyle)) return this.requiredFieldStyle;
+        return this.modelForm.getDefaultRequiredFieldStyle();
     }
 
     public String getSortFieldStyle() {
-        if (UtilValidate.isNotEmpty(this.sortFieldStyle)) {
-            return this.sortFieldStyle;
-        }
+        if (UtilValidate.isNotEmpty(this.sortFieldStyle)) return this.sortFieldStyle;
         return this.modelForm.getDefaultSortFieldStyle();
     }
 
     public String getSortFieldStyleAsc() {
-        if (UtilValidate.isNotEmpty(this.sortFieldAscStyle)) {
-            return this.sortFieldAscStyle;
-        }
+        if (UtilValidate.isNotEmpty(this.sortFieldAscStyle)) return this.sortFieldAscStyle;
         return this.modelForm.getDefaultSortFieldAscStyle();
     }
 
     public String getSortFieldStyleDesc() {
-        if (UtilValidate.isNotEmpty(this.sortFieldDescStyle)) {
-            return this.sortFieldDescStyle;
-        }
+        if (UtilValidate.isNotEmpty(this.sortFieldDescStyle)) return this.sortFieldDescStyle;
         return this.modelForm.getDefaultSortFieldDescStyle();
     }
 
     public String getTooltip(Map<String, Object> context) {
-        if (tooltip != null && !tooltip.isEmpty()) {
-            return tooltip.expandString(context);
-        } else {
-            return "";
-        }
+        if (UtilValidate.isNotEmpty(tooltip)) return tooltip.expandString(context);
+        return "";
     }
 
     public String getUseWhen(Map<String, Object> context) {
-        if (this.useWhen != null && !this.useWhen.isEmpty()) {
-            return this.useWhen.expandString(context);
-        } else {
-            return "";
-        }
+        if (UtilValidate.isNotEmpty(this.useWhen)) return this.useWhen.expandString(context);
+        return "";
     }
 
     public boolean getEncodeOutput() {
@@ -1108,11 +967,8 @@ public class ModelFormField {
     }
 
     public String getIdName() {
-        if (UtilValidate.isNotEmpty(idName)) {
-            return idName;
-        } else {
-            return this.modelForm.getName() + "_" + this.getFieldName();
-        }
+        if (UtilValidate.isNotEmpty(idName)) return idName;
+        return this.modelForm.getName() + "_" + this.getFieldName();
     }
 
     public String getCurrentContainerId(Map<String, Object> context) {
@@ -1155,30 +1011,28 @@ public class ModelFormField {
 
     public boolean shouldUse(Map<String, Object> context) {
         String useWhenStr = this.getUseWhen(context);
-        if (UtilValidate.isEmpty(useWhenStr)) {
-            return true;
-        } else {
-            try {
-                Interpreter bsh = this.modelForm.getBshInterpreter(context);
-                Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhenStr));
-                boolean condTrue = false;
-                // retVal should be a Boolean, if not something weird is up...
-                if (retVal instanceof Boolean) {
-                    Boolean boolVal = (Boolean) retVal;
-                    condTrue = boolVal.booleanValue();
-                } else {
-                    throw new IllegalArgumentException("Return value from use-when condition eval was not a Boolean: "
-                            + (retVal != null ? retVal.getClass().getName() : "null") + " [" + retVal + "] on the field " + this.name + " of form " + this.modelForm.getName());
-                }
-
-                return condTrue;
-            } catch (EvalError e) {
-                String errMsg = "Error evaluating BeanShell use-when condition [" + useWhenStr + "] on the field "
-                        + this.name + " of form " + this.modelForm.getName() + ": " + e.toString();
-                Debug.logError(e, errMsg, module);
-                //Debug.logError("For use-when eval error context is: " + context, module);
-                throw new IllegalArgumentException(errMsg);
-            }
+        if (UtilValidate.isEmpty(useWhenStr)) return true;
+        
+        try {
+            Interpreter bsh = this.modelForm.getBshInterpreter(context);
+            Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhenStr));
+            boolean condTrue = false;
+            // retVal should be a Boolean, if not something weird is up...
+            if (retVal instanceof Boolean) {
+                Boolean boolVal = (Boolean) retVal;
+                condTrue = boolVal.booleanValue();
+            } else {
+                throw new IllegalArgumentException("Return value from use-when condition eval was not a Boolean: "
+                        + (retVal != null ? retVal.getClass().getName() : "null") + " [" + retVal + "] on the field " + this.name + " of form " + this.modelForm.getName());
+            }
+
+            return condTrue;
+        } catch (EvalError e) {
+            String errMsg = "Error evaluating BeanShell use-when condition [" + useWhenStr + "] on the field "
+                    + this.name + " of form " + this.modelForm.getName() + ": " + e.toString();
+            Debug.logError(e, errMsg, module);
+            //Debug.logError("For use-when eval error context is: " + context, module);
+            throw new IllegalArgumentException(errMsg);
         }
     }
 
@@ -1193,27 +1047,18 @@ public class ModelFormField {
     }
 
     public String getWidgetAreaStyle() {
-        if (UtilValidate.isNotEmpty(this.widgetAreaStyle)) {
-            return this.widgetAreaStyle;
-        } else {
-            return this.modelForm.getDefaultWidgetAreaStyle();
-        }
+        if (UtilValidate.isNotEmpty(this.widgetAreaStyle)) return this.widgetAreaStyle;
+        return this.modelForm.getDefaultWidgetAreaStyle();
     }
 
     public String getWidgetStyle() {
-        if (UtilValidate.isNotEmpty(this.widgetStyle)) {
-            return this.widgetStyle;
-        } else {
-            return this.modelForm.getDefaultWidgetStyle();
-        }
+        if (UtilValidate.isNotEmpty(this.widgetStyle)) return this.widgetStyle;
+        return this.modelForm.getDefaultWidgetStyle();
     }
 
     public String getTooltipStyle() {
-        if (UtilValidate.isNotEmpty(this.tooltipStyle)) {
-            return this.tooltipStyle;
-        } else {
-            return this.modelForm.getDefaultTooltipStyle();
-        }
+        if (UtilValidate.isNotEmpty(this.tooltipStyle)) return this.tooltipStyle;
+        return this.modelForm.getDefaultTooltipStyle();
     }
 
     /**
@@ -1556,13 +1401,9 @@ public class ModelFormField {
         }
 
         public static String getDescriptionForOptionKey(String key, List<OptionValue> allOptionValues) {
-            if (UtilValidate.isEmpty(key)) {
-                return "";
-            }
+            if (UtilValidate.isEmpty(key)) return "";
 
-            if (UtilValidate.isEmpty(allOptionValues)) {
-                return key;
-            }
+            if (UtilValidate.isEmpty(allOptionValues)) return key;
 
             for (OptionValue optionValue: allOptionValues) {
                 if (key.equals(optionValue.getKey())) {
@@ -1731,12 +1572,8 @@ public class ModelFormField {
         }
 
         public String getKeyFieldName() {
-            if (UtilValidate.isNotEmpty(this.keyFieldName)) {
-                return this.keyFieldName;
-            } else {
-                // get the modelFormField fieldName
-                return this.fieldInfo.getModelFormField().getFieldName();
-            }
+            if (UtilValidate.isNotEmpty(this.keyFieldName)) return this.keyFieldName;
+            return this.fieldInfo.getModelFormField().getFieldName(); // get the modelFormField fieldName
         }
 
         @Override
@@ -2118,20 +1955,16 @@ public class ModelFormField {
         }
 
         public String getImageLocation(Map<String, Object> context){
-            if (this.imageLocation != null) {
-                return this.imageLocation.expandString(context);
-            } else {
-                return "";
-            }
+            if (this.imageLocation != null) return this.imageLocation.expandString(context);
+            return "";
         }
 
         public String getDescription(Map<String, Object> context) {
             String retVal = null;
-            if (this.description != null && !this.description.isEmpty()) {
-                retVal = this.description.expandString(context);
-            } else {
-                retVal = this.modelFormField.getEntry(context);
-            }
+            // Don't replace by UtilValidate.isNotEmpty: this.description is a FlexibleStringExpander and issues occur
+            if (UtilValidate.isNotEmpty(this.description)) retVal = this.description.expandString(context);
+            else retVal = this.modelFormField.getEntry(context);
+
             if (UtilValidate.isEmpty(retVal)) {
                 retVal = this.getDefaultValue(context);
             } else if ("currency".equals(type)) {
@@ -2139,9 +1972,7 @@ public class ModelFormField {
                 Locale locale = (Locale) context.get("locale");
                 if (locale == null) locale = Locale.getDefault();
                 String isoCode = null;
-                if (this.currency != null && !this.currency.isEmpty()) {
-                    isoCode = this.currency.expandString(context);
-                }
+                if (UtilValidate.isNotEmpty(this.currency)) isoCode = this.currency.expandString(context);
 
                 try {
                     BigDecimal parsedRetVal = (BigDecimal) ObjectType.simpleTypeConvert(retVal, "BigDecimal", null, null, locale, true);
@@ -2213,7 +2044,8 @@ public class ModelFormField {
                     throw new IllegalArgumentException(errMsg);
                 }
             }
-            if (this.description != null && !this.description.isEmpty() && retVal != null && this.getModelFormField().getEncodeOutput()) {
+         // Don't replace by UtilValidate.isNotEmpty: this.description is a FlexibleStringExpander and issues occur
+            if (UtilValidate.isNotEmpty(this.description) && retVal != null && this.getModelFormField().getEncodeOutput()) {
                 StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
                 if (simpleEncoder != null) {
                     retVal = simpleEncoder.encode(retVal);
@@ -2308,6 +2140,7 @@ public class ModelFormField {
             this.cache = !"false".equals(element.getAttribute("cache"));
             this.size = element.getAttribute("size");
 
+         // Don't replace by UtilValidate.isNotEmpty: this.description is a FlexibleStringExpander and issues occur
             if (this.description == null || this.description.isEmpty()) {
                 this.setDescription("${description}");
             }
@@ -2325,9 +2158,8 @@ public class ModelFormField {
             // rather than using the context to expand the string, lookup the given entity and use it to expand the string
             GenericValue value = null;
             String fieldKey = this.keyFieldName;
-            if (UtilValidate.isEmpty(fieldKey)) {
-                fieldKey = this.modelFormField.fieldName;
-            }
+            if (UtilValidate.isEmpty(fieldKey))  fieldKey = this.modelFormField.fieldName;
+            
             Delegator delegator = WidgetWorker.getDelegator(context);
             String fieldValue = modelFormField.getEntry(context);
             try {
@@ -2348,12 +2180,8 @@ public class ModelFormField {
                 retVal = this.description.expandString(localContext, locale);
             }
             // try to get the entry for the field if description doesn't expand to anything
-            if (UtilValidate.isEmpty(retVal)) {
-                retVal = fieldValue;
-            }
-            if (UtilValidate.isEmpty(retVal)) {
-                retVal = "";
-            }
+            if (UtilValidate.isEmpty(retVal)) retVal = fieldValue;
+            if (UtilValidate.isEmpty(retVal)) retVal = "";
             return retVal;
         }
 
@@ -2432,10 +2260,9 @@ public class ModelFormField {
 
         public String getConfirmation(Map<String, Object> context) {
             String message = getConfirmationMsg(context);
-            if (UtilValidate.isNotEmpty(message)) {
-                return message;
-            }
-            else if (getRequestConfirmation()) {
+            if (UtilValidate.isNotEmpty(message)) return message;            
+            
+            if (getRequestConfirmation()) {
                 String defaultMessage = UtilProperties.getPropertyValue("general", "default.confirmation.message", "${uiLabelMap.CommonConfirm}");
                 setConfirmationMsg(defaultMessage);
                 return getConfirmationMsg(context);
@@ -2452,11 +2279,8 @@ public class ModelFormField {
         }
 
         public String getTargetType() {
-            if (UtilValidate.isNotEmpty(this.targetType)) {
-                return this.targetType;
-            } else {
-                return HyperlinkField.DEFAULT_TARGET_TYPE;
-            }
+            if (UtilValidate.isNotEmpty(this.targetType)) return this.targetType;
+            return HyperlinkField.DEFAULT_TARGET_TYPE;
         }
 
         public String getTargetWindow(Map<String, Object> context) {
@@ -2601,11 +2425,8 @@ public class ModelFormField {
         }
 
         public String getTargetType() {
-            if (UtilValidate.isNotEmpty(this.targetType)) {
-                return this.targetType;
-            } else {
-                return HyperlinkField.DEFAULT_TARGET_TYPE;
-            }
+            if (UtilValidate.isNotEmpty(this.targetType)) return this.targetType;
+            return HyperlinkField.DEFAULT_TARGET_TYPE;
         }
 
         public String getDescription(Map<String, Object> context) {
@@ -2668,10 +2489,9 @@ public class ModelFormField {
 
         public String getConfirmation(Map<String, Object> context) {
             String message = getConfirmationMsg(context);
-            if (UtilValidate.isNotEmpty(message)) {
-                return message;
-            }
-            else if (getRequestConfirmation()) {
+            if (UtilValidate.isNotEmpty(message)) return message;
+            
+            if (getRequestConfirmation()) {
                 String defaultMessage = UtilProperties.getPropertyValue("general", "default.confirmation.message", "${uiLabelMap.CommonConfirm}");
                 setConfirmationMsg(defaultMessage);
                 return getConfirmationMsg(context);
@@ -3128,12 +2948,8 @@ public class ModelFormField {
             inputMethod = element.getAttribute("input-method");
             clock = element.getAttribute("clock");
             mask = element.getAttribute("mask");
-            if (UtilValidate.isNotEmpty(element.getAttribute("step"))) {
-                this.setStep(element.getAttribute("step"));
-            }
-            else {
-                this.setStep("1");
-            }
+            if (UtilValidate.isNotEmpty(element.getAttribute("step"))) this.setStep(element.getAttribute("step"));
+            else this.setStep("1");
         }
 
         @Override
@@ -3201,17 +3017,11 @@ public class ModelFormField {
          * @return Default value string for date-time
          */
         public String getDefaultDateTimeString(Map<String, Object> context) {
-            if (this.defaultValue != null && !this.defaultValue.isEmpty()) {
-                return this.getDefaultValue(context);
-            }
+            if (UtilValidate.isNotEmpty(this.defaultValue)) return this.getDefaultValue(context);
 
-            if ("date".equals(this.type)) {
-                return (new java.sql.Date(System.currentTimeMillis())).toString();
-            } else if ("time".equals(this.type)) {
-                return (new java.sql.Time(System.currentTimeMillis())).toString();
-            } else {
-                return UtilDateTime.nowTimestamp().toString();
-            }
+            if ("date".equals(this.type))  return (new java.sql.Date(System.currentTimeMillis())).toString();
+            else if ("time".equals(this.type)) return (new java.sql.Time(System.currentTimeMillis())).toString();
+            else return UtilDateTime.nowTimestamp().toString();
         }
     }
 
@@ -3290,18 +3100,13 @@ public class ModelFormField {
         }
 
         public String getCurrent() {
-            if (UtilValidate.isEmpty(this.current)) {
-                return "first-in-list";
-            } else {
-                return this.current;
-            }
+            if (UtilValidate.isEmpty(this.current)) return "first-in-list";
+            return this.current;
         }
 
         public String getCurrentDescription(Map<String, Object> context) {
-            if (this.currentDescription == null)
-                return null;
-            else
-                return this.currentDescription.expandString(context);
+            if (this.currentDescription == null) return null;
+            return this.currentDescription.expandString(context);
         }
 
         public void setAllowEmpty(boolean b) {
@@ -3351,11 +3156,8 @@ public class ModelFormField {
          */
         public String getParameterNameOther(Map<String, Object> context) {
             String baseName;
-            if (UtilValidate.isNotEmpty(this.modelFormField.parameterName)) {
-                baseName = this.modelFormField.parameterName;
-            } else {
-                baseName = this.modelFormField.name;
-            }
+            if (UtilValidate.isNotEmpty(this.modelFormField.parameterName)) baseName = this.modelFormField.parameterName;
+            else baseName = this.modelFormField.name;
 
             baseName += "_OTHER";
             Integer itemIndex = (Integer) context.get("itemIndex");
@@ -3419,11 +3221,8 @@ public class ModelFormField {
 
         public Boolean isAllChecked(Map<String, Object> context) {
             String allCheckedStr = this.allChecked.expandString(context);
-            if (UtilValidate.isNotEmpty(allCheckedStr)) {
-                return Boolean.valueOf("true".equals(allCheckedStr));
-            } else {
-                return null;
-            }
+            if (UtilValidate.isNotEmpty(allCheckedStr)) return Boolean.valueOf("true".equals(allCheckedStr));
+            else return null;
         }
     }
 
@@ -3478,9 +3277,7 @@ public class ModelFormField {
 
         public String getConfirmation(Map<String, Object> context) {
             String message = getConfirmationMsg(context);
-            if (UtilValidate.isNotEmpty(message)) {
-                return message;
-            }
+            if (UtilValidate.isNotEmpty(message)) return message;
             else if (getRequestConfirmation()) {
                 String defaultMessage = UtilProperties.getPropertyValue("general", "default.confirmation.message", "${uiLabelMap.CommonConfirm}");
                 setConfirmationMsg(defaultMessage);
@@ -3566,7 +3363,7 @@ public class ModelFormField {
         }
 
         public String getValue(Map<String, Object> context) {
-            if (this.value != null && !this.value.isEmpty()) {
+            if (UtilValidate.isNotEmpty(this.value)) {
                 String valueEnc = this.value.expandString(context);
                 StringUtil.SimpleEncoder simpleEncoder = (StringUtil.SimpleEncoder) context.get("simpleEncoder");
                 if (simpleEncoder != null) {
@@ -3961,11 +3758,8 @@ public class ModelFormField {
         }
 
         public String getValue(Map<String, Object> context) {
-            if (this.value != null && !this.value.isEmpty()) {
-                return this.value.expandString(context);
-            } else {
-                return modelFormField.getEntry(context);
-            }
+            if (UtilValidate.isNotEmpty(this.value)) return this.value.expandString(context);
+            return modelFormField.getEntry(context);
         }
 
         public void setValue(String string) {
@@ -3973,11 +3767,9 @@ public class ModelFormField {
         }
 
         public String getDescription(Map<String, Object> context) {
-            if (this.description != null && !this.description.isEmpty()) {
-                return this.description.expandString(context);
-            } else {
-                return "";
-            }
+         // Don't replace by UtilValidate.isNotEmpty: this.description is a FlexibleStringExpander and issues occur
+            if (UtilValidate.isNotEmpty(this.description)) return this.description.expandString(context);
+            return "";
         }
 
         public void setDescription(String description) {
@@ -3985,11 +3777,8 @@ public class ModelFormField {
         }
 
         public String getAlternate(Map<String, Object> context) {
-            if (this.alternate != null && !this.alternate.isEmpty()) {
-                return this.alternate.expandString(context);
-            } else {
-                return "";
-            }
+            if (UtilValidate.isNotEmpty(this.alternate)) return this.alternate.expandString(context);
+            return "";
         }
 
         public void setAlternate(String alternate) {