click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bck...@apache.org
Subject svn commit: r955743 - in /click/trunk/click/framework/src/org/apache: click/ click/control/ click/dataprovider/ click/util/ velocity/tools/view/
Date Thu, 17 Jun 2010 20:59:57 GMT
Author: bckfnn
Date: Thu Jun 17 20:59:56 2010
New Revision: 955743

URL: http://svn.apache.org/viewvc?rev=955743&view=rev
Log:
use typesafe collection. CLK-696

Modified:
    click/trunk/click/framework/src/org/apache/click/ClickServlet.java
    click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java
    click/trunk/click/framework/src/org/apache/click/control/ActionButton.java
    click/trunk/click/framework/src/org/apache/click/control/FieldSet.java
    click/trunk/click/framework/src/org/apache/click/control/Form.java
    click/trunk/click/framework/src/org/apache/click/control/HiddenField.java
    click/trunk/click/framework/src/org/apache/click/control/RadioGroup.java
    click/trunk/click/framework/src/org/apache/click/control/Select.java
    click/trunk/click/framework/src/org/apache/click/control/Table.java
    click/trunk/click/framework/src/org/apache/click/dataprovider/PagingDataProvider.java
    click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
    click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java
    click/trunk/click/framework/src/org/apache/click/util/ErrorPage.java
    click/trunk/click/framework/src/org/apache/click/util/Format.java
    click/trunk/click/framework/src/org/apache/click/util/PageImports.java
    click/trunk/click/framework/src/org/apache/velocity/tools/view/WebappResourceLoader.java

Modified: click/trunk/click/framework/src/org/apache/click/ClickServlet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Thu Jun 17 20:59:56
2010
@@ -26,7 +26,6 @@ import java.lang.reflect.Field;
 import java.util.Collections;
 import java.util.Date;
 import java.util.Enumeration;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
@@ -1033,7 +1032,6 @@ public class ClickServlet extends HttpSe
      * @return a new Page instance for the given request, or null if an
      * PageInterceptor has aborted page creation
      */
-    @SuppressWarnings("unchecked")
     protected Page createPage(Context context) {
 
         HttpServletRequest request = context.getRequest();
@@ -2146,17 +2144,14 @@ public class ClickServlet extends HttpSe
 
         Map<String, String[]> requestParams = new TreeMap<String, String[]>();
 
-        Enumeration e = request.getParameterNames();
+        Enumeration<?> e = request.getParameterNames();
         while (e.hasMoreElements()) {
             String name = e.nextElement().toString();
             String[] values = request.getParameterValues(name);
             requestParams.put(name, values);
         }
 
-        Iterator it = requestParams.entrySet().iterator();
-        while (it.hasNext()) {
-            Map.Entry<String, String[]> entry =
-                (Map.Entry<String, String[]>) it.next();
+        for (Map.Entry<String, String[]> entry : requestParams.entrySet()) {
             String name = entry.getKey();
             String[] values = entry.getValue();
 

Modified: click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/AbstractControl.java Thu Jun
17 20:59:56 2010
@@ -258,7 +258,7 @@ public abstract class AbstractControl im
 
     public List<Behavior> getBehaviors() {
         if (behaviors == null) {
-            behaviors = new ArrayList();
+            behaviors = new ArrayList<Behavior>();
         }
         return behaviors;
     }
@@ -670,7 +670,6 @@ public abstract class AbstractControl im
      * @param name the CSS style name
      * @param value the CSS style value
      */
-    @SuppressWarnings("unchecked")
     public void setStyle(String name, String value) {
         if (name == null) {
             throw new IllegalArgumentException("Null name parameter");

Modified: click/trunk/click/framework/src/org/apache/click/control/ActionButton.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/ActionButton.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/ActionButton.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/ActionButton.java Thu Jun 17
20:59:56 2010
@@ -551,7 +551,6 @@ public class ActionButton extends Button
      * value.
      */
     @Override
-    @SuppressWarnings("unchecked")
     public void bindRequestValue() {
         Context context = getContext();
         if (context.isMultipartRequest()) {

Modified: click/trunk/click/framework/src/org/apache/click/control/FieldSet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/FieldSet.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/FieldSet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/FieldSet.java Thu Jun 17 20:59:56
2010
@@ -20,7 +20,6 @@ package org.apache.click.control;
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import org.apache.click.Control;
@@ -107,16 +106,16 @@ public class FieldSet extends Field impl
     protected Map<String, Control> controlMap;
 
     /** The ordered list of fields, excluding buttons. */
-    protected final List fieldList = new ArrayList();
+    protected final List<Field> fieldList = new ArrayList<Field>();
 
     /** The map of field width values. */
-    protected Map fieldWidths;
+    protected Map<String, Integer> fieldWidths;
 
     /** The FieldSet legend. */
     protected String legend;
 
     /** The FieldSet legend attributes map. */
-    protected Map legendAttributes;
+    protected Map<String, String> legendAttributes;
 
     /** The render fieldset border flag, default value is true. */
     protected boolean showBorder = true;
@@ -661,7 +660,7 @@ public class FieldSet extends Field impl
      *
      * @return the ordered List of fieldset fields
      */
-    public List getFieldList() {
+    public List<Field> getFieldList() {
         return fieldList;
     }
 
@@ -670,7 +669,7 @@ public class FieldSet extends Field impl
      *
      * @return the Map of fieldset fields, keyed on field name
      */
-    public Map getFields() {
+    public Map<String, Control> getFields() {
         return getControlMap();
     }
 
@@ -679,9 +678,9 @@ public class FieldSet extends Field impl
      *
      * @return the map of field width values, keyed on field name
      */
-    public Map getFieldWidths() {
+    public Map<String, Integer> getFieldWidths() {
         if (fieldWidths == null) {
-            fieldWidths = new HashMap();
+            fieldWidths = new HashMap<String, Integer>();
         }
         return fieldWidths;
     }
@@ -697,8 +696,7 @@ public class FieldSet extends Field impl
 
         // Set the specified form on the fieldsSets children. This call is not
         // recursive to children's children
-        for (Iterator it = getControls().iterator(); it.hasNext();) {
-            Control control = (Control) it.next();
+        for (Control control : getControls()) {
             if (control instanceof Field) {
                 ((Field) control).setForm(form);
             }
@@ -755,7 +753,7 @@ public class FieldSet extends Field impl
      */
     public String getLegendAttribute(String name) {
         if (legendAttributes != null) {
-            return (String) legendAttributes.get(name);
+            return legendAttributes.get(name);
         } else {
             return null;
         }
@@ -774,7 +772,7 @@ public class FieldSet extends Field impl
         }
 
         if (legendAttributes == null) {
-            legendAttributes = new HashMap(5);
+            legendAttributes = new HashMap<String, String>(5);
         }
 
         if (value != null) {
@@ -789,9 +787,9 @@ public class FieldSet extends Field impl
      *
      * @return the fieldset attributes Map
      */
-    public Map getLegendAttributes() {
+    public Map<String, String> getLegendAttributes() {
         if (legendAttributes == null) {
-            legendAttributes = new HashMap(5);
+            legendAttributes = new HashMap<String, String>(5);
         }
         return legendAttributes;
     }
@@ -819,8 +817,7 @@ public class FieldSet extends Field impl
     @Override
     public boolean onProcess() {
         if (hasControls()) {
-            for (Iterator it = getControls().iterator(); it.hasNext();) {
-                Control control = (Control) it.next();
+            for (Control control : getControls()) {
                 String controlName = control.getName();
                 if (controlName == null || !controlName.startsWith(
                     Form.SUBMIT_CHECK)) {
@@ -1015,10 +1012,7 @@ public class FieldSet extends Field impl
             return;
         }
 
-        List controls = getControls();
-
-        for (int i = 0; i < controls.size(); i++) {
-            Control control = (Control) controls.get(i);
+        for (Control control : getControls()) {
 
             // Buttons are rendered separately
             if (control instanceof Button) {
@@ -1028,7 +1022,7 @@ public class FieldSet extends Field impl
             if (!isHidden(control)) {
 
                 // Field width
-                Integer width = (Integer) getFieldWidths().get(control.getName());
+                Integer width = getFieldWidths().get(control.getName());
 
                 if (column == 1) {
                     buffer.append("<tr class=\"fields\">\n");
@@ -1222,7 +1216,7 @@ public class FieldSet extends Field impl
      * @param buffer the StringBuffer to render to
      */
     protected void renderButtons(HtmlStringBuffer buffer) {
-        List buttons = ContainerUtils.getButtons(this);
+        List<Button> buttons = ContainerUtils.getButtons(this);
 
         if (!buttons.isEmpty()) {
             buffer.append("<table class=\"buttons\" id=\"");
@@ -1231,12 +1225,11 @@ public class FieldSet extends Field impl
             buffer.append("<tr class=\"buttons\">");
 
             Form form = getForm();
-            for (int i = 0, size = buttons.size(); i < size; i++) {
+            for (Button button : buttons) {
                 buffer.append("<td class=\"buttons\"");
                 buffer.appendAttribute("style", form.getButtonStyle());
                 buffer.closeTag();
 
-                Button button = (Button) buttons.get(i);
                 button.render(buffer);
 
                 buffer.append("</td>");

Modified: click/trunk/click/framework/src/org/apache/click/control/Form.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Form.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Form.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Form.java Thu Jun 17 20:59:56
2010
@@ -1410,7 +1410,7 @@ public class Form extends AbstractContai
      * @return the Map of form fields (including buttons), keyed
      * on field name
      */
-    public Map getFields() {
+    public Map<String, Control> getFields() {
         return getControlMap();
     }
 
@@ -2407,7 +2407,7 @@ public class Form extends AbstractContai
                 return;
 
             } else {
-                Map fieldMap = ContainerUtils.getFieldMap(this);
+                Map<String, Field> fieldMap = ContainerUtils.getFieldMap(this);
                 if (fieldMap.containsKey(FORM_NAME)
                     && fieldMap.containsKey(BYPASS_VALIDATION)) {
                     return;
@@ -3018,7 +3018,7 @@ public class Form extends AbstractContai
          * @param name the field name
          * @param valueClass the Class of the value Object
          */
-        public NonbindableHiddenField(String name, Class valueClass) {
+        public NonbindableHiddenField(String name, Class<?> valueClass) {
             super(name, valueClass);
         }
 

Modified: click/trunk/click/framework/src/org/apache/click/control/HiddenField.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/HiddenField.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/HiddenField.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/HiddenField.java Thu Jun 17 20:59:56
2010
@@ -94,7 +94,7 @@ public class HiddenField extends Field {
     protected Object valueObject;
 
     /** The field value Class. */
-    protected Class valueClass;
+    protected Class<?> valueClass;
 
     // ----------------------------------------------------------- Constructors
 
@@ -104,7 +104,7 @@ public class HiddenField extends Field {
      * @param name the name of the hidden field
      * @param valueClass the Class of the value Object
      */
-    public HiddenField(String name, Class valueClass) {
+    public HiddenField(String name, Class<?> valueClass) {
         if (name == null) {
             throw new IllegalArgumentException("Null name parameter");
         }
@@ -151,6 +151,7 @@ public class HiddenField extends Field {
      *
      * @return this controls html tag
      */
+    @Override
     public String getTag() {
         return "input";
     }
@@ -162,6 +163,7 @@ public class HiddenField extends Field {
      *
      * @return true
      */
+    @Override
     public boolean isHidden() {
         return true;
     }
@@ -180,6 +182,7 @@ public class HiddenField extends Field {
      *
      * @return the Field value
      */
+    @Override
     public String getValue() {
         return (getValueObject() != null) ? getValueObject().toString() : "";
     }
@@ -189,6 +192,7 @@ public class HiddenField extends Field {
      *
      * @param value the Field value
      */
+    @Override
     public void setValue(String value) {
         setValueObject(value);
     }
@@ -198,7 +202,7 @@ public class HiddenField extends Field {
      *
      * @return the registered Class for the Hidden Field value Object
      */
-    public Class getValueClass() {
+    public Class<?> getValueClass() {
         return valueClass;
     }
 
@@ -207,7 +211,7 @@ public class HiddenField extends Field {
      *
      * @param valueClass the registered Class for the Hidden Field value Object
      */
-    public void setValueClass(Class valueClass) {
+    public void setValueClass(Class<?> valueClass) {
         this.valueClass = valueClass;
     }
 
@@ -218,6 +222,7 @@ public class HiddenField extends Field {
      *
      * @return the object representation of the Field value
      */
+    @Override
     public Object getValueObject() {
         return valueObject;
     }
@@ -227,6 +232,7 @@ public class HiddenField extends Field {
      *
      * @param value the object value to set
      */
+    @Override
     public void setValueObject(Object value) {
         if ((value != null) && (value.getClass() != valueClass)) {
             String msg =
@@ -245,6 +251,7 @@ public class HiddenField extends Field {
      *
      * @return null to ensure no client side JavaScript validation is performed
      */
+    @Override
     public String getValidationJavaScript() {
         return null;
     }
@@ -254,10 +261,11 @@ public class HiddenField extends Field {
     /**
      * This method binds the submitted request value to the Field's value.
      */
+    @Override
     public void bindRequestValue() {
 
         String aValue = getRequestValue();
-        Class valueClass = getValueClass();
+        Class<?> valueClass = getValueClass();
 
         if (valueClass == null) {
             throw new IllegalStateException("The value class is not defined."
@@ -331,6 +339,7 @@ public class HiddenField extends Field {
      *
      * @param buffer the specified buffer to render the control's output to
      */
+    @Override
     public void render(HtmlStringBuffer buffer) {
 
         buffer.elementStart(getTag());
@@ -338,7 +347,7 @@ public class HiddenField extends Field {
         buffer.appendAttribute("name", getName());
         buffer.appendAttribute("id", getId());
 
-        Class valueCls = getValueClass();
+        Class<?> valueCls = getValueClass();
 
         if (valueCls == String.class
             || valueCls == Integer.class

Modified: click/trunk/click/framework/src/org/apache/click/control/RadioGroup.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/RadioGroup.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/RadioGroup.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/RadioGroup.java Thu Jun 17 20:59:56
2010
@@ -22,7 +22,6 @@ import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import org.apache.click.Context;
@@ -208,13 +207,12 @@ public class RadioGroup extends Field {
      * @param options the collection of Radio items to add
      * @throws IllegalArgumentException if options is null
      */
-    public void addAll(Collection options) {
+    public void addAll(Collection<Radio> options) {
         if (options == null) {
             String msg = "options parameter cannot be null";
             throw new IllegalArgumentException(msg);
         }
-        for (Iterator i = options.iterator(); i.hasNext();) {
-            Radio radio = (Radio) i.next();
+        for (Radio radio : options) {
             add(radio);
         }
     }
@@ -230,15 +228,13 @@ public class RadioGroup extends Field {
      * @param options the Map of radio option values and labels to add
      * @throws IllegalArgumentException if options is null
      */
-    public void addAll(Map options) {
+    public void addAll(Map<String, String> options) {
         if (options == null) {
             String msg = "options parameter cannot be null";
             throw new IllegalArgumentException(msg);
         }
-        for (Iterator i = options.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            Radio radio = new Radio(entry.getKey().toString(),
-                                    entry.getValue().toString());
+        for (Map.Entry<String, String> entry : options.entrySet()) {
+            Radio radio = new Radio(entry.getKey(), entry.getValue());
             add(radio);
         }
     }
@@ -258,7 +254,7 @@ public class RadioGroup extends Field {
      * @param label the name of the object property to render as the Radio label
      * @throws IllegalArgumentException if options, value or label parameter is null
      */
-    public void addAll(Collection objects, String value, String label) {
+    public void addAll(Collection<?> objects, String value, String label) {
         if (objects == null) {
             String msg = "objects parameter cannot be null";
             throw new IllegalArgumentException(msg);
@@ -276,7 +272,7 @@ public class RadioGroup extends Field {
             return;
         }
 
-        Map cache = new HashMap();
+        Map<?, ?> cache = new HashMap<Object, Object>();
 
         for (Object object : objects) {
             try {

Modified: click/trunk/click/framework/src/org/apache/click/control/Select.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Select.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Select.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Select.java Thu Jun 17 20:59:56
2010
@@ -319,7 +319,7 @@ public class Select extends Field {
      * The multiple selected values. This list will only be populated if
      * {@link #multiple} is true.
      */
-    protected List selectedValues;
+    protected List<String> selectedValues;
 
     /** The select data provider. */
     @SuppressWarnings("unchecked")
@@ -751,7 +751,7 @@ public class Select extends Field {
      *
      * @param multipleValues the list of selected values
      */
-    public void setMultipleValues(List multipleValues) {
+    public void setMultipleValues(List<String> multipleValues) {
         this.selectedValues = multipleValues;
     }
 
@@ -760,7 +760,7 @@ public class Select extends Field {
      *
      * @param multipleValues the list of selected values
      */
-    public void setSelectedValues(List multipleValues) {
+    public void setSelectedValues(List<String> multipleValues) {
         this.selectedValues = multipleValues;
     }
 
@@ -905,7 +905,7 @@ public class Select extends Field {
     @Override
     public void bindRequestValue() {
 
-        selectedValues = new ArrayList(5);
+        selectedValues = new ArrayList<String>(5);
 
         // Process single item select case.
         if (!isMultiple()) {

Modified: click/trunk/click/framework/src/org/apache/click/control/Table.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Table.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Table.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Table.java Thu Jun 17 20:59:56
2010
@@ -1534,8 +1534,9 @@ public class Table extends AbstractContr
      *
      * @return a new table row list
      */
-    protected List createRowList() {
-        DataProvider dp = getDataProvider();
+    @SuppressWarnings("unchecked")
+    protected List<Object> createRowList() {
+        DataProvider<?> dp = getDataProvider();
 
         List<Object> rowList = null;
 
@@ -1543,7 +1544,7 @@ public class Table extends AbstractContr
 
             boolean isPaginating = false;
 
-            if (dp instanceof PagingDataProvider) {
+            if (dp instanceof PagingDataProvider<?>) {
                 isPaginating = true;
             }
 
@@ -1553,7 +1554,7 @@ public class Table extends AbstractContr
                 // since the getData implementation could have a dependency
                 // on the methods getFirstRow, getLastRow etc all of which
                 // depends on the rowCount value
-                this.rowCount = ((PagingDataProvider) dp).size();
+                this.rowCount = ((PagingDataProvider<?>) dp).size();
 
                 // paginated datasets cannot be sorted by the table since it
                 // has access to only a limited number of rows. The dataset has
@@ -1563,11 +1564,11 @@ public class Table extends AbstractContr
                 setSorted(true);
             }
 
-            Iterable iterableData = dp.getData();
+            Iterable<?> iterableData = dp.getData();
 
             // If dataProvider returns a list, use that as the rowList
-            if (iterableData instanceof List) {
-                rowList = (List) iterableData;
+            if (iterableData instanceof List<?>) {
+                rowList = (List<Object>) iterableData;
 
             } else {
 

Modified: click/trunk/click/framework/src/org/apache/click/dataprovider/PagingDataProvider.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/dataprovider/PagingDataProvider.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/dataprovider/PagingDataProvider.java
(original)
+++ click/trunk/click/framework/src/org/apache/click/dataprovider/PagingDataProvider.java
Thu Jun 17 20:59:56 2010
@@ -89,7 +89,7 @@ package org.apache.click.dataprovider;
  *     }
  * } </pre>
  */
-public interface PagingDataProvider<T> extends DataProvider {
+public interface PagingDataProvider<T> extends DataProvider<T> {
 
     /**
      * Return the total number of results represented by this DataProvider.

Modified: click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java Thu Jun 17 20:59:56
2010
@@ -41,7 +41,6 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -185,7 +184,7 @@ public class ClickUtils {
      *         of the response content
      */
     public static void autoPostRedirect(HttpServletRequest request,
-            HttpServletResponse response, String target, Map params,
+            HttpServletResponse response, String target, Map<String, String> params,
             boolean compress) {
 
         Validate.notNull(request, "Null response parameter");
@@ -197,8 +196,7 @@ public class ClickUtils {
         buffer.append("<form name=\"form\" method=\"post\" style=\"{display:none;}\" action=\"");
         buffer.append(target);
         buffer.append("\">");
-        for (Iterator i = params.keySet().iterator(); i.hasNext();) {
-            String name = i.next().toString();
+        for (String name : params.keySet()) {
             String value = params.get(name).toString();
             buffer.elementStart("textarea");
             buffer.appendAttribute("name", name);
@@ -211,7 +209,7 @@ public class ClickUtils {
         // Determine whether browser will accept gzip compression
         if (compress) {
             compress = false;
-            Enumeration e = request.getHeaders("Accept-Encoding");
+            Enumeration<?> e = request.getHeaders("Accept-Encoding");
 
             while (e.hasMoreElements()) {
                 String name = (String) e.nextElement();
@@ -1344,7 +1342,8 @@ public class ClickUtils {
      * @param targetDir target directory where to deploy the files to. In most cases this
      * is only the reserved directory <code>click</code>
      */
-    public static void deployFileList(ServletContext servletContext, Class controlClass,
String targetDir) {
+    public static void deployFileList(ServletContext servletContext, 
+            Class<? extends Control> controlClass, String targetDir) {
 
         String packageName = ClassUtils.getPackageName(controlClass);
         packageName = StringUtils.replaceChars(packageName, '.', '/');
@@ -1366,7 +1365,7 @@ public class ClickUtils {
 
             // a target dir list is required cause the ClickUtils.deployFile() is too inflexible
to autodetect
             // required subdirectories.
-            List targetDirList = new ArrayList(fileList.size());
+            List<String> targetDirList = new ArrayList<String>(fileList.size());
             for (int i = 0; i < fileList.size(); i++) {
                 String filePath = (String) fileList.get(i);
                 String destination = "";
@@ -1380,7 +1379,7 @@ public class ClickUtils {
 
             for (int i = 0; i < fileList.size(); i++) {
                 String source = (String) fileList.get(i);
-                String targetDirName = (String) targetDirList.get(i);
+                String targetDirName = targetDirList.get(i);
                 ClickUtils.deployFile(servletContext, source, targetDirName);
             }
 
@@ -1863,7 +1862,7 @@ public class ClickUtils {
      * @param form the form to obtain the fields from
      * @return the list of contained form fields
      */
-    public static List getFormFields(Form form) {
+    public static List<Field> getFormFields(Form form) {
         if (form == null) {
             throw new IllegalArgumentException("Null form parameter");
         }
@@ -2078,11 +2077,11 @@ public class ClickUtils {
      * @param request the servlet request to obtain request parameters from
      * @return the ordered map of request parameters
      */
-    public static Map getRequestParameterMap(HttpServletRequest request) {
+    public static Map<String, Object> getRequestParameterMap(HttpServletRequest request)
{
 
-        TreeMap requestParams = new TreeMap();
+        TreeMap<String, Object> requestParams = new TreeMap<String, Object>();
 
-        Enumeration paramNames = request.getParameterNames();
+        Enumeration<?> paramNames = request.getParameterNames();
         while (paramNames.hasMoreElements()) {
             String name = paramNames.nextElement().toString();
 
@@ -2177,7 +2176,7 @@ public class ClickUtils {
      *     not found using the current <tt>Thread</tt> context <tt>ClassLoader</tt>.
      * @return the input stream of the resource if found or null otherwise
      */
-    public static InputStream getResourceAsStream(String name, Class aClass) {
+    public static InputStream getResourceAsStream(String name, Class<?> aClass) {
         Validate.notNull(name, "Parameter name is null");
         Validate.notNull(aClass, "Parameter aClass is null");
 
@@ -2204,7 +2203,7 @@ public class ClickUtils {
      *     not found using the current <tt>Thread</tt> context <tt>ClassLoader</tt>.
      * @return the URL of the resource if found or null otherwise
      */
-    public static URL getResource(String name, Class aClass) {
+    public static URL getResource(String name, Class<?> aClass) {
         Validate.notNull(name, "Parameter name is null");
         Validate.notNull(aClass, "Parameter aClass is null");
 
@@ -2322,8 +2321,8 @@ public class ClickUtils {
             char[] buffer = new char[32];
 
             for (int i = 0; i < 16; i++) {
-                int low = (int) (binaryData[i] & 0x0f);
-                int high = (int) ((binaryData[i] & 0xf0) >> 4);
+                int low = (binaryData[i] & 0x0f);
+                int high = ((binaryData[i] & 0xf0) >> 4);
                 buffer[i * 2] = HEXADECIMAL[high];
                 buffer[i * 2 + 1] = HEXADECIMAL[low];
             }
@@ -2683,7 +2682,7 @@ public class ClickUtils {
                 result = foundMethod.getReturnType().newInstance();
 
                 String setterName = toSetterName(value);
-                Class[] classArgs = { foundMethod.getReturnType() };
+                Class<?>[] classArgs = { foundMethod.getReturnType() };
 
                 Method setterMethod =
                     object.getClass().getMethod(setterName, classArgs);
@@ -2741,7 +2740,7 @@ public class ClickUtils {
         Method targetMethod = null;
         boolean isAccessible = true;
         try {
-            Class targetClass = target.getClass();
+            Class<?> targetClass = target.getClass();
             targetMethod = targetClass.getMethod(method);
 
             // Change accessible for anonymous inner classes public methods

Modified: click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java Thu Jun 17 20:59:56
2010
@@ -120,7 +120,7 @@ public class ContainerUtils {
 
         // If the given object is a map, its key/value pair is populated from
         // the fields name/value pair.
-        if (object instanceof Map) {
+        if (object instanceof Map<?, ?>) {
             copyFieldsToMap(fieldList, (Map) object);
             // Exit after populating the map.
             return;
@@ -129,7 +129,7 @@ public class ContainerUtils {
         LogService logService = ClickUtils.getLogService();
 
         Set<String> properties = getObjectPropertyNames(object);
-        Map ognlContext = new HashMap();
+        Map<?, ?> ognlContext = new HashMap<Object, Object>();
 
         for (Field field : fieldList) {
 
@@ -240,7 +240,7 @@ public class ContainerUtils {
 
         //If the given object is a map, populate the fields name/value from
         //the maps key/value pair.
-        if (object instanceof Map) {
+        if (object instanceof Map<?, ?>) {
 
             copyMapToFields((Map) object, fieldList);
             //Exit after populating the fields.
@@ -830,9 +830,9 @@ public class ContainerUtils {
 
         if (result == null) {
             // Find the target class of the object in the path to create
-            Class targetClass = getterMethod.getReturnType();
+            Class<?> targetClass = getterMethod.getReturnType();
 
-            Constructor constructor = null;
+            Constructor<?> constructor = null;
             try {
                 // Lookup default no-arg constructor
                 constructor = targetClass.getConstructor((Class[]) null);
@@ -891,7 +891,7 @@ public class ContainerUtils {
         String getterName = ClickUtils.toGetterName(property);
 
         Method method = null;
-        Class sourceClass = object.getClass();
+        Class<?> sourceClass = object.getClass();
 
         try {
             method = sourceClass.getMethod(getterName, (Class[]) null);
@@ -955,14 +955,14 @@ public class ContainerUtils {
      * @return the setter method
      */
     private final static Method findSetter(Object source,
-        String property, Class targetClass, String path) {
+        String property, Class<?> targetClass, String path) {
         Method method = null;
 
         // Find the setter for property
         String setterName = ClickUtils.toSetterName(property);
 
-        Class sourceClass = source.getClass();
-        Class[] classArgs = { targetClass };
+        Class<?> sourceClass = source.getClass();
+        Class<?>[] classArgs = { targetClass };
         try {
             method = sourceClass.getMethod(setterName, classArgs);
         } catch (Exception e) {

Modified: click/trunk/click/framework/src/org/apache/click/util/ErrorPage.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ErrorPage.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ErrorPage.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ErrorPage.java Thu Jun 17 20:59:56
2010
@@ -79,6 +79,7 @@ import org.apache.click.Page;
  * </ul>
  */
 public class ErrorPage extends Page {
+    private static final long serialVersionUID = 1L;
 
     /** The number of lines to display. */
     protected static final int NUMB_LINES = 8;
@@ -93,7 +94,7 @@ public class ErrorPage extends Page {
     protected String mode;
 
     /** The page class in error. */
-    protected Class pageClass;
+    protected Class<? extends Page> pageClass;
 
     // --------------------------------------------------------- Event Handlers
 
@@ -112,6 +113,7 @@ public class ErrorPage extends Page {
      *
      * @see Page#onInit()
      */
+    @Override
     public void onInit() {
         addModel("mode", getMode());
         Context context = getContext();
@@ -178,7 +180,7 @@ public class ErrorPage extends Page {
      *
      * @return the page class in error
      */
-    public Class getPageClass() {
+    public Class<? extends Page> getPageClass() {
         return pageClass;
     }
 
@@ -187,7 +189,7 @@ public class ErrorPage extends Page {
      *
      * @param pageClass the page class in error
      */
-    public void setPageClass(Class pageClass) {
+    public void setPageClass(Class<? extends Page> pageClass) {
         this.pageClass = pageClass;
     }
 }

Modified: click/trunk/click/framework/src/org/apache/click/util/Format.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/Format.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/Format.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/Format.java Thu Jun 17 20:59:56
2010
@@ -717,7 +717,7 @@ public class Format implements Serializa
      * @param arguments list of message arguments
      * @return the formatted string
      */
-    public String message(String pattern, List arguments) {
+    public String message(String pattern, List<?> arguments) {
         return message(pattern, arguments.toArray());
     }
 

Modified: click/trunk/click/framework/src/org/apache/click/util/PageImports.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/PageImports.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/PageImports.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/PageImports.java Thu Jun 17 20:59:56
2010
@@ -339,7 +339,6 @@ public class PageImports {
      *
      * @param controls the list of Controls which HEAD elements to process
      */
-    @SuppressWarnings("deprecation")
     public void processControls(List<Control> controls) {
         for (Control control : controls) {
 
@@ -497,7 +496,6 @@ public class PageImports {
     /**
      * Process the Page's set of control HEAD elements.
      */
-    @SuppressWarnings("deprecation")
     protected void processPageControls() {
         if (isInitialized()) {
             return;

Modified: click/trunk/click/framework/src/org/apache/velocity/tools/view/WebappResourceLoader.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/velocity/tools/view/WebappResourceLoader.java?rev=955743&r1=955742&r2=955743&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/velocity/tools/view/WebappResourceLoader.java
(original)
+++ click/trunk/click/framework/src/org/apache/velocity/tools/view/WebappResourceLoader.java
Thu Jun 17 20:59:56 2010
@@ -55,7 +55,7 @@ public class WebappResourceLoader extend
 {
     /** The root paths for templates (relative to webapp's root). */
     protected String[] paths = null;
-    protected HashMap templatePaths = null;
+    protected HashMap<String, String> templatePaths = null;
     protected ServletContext servletContext = null;
 
 
@@ -69,6 +69,7 @@ public class WebappResourceLoader extend
      * @param configuration the {@link ExtendedProperties} associated with
      *        this resource loader.
      */
+    @Override
     public void init(ExtendedProperties configuration)
     {
         log.trace("WebappResourceLoader: initialization starting.");
@@ -105,7 +106,7 @@ public class WebappResourceLoader extend
         }
 
         /* init the template paths map */
-        templatePaths = new HashMap();
+        templatePaths = new HashMap<String, String>();
 
         log.trace("WebappResourceLoader: initialization complete.");
     }
@@ -119,6 +120,7 @@ public class WebappResourceLoader extend
      * @throws ResourceNotFoundException if template not found
      *         in  classpath.
      */
+    @Override
     public synchronized InputStream getResourceStream(String name)
         throws ResourceNotFoundException
     {
@@ -198,7 +200,7 @@ public class WebappResourceLoader extend
             fileName = fileName.substring(1);
         }
 
-        String savedPath = (String)templatePaths.get(fileName);
+        String savedPath = templatePaths.get(fileName);
         return new File(rootPath + savedPath, fileName);
     }
 
@@ -209,6 +211,7 @@ public class WebappResourceLoader extend
      * @param resource Resource  The resource to check for modification
      * @return boolean  True if the resource has been modified
      */
+    @Override
     public boolean isSourceModified(Resource resource)
     {
         String rootPath = servletContext.getRealPath("/");
@@ -262,6 +265,7 @@ public class WebappResourceLoader extend
      * @param resource Resource the resource to check
      * @return long The time when the resource was last modified or 0 if the file can't be
read
      */
+    @Override
     public long getLastModified(Resource resource)
     {
         String rootPath = servletContext.getRealPath("/");



Mime
View raw message