Author: adrianc
Date: Sat Dec 13 10:26:52 2008 New Revision: 726252 URL: http://svn.apache.org/viewvc?rev=726252&view=rev Log: Oops, I missed a couple of files in my last commit. Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java?rev=726252&r1=726251&r2=726252&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java Sat Dec 13 10:26:52 2008 @@ -113,12 +113,12 @@ public SetField(ModelForm modelForm, Element setElement) { super (modelForm, setElement); this.field = FlexibleMapAccessor.getInstance(setElement.getAttribute("field")); - this.fromField = UtilValidate.isNotEmpty(setElement.getAttribute("from-field")) ? new FlexibleMapAccessor<String>(setElement.getAttribute("from-field")) : null; - this.valueExdr = UtilValidate.isNotEmpty(setElement.getAttribute("value")) ? FlexibleStringExpander.getInstance(setElement.getAttribute("value")) : null; + this.fromField = FlexibleMapAccessor.getInstance(setElement.getAttribute("from-field")); + this.valueExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("value")); this.defaultExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("default-value")); this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global")); this.type = setElement.getAttribute("type"); - if (this.fromField != null && this.valueExdr != null) { + if (!this.fromField.isEmpty() && !this.valueExdr.isEmpty()) { throw new IllegalArgumentException("Cannot specify a from-field [" + setElement.getAttribute("from-field") + "] and a value [" + setElement.getAttribute("value") + "] on the set action in a screen widget"); } } @@ -129,10 +129,10 @@ boolean global = "true".equals(globalStr); Object newValue = null; - if (this.fromField != null) { + if (!this.fromField.isEmpty()) { newValue = this.fromField.get(context); if (Debug.verboseOn()) Debug.logVerbose("In screen getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module); - } else if (this.valueExdr != null) { + } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expandString(context); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java?rev=726252&r1=726251&r2=726252&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java Sat Dec 13 10:26:52 2008 @@ -125,14 +125,14 @@ public SetField(ModelMenu modelMenu, Element setElement) { super (modelMenu, setElement); this.field = FlexibleMapAccessor.getInstance(setElement.getAttribute("field")); - this.fromField = UtilValidate.isNotEmpty(setElement.getAttribute("from-field")) ? new FlexibleMapAccessor<Object>(setElement.getAttribute("from-field")) : null; - this.valueExdr = UtilValidate.isNotEmpty(setElement.getAttribute("value")) ? FlexibleStringExpander.getInstance(setElement.getAttribute("value")) : null; + this.fromField = FlexibleMapAccessor.getInstance(setElement.getAttribute("from-field")); + this.valueExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("value")); this.defaultExdr = UtilValidate.isNotEmpty(setElement.getAttribute("default-value")) ? FlexibleStringExpander.getInstance(setElement.getAttribute("default-value")) : null; this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global")); this.type = setElement.getAttribute("type"); this.toScope = setElement.getAttribute("to-scope"); this.fromScope = setElement.getAttribute("from-scope"); - if (this.fromField != null && this.valueExdr != null) { + if (!this.fromField.isEmpty() && this.valueExdr != null) { throw new IllegalArgumentException("Cannot specify a from-field [" + setElement.getAttribute("from-field") + "] and a value [" + setElement.getAttribute("value") + "] on the set action in a screen widget"); } } @@ -144,7 +144,7 @@ Object newValue = null; if (this.fromScope != null && this.fromScope.equals("user")) { - if (this.fromField != null) { + if (!this.fromField.isEmpty()) { String originalName = this.fromField.getOriginalName(); String currentWidgetTrail = (String)context.get("_WIDGETTRAIL_"); String newKey = currentWidgetTrail + "|" + originalName; @@ -156,7 +156,7 @@ } } else if (this.fromScope != null && this.fromScope.equals("application")) { - if (this.fromField != null) { + if (!this.fromField.isEmpty()) { String originalName = this.fromField.getOriginalName(); String currentWidgetTrail = (String)context.get("_WIDGETTRAIL_"); String newKey = currentWidgetTrail + "|" + originalName; @@ -168,7 +168,7 @@ } } else { - if (this.fromField != null) { + if (!this.fromField.isEmpty()) { newValue = this.fromField.get(context); if (Debug.verboseOn()) Debug.logVerbose("In screen getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module); } else if (this.valueExdr != null) { |
Free forum by Nabble | Edit this page |