Author: adrianc
Date: Sat Dec 13 10:13:05 2008 New Revision: 726246 URL: http://svn.apache.org/viewvc?rev=726246&view=rev Log: Implemented FlexibleMapAccessor.getInstance() in the screen widgets. Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelFormField.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=726246&r1=726245&r2=726246&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Sat Dec 13 10:13:05 2008 @@ -1996,7 +1996,7 @@ * @param string */ public void setDefaultMapName(String string) { - this.defaultMapName = new FlexibleMapAccessor<Map<String, ? extends Object>>(string); + this.defaultMapName = FlexibleMapAccessor.getInstance(string); } /** 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=726246&r1=726245&r2=726246&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:13:05 2008 @@ -112,7 +112,7 @@ public SetField(ModelForm modelForm, Element setElement) { super (modelForm, setElement); - this.field = new FlexibleMapAccessor<Object>(setElement.getAttribute("field")); + 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.defaultExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("default-value")); @@ -177,7 +177,7 @@ public PropertyMap(ModelForm modelForm, Element setElement) { super (modelForm, setElement); this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource")); - this.mapNameAcsr = new FlexibleMapAccessor<Map<String, Object>>(setElement.getAttribute("map-name")); + this.mapNameAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("map-name")); this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global")); } @@ -214,10 +214,10 @@ super (modelForm, setElement); this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource")); this.propertyExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("property")); - this.fieldAcsr = new FlexibleMapAccessor<String>(setElement.getAttribute("field")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("field")); this.defaultExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("default")); noLocale = "true".equals(setElement.getAttribute("no-locale")); - this.argListAcsr = new FlexibleMapAccessor<List<Object>>(setElement.getAttribute("arg-list-name")); + this.argListAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("arg-list-name")); this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global")); } @@ -297,7 +297,7 @@ public Service(ModelForm modelForm, Element serviceElement) { super (modelForm, serviceElement); this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name")); - this.resultMapNameAcsr = UtilValidate.isNotEmpty(serviceElement.getAttribute("result-map-name")) ? new FlexibleMapAccessor<Map<String, Object>>(serviceElement.getAttribute("result-map-name")) : null; + this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map")); if (UtilValidate.isEmpty(serviceElement.getAttribute("result-map-list-name"))) { if (UtilValidate.isEmpty(serviceElement.getAttribute("result-map-list-iterator-name"))) { @@ -340,7 +340,7 @@ Map<String, Object> result = this.modelForm.getDispatcher(context).runSync(serviceNameExpanded, serviceContext); - if (this.resultMapNameAcsr != null) { + if (!this.resultMapNameAcsr.isEmpty()) { this.resultMapNameAcsr.put(context, result); String queryString = (String)result.get("queryString"); context.put("queryString", queryString); 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=726246&r1=726245&r2=726246&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 Sat Dec 13 10:13:05 2008 @@ -1185,7 +1185,7 @@ * @param string */ public void setEntryName(String string) { - entryAcsr = new FlexibleMapAccessor<Object>(string); + entryAcsr = FlexibleMapAccessor.getInstance(string); } /** @@ -1199,7 +1199,7 @@ * @param string */ public void setMapName(String string) { - this.mapAcsr = new FlexibleMapAccessor<Map<String, ? extends Object>>(string); + this.mapAcsr = FlexibleMapAccessor.getInstance(string); } /** @@ -1594,17 +1594,17 @@ protected FlexibleStringExpander description; public ListOptions(String listName, String listEntryName, String keyName, String description, FieldInfo fieldInfo) { - this.listAcsr = new FlexibleMapAccessor<List<? extends Object>>(listName); + this.listAcsr = FlexibleMapAccessor.getInstance(listName); this.listEntryName = listEntryName; - this.keyAcsr = new FlexibleMapAccessor<String>(keyName); + this.keyAcsr = FlexibleMapAccessor.getInstance(keyName); this.description = FlexibleStringExpander.getInstance(description); this.fieldInfo = fieldInfo; } public ListOptions(Element optionElement, FieldInfo fieldInfo) { this.listEntryName = optionElement.getAttribute("list-entry-name"); - this.keyAcsr = new FlexibleMapAccessor<String>(optionElement.getAttribute("key-name")); - this.listAcsr = new FlexibleMapAccessor<List<? extends Object>>(optionElement.getAttribute("list-name")); + this.keyAcsr = FlexibleMapAccessor.getInstance(optionElement.getAttribute("key-name")); + this.listAcsr = FlexibleMapAccessor.getInstance(optionElement.getAttribute("list-name")); this.listEntryName = optionElement.getAttribute("list-entry-name"); this.description = FlexibleStringExpander.getInstance(optionElement.getAttribute("description")); this.fieldInfo = fieldInfo; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=726246&r1=726245&r2=726246&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Sat Dec 13 10:13:05 2008 @@ -222,7 +222,7 @@ if (this.defaultDisabledTitleStyle == null || menuElement.hasAttribute("default-disabled-title-style")) this.defaultDisabledTitleStyle = menuElement.getAttribute("default-disabled-title-style"); if (this.selectedMenuItemContextFieldName == null || menuElement.hasAttribute("selected-menuitem-context-field-name")) - this.selectedMenuItemContextFieldName = new FlexibleMapAccessor<String>(menuElement.getAttribute("selected-menuitem-context-field-name")); + this.selectedMenuItemContextFieldName = FlexibleMapAccessor.getInstance(menuElement.getAttribute("selected-menuitem-context-field-name")); if (this.menuContainerStyleExdr == null || menuElement.hasAttribute("menu-container-style")) this.setMenuContainerStyle(menuElement.getAttribute("menu-container-style")); if (this.defaultAlign == null || menuElement.hasAttribute("default-align")) 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=726246&r1=726245&r2=726246&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:13:05 2008 @@ -124,7 +124,7 @@ public SetField(ModelMenu modelMenu, Element setElement) { super (modelMenu, setElement); - this.field = new FlexibleMapAccessor<Object>(setElement.getAttribute("field")); + 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.defaultExdr = UtilValidate.isNotEmpty(setElement.getAttribute("default-value")) ? FlexibleStringExpander.getInstance(setElement.getAttribute("default-value")) : null; @@ -237,7 +237,7 @@ public PropertyMap(ModelMenu modelMenu, Element setElement) { super (modelMenu, setElement); this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource")); - this.mapNameAcsr = new FlexibleMapAccessor<Map<String, Object>>(setElement.getAttribute("map-name")); + this.mapNameAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("map-name")); this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global")); } @@ -274,10 +274,10 @@ super (modelMenu, setElement); this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource")); this.propertyExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("property")); - this.fieldAcsr = new FlexibleMapAccessor<Object>(setElement.getAttribute("field")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("field")); this.defaultExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("default")); noLocale = "true".equals(setElement.getAttribute("no-locale")); - this.argListAcsr = new FlexibleMapAccessor<List<? extends Object>>(setElement.getAttribute("arg-list-name")); + this.argListAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("arg-list-name")); this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global")); } @@ -354,7 +354,7 @@ public Service(ModelMenu modelMenu, Element serviceElement) { super (modelMenu, serviceElement); this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name")); - this.resultMapNameAcsr = UtilValidate.isNotEmpty(serviceElement.getAttribute("result-map-name")) ? new FlexibleMapAccessor<Map<String, Object>>(serviceElement.getAttribute("result-map-name")) : null; + this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map")); List<? extends Element> fieldMapElementList = UtilXml.childElementList(serviceElement, "field-map"); @@ -363,8 +363,8 @@ for (Element fieldMapElement: fieldMapElementList) { // set the env-name for each field-name, noting that if no field-name is specified it defaults to the env-name this.fieldMap.put( - new FlexibleMapAccessor<Object>(UtilFormatOut.checkEmpty(fieldMapElement.getAttribute("field-name"), fieldMapElement.getAttribute("env-name"))), - new FlexibleMapAccessor<Object>(fieldMapElement.getAttribute("env-name"))); + FlexibleMapAccessor.getInstance(UtilFormatOut.checkEmpty(fieldMapElement.getAttribute("field-name"), fieldMapElement.getAttribute("env-name"))), + FlexibleMapAccessor.getInstance(fieldMapElement.getAttribute("env-name"))); } } } @@ -396,7 +396,7 @@ Map<String, Object> result = this.modelMenu.getDispacher().runSync(serviceNameExpanded, serviceContext); - if (this.resultMapNameAcsr != null) { + if (!this.resultMapNameAcsr.isEmpty()) { this.resultMapNameAcsr.put(context, result); } else { context.putAll(result); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java?rev=726246&r1=726245&r2=726246&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuCondition.java Sat Dec 13 10:13:05 2008 @@ -337,7 +337,7 @@ public IfValidateMethod(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method")); this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class")); } @@ -399,7 +399,7 @@ public IfCompare(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value")); this.operator = condElement.getAttribute("operator"); @@ -448,8 +448,8 @@ public IfCompareField(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); - this.toFieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("to-field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); this.operator = condElement.getAttribute("operator"); this.type = condElement.getAttribute("type"); @@ -496,7 +496,7 @@ public IfRegexp(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr")); } @@ -530,7 +530,7 @@ public IfEmpty(ModelMenuItem modelMenuItem, Element condElement) { super (modelMenuItem, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); } public boolean eval(Map<String, Object> context) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java?rev=726246&r1=726245&r2=726246&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java Sat Dec 13 10:13:05 2008 @@ -73,7 +73,7 @@ public IterateSectionWidget(ModelScreen modelScreen, Element iterateSectionElement) { super(modelScreen, iterateSectionElement); - listNameExdr = new FlexibleMapAccessor<Object>(iterateSectionElement.getAttribute("list-name")); + listNameExdr = FlexibleMapAccessor.getInstance(iterateSectionElement.getAttribute("list-name")); entryNameExdr = FlexibleStringExpander.getInstance(iterateSectionElement.getAttribute("entry-name")); keyNameExdr = FlexibleStringExpander.getInstance(iterateSectionElement.getAttribute("key-name")); if (this.paginateTarget == null || iterateSectionElement.hasAttribute("paginate-target")) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java?rev=726246&r1=726245&r2=726246&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenAction.java Sat Dec 13 10:13:05 2008 @@ -136,8 +136,8 @@ public SetField(ModelScreen modelScreen, Element setElement) { super (modelScreen, setElement); - this.field = new FlexibleMapAccessor<Object>(setElement.getAttribute("field")); - this.fromField = new FlexibleMapAccessor<Object>(setElement.getAttribute("from-field")); + this.field = FlexibleMapAccessor.getInstance(setElement.getAttribute("field")); + 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")); @@ -286,7 +286,7 @@ public PropertyMap(ModelScreen modelScreen, Element setElement) { super (modelScreen, setElement); this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource")); - this.mapNameAcsr = new FlexibleMapAccessor<ResourceBundleMapWrapper>(setElement.getAttribute("map-name")); + this.mapNameAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("map-name")); this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global")); } @@ -337,10 +337,10 @@ super (modelScreen, setElement); this.resourceExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("resource")); this.propertyExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("property")); - this.fieldAcsr = new FlexibleMapAccessor<Object>(setElement.getAttribute("field")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("field")); this.defaultExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("default")); - noLocale = "true".equals(setElement.getAttribute("no-locale")); - this.argListAcsr = new FlexibleMapAccessor<List<? extends Object>>(setElement.getAttribute("arg-list-name")); + this.noLocale = "true".equals(setElement.getAttribute("no-locale")); + this.argListAcsr = FlexibleMapAccessor.getInstance(setElement.getAttribute("arg-list-name")); this.globalExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("global")); } @@ -430,7 +430,7 @@ public Service(ModelScreen modelScreen, Element serviceElement) { super (modelScreen, serviceElement); this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name")); - this.resultMapNameAcsr = UtilValidate.isNotEmpty(serviceElement.getAttribute("result-map-name")) ? new FlexibleMapAccessor<Map<String, Object>>(serviceElement.getAttribute("result-map-name")) : null; + this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map")); this.fieldMap = EntityFinderUtil.makeFieldMap(serviceElement); } @@ -456,7 +456,7 @@ combinedMap.putAll(context); serviceContext = dc.makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, combinedMap); } else if (UtilValidate.isNotEmpty(autoFieldMapString) && !"false".equals(autoFieldMapString)) { - FlexibleMapAccessor<Object> fieldFma = new FlexibleMapAccessor<Object>(autoFieldMapString); + FlexibleMapAccessor<Object> fieldFma = FlexibleMapAccessor.getInstance(autoFieldMapString); Map<String, Object> autoFieldMap = UtilGenerics.toMap(fieldFma.get(context)); if (autoFieldMap != null) { serviceContext = this.modelScreen.getDispatcher(context).getDispatchContext().makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, autoFieldMap); @@ -472,7 +472,7 @@ Map<String, Object> result = this.modelScreen.getDispatcher(context).runSync(serviceNameExpanded, serviceContext); - if (this.resultMapNameAcsr != null) { + if (!this.resultMapNameAcsr.isEmpty()) { this.resultMapNameAcsr.put(context, result); String queryString = (String)result.get("queryString"); context.put("queryString", queryString); @@ -565,8 +565,8 @@ public GetRelatedOne(ModelScreen modelScreen, Element getRelatedOneElement) { super (modelScreen, getRelatedOneElement); - this.valueNameAcsr = new FlexibleMapAccessor<Object>(getRelatedOneElement.getAttribute("value-name")); - this.toValueNameAcsr = new FlexibleMapAccessor<Object>(getRelatedOneElement.getAttribute("to-value-name")); + this.valueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedOneElement.getAttribute("value-name")); + this.toValueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedOneElement.getAttribute("to-value-name")); this.relationName = getRelatedOneElement.getAttribute("relation-name"); this.useCache = "true".equals(getRelatedOneElement.getAttribute("use-cache")); } @@ -609,11 +609,11 @@ public GetRelated(ModelScreen modelScreen, Element getRelatedElement) { super (modelScreen, getRelatedElement); - this.valueNameAcsr = new FlexibleMapAccessor<Object>(getRelatedElement.getAttribute("value-name")); - this.listNameAcsr = new FlexibleMapAccessor<List<GenericValue>>(getRelatedElement.getAttribute("list-name")); + this.valueNameAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("value-name")); + this.listNameAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("list-name")); this.relationName = getRelatedElement.getAttribute("relation-name"); - this.mapAcsr = new FlexibleMapAccessor<Map<String, Object>>(getRelatedElement.getAttribute("map-name")); - this.orderByListAcsr = new FlexibleMapAccessor<List<String>>(getRelatedElement.getAttribute("order-by-list-name")); + this.mapAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("map-name")); + this.orderByListAcsr = FlexibleMapAccessor.getInstance(getRelatedElement.getAttribute("order-by-list-name")); this.useCache = "true".equals(getRelatedElement.getAttribute("use-cache")); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java?rev=726246&r1=726245&r2=726246&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenCondition.java Sat Dec 13 10:13:05 2008 @@ -322,7 +322,7 @@ public IfValidateMethod(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method")); this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class")); } @@ -384,7 +384,7 @@ public IfCompare(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value")); this.operator = condElement.getAttribute("operator"); @@ -432,8 +432,8 @@ public IfCompareField(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); - this.toFieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("to-field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); this.operator = condElement.getAttribute("operator"); this.type = condElement.getAttribute("type"); @@ -479,7 +479,7 @@ public IfRegexp(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr")); } @@ -513,7 +513,7 @@ public IfEmpty(ModelScreen modelScreen, Element condElement) { super (modelScreen, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); } public boolean eval(Map<String, Object> context) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java?rev=726246&r1=726245&r2=726246&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeAction.java Sat Dec 13 10:13:05 2008 @@ -119,12 +119,12 @@ public SetField(ModelTree.ModelNode modelNode, Element setElement) { super (modelNode, setElement); - this.field = new FlexibleMapAccessor<Object>(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.field = FlexibleMapAccessor.getInstance(setElement.getAttribute("field")); + this.fromField = FlexibleMapAccessor.getInstance(setElement.getAttribute("from-field")); + this.valueExdr = FlexibleStringExpander.getInstance(setElement.getAttribute("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 tree widget"); } } @@ -135,9 +135,9 @@ boolean global = "true".equals(globalStr); Object newValue = null; - if (this.fromField != null) { + if (!this.fromField.isEmpty()) { newValue = this.fromField.get(context); - } else if (this.valueExdr != null) { + } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expandString(context); } if (UtilValidate.isNotEmpty(this.type)) { @@ -231,7 +231,7 @@ public void initService( Element serviceElement ) { this.serviceNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("service-name")); - this.resultMapNameAcsr = UtilValidate.isNotEmpty(serviceElement.getAttribute("result-map-name")) ? new FlexibleMapAccessor<Map<String, Object>>(serviceElement.getAttribute("result-map-name")) : null; + this.resultMapNameAcsr = FlexibleMapAccessor.getInstance(serviceElement.getAttribute("result-map-name")); this.autoFieldMapExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("auto-field-map")); this.resultMapListNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-name")); this.resultMapListIteratorNameExdr = FlexibleStringExpander.getInstance(serviceElement.getAttribute("result-map-list-iterator-name")); @@ -263,7 +263,7 @@ Map<String, Object> result = this.modelTree.getDispatcher().runSync(serviceNameExpanded, serviceContext); - if (this.resultMapNameAcsr != null) { + if (!this.resultMapNameAcsr.isEmpty()) { this.resultMapNameAcsr.put(context, result); String queryString = (String)result.get("queryString"); context.put("queryString", queryString); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java?rev=726246&r1=726245&r2=726246&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java Sat Dec 13 10:13:05 2008 @@ -235,7 +235,7 @@ public IfValidateMethod(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method")); this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class")); } @@ -297,7 +297,7 @@ public IfCompare(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value")); this.operator = condElement.getAttribute("operator"); @@ -346,8 +346,8 @@ public IfCompareField(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); - this.toFieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("to-field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); + this.toFieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("to-field-name")); this.operator = condElement.getAttribute("operator"); this.type = condElement.getAttribute("type"); @@ -394,7 +394,7 @@ public IfRegexp(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr")); } @@ -428,7 +428,7 @@ public IfEmpty(ModelTree modelTree, Element condElement) { super (modelTree, condElement); - this.fieldAcsr = new FlexibleMapAccessor<Object>(condElement.getAttribute("field-name")); + this.fieldAcsr = FlexibleMapAccessor.getInstance(condElement.getAttribute("field-name")); } public boolean eval(Map<String, Object> context) { |
Free forum by Nabble | Edit this page |