You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2009/11/07 22:35:51 UTC
svn commit: r833770 [1/3] - in
/ofbiz/trunk/framework/widget/src/org/ofbiz/widget: ./ cache/ form/ html/
menu/ screen/ text/ tree/
Author: jleroux
Date: Sat Nov 7 21:35:50 2009
New Revision: 833770
URL: http://svn.apache.org/viewvc?rev=833770&view=rev
Log:
A (slightly modified) patch from Marc Morin "Resolve java warnings exposed in Eclipse : framework - widget" (https://issues.apache.org/jira/browse/OFBIZ-3123) - OFBIZ-3123
I have only replaced a while loop by an enhanced for loop
Modified:
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/form/MacroFormRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.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/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/menu/MenuFactory.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/ModelMenuCondition.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreen.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/ScreenFopViewHandler.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/text/TextFormRenderer.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTreeCondition.java
ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java
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=833770&r1=833769&r2=833770&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Sat Nov 7 21:35:50 2009
@@ -27,7 +27,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilGenerics;
import org.ofbiz.base.util.UtilHttp;
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=833770&r1=833769&r2=833770&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 Sat Nov 7 21:35:50 2009
@@ -44,7 +44,7 @@
return getCacheNamePrefix() + widgetName;
}
- protected UtilCache getCache(String widgetName) {
+ protected <K,V> UtilCache<K,V> getCache(String widgetName) {
return UtilCache.findCache(getCacheName(widgetName));
}
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=833770&r1=833769&r2=833770&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 Sat Nov 7 21:35:50 2009
@@ -29,9 +29,9 @@
}
public GenericWidgetOutput get(String screenName, WidgetContextCacheKey wcck) {
- UtilCache screenCache = getCache(screenName);
+ UtilCache<WidgetContextCacheKey,GenericWidgetOutput> screenCache = getCache(screenName);
if (screenCache == null) return null;
- return (GenericWidgetOutput) screenCache.get(wcck);
+ return screenCache.get(wcck);
}
public GenericWidgetOutput put(String screenName, WidgetContextCacheKey wcck, GenericWidgetOutput output) {
@@ -40,10 +40,10 @@
}
public GenericWidgetOutput remove(String screenName, WidgetContextCacheKey wcck) {
- UtilCache screenCache = getCache(screenName);
+ UtilCache<WidgetContextCacheKey,GenericWidgetOutput> screenCache = getCache(screenName);
if (Debug.verboseOn()) Debug.logVerbose("Removing from ScreenCache with key [" + wcck + "], will remove from this cache: " + (screenCache == null ? "[No cache found to remove from]" : screenCache.getName()), module);
if (screenCache == null) return null;
- GenericWidgetOutput retVal = (GenericWidgetOutput) screenCache.remove(wcck);
+ GenericWidgetOutput retVal = screenCache.remove(wcck);
if (Debug.verboseOn()) Debug.logVerbose("Removing from ScreenCache with key [" + wcck + "], found this in the cache: " + retVal, module);
return retVal;
}
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=833770&r1=833769&r2=833770&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 Sat Nov 7 21:35:50 2009
@@ -18,17 +18,16 @@
*******************************************************************************/
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;
import java.util.Map;
import java.util.Set;
import javolution.util.FastMap;
import javolution.util.FastSet;
+import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilMisc;
+
public class WidgetContextCacheKey {
public static final String module = WidgetContextCacheKey.class.getName();
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=833770&r1=833769&r2=833770&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Sat Nov 7 21:35:50 2009
@@ -23,7 +23,6 @@
import java.io.StringReader;
import java.io.StringWriter;
import java.sql.Timestamp;
-import com.ibm.icu.util.Calendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -37,7 +36,6 @@
import javax.servlet.http.HttpServletResponse;
import javolution.util.FastList;
-import javolution.util.FastSet;
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
@@ -75,6 +73,8 @@
import org.ofbiz.widget.form.ModelFormField.TextareaField;
import org.ofbiz.widget.screen.ModelScreenWidget;
+import com.ibm.icu.util.Calendar;
+
import freemarker.core.Environment;
import freemarker.template.Template;
import freemarker.template.TemplateException;
@@ -766,7 +766,7 @@
// http://www.cs.tut.fi/~jkorpela/forms/combo.html
if (otherFieldSize > 0) {
fieldName = modelFormField.getParameterName(context);
- Map dataMap = modelFormField.getMap(context);
+ Map<String, ? extends Object> dataMap = modelFormField.getMap(context);
if (dataMap == null) {
dataMap = context;
}
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=833770&r1=833769&r2=833770&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 Nov 7 21:35:50 2009
@@ -1283,7 +1283,7 @@
return maxNumOfColumns;
}
- protected Object safeNext(Iterator iterator) {
+ protected <X> X safeNext(Iterator<X> iterator) {
try {
return iterator.next();
} catch (NoSuchElementException e) {
@@ -1305,12 +1305,12 @@
return;
}
// if list is empty, do not render rows
- Iterator iter = null;
+ Iterator<?> iter = null;
if (obj instanceof Iterator) {
- iter = (Iterator) obj;
+ iter = (Iterator<?>) obj;
setPaginate(true);
} else if (obj instanceof List) {
- iter = ((List) obj).listIterator();
+ iter = ((List<?>) obj).listIterator();
setPaginate(true);
}
@@ -1370,12 +1370,12 @@
return;
}
// if list is empty, do not render rows
- Iterator iter = null;
+ Iterator<?> iter = null;
if (obj instanceof Iterator) {
- iter = (Iterator) obj;
+ iter = (Iterator<?>) obj;
setPaginate(true);
} else if (obj instanceof List) {
- iter = ((List) obj).listIterator();
+ iter = ((List<?>) obj).listIterator();
setPaginate(true);
}
@@ -2152,7 +2152,7 @@
public String getPaginateTarget(Map<String, Object> context) {
String targ = this.paginateTarget.expandString(context);
if (UtilValidate.isEmpty(targ)) {
- Map parameters = (Map) context.get("parameters");
+ Map<String, ?> parameters = UtilGenerics.cast(context.get("parameters"));
if (parameters != null && parameters.containsKey("targetRequestUri")) {
targ = (String) parameters.get("targetRequestUri");
}
@@ -2183,7 +2183,7 @@
if (value == null) {
// try parameters.VIEW_INDEX as that is an old OFBiz convention
- Map parameters = (Map) context.get("parameters");
+ Map<String, Object> parameters = UtilGenerics.cast(context.get("parameters"));
if (parameters != null) {
value = parameters.get("VIEW_INDEX" + "_" + getPaginatorNumber(context));
@@ -2224,7 +2224,7 @@
if (value == null) {
// try parameters.VIEW_SIZE as that is an old OFBiz convention
- Map parameters = (Map) context.get("parameters");
+ Map<String, Object> parameters = UtilGenerics.cast(context.get("parameters"));
if (parameters != null) {
value = parameters.get("VIEW_SIZE" + "_" + getPaginatorNumber(context));
@@ -2456,7 +2456,7 @@
listSize = 0;
}
} else if (entryList instanceof List) {
- List items = (List) entryList;
+ List<?> items = (List<?>) entryList;
listSize = items.size();
}
@@ -2542,9 +2542,9 @@
try {
value = (String)context.get(field);
if (value == null) {
- Map parameters = (Map) context.get("parameters");
+ Map<String, String> parameters = UtilGenerics.cast(context.get("parameters"));
if (parameters != null) {
- value = (String)parameters.get(field);
+ value = parameters.get(field);
}
}
} catch (Exception e) {