Author: adrianc
Date: Mon Jun 2 15:23:55 2008 New Revision: 662590 URL: http://svn.apache.org/viewvc?rev=662590&view=rev Log: Eliminated compiler warnings from most of the screen widget library. No functional changes. I skipped the tree widget because it is not thread safe and it needs some work. Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ContentWorkerInterface.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/ScreenCache.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java 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/html/HtmlFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.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/menu/ModelMenuItem.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.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/screen/ModelScreenWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderException.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenStringRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenTextViewHandler.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextScreenRenderer.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/xml/XmlFormRenderer.java Modified: ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java (original) +++ ofbiz/trunk/framework/minilang/src/org/ofbiz/minilang/method/MethodContext.java Mon Jun 2 15:23:55 2008 @@ -296,7 +296,7 @@ this.results.put(key, value); } - public Map getResults() { + public Map<String, Object> getResults() { return this.results; } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ContentWorkerInterface.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ContentWorkerInterface.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ContentWorkerInterface.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ContentWorkerInterface.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget; import java.io.IOException; -import java.io.Writer; import java.util.List; import java.util.Locale; import java.util.Map; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/DataResourceWorkerInterface.java Mon Jun 2 15:23:55 2008 @@ -19,16 +19,11 @@ package org.ofbiz.widget; import java.io.IOException; -import java.io.Writer; -import java.util.List; import java.util.Locale; import java.util.Map; import org.ofbiz.base.util.GeneralException; import org.ofbiz.entity.GenericDelegator; -import org.ofbiz.entity.GenericEntityException; -import org.ofbiz.entity.GenericValue; -import org.ofbiz.service.LocalDispatcher; /** * ContentWorkerInterface Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java Mon Jun 2 15:23:55 2008 @@ -27,6 +27,7 @@ * Widget Library - Widget model class. ModelWidget is a base class that is * extended by other widget model classes. */ +@SuppressWarnings("serial") public class ModelWidget implements Serializable { /** Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget; import java.io.IOException; -import java.io.Writer; import java.util.Map; import javax.servlet.ServletContext; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/AbstractCache.java Mon Jun 2 15:23:55 2008 @@ -48,12 +48,12 @@ return UtilCache.findCache(getCacheName(widgetName)); } - protected UtilCache getOrCreateCache(String widgetName) { + protected UtilCache<WidgetContextCacheKey, GenericWidgetOutput> getOrCreateCache(String widgetName) { synchronized (UtilCache.utilCacheTable) { String name = getCacheName(widgetName); - UtilCache cache = UtilCache.findCache(name); + UtilCache<WidgetContextCacheKey, GenericWidgetOutput> cache = UtilCache.findCache(name); if (cache == null) { - cache = new UtilCache(name, 0, 0, true); + cache = new UtilCache<WidgetContextCacheKey, GenericWidgetOutput>(name, 0, 0, true); cache.setPropertiesParams(new String[] {name}); } return cache; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/ScreenCache.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/ScreenCache.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/ScreenCache.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/ScreenCache.java Mon Jun 2 15:23:55 2008 @@ -18,8 +18,6 @@ *******************************************************************************/ package org.ofbiz.widget.cache; -import java.util.Iterator; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.cache.UtilCache; @@ -37,8 +35,8 @@ } public GenericWidgetOutput put(String screenName, WidgetContextCacheKey wcck, GenericWidgetOutput output) { - UtilCache screenCache = getOrCreateCache(screenName); - return (GenericWidgetOutput)screenCache.put(wcck, output); + UtilCache<WidgetContextCacheKey, GenericWidgetOutput> screenCache = getOrCreateCache(screenName); + return screenCache.put(wcck, output); } public GenericWidgetOutput remove(String screenName, WidgetContextCacheKey wcck) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/cache/WidgetContextCacheKey.java Mon Jun 2 15:23:55 2008 @@ -19,6 +19,7 @@ package org.ofbiz.widget.cache; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import java.util.Iterator; @@ -32,7 +33,7 @@ public static final String module = WidgetContextCacheKey.class.getName(); - private static Set fieldNamesToSkip; + private static Set<String> fieldNamesToSkip; static { fieldNamesToSkip = FastSet.newInstance(); @@ -80,9 +81,9 @@ fieldNamesToSkip.add("visitor"); } - protected Map context; + protected Map<String, Object> context; - public WidgetContextCacheKey(Map context) { + public WidgetContextCacheKey(Map<String, Object> context) { this.context = FastMap.newInstance(); this.context.putAll(context); } @@ -90,6 +91,7 @@ public int hashCode() { return 0; } + public boolean equals(Object obj) { WidgetContextCacheKey key = null; if (obj instanceof WidgetContextCacheKey) { @@ -102,7 +104,7 @@ return false; } - Set unifiedContext = FastSet.newInstance(); + Set<String> unifiedContext = FastSet.newInstance(); unifiedContext.addAll(this.context.keySet()); unifiedContext.addAll(key.context.keySet()); Iterator fieldNameIt = unifiedContext.iterator(); @@ -121,7 +123,7 @@ return false; } if ("parameters".equals(fieldName)) { - if (!parametersAreEqual((Map)field1, (Map)field2)) { + if (!parametersAreEqual(UtilGenerics.checkMap(field1), UtilGenerics.checkMap(field2))) { return false; } continue; @@ -135,7 +137,7 @@ } public String toString() { - Map printableMap = FastMap.newInstance(); + Map<String, Object> printableMap = FastMap.newInstance(); Iterator fieldNameIt = this.context.keySet().iterator(); while (fieldNameIt.hasNext()) { String fieldName = (String)fieldNameIt.next(); @@ -147,7 +149,7 @@ } public static String printMap(Map map) { - Map printableMap = FastMap.newInstance(); + Map<String, Object> printableMap = FastMap.newInstance(); Iterator fieldNameIt = map.keySet().iterator(); while (fieldNameIt.hasNext()) { String fieldName = (String)fieldNameIt.next(); @@ -161,8 +163,8 @@ return UtilMisc.printMap(printableMap); } - public static boolean parametersAreEqual(Map map1, Map map2) { - Set unifiedContext = FastSet.newInstance(); + public static boolean parametersAreEqual(Map<Object, Object> map1, Map<Object, Object> map2) { + Set<Object> unifiedContext = FastSet.newInstance(); unifiedContext.addAll(map1.keySet()); unifiedContext.addAll(map2.keySet()); Iterator fieldNameIt = unifiedContext.iterator(); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoFormRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.fo; import java.io.IOException; -import java.io.Writer; import java.util.List; import java.util.Map; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/fo/FoScreenRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.fo; import java.io.IOException; -import java.io.Writer; import java.util.Map; import org.ofbiz.base.util.GeneralException; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java Mon Jun 2 15:23:55 2008 @@ -49,15 +49,15 @@ public static final String module = FormFactory.class.getName(); - public static final UtilCache formLocationCache = new UtilCache("widget.form.locationResource", 0, 0, false); - public static final UtilCache formWebappCache = new UtilCache("widget.form.webappResource", 0, 0, false); + public static final UtilCache<String, Map<String, ModelForm>> formLocationCache = new UtilCache<String, Map<String, ModelForm>>("widget.form.locationResource", 0, 0, false); + public static final UtilCache<String, Map<String, ModelForm>> formWebappCache = new UtilCache<String, Map<String, ModelForm>>("widget.form.webappResource", 0, 0, false); - public static Map getFormsFromLocation(String resourceName, ModelReader entityModelReader, DispatchContext dispatchContext) + public static Map<String, ModelForm> getFormsFromLocation(String resourceName, ModelReader entityModelReader, DispatchContext dispatchContext) throws IOException, SAXException, ParserConfigurationException { - Map modelFormMap = (Map) formLocationCache.get(resourceName); + Map<String, ModelForm> modelFormMap = formLocationCache.get(resourceName); if (modelFormMap == null) { synchronized (FormFactory.class) { - modelFormMap = (Map) formLocationCache.get(resourceName); + modelFormMap = formLocationCache.get(resourceName); if (modelFormMap == null) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { @@ -93,10 +93,10 @@ String cacheKey = webappName + "::" + resourceName; - Map modelFormMap = (Map) formWebappCache.get(cacheKey); + Map<String, ModelForm> modelFormMap = formWebappCache.get(cacheKey); if (modelFormMap == null) { synchronized (FormFactory.class) { - modelFormMap = (Map) formWebappCache.get(cacheKey); + modelFormMap = formWebappCache.get(cacheKey); if (modelFormMap == null) { ServletContext servletContext = (ServletContext) request.getAttribute("servletContext"); GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); @@ -117,8 +117,8 @@ return modelForm; } - public static Map readFormDocument(Document formFileDoc, ModelReader entityModelReader, DispatchContext dispatchContext, String formLocation) { - Map modelFormMap = new HashMap(); + public static Map<String, ModelForm> readFormDocument(Document formFileDoc, ModelReader entityModelReader, DispatchContext dispatchContext, String formLocation) { + Map<String, ModelForm> modelFormMap = new HashMap<String, ModelForm>(); if (formFileDoc != null) { // read document and construct ModelForm for each form element Element rootElement = formFileDoc.getDocumentElement(); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormStringRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.form; import java.io.IOException; -import java.io.Writer; import java.util.Map; /** 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=662590&r1=662589&r2=662590&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 Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.form; import java.io.IOException; -import java.io.Writer; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -38,6 +37,7 @@ import org.ofbiz.base.util.BshUtil; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; @@ -181,7 +181,7 @@ protected List<ModelFormAction> actions; protected List<ModelFormAction> rowActions; protected FlexibleStringExpander rowCountExdr; - protected List multiSubmitFields = FastList.newInstance(); + protected List<ModelFormField> multiSubmitFields = FastList.newInstance(); protected int rowCount = 0; /** On Submit areas to be updated. */ @@ -815,7 +815,7 @@ } public void renderSingleFormString(Appendable writer, Map<String, Object> context, FormStringRenderer formStringRenderer, int positions) throws IOException { - List tempFieldList = FastList.newInstance(); + List<ModelFormField> tempFieldList = FastList.newInstance(); tempFieldList.addAll(this.fieldList); // Check to see if there is a field, same name and same use-when (could come from extended form) @@ -837,7 +837,7 @@ } } - Set alreadyRendered = new TreeSet(); + Set<String> alreadyRendered = new TreeSet<String>(); FieldGroup lastFieldGroup = null; // render form open if (!skipStart) formStringRenderer.renderFormOpen(writer, context, this); @@ -1099,7 +1099,7 @@ // in this model: we can have more fields with the same name when use-when // conditions are used or when a form is extended or when the fields are // automatically retrieved by a service or entity definition. - List tempFieldList = FastList.newInstance(); + List<ModelFormField> tempFieldList = FastList.newInstance(); tempFieldList.addAll(this.fieldList); for (int j = 0; j < tempFieldList.size(); j++) { ModelFormField modelFormField = (ModelFormField) tempFieldList.get(j); @@ -1118,14 +1118,14 @@ // each list contains all the fields with that position. Collection fieldListsByPosition = this.getFieldListsByPosition(tempFieldList); Iterator fieldListsByPositionIter = fieldListsByPosition.iterator(); - List fieldRowsByPosition = FastList.newInstance(); // this list will contain maps, each one containing the list of fields for a position + List<Map> fieldRowsByPosition = FastList.newInstance(); // this list will contain maps, each one containing the list of fields for a position while (fieldListsByPositionIter.hasNext()) { int numOfColumns = 0; List mainFieldList = (List) fieldListsByPositionIter.next(); - List innerDisplayHyperlinkFieldsBegin = FastList.newInstance(); - List innerFormFields = FastList.newInstance(); - List innerDisplayHyperlinkFieldsEnd = FastList.newInstance(); + List<ModelFormField> innerDisplayHyperlinkFieldsBegin = FastList.newInstance(); + List<ModelFormField> innerFormFields = FastList.newInstance(); + List<ModelFormField> innerDisplayHyperlinkFieldsEnd = FastList.newInstance(); // render title for each field, except hidden & ignored, etc @@ -1330,9 +1330,10 @@ // count item rows int itemIndex = -1; - Object item = null; - while ((item = this.safeNext(iter)) != null && (itemIndex < highIndex)) { + Object item = this.safeNext(iter); + while (item != null && itemIndex < highIndex) { itemIndex++; + item = this.safeNext(iter); } Debug.logInfo("preparePager: Found rows = " + itemIndex, module); @@ -1397,7 +1398,7 @@ // render item rows int itemIndex = -1; Object item = null; - Map previousItem = FastMap.newInstance(); + Map<String, Object> previousItem = FastMap.newInstance(); while ((item = this.safeNext(iter)) != null) { itemIndex++; if (itemIndex >= highIndex) { @@ -1409,17 +1410,17 @@ continue; } - Map localContext = new HashMap(context); + Map<String, Object> itemMap = UtilGenerics.checkMap(item); + Map<String, Object> localContext = new HashMap<String, Object>(context); if (UtilValidate.isNotEmpty(this.getListEntryName())) { localContext.put(this.getListEntryName(), item); } else { - Map itemMap = (Map) item; localContext.putAll(itemMap); } localContext.put("previousItem", previousItem); previousItem = FastMap.newInstance(); - previousItem.putAll((Map)item); + previousItem.putAll(itemMap); ModelFormAction.runSubActions(this.rowActions, localContext); @@ -1429,7 +1430,7 @@ if (Debug.verboseOn()) Debug.logVerbose("In form got another row, context is: " + localContext, module); // Check to see if there is a field, same name and same use-when (could come from extended form) - List tempFieldList = FastList.newInstance(); + List<ModelFormField> tempFieldList = FastList.newInstance(); tempFieldList.addAll(this.fieldList); for (int j = 0; j < tempFieldList.size(); j++) { ModelFormField modelFormField = (ModelFormField) tempFieldList.get(j); @@ -1468,9 +1469,9 @@ this.rowCount++; List fieldListByPosition = (List) fieldListsByPositionIter.next(); - List innerDisplayHyperlinkFieldsBegin = FastList.newInstance(); - List innerFormFields = FastList.newInstance(); - List innerDisplayHyperlinkFieldsEnd = FastList.newInstance(); + List<ModelFormField> innerDisplayHyperlinkFieldsBegin = FastList.newInstance(); + List<ModelFormField> innerFormFields = FastList.newInstance(); + List<ModelFormField> innerDisplayHyperlinkFieldsEnd = FastList.newInstance(); // Preprocessing: // all the form fields are evaluated and the ones that will @@ -1574,7 +1575,7 @@ // The fields in the three lists, usually created in the preprocessing phase // of the renderItemRows method are rendered: this will create a visual representation // of one row (corresponding to one position). - public void renderItemRow(Appendable writer, Map localContext, FormStringRenderer formStringRenderer, boolean formPerItem, List hiddenIgnoredFieldList, List innerDisplayHyperlinkFieldsBegin, List innerFormFields, List innerDisplayHyperlinkFieldsEnd, int position, int numOfColumns) throws IOException { + public void renderItemRow(Appendable writer, Map<String, Object> localContext, FormStringRenderer formStringRenderer, boolean formPerItem, List hiddenIgnoredFieldList, List innerDisplayHyperlinkFieldsBegin, List innerFormFields, List innerDisplayHyperlinkFieldsEnd, int position, int numOfColumns) throws IOException { int numOfCells = innerDisplayHyperlinkFieldsBegin.size() + innerDisplayHyperlinkFieldsEnd.size() + (innerFormFields.size() > 0? 1: 0); @@ -1650,8 +1651,8 @@ formStringRenderer.renderFormatItemRowClose(writer, localContext, this); } - public List getHiddenIgnoredFields(Map<String, Object> context, Set alreadyRendered, List fieldList, int position) { - List hiddenIgnoredFieldList = FastList.newInstance(); + public List getHiddenIgnoredFields(Map<String, Object> context, Set<String> alreadyRendered, List fieldList, int position) { + List<ModelFormField> hiddenIgnoredFieldList = FastList.newInstance(); Iterator fieldIter = fieldList.iterator(); while (fieldIter.hasNext()) { ModelFormField modelFormField = (ModelFormField) fieldIter.next(); @@ -1714,13 +1715,13 @@ } } - public Collection getFieldListsByPosition(List modelFormFieldList) { - Map fieldsByPosition = new TreeMap(); + public Collection getFieldListsByPosition(List<ModelFormField> modelFormFieldList) { + Map<Integer, List<ModelFormField>> fieldsByPosition = new TreeMap<Integer, List<ModelFormField>>(); Iterator fieldListIter = modelFormFieldList.iterator(); while (fieldListIter.hasNext()) { ModelFormField modelFormField = (ModelFormField) fieldListIter.next(); Integer position = new Integer(modelFormField.getPosition()); - List fieldListByPosition = (List)fieldsByPosition.get(position); + List<ModelFormField> fieldListByPosition = fieldsByPosition.get(position); if (fieldListByPosition == null) { fieldListByPosition = FastList.newInstance(); fieldsByPosition.put(position, fieldListByPosition); @@ -1730,8 +1731,8 @@ return fieldsByPosition.values(); } - public List getFieldListByPosition(List modelFormFieldList, int position) { - List fieldListByPosition = FastList.newInstance(); + public List getFieldListByPosition(List<ModelFormField> modelFormFieldList, int position) { + List<ModelFormField> fieldListByPosition = FastList.newInstance(); Iterator fieldListIter = modelFormFieldList.iterator(); while (fieldListIter.hasNext()) { ModelFormField modelFormField = (ModelFormField) fieldListIter.next(); @@ -2545,7 +2546,7 @@ } public List getInbetweenList(FieldGroup startFieldGroup, FieldGroup endFieldGroup) { - ArrayList inbetweenList = new ArrayList(); + ArrayList<Object> inbetweenList = new ArrayList<Object>(); boolean firstFound = false; String startFieldGroupId = null; String endFieldGroupId = null; 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=662590&r1=662589&r2=662590&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 Mon Jun 2 15:23:55 2008 @@ -64,8 +64,8 @@ public abstract void runAction(Map<String, Object> context); - public static List readSubActions(ModelForm modelForm, Element parentElement) { - List actions = new LinkedList(); + public static List<ModelFormAction> readSubActions(ModelForm modelForm, Element parentElement) { + List<ModelFormAction> actions = new LinkedList<ModelFormAction>(); List actionElementList = UtilXml.childElementList(parentElement); Iterator actionElementIter = actionElementList.iterator(); @@ -296,7 +296,7 @@ protected FlexibleMapAccessor resultMapNameAcsr; protected FlexibleStringExpander autoFieldMapExdr; protected FlexibleStringExpander resultMapListNameExdr; - protected Map fieldMap; + protected Map<FlexibleMapAccessor, Object> fieldMap; public Service(ModelForm modelForm, Element serviceElement) { super (modelForm, serviceElement); @@ -331,18 +331,18 @@ boolean autoFieldMapBool = !"false".equals(autoFieldMapString); try { - Map serviceContext = null; + Map<String, Object> serviceContext = null; if (autoFieldMapBool) { serviceContext = this.modelForm.getDispatcher(context).getDispatchContext().makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, context); } else { - serviceContext = new HashMap(); + serviceContext = new HashMap<String, Object>(); } if (this.fieldMap != null) { EntityFinderUtil.expandFieldMapToContext(this.fieldMap, context, serviceContext); } - Map result = this.modelForm.getDispatcher(context).runSync(serviceNameExpanded, serviceContext); + Map<String, Object> result = this.modelForm.getDispatcher(context).runSync(serviceNameExpanded, serviceContext); if (this.resultMapNameAcsr != null) { this.resultMapNameAcsr.put(context, result); 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=662590&r1=662589&r2=662590&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 Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.form; import java.io.IOException; -import java.io.Writer; import java.math.BigDecimal; import java.text.DateFormat; import java.text.NumberFormat; @@ -40,6 +39,7 @@ import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilFormatOut; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; @@ -1415,7 +1415,7 @@ public static final int SOURCE_AUTO_ENTITY = 2; public static final int SOURCE_AUTO_SERVICE = 3; - public static Map fieldTypeByName = new HashMap(); + public static Map<String, Integer> fieldTypeByName = new HashMap<String, Integer>(); static { fieldTypeByName.put("display", new Integer(1)); @@ -1531,8 +1531,8 @@ } } - public List getAllOptionValues(Map<String, Object> context, GenericDelegator delegator) { - List optionValues = new LinkedList(); + public List<OptionValue> getAllOptionValues(Map<String, Object> context, GenericDelegator delegator) { + List<OptionValue> optionValues = new LinkedList<OptionValue>(); Iterator optionSourceIter = this.optionSources.iterator(); while (optionSourceIter.hasNext()) { OptionSource optionSource = (OptionSource) optionSourceIter.next(); @@ -1599,7 +1599,7 @@ public static abstract class OptionSource { protected FieldInfo fieldInfo; - public abstract void addOptionValues(List optionValues, Map<String, Object> context, GenericDelegator delegator); + public abstract void addOptionValues(List<OptionValue> optionValues, Map<String, Object> context, GenericDelegator delegator); } public static class SingleOption extends OptionSource { @@ -1618,7 +1618,7 @@ this.fieldInfo = fieldInfo; } - public void addOptionValues(List optionValues, Map<String, Object> context, GenericDelegator delegator) { + public void addOptionValues(List<OptionValue> optionValues, Map<String, Object> context, GenericDelegator delegator) { optionValues.add(new OptionValue(key.expandString(context), description.expandString(context))); } } @@ -1647,17 +1647,18 @@ this.fieldInfo = fieldInfo; } - public void addOptionValues(List optionValues, Map<String, Object> context, GenericDelegator delegator) { + public void addOptionValues(List<OptionValue> optionValues, Map<String, Object> context, GenericDelegator delegator) { List dataList = (List) this.listAcsr.get(context); if (dataList != null && dataList.size() != 0) { Iterator dataIter = dataList.iterator(); while (dataIter.hasNext()) { Object data = dataIter.next(); - Map localContext = new HashMap(context); + Map<String, Object> localContext = new HashMap<String, Object>(context); if (UtilValidate.isNotEmpty(this.listEntryName)) { localContext.put(this.listEntryName, data); } else { - localContext.putAll((Map) data); + Map<String, Object> dataMap = UtilGenerics.checkMap(data); + localContext.putAll(dataMap); } optionValues.add(new OptionValue((String) keyAcsr.get(localContext), description.expandString(localContext))); } @@ -1672,8 +1673,8 @@ protected boolean cache = true; protected String filterByDate; - protected List constraintList = null; - protected List orderByList = null; + protected List<EntityFinderUtil.ConditionExpr> constraintList = null; + protected List<String> orderByList = null; public EntityOptions(FieldInfo fieldInfo) { this.fieldInfo = fieldInfo; @@ -1688,7 +1689,7 @@ List constraintElements = UtilXml.childElementList(entityOptionsElement, "entity-constraint"); if (constraintElements != null && constraintElements.size() > 0) { - this.constraintList = new LinkedList(); + this.constraintList = new LinkedList<EntityFinderUtil.ConditionExpr>(); Iterator constraintElementIter = constraintElements.iterator(); while (constraintElementIter.hasNext()) { Element constraintElement = (Element) constraintElementIter.next(); @@ -1698,7 +1699,7 @@ List orderByElements = UtilXml.childElementList(entityOptionsElement, "entity-order-by"); if (orderByElements != null && orderByElements.size() > 0) { - this.orderByList = new LinkedList(); + this.orderByList = new LinkedList<String>(); Iterator orderByElementIter = orderByElements.iterator(); while (orderByElementIter.hasNext()) { Element orderByElement = (Element) orderByElementIter.next(); @@ -1718,11 +1719,11 @@ } } - public void addOptionValues(List optionValues, Map<String, Object> context, GenericDelegator delegator) { + public void addOptionValues(List<OptionValue> optionValues, Map<String, Object> context, GenericDelegator delegator) { // first expand any conditions that need expanding based on the current context EntityCondition findCondition = null; if (this.constraintList != null && this.constraintList.size() > 0) { - List expandedConditionList = new LinkedList(); + List<EntityCondition> expandedConditionList = new LinkedList<EntityCondition>(); Iterator constraintIter = constraintList.iterator(); while (constraintIter.hasNext()) { EntityFinderUtil.Condition condition = (EntityFinderUtil.Condition) constraintIter.next(); @@ -1734,7 +1735,7 @@ try { Locale locale = UtilMisc.ensureLocale(context.get("locale")); - List values = null; + List<GenericValue> values = null; values = delegator.findList(this.entityName, findCondition, null, this.orderByList, null, this.cache); // filter-by-date if requested @@ -1752,12 +1753,7 @@ while (valueIter.hasNext()) { GenericValue value = (GenericValue) valueIter.next(); // add key and description with string expansion, ie expanding ${} stuff, passing locale explicitly to expand value string because it won't be found in the Entity - MapStack localContext = null; - if (context instanceof MapStack) { - localContext = ((MapStack) context).standAloneStack(); - } else { - localContext = MapStack.create(context); - } + MapStack<String> localContext = MapStack.create(context); localContext.push(value); // expand with the new localContext, which is locale aware @@ -1938,12 +1934,7 @@ String retVal = null; if (value != null) { // expanding ${} stuff, passing locale explicitly to expand value string because it won't be found in the Entity - MapStack localContext = null; - if (context instanceof MapStack) { - localContext = ((MapStack) context).standAloneStack(); - } else { - localContext = MapStack.create(context); - } + MapStack<String> localContext = MapStack.create(context); localContext.push(value); // expand with the new localContext, which is locale aware @@ -2997,8 +2988,8 @@ return this.formName.expandString(context); } - public List getTargetParameterList() { - List paramList = FastList.newInstance(); + public List<String> getTargetParameterList() { + List<String> paramList = FastList.newInstance(); if (UtilValidate.isNotEmpty(this.targetParameter)) { StringTokenizer stk = new StringTokenizer(this.targetParameter, ", "); while (stk.hasMoreTokens()) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.html; import java.io.IOException; -import java.io.Writer; import java.sql.Timestamp; import java.util.Calendar; import java.util.HashSet; @@ -36,6 +35,7 @@ import org.apache.commons.lang.StringEscapeUtils; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; @@ -1196,7 +1196,7 @@ if (UtilValidate.isNotEmpty((String)context.get("queryString"))) { queryString = (String)context.get("queryString"); } else { - Map inputFields = (Map)context.get("requestParameters"); + Map<String, Object> inputFields = UtilGenerics.checkMap(context.get("requestParameters")); // strip out any multi form fields if the form is of type multi if (modelForm.getType().equals("multi")) { inputFields = UtilHttp.removeMultiFormParameters(inputFields); @@ -2068,7 +2068,7 @@ String queryString = UtilHttp.stripViewParamsFromQueryString(str); // strip parametrized index/size params from the query string - HashSet paramNames = new HashSet(); + HashSet<String> paramNames = new HashSet<String>(); paramNames.add(viewIndexParam); paramNames.add(viewSizeParam); queryString = UtilHttp.stripNamedParamsFromQueryString(queryString, paramNames); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlFormWrapper.java Mon Jun 2 15:23:55 2008 @@ -74,7 +74,7 @@ this.renderer = new HtmlFormRenderer(request, response); - this.context = new HashMap(); + this.context = new HashMap<String, Object>(); Map parameterMap = UtilHttp.getParameterMap(request); context.put("parameters", parameterMap); @@ -102,6 +102,7 @@ } } + @SuppressWarnings("unchecked") public String renderFormString(Object contextStack) throws IOException { if (contextStack instanceof MapStack) { return renderFormString((MapStack) contextStack); @@ -110,7 +111,7 @@ return renderFormString(); } } - public String renderFormString(MapStack contextStack) throws IOException { + public String renderFormString(MapStack<String> contextStack) throws IOException { // create a new context with the current context on the bottom contextStack.push(this.context); StringWriter buffer = new StringWriter(); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.html; import java.io.IOException; -import java.io.Writer; import java.util.Iterator; import java.util.List; import java.util.Map; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapper.java Mon Jun 2 15:23:55 2008 @@ -31,6 +31,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericValue; @@ -73,7 +74,7 @@ this.renderer = getMenuRenderer(); - this.context = new HashMap(); + this.context = new HashMap<String, Object>(); Map parameterMap = UtilHttp.getParameterMap(request); context.put("parameters", parameterMap); @@ -149,9 +150,9 @@ } public void putInContext(String menuItemName, String valueName, Object value) { - Map valueMap = (Map)context.get(menuItemName); + Map<String, Object> valueMap = UtilGenerics.toMap(context.get(menuItemName)); if (valueMap == null) { - valueMap = new HashMap(); + valueMap = new HashMap<String, Object>(); context.put(menuItemName, valueMap); } valueMap.put(valueName, value); @@ -162,9 +163,9 @@ } public Object getFromContext(String menuItemName, String valueName) { - Map valueMap = (Map)context.get(menuItemName); + Map<String, Object> valueMap = UtilGenerics.toMap(context.get(menuItemName)); if (valueMap == null) { - valueMap = new HashMap(); + valueMap = new HashMap<String, Object>(); context.put(menuItemName, valueMap); } return valueMap.get(valueName); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlMenuWrapperImage.java Mon Jun 2 15:23:55 2008 @@ -58,9 +58,9 @@ throws IOException, SAXException, ParserConfigurationException { super.init(resourceName, menuName, request, response); - String pubPt = (String)request.getAttribute("pubPt"); + //String pubPt = (String)request.getAttribute("pubPt"); //if (Debug.infoOn()) Debug.logInfo("in init, pubPt:" + pubPt, module); - Map dummyMap = new HashMap(); + Map<String, Object> dummyMap = new HashMap<String, Object>(); GenericDelegator delegator = (GenericDelegator)request.getAttribute("delegator"); //if (Debug.infoOn()) Debug.logInfo("in init, delegator:" + delegator, module); try { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlScreenRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.html; import java.io.IOException; -import java.io.Writer; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; @@ -28,18 +27,17 @@ import javax.servlet.ServletContext; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; import javolution.util.FastMap; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilFormatOut; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.GenericDelegator; -import org.ofbiz.entity.GenericValue; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.webapp.control.RequestHandler; import org.ofbiz.webapp.taglib.ContentUrlTag; @@ -150,8 +148,9 @@ } if (screenlet.collapsible()) { String toolTip = null; - Map uiLabelMap = (Map) context.get("uiLabelMap"); - Map requestParameters = new HashMap((Map)context.get("requestParameters")); + Map<String, Object> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap")); + Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters")); + Map<String, Object> requestParameters = new HashMap<String, Object>(paramMap); writer.append("<li class=\""); if (collapsed) { requestParameters.put(screenlet.getPreferenceKey(context) + "_collapsed", "false"); @@ -229,14 +228,10 @@ // needed for the "Page" and "rows" labels Map uiLabelMap = (Map) context.get("uiLabelMap"); - String pageLabel = ""; - String rowsLabel = ""; String ofLabel = ""; if (uiLabelMap == null) { Debug.logWarning("Could not find uiLabelMap in context", module); } else { - pageLabel = (String) uiLabelMap.get("CommonPage"); - rowsLabel = (String) uiLabelMap.get("CommonRows"); ofLabel = (String) uiLabelMap.get("CommonOf"); ofLabel = ofLabel.toLowerCase(); } @@ -248,7 +243,7 @@ ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); - Map inputFields = (Map) context.get("requestParameters"); + Map<String, Object> inputFields = UtilGenerics.toMap(context.get("requestParameters")); // strip out any multi form fields if the form is of type multi if (modelForm.getType().equals("multi")) { inputFields = UtilHttp.removeMultiFormParameters(inputFields); @@ -257,7 +252,7 @@ // strip legacy viewIndex/viewSize params from the query string queryString = UtilHttp.stripViewParamsFromQueryString(queryString); // strip parametrized index/size params from the query string - HashSet paramNames = new HashSet(); + HashSet<String> paramNames = new HashSet<String>(); paramNames.add(viewIndexParam); paramNames.add(viewSizeParam); queryString = UtilHttp.stripNamedParamsFromQueryString(queryString, paramNames); @@ -600,7 +595,7 @@ GenericDelegator delegator = (GenericDelegator) context.get("delegator"); // make a new map for content rendering; so our current map does not get clobbered - Map contentContext = FastMap.newInstance(); + Map<String, Object> contentContext = FastMap.newInstance(); contentContext.putAll(context); String dataResourceId = (String)contentContext.get("dataResourceId"); if (Debug.verboseOn()) Debug.logVerbose("expandedContentId:" + expandedContentId, module); @@ -736,7 +731,7 @@ GenericDelegator delegator = (GenericDelegator) context.get("delegator"); // create a new map for the content rendering; so our current context does not get overwritten! - Map contentContext = FastMap.newInstance(); + Map<String, Object> contentContext = FastMap.newInstance(); contentContext.putAll(context); try { @@ -796,8 +791,8 @@ if (UtilValidate.isNotEmpty(expandedMapKey)) { editRequest += "&mapKey=" + expandedMapKey; } - HttpSession session = request.getSession(); - GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); + //HttpSession session = request.getSession(); + //GenericValue userLogin = (GenericValue)session.getAttribute("userLogin"); /* don't know why this is here. might come to me later. -amb GenericDelegator delegator = (GenericDelegator)request.getAttribute("delegator"); String contentIdTo = content.getContentId(context); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlTreeRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.html; import java.io.IOException; -import java.io.Writer; import java.util.List; import java.util.Map; @@ -61,7 +60,7 @@ String pathString = buildPathString(node.getModelTree(), depth); String currentNodeTrailPiped = null; - List currentNodeTrail = node.getModelTree().getCurrentNodeTrail(); + List<String> currentNodeTrail = node.getModelTree().getCurrentNodeTrail(); String staticNodeTrailPiped = StringUtil.join(currentNodeTrail, "|"); context.put("staticNodeTrailPiped", staticNodeTrailPiped); context.put("nodePathString", pathString); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/html/HtmlWidgetRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.html; import java.io.IOException; -import java.io.Writer; import org.ofbiz.base.util.UtilHttp; import org.ofbiz.widget.ModelWidget; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java Mon Jun 2 15:23:55 2008 @@ -48,8 +48,8 @@ public static final String module = MenuFactory.class.getName(); - public static final UtilCache menuWebappCache = new UtilCache("widget.menu.webappResource", 0, 0, false); - public static final UtilCache menuLocationCache = new UtilCache("widget.menu.locationResource", 0, 0, false); + public static final UtilCache<String, Map<String, ModelMenu>> menuWebappCache = new UtilCache<String, Map<String, ModelMenu>>("widget.menu.webappResource", 0, 0, false); + public static final UtilCache<String, Map<String, ModelMenu>> menuLocationCache = new UtilCache<String, Map<String, ModelMenu>>("widget.menu.locationResource", 0, 0, false); public static ModelMenu getMenuFromWebappContext(String resourceName, String menuName, HttpServletRequest request) throws IOException, SAXException, ParserConfigurationException { @@ -57,10 +57,10 @@ String cacheKey = webappName + "::" + resourceName; - Map modelMenuMap = (Map) menuWebappCache.get(cacheKey); + Map<String, ModelMenu> modelMenuMap = menuWebappCache.get(cacheKey); if (modelMenuMap == null) { synchronized (MenuFactory.class) { - modelMenuMap = (Map) menuWebappCache.get(cacheKey); + modelMenuMap = menuWebappCache.get(cacheKey); if (modelMenuMap == null) { ServletContext servletContext = (ServletContext) request.getAttribute("servletContext"); GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); @@ -85,8 +85,8 @@ return modelMenu; } - public static Map readMenuDocument(Document menuFileDoc, GenericDelegator delegator, LocalDispatcher dispatcher, String menuLocation) { - Map modelMenuMap = new HashMap(); + public static Map<String, ModelMenu> readMenuDocument(Document menuFileDoc, GenericDelegator delegator, LocalDispatcher dispatcher, String menuLocation) { + Map<String, ModelMenu> modelMenuMap = new HashMap<String, ModelMenu>(); if (menuFileDoc != null) { // read document and construct ModelMenu for each menu element Element rootElement = menuFileDoc.getDocumentElement(); @@ -104,10 +104,10 @@ public static ModelMenu getMenuFromLocation(String resourceName, String menuName, GenericDelegator delegator, LocalDispatcher dispatcher) throws IOException, SAXException, ParserConfigurationException { - Map modelMenuMap = (Map) menuLocationCache.get(resourceName); + Map<String, ModelMenu> modelMenuMap = menuLocationCache.get(resourceName); if (modelMenuMap == null) { synchronized (MenuFactory.class) { - modelMenuMap = (Map) menuLocationCache.get(resourceName); + modelMenuMap = menuLocationCache.get(resourceName); if (modelMenuMap == null) { ClassLoader loader = Thread.currentThread().getContextClassLoader(); if (loader == null) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuStringRenderer.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.menu; import java.io.IOException; -import java.io.Writer; import java.util.Map; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuWrapTransform.java Mon Jun 2 15:23:55 2008 @@ -30,6 +30,7 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.template.FreeMarkerWorker; import org.ofbiz.entity.GenericDelegator; @@ -62,26 +63,27 @@ return FreeMarkerWorker.getWrappedObject(varName, env); } - public static String getArg(Map args, String key, Environment env) { + public static String getArg(Map<String, Object> args, String key, Environment env) { return FreeMarkerWorker.getArg(args, key, env); } - public static String getArg(Map args, String key, Map ctx) { + public static String getArg(Map<String, Object> args, String key, Map<String, Object> ctx) { return FreeMarkerWorker.getArg(args, key, ctx); } public Writer getWriter(final Writer out, Map args) { + Map<String, Object> checkedArgs = UtilGenerics.checkMap(args); final StringBuffer buf = new StringBuffer(); final Environment env = Environment.getCurrentEnvironment(); - final Map templateCtx = (Map) FreeMarkerWorker.getWrappedObject("context", env); + final Map<String, Object> templateCtx = UtilGenerics.checkMap(FreeMarkerWorker.getWrappedObject("context", env)); final GenericDelegator delegator = (GenericDelegator) FreeMarkerWorker.getWrappedObject("delegator", env); final HttpServletRequest request = (HttpServletRequest) FreeMarkerWorker.getWrappedObject("request", env); final HttpServletResponse response = (HttpServletResponse) FreeMarkerWorker.getWrappedObject("response", env); final HttpSession session = (HttpSession) FreeMarkerWorker.getWrappedObject("session", env); FreeMarkerWorker.getSiteParameters(request, templateCtx); - final Map savedValuesUp = new HashMap(); + final Map<String, Object> savedValuesUp = new HashMap<String, Object>(); FreeMarkerWorker.saveContextValues(templateCtx, upSaveKeyNames, savedValuesUp); - FreeMarkerWorker.overrideWithArgs(templateCtx, args); + FreeMarkerWorker.overrideWithArgs(templateCtx, checkedArgs); //final String menuDefFile = (String)templateCtx.get("menuDefFile"); //final String menuName = (String)templateCtx.get("menuName"); //final String associatedContentId = (String)templateCtx.get("associatedContentId"); @@ -133,7 +135,7 @@ templateCtx.put("dataResourceId", dataResourceId); templateCtx.put("subContentIdSub", subContentIdSub); templateCtx.put("subDataResourceTypeId", subDataResourceTypeId); - final Map savedValues = new HashMap(); + final Map<String, Object> savedValues = new HashMap<String, Object>(); FreeMarkerWorker.saveContextValues(templateCtx, saveKeyNames, savedValues); return new LoopWriter(out) { 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=662590&r1=662589&r2=662590&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 Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.menu; import java.io.IOException; -import java.io.Writer; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -43,6 +42,7 @@ /** * Widget Library - Menu model class */ +@SuppressWarnings("serial") public class ModelMenu extends ModelWidget { public static final String module = ModelMenu.class.getName(); 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=662590&r1=662589&r2=662590&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 Mon Jun 2 15:23:55 2008 @@ -345,7 +345,7 @@ protected FlexibleStringExpander serviceNameExdr; protected FlexibleMapAccessor resultMapNameAcsr; protected FlexibleStringExpander autoFieldMapExdr; - protected Map fieldMap; + protected Map<FlexibleMapAccessor, FlexibleMapAccessor> fieldMap; public Service(ModelMenu modelMenu, Element serviceElement) { super (modelMenu, serviceElement); @@ -355,7 +355,7 @@ List fieldMapElementList = UtilXml.childElementList(serviceElement, "field-map"); if (fieldMapElementList.size() > 0) { - this.fieldMap = new HashMap(); + this.fieldMap = new HashMap<FlexibleMapAccessor, FlexibleMapAccessor>(); Iterator fieldMapElementIter = fieldMapElementList.iterator(); while (fieldMapElementIter.hasNext()) { Element fieldMapElement = (Element) fieldMapElementIter.next(); @@ -377,11 +377,11 @@ boolean autoFieldMapBool = !"false".equals(autoFieldMapString); try { - Map serviceContext = null; + Map<String, Object> serviceContext = null; if (autoFieldMapBool) { serviceContext = this.modelMenu.getDispacher().getDispatchContext().makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, context); } else { - serviceContext = new HashMap(); + serviceContext = new HashMap<String, Object>(); } if (this.fieldMap != null) { @@ -394,7 +394,7 @@ } } - Map result = this.modelMenu.getDispacher().runSync(serviceNameExpanded, serviceContext); + Map<String, Object> result = this.modelMenu.getDispacher().runSync(serviceNameExpanded, serviceContext); if (this.resultMapNameAcsr != null) { this.resultMapNameAcsr.put(context, 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=662590&r1=662589&r2=662590&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 Mon Jun 2 15:23:55 2008 @@ -98,8 +98,8 @@ public abstract boolean eval(Map<String, Object> context); } - public static List readSubConditions(ModelMenuItem modelMenuItem, Element conditionElement) { - List condList = FastList.newInstance(); + public static List<MenuCondition> readSubConditions(ModelMenuItem modelMenuItem, Element conditionElement) { + List<MenuCondition> condList = FastList.newInstance(); List subElementList = UtilXml.childElementList(conditionElement); Iterator subElementIter = subElementList.iterator(); while (subElementIter.hasNext()) { @@ -268,14 +268,14 @@ if (permService != null) { // build the context - Map svcCtx = permService.makeValid(context, ModelService.IN_PARAM); + Map<String, Object> svcCtx = permService.makeValid(context, ModelService.IN_PARAM); svcCtx.put("resourceDescription", resource); if (UtilValidate.isNotEmpty(mainAction)) { svcCtx.put("mainAction", mainAction); } // invoke the service - Map resp; + Map<String, Object> resp; try { resp = dispatcher.runSync(permService.name, svcCtx, 300, true); } catch (GenericServiceException e) { @@ -419,7 +419,7 @@ fieldVal = ""; } - List messages = FastList.newInstance(); + List<String> messages = FastList.newInstance(); Boolean resultBool = BaseCompare.doRealCompare(fieldVal, value, operator, type, format, messages, null, null, true); if (messages.size() > 0) { messages.add(0, "Error with comparison in if-compare between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and value [" + value + "] with operator [" + operator + "] and type [" + type + "]: "); @@ -468,7 +468,7 @@ fieldVal = ""; } - List messages = FastList.newInstance(); + List<String> messages = FastList.newInstance(); Boolean resultBool = BaseCompare.doRealCompare(fieldVal, toFieldVal, operator, type, format, messages, null, null, false); if (messages.size() > 0) { messages.add(0, "Error with comparison in if-compare-field between field [" + fieldAcsr.toString() + "] with value [" + fieldVal + "] and to-field [" + toFieldVal.toString() + "] with value [" + toFieldVal + "] with operator [" + operator + "] and type [" + type + "]: "); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.menu; import java.io.IOException; -import java.io.Writer; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; @@ -46,7 +45,7 @@ protected ModelMenu modelMenu; - protected Map dataMap = new HashMap(); + protected Map<String, Object> dataMap = new HashMap<String, Object>(); protected String name; protected String entityName; protected FlexibleStringExpander title; @@ -66,8 +65,8 @@ protected ModelMenu subMenu; protected Link link; - protected List menuItemList = new LinkedList(); - protected Map menuItemMap = new HashMap(); + protected List<ModelMenuItem> menuItemList = new LinkedList<ModelMenuItem>(); + protected Map<String, ModelMenuItem> menuItemMap = new HashMap<String, ModelMenuItem>(); public static String DEFAULT_TARGET_TYPE = "intra-app"; Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.screen; import java.io.IOException; -import java.io.Writer; import java.net.MalformedURLException; import java.util.ArrayList; import java.util.HashMap; @@ -146,7 +145,7 @@ public static class HtmlTemplateDecorator extends ModelScreenWidget { protected FlexibleStringExpander locationExdr; - protected Map sectionMap = new HashMap(); + protected Map<String, HtmlTemplateDecoratorSection> sectionMap = new HashMap<String, HtmlTemplateDecoratorSection>(); public HtmlTemplateDecorator(ModelScreen modelScreen, Element htmlTemplateDecoratorElement) { super(modelScreen, htmlTemplateDecoratorElement); @@ -161,6 +160,7 @@ } } + @SuppressWarnings("unchecked") public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { // isolate the scope if (!(context instanceof MapStack)) { 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=662590&r1=662589&r2=662590&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 Mon Jun 2 15:23:55 2008 @@ -19,7 +19,6 @@ package org.ofbiz.widget.screen; import java.io.IOException; -import java.io.Writer; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; @@ -45,11 +44,12 @@ /** * Widget Library - Screen model HTML class */ +@SuppressWarnings("serial") public class IterateSectionWidget extends ModelScreenWidget { public static final String module = IterateSectionWidget.class.getName(); protected ModelScreenWidget childWidget; - protected List sectionList; + protected List<ModelScreenWidget.Section> sectionList; protected FlexibleMapAccessor listNameExdr; protected FlexibleStringExpander entryNameExdr; protected FlexibleStringExpander keyNameExdr; @@ -76,7 +76,7 @@ paginate = "true".equals(iterateSectionElement.getAttribute("paginate")); if (iterateSectionElement.hasAttribute("view-size")) setViewSize(iterateSectionElement.getAttribute("view-size")); - sectionList = new ArrayList(); + sectionList = new ArrayList<ModelScreenWidget.Section>(); List childElementList = UtilXml.childElementList(iterateSectionElement); Iterator childElementIter = childElementList.iterator(); while (childElementIter.hasNext()) { @@ -89,14 +89,9 @@ public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { boolean isEntrySet = false; - if (!(context instanceof MapStack)) { - context = MapStack.create(context); - } - - MapStack contextMs = (MapStack) context; - contextMs.push(); - // create a standAloneStack, basically a "save point" for this SectionsRenderer, and make a new "screens" object just for it so it is isolated and doesn't follow the stack down + MapStack<String> contextMs = MapStack.create(context); + String entryName = this.entryNameExdr.expandString(context); String keyName = this.keyNameExdr.expandString(context); Object obj = listNameExdr.get(context); @@ -156,7 +151,6 @@ throw new RuntimeException(e.getMessage()); } } - contextMs.pop(); } /* Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java?rev=662590&r1=662589&r2=662590&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.java Mon Jun 2 15:23:55 2008 @@ -18,12 +18,7 @@ *******************************************************************************/ package org.ofbiz.widget.screen; -import java.io.File; -import java.io.IOException; import java.io.Serializable; -import java.io.Writer; -import java.net.MalformedURLException; -import java.net.URL; import java.util.Collection; import java.util.List; import java.util.Map; @@ -32,9 +27,7 @@ import javolution.util.FastSet; import org.ofbiz.base.util.Debug; -import org.ofbiz.base.util.FileUtil; import org.ofbiz.base.util.GeneralException; -import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.string.FlexibleStringExpander; @@ -44,13 +37,13 @@ import org.ofbiz.entity.transaction.TransactionUtil; import org.ofbiz.service.LocalDispatcher; import org.ofbiz.webapp.control.ConfigXMLReader; -import org.ofbiz.webapp.control.ConfigXMLReader.ControllerConfig; import org.ofbiz.widget.ModelWidget; import org.w3c.dom.Element; /** * Widget Library - Screen model class */ +@SuppressWarnings("serial") public class ModelScreen extends ModelWidget implements Serializable { public static final String module = ModelScreen.class.getName(); 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=662590&r1=662589&r2=662590&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 Mon Jun 2 15:23:55 2008 @@ -40,7 +40,7 @@ import org.ofbiz.base.util.GroovyUtil; import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.StringUtil; -import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; @@ -77,8 +77,8 @@ public abstract void runAction(Map<String, Object> context) throws GeneralException; - public static List readSubActions(ModelScreen modelScreen, Element parentElement) { - List actions = FastList.newInstance(); + public static List<ModelScreenAction> readSubActions(ModelScreen modelScreen, Element parentElement) { + List<ModelScreenAction> actions = FastList.newInstance(); List actionElementList = UtilXml.childElementList(parentElement); Iterator actionElementIter = actionElementList.iterator(); @@ -123,6 +123,7 @@ } } + @SuppressWarnings("serial") public static class SetField extends ModelScreenAction { protected FlexibleMapAccessor field; protected FlexibleMapAccessor fromField; @@ -153,8 +154,6 @@ // default to false boolean global = "true".equals(globalStr); - Locale locale = UtilMisc.ensureLocale(context.get("locale")); - Object newValue = null; if (this.fromScope != null && this.fromScope.equals("user")) { if (!this.fromField.isEmpty()) { @@ -198,7 +197,7 @@ if (this.toScope != null && this.toScope.equals("user")) { String originalName = this.field.getOriginalName(); - List currentWidgetTrail = (List)context.get("_WIDGETTRAIL_"); + List<String> currentWidgetTrail = UtilGenerics.toList(context.get("_WIDGETTRAIL_")); String newKey = ""; if (currentWidgetTrail != null) { newKey = StringUtil.join(currentWidgetTrail, "|"); @@ -212,7 +211,7 @@ if (Debug.verboseOn()) Debug.logVerbose("In user setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module); } else if (this.toScope != null && this.toScope.equals("application")) { String originalName = this.field.getOriginalName(); - List currentWidgetTrail = (List)context.get("_WIDGETTRAIL_"); + List<String> currentWidgetTrail = UtilGenerics.toList(context.get("_WIDGETTRAIL_")); String newKey = ""; if (currentWidgetTrail != null) { newKey = StringUtil.join(currentWidgetTrail, "|"); @@ -251,14 +250,14 @@ public Object getInMemoryPersistedFromField(Object storeAgent, Map<String, Object> context) { Object newValue = null; String originalName = this.fromField.getOriginalName(); - List currentWidgetTrail = (List)context.get("_WIDGETTRAIL_"); - List trailList = new ArrayList(); + List<String> currentWidgetTrail = UtilGenerics.toList(context.get("_WIDGETTRAIL_")); + List<String> trailList = new ArrayList<String>(); if (currentWidgetTrail != null) { trailList.addAll(currentWidgetTrail); } for (int i=trailList.size(); i >= 0; i--) { - List subTrail = trailList.subList(0,i); + List<String> subTrail = trailList.subList(0,i); String newKey = null; if (subTrail.size() > 0) newKey = StringUtil.join(subTrail, "|") + "|" + originalName; @@ -278,6 +277,7 @@ } } + @SuppressWarnings("serial") public static class PropertyMap extends ModelScreenAction { protected FlexibleStringExpander resourceExdr; protected FlexibleMapAccessor mapNameAcsr; @@ -322,6 +322,7 @@ } } + @SuppressWarnings("serial") public static class PropertyToField extends ModelScreenAction { protected FlexibleStringExpander resourceExdr; @@ -378,6 +379,7 @@ } } + @SuppressWarnings("serial") public static class Script extends ModelScreenAction { protected String location; @@ -402,7 +404,7 @@ } else if (location.contains(".xml#")) { String xmlResource = ScreenFactory.getResourceNameFromCombined(location); String methodName = ScreenFactory.getScreenNameFromCombined(location); - Map localContext = FastMap.newInstance(); + Map<String, Object> localContext = FastMap.newInstance(); localContext.putAll(context); DispatchContext ctx = this.modelScreen.getDispatcher(context).getDispatchContext(); MethodContext methodContext = new MethodContext(ctx, localContext, null); @@ -418,11 +420,12 @@ } } + @SuppressWarnings("serial") public static class Service extends ModelScreenAction { protected FlexibleStringExpander serviceNameExdr; protected FlexibleMapAccessor resultMapNameAcsr; protected FlexibleStringExpander autoFieldMapExdr; - protected Map fieldMap; + protected Map<FlexibleMapAccessor, Object> fieldMap; public Service(ModelScreen modelScreen, Element serviceElement) { super (modelScreen, serviceElement); @@ -441,20 +444,20 @@ String autoFieldMapString = this.autoFieldMapExdr.expandString(context); try { - Map serviceContext = null; + Map<String, Object> serviceContext = null; if ("true".equals(autoFieldMapString)) { DispatchContext dc = this.modelScreen.getDispatcher(context).getDispatchContext(); // try a map called "parameters", try it first so values from here are overriden by values in the main context - Map combinedMap = FastMap.newInstance(); - Object parametersObj = context.get("parameters"); - if (parametersObj != null && parametersObj instanceof Map) { - combinedMap.putAll((Map) parametersObj); + Map<String, Object> combinedMap = FastMap.newInstance(); + Map<String, Object> parametersObj = UtilGenerics.toMap(context.get("parameters")); + if (parametersObj != null) { + combinedMap.putAll(parametersObj); } combinedMap.putAll(context); serviceContext = dc.makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, combinedMap); } else if (UtilValidate.isNotEmpty(autoFieldMapString) && !"false".equals(autoFieldMapString)) { FlexibleMapAccessor fieldFma = new FlexibleMapAccessor(autoFieldMapString); - Map autoFieldMap = (Map) fieldFma.get(context); + Map<String, Object> autoFieldMap = UtilGenerics.toMap(fieldFma.get(context)); if (autoFieldMap != null) { serviceContext = this.modelScreen.getDispatcher(context).getDispatchContext().makeValidContext(serviceNameExpanded, ModelService.IN_PARAM, autoFieldMap); } @@ -467,7 +470,7 @@ EntityFinderUtil.expandFieldMapToContext(this.fieldMap, context, serviceContext); } - Map result = this.modelScreen.getDispatcher(context).runSync(serviceNameExpanded, serviceContext); + Map<String, Object> result = this.modelScreen.getDispatcher(context).runSync(serviceNameExpanded, serviceContext); if (this.resultMapNameAcsr != null) { this.resultMapNameAcsr.put(context, result); @@ -493,6 +496,7 @@ } } + @SuppressWarnings("serial") public static class EntityOne extends ModelScreenAction { protected PrimaryKeyFinder finder; @@ -512,6 +516,7 @@ } } + @SuppressWarnings("serial") public static class EntityAnd extends ModelScreenAction { protected ByAndFinder finder; @@ -531,6 +536,7 @@ } } + @SuppressWarnings("serial") public static class EntityCondition extends ModelScreenAction { ByConditionFinder finder; @@ -550,6 +556,7 @@ } } + @SuppressWarnings("serial") public static class GetRelatedOne extends ModelScreenAction { protected FlexibleMapAccessor valueNameAcsr; protected FlexibleMapAccessor toValueNameAcsr; @@ -591,6 +598,7 @@ } + @SuppressWarnings("serial") public static class GetRelated extends ModelScreenAction { protected FlexibleMapAccessor valueNameAcsr; protected FlexibleMapAccessor listNameAcsr; @@ -621,13 +629,13 @@ throw new IllegalArgumentException(errMsg); } GenericValue value = (GenericValue) valueObject; - List orderByNames = null; + List<String> orderByNames = null; if (!orderByListAcsr.isEmpty()) { - orderByNames = (List) orderByListAcsr.get(context); + orderByNames = UtilGenerics.toList(orderByListAcsr.get(context)); } - Map constraintMap = null; + Map<String, Object> constraintMap = null; if (!mapAcsr.isEmpty()) { - constraintMap = (Map) mapAcsr.get(context); + constraintMap = UtilGenerics.toMap(mapAcsr.get(context)); } try { if (useCache) { |
Free forum by Nabble | Edit this page |