click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bck...@apache.org
Subject svn commit: r961690 - in /click/trunk/click/extras/src/org/apache/click/extras: control/ filter/ gae/ hibernate/ spring/ tree/
Date Thu, 08 Jul 2010 10:27:36 GMT
Author: bckfnn
Date: Thu Jul  8 10:27:35 2010
New Revision: 961690

URL: http://svn.apache.org/viewvc?rev=961690&view=rev
Log:
generics. CLK-696

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java
    click/trunk/click/extras/src/org/apache/click/extras/control/CheckList.java
    click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java
    click/trunk/click/extras/src/org/apache/click/extras/control/FieldColumn.java
    click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java
    click/trunk/click/extras/src/org/apache/click/extras/control/HiddenList.java
    click/trunk/click/extras/src/org/apache/click/extras/control/HtmlForm.java
    click/trunk/click/extras/src/org/apache/click/extras/control/LinkDecorator.java
    click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java
    click/trunk/click/extras/src/org/apache/click/extras/control/PageSubmit.java
    click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
    click/trunk/click/extras/src/org/apache/click/extras/control/TabbedForm.java
    click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java
    click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java
    click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java
    click/trunk/click/extras/src/org/apache/click/extras/gae/MemoryFileItem.java
    click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java
    click/trunk/click/extras/src/org/apache/click/extras/hibernate/SessionContext.java
    click/trunk/click/extras/src/org/apache/click/extras/spring/PageScopeResolver.java
    click/trunk/click/extras/src/org/apache/click/extras/spring/SpringClickServlet.java
    click/trunk/click/extras/src/org/apache/click/extras/tree/CheckboxTree.java
    click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java
    click/trunk/click/extras/src/org/apache/click/extras/tree/TreeNode.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/AutoCompleteTextField.java Thu Jul  8 10:27:35 2010
@@ -186,7 +186,7 @@ public abstract class AutoCompleteTextFi
      * @param criteria the search criteria
      * @return the list of suggested values for the given search criteria
      */
-    abstract public List getAutoCompleteList(String criteria);
+    abstract public List<String> getAutoCompleteList(String criteria);
 
     // Public Methods ---------------------------------------------------------
 
@@ -456,7 +456,7 @@ public abstract class AutoCompleteTextFi
                 String contentType = getPage().getContentType();
                 partial.setContentType(contentType);
 
-                List autocompleteList = getAutoCompleteList(getValue());
+                List<String> autocompleteList = getAutoCompleteList(getValue());
                 if (autocompleteList != null) {
                     HtmlStringBuffer buffer = new HtmlStringBuffer(10 + (autocompleteList.size() * 20));
                     renderAutoCompleteList(buffer, autocompleteList);

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/CheckList.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/CheckList.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/CheckList.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/CheckList.java Thu Jul  8 10:27:35 2010
@@ -23,7 +23,6 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -211,8 +210,7 @@ public class CheckList extends Field {
     // Instance Variables -----------------------------------------------------
 
     /** The select data provider. */
-    @SuppressWarnings("unchecked")
-    protected DataProvider dataProvider;
+    protected DataProvider<Option> dataProvider;
 
     /** The height if null not scrollable. */
     protected String height;
@@ -386,13 +384,12 @@ public class CheckList extends Field {
      * @param options the Map of option values and labels to add
      * @throws IllegalArgumentException if options is null
      */
-    public void addAll(Map options) {
+    public void addAll(Map<?, ?> 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();
+        for (Map.Entry<?, ?> entry : options.entrySet()) {
             Option option = new Option(entry.getKey().toString(), entry
                     .getValue().toString());
             getOptionList().add(option);
@@ -443,7 +440,7 @@ public class CheckList extends Field {
      * @throws IllegalArgumentException if objects or optionValueProperty
      * parameter is null
      */
-    public void addAll(Collection objects, String optionValueProperty,
+    public void addAll(Collection<?> objects, String optionValueProperty,
         String optionLabelProperty) {
         if (objects == null) {
             String msg = "objects parameter cannot be null";
@@ -458,11 +455,9 @@ public class CheckList extends Field {
             return;
         }
 
-        Map methodCache = new HashMap();
-
-        for (Iterator i = objects.iterator(); i.hasNext();) {
-            Object object = i.next();
+        Map<?, ?> methodCache = new HashMap<Object, Object>();
 
+        for (Object object : objects) {
             try {
                 Object valueResult = PropertyUtils.getValue(object,
                     optionValueProperty, methodCache);
@@ -498,8 +493,7 @@ public class CheckList extends Field {
      *
      * @return the CheckList optionList DataProvider
      */
-    @SuppressWarnings("unchecked")
-    public DataProvider getDataProvider() {
+    public DataProvider<Option> getDataProvider() {
         return dataProvider;
     }
 
@@ -524,8 +518,7 @@ public class CheckList extends Field {
      *
      * @param dataProvider the CheckList option list DataProvider
      */
-    @SuppressWarnings("unchecked")
-    public void setDataProvider(DataProvider dataProvider) {
+    public void setDataProvider(DataProvider<Option> dataProvider) {
         this.dataProvider = dataProvider;
         if (dataProvider != null) {
             if (optionList != null) {
@@ -725,14 +718,14 @@ public class CheckList extends Field {
     public List<Option> getOptionList() {
         if (optionList == null) {
 
-            DataProvider dp = getDataProvider();
+            DataProvider<Option> dp = getDataProvider();
 
             if (dp != null) {
-                Iterable iterableData = dp.getData();
+                Iterable<Option> iterableData = dp.getData();
 
-                if (iterableData instanceof List) {
+                if (iterableData instanceof List<?>) {
                     // Set optionList to data
-                    setOptionList((List) iterableData);
+                    setOptionList((List<Option>) iterableData);
 
                 } else {
                     // Create and populate the optionList from the Iterable data
@@ -860,7 +853,7 @@ public class CheckList extends Field {
      *
      * @param selectedValues the list of selected string values or null
      */
-    public void setSelectedValues(List selectedValues) {
+    public void setSelectedValues(List<String> selectedValues) {
         this.selectedValues = selectedValues;
     }
 
@@ -890,10 +883,11 @@ public class CheckList extends Field {
      *
      * @param object a List of Strings
      */
+    @SuppressWarnings("unchecked")
     @Override
     public void setValueObject(Object object) {
-        if (object instanceof List) {
-            setSelectedValues((List) object);
+        if (object instanceof List<?>) {
+            setSelectedValues((List<String>) object);
         }
     }
 
@@ -965,15 +959,15 @@ public class CheckList extends Field {
      * @param order values in the order to sort the list.
      */
     protected void sortOptions(String[] order) {
-        final List options = getOptionList();
-        final List orderList = new ArrayList(options.size());
+        final List<Option> options = getOptionList();
+        final List<Option> orderList = new ArrayList<Option>(options.size());
 
         for (int i = 0, size = order.length; i < size; i++) {
             String value = order[i];
             if (value != null) {
                 int oI = -1;
                 for (int j = 0, jSize = options.size(); j < jSize; j++) {
-                    Option optT = (Option) options.get(j);
+                    Option optT = options.get(j);
                     if (value.equals(optT.getValue())) {
                         oI = j;
                     }
@@ -1044,11 +1038,10 @@ public class CheckList extends Field {
         buffer.closeTag();
 
         // the options
-        List optionsList = getOptionList();
+        List<Option> optionsList = getOptionList();
         if (!optionsList.isEmpty()) {
             int i = -1;
-            for (Iterator it = optionsList.iterator(); it.hasNext();) {
-                Option option = (Option) it.next();
+            for (Option option : optionsList) {
                 i++;
 
                 buffer.append("<li>");
@@ -1072,7 +1065,7 @@ public class CheckList extends Field {
                 }
 
                 // set checked status
-                List values = getSelectedValues();
+                List<String> values = getSelectedValues();
                 for (int k = 0; k < values.size(); k++) {
                     if (String.valueOf(values.get(k)).equals(option.getValue())) {
                         buffer.appendAttribute("checked", "checked");

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/CountrySelect.java Thu Jul  8 10:27:35 2010
@@ -212,7 +212,7 @@ public class CountrySelect extends Selec
             return;
         }
 
-        Set countryList = new TreeSet(new OptionLabelComparator(getLocale()));
+        Set<Option> countryList = new TreeSet<Option>(new OptionLabelComparator(getLocale()));
 
         Locale[] availableLocales = Locale.getAvailableLocales();
 
@@ -237,10 +237,10 @@ public class CountrySelect extends Selec
     /**
      * Provides a comparator for Option labels with locale-sensitive behaviour.
      */
-    static class OptionLabelComparator implements Comparator {
+    static class OptionLabelComparator implements Comparator<Option> {
 
         /** The locale comparator. */
-        private final Comparator comparator;
+        private final Comparator<Object> comparator;
 
         /**
          * Creates a new OptionLabelComparator object.
@@ -260,11 +260,8 @@ public class CountrySelect extends Selec
          * @param o2 The second Option to compare.
          * @return The value returned by comparing the localized labels.
          */
-        public final int compare(Object o1, Object o2) {
-            Option lhs = (Option) o1;
-            Option rhs = (Option) o2;
-
-            return comparator.compare(lhs.getLabel(), rhs.getLabel());
+        public final int compare(Option o1, Option o2) {
+            return comparator.compare(o1.getLabel(), o2.getLabel());
         }
     }
 }

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/FieldColumn.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/FieldColumn.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/FieldColumn.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/FieldColumn.java Thu Jul  8 10:27:35 2010
@@ -69,7 +69,7 @@ public class FieldColumn extends Column 
     protected Field field;
 
     /** The ognl context map. */
-    private transient Map ognlContext;
+    private transient Map<?, ?> ognlContext;
 
     // ----------------------------------------------------------- Constructors
 
@@ -172,16 +172,17 @@ public class FieldColumn extends Column 
      * @param value the row object property value
      * @throws RuntimeException if an error occurred obtaining the property
      */
+    @SuppressWarnings("unchecked")
     public void setProperty(Object row, String propertyName, Object value) {
-        if (row instanceof Map) {
-            Map map = (Map) row;
+        if (row instanceof Map<?, ?>) {
+            Map<Object, Object> map = (Map<Object, Object>) row;
             if (map.containsKey(propertyName)) {
                 map.put(propertyName, value);
             }
 
         } else {
             if (ognlContext == null) {
-                ognlContext = new HashMap();
+                ognlContext = new HashMap<Object, Object>();
             }
 
             try {
@@ -208,6 +209,7 @@ public class FieldColumn extends Column 
      * @param context the request context
      * @param rowIndex the index of the current row within the parent table
      */
+    @Override
     protected void renderTableDataContent(Object row, HtmlStringBuffer buffer,
             Context context, int rowIndex) {
 

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/FormTable.java Thu Jul  8 10:27:35 2010
@@ -527,22 +527,20 @@ public class FormTable extends Table {
                 int firstRow = 0;
                 int lastRow = 0;
 
-                if (getDataProvider() instanceof PagingDataProvider) {
+                if (getDataProvider() instanceof PagingDataProvider<?>) {
                     lastRow = getRowList().size();
                 } else {
                     firstRow = getFirstRow();
                     lastRow = getLastRow();
                 }
 
-                List rowList = getRowList();
-                List columnList = getColumnList();
+                List<?> rowList = getRowList();
+                List<Column> columnList = getColumnList();
 
                 for (int i = firstRow; i < lastRow; i++) {
                     Object row = rowList.get(i);
 
-                    for (int j = 0; j < columnList.size(); j++) {
-
-                        Column column = (Column) columnList.get(j);
+                    for (Column column : columnList) {
 
                         if (column instanceof FieldColumn) {
                             FieldColumn fieldColumn = (FieldColumn) column;
@@ -626,7 +624,7 @@ public class FormTable extends Table {
     protected void renderButtons(HtmlStringBuffer buffer) {
         Form form = getForm();
 
-        List buttonList = form.getButtonList();
+        List<Button> buttonList = form.getButtonList();
         if (!buttonList.isEmpty()) {
             buffer.append("<table cellpadding=\"0\" cellspacing=\"0\"");
             if (getAttribute("width") != null) {
@@ -639,12 +637,11 @@ public class FormTable extends Table {
             buffer.append(getId());
             buffer.append("-buttons\"><tbody>\n");
             buffer.append("<tr class=\"buttons\">");
-            for (int i = 0, size = buttonList.size(); i < size; i++) {
+            for (Button button : buttonList) {
                 buffer.append("<td class=\"buttons\"");
                 buffer.appendAttribute("style", form.getButtonStyle());
                 buffer.closeTag();
 
-                Button button = (Button) buttonList.get(i);
                 button.render(buffer);
 
                 buffer.append("</td>");

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/HiddenList.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/HiddenList.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/HiddenList.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/HiddenList.java Thu Jul  8 10:27:35 2010
@@ -58,7 +58,7 @@ public class HiddenList extends Field {
     // Instance Variables -----------------------------------------------------
 
     /** The hidden values. */
-    protected List valueObject;
+    protected List<String> valueObject;
 
     // Constructors -----------------------------------------------------------
 
@@ -86,13 +86,14 @@ public class HiddenList extends Field {
      *
      * @param valueObject a list of Strings
      */
+    @SuppressWarnings("unchecked")
     @Override
     public void setValueObject(Object valueObject) {
-        if (!(valueObject instanceof List)) {
+        if (!(valueObject instanceof List<?>)) {
             throw new IllegalArgumentException("the valueObject must be a"
                 + " List.");
         }
-        this.valueObject = (List) valueObject;
+        this.valueObject = (List<String>) valueObject;
     }
 
     /**
@@ -103,7 +104,7 @@ public class HiddenList extends Field {
     @Override
     public Object getValueObject() {
         if (this.valueObject == null) {
-            this.valueObject = new ArrayList();
+            this.valueObject = new ArrayList<String>();
         }
         return this.valueObject;
     }
@@ -114,8 +115,9 @@ public class HiddenList extends Field {
      *
      * @return a list of Strings
      */
-    public List getValues() {
-        return (List) getValueObject();
+    @SuppressWarnings("unchecked")
+    public List<String> getValues() {
+        return (List<String>) getValueObject();
     }
 
     /**
@@ -143,7 +145,7 @@ public class HiddenList extends Field {
         String[] values = getContext().getRequestParameterValues(getName());
 
         if (values != null) {
-            List list = new ArrayList();
+            List<String> list = new ArrayList<String>();
             for (int i = 0; i < values.length; i++) {
                 list.add(values[i]);
             }
@@ -172,7 +174,7 @@ public class HiddenList extends Field {
      */
     @Override
     public void render(HtmlStringBuffer buffer) {
-        List values = getValues();
+        List<String> values = getValues();
 
         for (int i = 0; i < values.size(); i++) {
             buffer.elementStart("input");

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/HtmlForm.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/HtmlForm.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/HtmlForm.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/HtmlForm.java Thu Jul  8 10:27:35 2010
@@ -18,12 +18,10 @@
  */
 package org.apache.click.extras.control;
 
-import java.util.Iterator;
 import java.util.List;
 import org.apache.click.Control;
 import org.apache.click.control.Field;
 import org.apache.click.control.Form;
-import org.apache.click.service.FileUploadService;
 import org.apache.click.util.ContainerUtils;
 import org.apache.click.util.HtmlStringBuffer;
 
@@ -157,9 +155,8 @@ public class HtmlForm extends Form {
     @Override
     protected void renderContent(HtmlStringBuffer buffer) {
         // Render hidden fields
-        List fields = ContainerUtils.getInputFields(this);
-        for (Iterator it = fields.iterator(); it.hasNext();) {
-            Field field = (Field) it.next();
+        List<Field> fields = ContainerUtils.getInputFields(this);
+        for (Field field : fields) {
             if (field.isHidden()) {
                 field.render(buffer);
                 buffer.append("\n");
@@ -203,7 +200,7 @@ public class HtmlForm extends Form {
      * @return the estimated rendered control size in characters
      */
     @Override
-    protected int getFormSizeEst(List formFields) {
+    protected int getFormSizeEst(List<Field> formFields) {
         return 400 + (getControls().size() * 350);
     }
 }

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/LinkDecorator.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/LinkDecorator.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/LinkDecorator.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/LinkDecorator.java Thu Jul  8 10:27:35 2010
@@ -172,7 +172,7 @@ public class LinkDecorator implements De
     protected Table table;
 
     /** The method cached for rendering column values. */
-    protected transient Map methodCache;
+    protected transient Map<?, ?> methodCache;
 
     /** An optional parameter name for the {@link #idProperty}. */
     protected String parameterName;
@@ -419,7 +419,7 @@ public class LinkDecorator implements De
      * @param controls the list of AbstractLink or ActionButtons to render
      * @param idProperty the row object identifier property name
      */
-    public LinkDecorator(Table table, List controls, String idProperty) {
+    public LinkDecorator(Table table, List<AbstractControl> controls, String idProperty) {
         if (table == null) {
             throw new IllegalArgumentException("Null table parameter");
         }
@@ -530,7 +530,7 @@ public class LinkDecorator implements De
      */
     public String renderActionLinks(Object row, Context context) {
         if (methodCache == null) {
-            methodCache = new HashMap();
+            methodCache = new HashMap<Object, Object>();
         }
 
         Object value = PropertyUtils.getValue(row, idProperty, methodCache);
@@ -578,7 +578,7 @@ public class LinkDecorator implements De
      */
     public String renderActionButtons(Object row, Context context) {
         if (methodCache == null) {
-            methodCache = new HashMap();
+            methodCache = new HashMap<Object, Object>();
         }
 
         Object value = PropertyUtils.getValue(row, idProperty, methodCache);
@@ -734,6 +734,7 @@ public class LinkDecorator implements De
         /**
          * @see org.apache.click.Control#onProcess()
          */
+        @Override
         public boolean onProcess() {
             Context context = getContext();
             if (anyLinkOrButtonClicked()) {

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/Menu.java Thu Jul  8 10:27:35 2010
@@ -20,7 +20,6 @@ package org.apache.click.extras.control;
 
 import java.io.InputStream;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.StringTokenizer;
 
@@ -1250,9 +1249,7 @@ public class Menu extends AbstractContro
         buffer.closeTag();
         buffer.append("\n");
 
-        Iterator it = menu.getChildren().iterator();
-        while (it.hasNext()) {
-            Menu child = (Menu) it.next();
+        for (Menu child : menu.getChildren()) {
 
             if (canRender(child, depth)) {
 

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/PageSubmit.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/PageSubmit.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/PageSubmit.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/PageSubmit.java Thu Jul  8 10:27:35 2010
@@ -89,7 +89,7 @@ public class PageSubmit extends Submit {
      * @param name the button name
      * @param pageClass the target page class
      */
-    public PageSubmit(String name, Class pageClass) {
+    public PageSubmit(String name, Class<? extends Page> pageClass) {
         super(name);
 
         setPageClass(pageClass);
@@ -104,7 +104,7 @@ public class PageSubmit extends Submit {
      * @param label the button display label
      * @param pageClass the target page class
      */
-    public PageSubmit(String name, String label, Class pageClass) {
+    public PageSubmit(String name, String label, Class<? extends Page> pageClass) {
         super(name, label);
 
         setPageClass(pageClass);
@@ -129,7 +129,7 @@ public class PageSubmit extends Submit {
      *
      * @return the target page class to redirect to
      */
-    public Class getPageClass() {
+    public Class<? extends Page> getPageClass() {
         return pageClass;
     }
 
@@ -138,7 +138,7 @@ public class PageSubmit extends Submit {
      *
      * @param pageClass the target page class to redirect to
      */
-    public void setPageClass(Class pageClass) {
+    public void setPageClass(Class<? extends Page> pageClass) {
         if (pageClass == null) {
             throw new IllegalArgumentException("null pageClass parameter");
         }

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java Thu Jul  8 10:27:35 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;
@@ -202,8 +201,7 @@ public class PickList extends Field {
     // Instance Variables -----------------------------------------------------
 
     /** The select data provider. */
-    @SuppressWarnings("unchecked")
-    protected DataProvider dataProvider;
+    protected DataProvider<Option> dataProvider;
 
     /**
      * The list height. The default height is 8.
@@ -213,7 +211,7 @@ public class PickList extends Field {
     /**
      * The Option list.
      */
-    protected List optionList;
+    protected List<Option> optionList;
 
     /**
      * The label text for the selected list.
@@ -223,7 +221,7 @@ public class PickList extends Field {
     /**
      * The selected values.
      */
-    protected List selectedValues;
+    protected List<String> selectedValues;
 
     /**
      * The component size (width) in pixels. The default size is 400px.
@@ -289,7 +287,7 @@ public class PickList extends Field {
      */
     public void add(Object option) {
         if (option instanceof Option) {
-            getOptionList().add(option);
+            getOptionList().add((Option) option);
 
         } else if (option instanceof String) {
             getOptionList().add(new Option(option.toString()));
@@ -340,13 +338,12 @@ public class PickList extends Field {
      * @param options the Map of option values and labels to add
      * @throws IllegalArgumentException if options is null
      */
-    public void addAll(Map options) {
+    public void addAll(Map<?, ?> 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();
+        for (Map.Entry<?, ?> entry : options.entrySet()) {
             Option option = new Option(entry.getKey().toString(), entry
                     .getValue().toString());
             getOptionList().add(option);
@@ -398,7 +395,7 @@ public class PickList extends Field {
      * @throws IllegalArgumentException if objects or optionValueProperty
      * parameter is null
      */
-    public void addAll(Collection objects, String optionValueProperty,
+    public void addAll(Collection<?> objects, String optionValueProperty,
         String optionLabelProperty) {
         if (objects == null) {
             String msg = "objects parameter cannot be null";
@@ -413,11 +410,9 @@ public class PickList extends Field {
             return;
         }
 
-        Map methodCache = new HashMap();
-
-        for (Iterator i = objects.iterator(); i.hasNext();) {
-            Object object = i.next();
+        Map<?, ?> methodCache = new HashMap<Object, Object>();
 
+        for (Object object : objects) {
             try {
                 Object valueResult = PropertyUtils.getValue(object,
                     optionValueProperty, methodCache);
@@ -453,8 +448,7 @@ public class PickList extends Field {
      *
      * @return the PickList optionList DataProvider
      */
-    @SuppressWarnings("unchecked")
-    public DataProvider getDataProvider() {
+    public DataProvider<Option> getDataProvider() {
         return dataProvider;
     }
 
@@ -509,21 +503,21 @@ public class PickList extends Field {
      *
      * @return the Option list
      */
-    public List getOptionList() {
+    public List<Option> getOptionList() {
         if (optionList == null) {
 
-            DataProvider dp = getDataProvider();
+            DataProvider<Option> dp = getDataProvider();
 
             if (dp != null) {
-                Iterable iterableData = dp.getData();
+                Iterable<Option> iterableData = dp.getData();
 
-                if (iterableData instanceof List) {
+                if (iterableData instanceof List<?>) {
                     // Set optionList to data
-                    setOptionList((List) iterableData);
+                    setOptionList((List<Option>) iterableData);
 
                 } else {
                     // Create and populate the optionList from the Iterable data
-                    optionList = new ArrayList();
+                    optionList = new ArrayList<Option>();
 
                     if (iterableData != null) {
                         // Populate optionList from options
@@ -534,7 +528,7 @@ public class PickList extends Field {
                 }
             } else {
                 // Create empty list
-                optionList = new ArrayList();
+                optionList = new ArrayList<Option>();
             }
         }
         return optionList;
@@ -545,7 +539,7 @@ public class PickList extends Field {
      *
      * @param options the Option list
      */
-    public void setOptionList(List options) {
+    public void setOptionList(List<Option> options) {
         optionList = options;
     }
 
@@ -612,7 +606,7 @@ public class PickList extends Field {
      * @param value the name of the object property to render as the Option value
      * @throws IllegalArgumentException if options or value parameter is null
      */
-    public void setSelectedValues(Collection objects, String value) {
+    public void setSelectedValues(Collection<?> objects, String value) {
         if (objects == null) {
             String msg = "objects parameter cannot be null";
             throw new IllegalArgumentException(msg);
@@ -626,11 +620,9 @@ public class PickList extends Field {
             return;
         }
 
-        Map cache = new HashMap();
-
-        for (Iterator i = objects.iterator(); i.hasNext();) {
-            Object object = i.next();
+        Map<?, ?> cache = new HashMap<Object, Object>();
 
+        for (Object object : objects) {
             try {
                 Object valueResult = PropertyUtils.getValue(object, value, cache);
 
@@ -664,9 +656,9 @@ public class PickList extends Field {
      *
      * @return selected values as a List of Strings
      */
-    public List getSelectedValues() {
+    public List<String> getSelectedValues() {
         if (selectedValues == null) {
-            selectedValues = new ArrayList();
+            selectedValues = new ArrayList<String>();
         }
         return selectedValues;
     }
@@ -696,7 +688,7 @@ public class PickList extends Field {
      *
      * @param selectedValues the list of selected string values or null
      */
-    public void setSelectedValues(List selectedValues) {
+    public void setSelectedValues(List<String> selectedValues) {
         this.selectedValues = selectedValues;
     }
 
@@ -727,10 +719,11 @@ public class PickList extends Field {
      *
      * @param object a List of Strings
      */
+    @SuppressWarnings("unchecked")
     @Override
     public void setValueObject(Object object) {
-        if (object instanceof List) {
-            setSelectedValues((List) object);
+        if (object instanceof List<?>) {
+            setSelectedValues((List<String>) object);
         }
     }
 
@@ -780,7 +773,7 @@ public class PickList extends Field {
     public void bindRequestValue() {
 
         // Load the selected items.
-        this.selectedValues = new ArrayList();
+        this.selectedValues = new ArrayList<String>();
 
         String[] values =
             getContext().getRequest().getParameterValues(getName());
@@ -806,7 +799,7 @@ public class PickList extends Field {
     @Override
     public void validate() {
         setError(null);
-        List values = getSelectedValues();
+        List<String> values = getSelectedValues();
 
         if (values.size() > 0) {
             return;
@@ -827,13 +820,12 @@ public class PickList extends Field {
      */
     @Override
     public void render(HtmlStringBuffer buffer) {
-        List optionList     = getOptionList();
-        List selectedValues = getSelectedValues();
-        List options        = new ArrayList();
-
-        for (int i = 0; i < optionList.size(); i++) {
-            Option option = (Option) optionList.get(i);
-            Map map = new HashMap();
+        List<Option> optionList      = getOptionList();
+        List<String> selectedValues  = getSelectedValues();
+        List<Map<String, Object>> options = new ArrayList<Map<String, Object>>();
+
+        for (Option option : optionList) {
+            Map<String, Object> map = new HashMap<String, Object>();
             map.put("option", option);
             map.put("selected", new Boolean(selectedValues.contains(option.getValue())));
             options.add(map);
@@ -867,7 +859,7 @@ public class PickList extends Field {
             setAttribute("class", cssClass);
         }
 
-        Map model = new HashMap();
+        Map<String, Object> model = new HashMap<String, Object>();
 
         model.put("id", getId());
         model.put("attributes", attributesBuffer.toString());
@@ -907,7 +899,7 @@ public class PickList extends Field {
      * @param buffer the specified buffer to render the template output to
      * @param model the model data to merge with the template
      */
-    protected void renderTemplate(HtmlStringBuffer buffer, Map model) {
+    protected void renderTemplate(HtmlStringBuffer buffer, Map<String, Object> model) {
         buffer.append(getContext().renderTemplate(PickList.class, model));
     }
 

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/TabbedForm.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/TabbedForm.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/TabbedForm.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/TabbedForm.java Thu Jul  8 10:27:35 2010
@@ -155,7 +155,7 @@ public class TabbedForm extends Form {
     protected String tabHeight = "";
 
     /** The list of FieldSet tab sheets. */
-    protected List tabSheets = new ArrayList();
+    protected List<FieldSet> tabSheets = new ArrayList<FieldSet>();
 
     /** The tab sheet width HTML attribute value. */
     protected String tabWidth = "";
@@ -292,7 +292,7 @@ public class TabbedForm extends Form {
      *
      * @return list FieldSet tab sheets
      */
-    public List getTabSheets() {
+    public List<FieldSet> getTabSheets() {
         return tabSheets;
     }
 
@@ -305,7 +305,7 @@ public class TabbedForm extends Form {
      */
     public int getTabSheetNumber(String fieldName) {
         for (int i = 0; i < getTabSheets().size(); i++) {
-            FieldSet fieldSet = (FieldSet) getTabSheets().get(i);
+            FieldSet fieldSet = getTabSheets().get(i);
             if (fieldSet.getFields().containsKey(fieldName)) {
                 return i + 1;
             }
@@ -363,9 +363,9 @@ public class TabbedForm extends Form {
         boolean result = super.onProcess();
 
         if (!isValid()) {
-            List errorFields = getErrorFields();
+            List<Field> errorFields = getErrorFields();
             if (!errorFields.isEmpty()) {
-                Field field = (Field) errorFields.get(0);
+                Field field = errorFields.get(0);
                 int sheetNumber = getTabSheetNumber(field.getName());
                 setDisplayTab(sheetNumber);
             }
@@ -383,7 +383,7 @@ public class TabbedForm extends Form {
      */
     @Override
     public void render(HtmlStringBuffer buffer) {
-        Map model = new HashMap();
+        Map<String, Object> model = new HashMap<String, Object>();
         model.put("form", this);
 
         buffer.append(getContext().renderTemplate(getTemplate(), model));

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/TableInlinePaginator.java Thu Jul  8 10:27:35 2010
@@ -51,7 +51,7 @@ public class TableInlinePaginator extend
          * <tt>org/apache/click/extras/control/TableInlinePaginator.properties</tt>.
          */
         @Override
-        public Map getMessages() {
+        public Map<String, String> getMessages() {
             if (messages == null) {
                 messages = new MessagesMap(TableInlinePaginator.class, "");
             }

Modified: click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java Thu Jul  8 10:27:35 2010
@@ -226,7 +226,7 @@ public class CompressionFilter implement
                 return false;
             }
 
-            Enumeration e = request.getHeaders("Accept-Encoding");
+            Enumeration<?> e = request.getHeaders("Accept-Encoding");
 
             while (e.hasMoreElements()) {
                 String name = (String) e.nextElement();

Modified: click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java Thu Jul  8 10:27:35 2010
@@ -294,16 +294,16 @@ public class PerformanceFilter implement
     protected FilterConfig filterConfig = null;
 
     /** The cacheable-path include directories. */
-    protected List includeDirs = new ArrayList();
+    protected List<String> includeDirs = new ArrayList<String>();
 
     /** The cacheable-path include files. */
-    protected List includeFiles = new ArrayList();
+    protected List<String> includeFiles = new ArrayList<String>();
 
     /** The cacheable-path exclude directories. */
-    protected List excludeDirs = new ArrayList();
+    protected List<String> excludeDirs = new ArrayList<String>();
 
     /** The cacheable-path exclude files. */
-    protected List excludeFiles = new ArrayList();
+    protected List<String> excludeFiles = new ArrayList<String>();
 
     /** The application resource version indicator. */
     protected String applicationVersionIndicator = "";
@@ -751,7 +751,7 @@ public class PerformanceFilter implement
                 return false;
             }
 
-            Enumeration e = request.getHeaders("Accept-Encoding");
+            Enumeration<?> e = request.getHeaders("Accept-Encoding");
 
             while (e.hasMoreElements()) {
                 String name = (String) e.nextElement();

Modified: click/trunk/click/extras/src/org/apache/click/extras/gae/MemoryFileItem.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/gae/MemoryFileItem.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/gae/MemoryFileItem.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/gae/MemoryFileItem.java Thu Jul  8 10:27:35 2010
@@ -310,7 +310,7 @@ public class MemoryFileItem implements F
         ParameterParser parser = new ParameterParser();
         parser.setLowerCaseNames(true);
         // Parameter parser can handle null input
-        Map params = parser.parse(getContentType(), ';');
+        Map<?, ?> params = parser.parse(getContentType(), ';');
         return (String) params.get("charset");
     }
 }

Modified: click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java Thu Jul  8 10:27:35 2010
@@ -162,7 +162,7 @@ public class HibernateForm extends Form 
      * @param name the form name
      * @param valueClass the value object class
      */
-    public HibernateForm(String name, Class valueClass) {
+    public HibernateForm(String name, Class<?> valueClass) {
         super(name);
 
         if (valueClass == null) {
@@ -249,7 +249,7 @@ public class HibernateForm extends Form 
     public Object getValueObject() {
         if (StringUtils.isNotBlank(classField.getValue())) {
             try {
-                Class valueClass = ClickUtils.classForName(classField.getValue());
+                Class<?> valueClass = ClickUtils.classForName(classField.getValue());
 
                 Serializable oid = (Serializable) oidField.getValueObject();
 
@@ -350,6 +350,7 @@ public class HibernateForm extends Form 
      *
      * @return true to continue Page event processing or false otherwise
      */
+    @Override
     public boolean onProcess() {
         applyMetaData();
         return super.onProcess();
@@ -365,6 +366,7 @@ public class HibernateForm extends Form 
      *
      * @param buffer the specified buffer to render the control's output to
      */
+    @Override
     public void render(HtmlStringBuffer buffer) {
         applyMetaData();
         super.render(buffer);
@@ -387,7 +389,7 @@ public class HibernateForm extends Form 
         }
 
         try {
-            Class valueClass = ClickUtils.classForName(classField.getValue());
+            Class<?> valueClass = ClickUtils.classForName(classField.getValue());
 
             String classname = getClassname(valueClass);
 
@@ -423,7 +425,7 @@ public class HibernateForm extends Form 
      * @param aClass the class to obtain the original name from
      * @return the original classname for the given class
      */
-    protected String getClassname(Class aClass) {
+    protected String getClassname(Class<?> aClass) {
 
         String classname = aClass.getName();
         if (classname.indexOf("$$") != -1) {

Modified: click/trunk/click/extras/src/org/apache/click/extras/hibernate/SessionContext.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/hibernate/SessionContext.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/hibernate/SessionContext.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/hibernate/SessionContext.java Thu Jul  8 10:27:35 2010
@@ -53,7 +53,7 @@ public class SessionContext {
     private static SessionFactory sessionFactory;
 
     /** The ThreadLocal session holder. */
-    private static final ThreadLocal SESSION_HOLDER = new ThreadLocal();
+    private static final ThreadLocal<Session> SESSION_HOLDER = new ThreadLocal<Session>();
 
     /**
      * Initializes the SessionContext instance.
@@ -87,7 +87,7 @@ public class SessionContext {
     public Configuration createConfiguration() {
         try {
             // Try to instantiate AnnotationConfiguration by reflection
-            Class clazz = ClickUtils.classForName("org.hibernate.cfg.AnnotationConfiguration");
+            Class<?> clazz = ClickUtils.classForName("org.hibernate.cfg.AnnotationConfiguration");
             Configuration configuration = (Configuration) clazz.newInstance();
             return configuration;
         } catch (ClassNotFoundException e) {
@@ -122,7 +122,7 @@ public class SessionContext {
      * @throws HibernateException if an error occurs opening the session
      */
     public static Session getSession() throws HibernateException {
-        Session session = (Session) SESSION_HOLDER.get();
+        Session session = SESSION_HOLDER.get();
 
         if (session == null) {
             session = getSessionFactory().openSession();
@@ -139,7 +139,7 @@ public class SessionContext {
      * @throws HibernateException if an error occurs closing the session
      */
     public static void close() throws HibernateException {
-        Session session = (Session) SESSION_HOLDER.get();
+        Session session = SESSION_HOLDER.get();
 
         if (session != null && session.isOpen()) {
             session.close();

Modified: click/trunk/click/extras/src/org/apache/click/extras/spring/PageScopeResolver.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/spring/PageScopeResolver.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/spring/PageScopeResolver.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/spring/PageScopeResolver.java Thu Jul  8 10:27:35 2010
@@ -94,7 +94,7 @@ public class PageScopeResolver implement
         ScopeMetadata sm = new ScopeMetadata();
 
         try {
-            Class beanClass = ClickUtils.classForName(beanDef.getBeanClassName());
+            Class<?> beanClass = ClickUtils.classForName(beanDef.getBeanClassName());
 
             if (Page.class.isAssignableFrom(beanClass)) {
                 sm.setScopeName(ConfigurableBeanFactory.SCOPE_PROTOTYPE);

Modified: click/trunk/click/extras/src/org/apache/click/extras/spring/SpringClickServlet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/spring/SpringClickServlet.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/spring/SpringClickServlet.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/spring/SpringClickServlet.java Thu Jul  8 10:27:35 2010
@@ -348,7 +348,7 @@ public class SpringClickServlet extends 
     public static final String SPRING_PATH = "spring-path";
 
     /** The set of setter methods to ignore. */
-    static final Set SETTER_METHODS_IGNORE_SET = new HashSet();
+    static final Set<String> SETTER_METHODS_IGNORE_SET = new HashSet<String>();
 
     // Initialize the setter method ignore set
     static {
@@ -368,7 +368,8 @@ public class SpringClickServlet extends 
     protected ApplicationContext applicationContext;
 
     /** The list of page injectable Spring beans, keyed on page class name. */
-    protected Map pageSetterBeansMap = new HashMap();
+    protected Map<Class<? extends Page>, List<BeanNameAndMethod>> pageSetterBeansMap = 
+        new HashMap<Class<? extends Page>, List<BeanNameAndMethod>>();
 
     // Public Methods ----------------------------------------------------------
 
@@ -406,9 +407,8 @@ public class SpringClickServlet extends 
 
             // Process page classes looking for setter methods which match beans
             // available in the applicationContext
-            List pageClassList = getConfigService().getPageClassList();
-            for (int i = 0; i < pageClassList.size(); i++) {
-                Class pageClass = (Class) pageClassList.get(i);
+            List<Class<? extends Page>> pageClassList = getConfigService().getPageClassList();
+            for (Class<? extends Page> pageClass : pageClassList) {
                 loadSpringBeanSetterMethods(pageClass);
             }
         }
@@ -432,7 +432,7 @@ public class SpringClickServlet extends 
      * @throws Exception if an error occurs creating the Page
      */
     @Override
-    protected Page newPageInstance(String path, Class pageClass,
+    protected Page newPageInstance(String path, Class<? extends Page> pageClass,
             HttpServletRequest request) throws Exception {
 
         Page page = null;
@@ -446,7 +446,7 @@ public class SpringClickServlet extends 
             page = (Page) getApplicationContext().getBean(pageClass.getName());
 
         } else {
-            page = (Page) pageClass.newInstance();
+            page = pageClass.newInstance();
         }
 
         return page;
@@ -480,7 +480,7 @@ public class SpringClickServlet extends 
             aware.setApplicationContext(applicationContext);
         }
 
-        Class pageClass = page.getClass();
+        Class<? extends Page> pageClass = page.getClass();
         String beanName = toBeanName(pageClass);
 
         if (applicationContext.containsBean(beanName)
@@ -493,10 +493,9 @@ public class SpringClickServlet extends 
             if (!pageSetterBeansMap.isEmpty()) {
                 // In development mode, lazily loaded page classes won't have
                 // their bean setters methods mapped, thus beans won't be injected
-                List beanList = (List) pageSetterBeansMap.get(page.getClass());
+                List<BeanNameAndMethod> beanList = pageSetterBeansMap.get(page.getClass());
                 if (beanList != null) {
-                    for (int i = 0; i < beanList.size(); i++) {
-                        BeanNameAndMethod bnam = (BeanNameAndMethod) beanList.get(i);
+                    for (BeanNameAndMethod bnam : beanList) {
                         Object bean = applicationContext.getBean(bnam.beanName);
 
                         try {
@@ -518,7 +517,7 @@ public class SpringClickServlet extends 
      * @param aClass the class to get the Spring bean name from
      * @return the class bean name
      */
-    protected String toBeanName(Class aClass) {
+    protected String toBeanName(Class<?> aClass) {
         String className = aClass.getName();
         String beanName = className.substring(className.lastIndexOf(".") + 1);
         return Character.toLowerCase(beanName.charAt(0)) + beanName.substring(1);
@@ -556,7 +555,7 @@ public class SpringClickServlet extends 
      *
      * @param pageClass the page class
      */
-    private void loadSpringBeanSetterMethods(Class pageClass) {
+    private void loadSpringBeanSetterMethods(Class<? extends Page> pageClass) {
 
         Method[] methods = pageClass.getMethods();
         for (int j = 0; j < methods.length; j++) {
@@ -575,9 +574,9 @@ public class SpringClickServlet extends 
 
                 // If Spring contains the bean then cache in map list
                 if (getApplicationContext().containsBean(beanName)) {
-                    List beanList = (List) pageSetterBeansMap.get(pageClass);
+                    List<BeanNameAndMethod> beanList = pageSetterBeansMap.get(pageClass);
                     if (beanList == null) {
-                        beanList = new ArrayList();
+                        beanList = new ArrayList<BeanNameAndMethod>();
                         pageSetterBeansMap.put(pageClass, beanList);
                     }
 

Modified: click/trunk/click/extras/src/org/apache/click/extras/tree/CheckboxTree.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/tree/CheckboxTree.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/tree/CheckboxTree.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/tree/CheckboxTree.java Thu Jul  8 10:27:35 2010
@@ -282,7 +282,7 @@ public class CheckboxTree extends Tree {
 
         // find currently selected nodes
         boolean includeInvisibleNodes = isSelectChildNodes();
-        Collection currentlySelected = getSelectedNodes(includeInvisibleNodes);
+        Collection<TreeNode> currentlySelected = getSelectedNodes(includeInvisibleNodes);
 
         // is there any new selected node's
         if (nodeIds == null || nodeIds.length == 0) {
@@ -291,16 +291,16 @@ public class CheckboxTree extends Tree {
             return;
         }
         // build hashes of id's for fast lookup
-        Set hashes = new HashSet();
-        List newSelectedNodes = new ArrayList();
+        Set<String> hashes = new HashSet<String>();
+        List<TreeNode> newSelectedNodes = new ArrayList<TreeNode>();
         for (int i = 0; i < nodeIds.length; i++) {
             hashes.add(nodeIds[i]);
         }
         nodeIds = null;
 
         // build list of newSelectedNodes
-        for (Iterator it = iterator(getRootNode()); it.hasNext();) {
-            TreeNode result = (TreeNode) it.next();
+        for (Iterator<TreeNode> it = iterator(getRootNode()); it.hasNext();) {
+            TreeNode result = it.next();
             if (hashes.contains(result.getId())) {
                 newSelectedNodes.add(result);
             }
@@ -386,7 +386,7 @@ public class CheckboxTree extends Tree {
                 if (isJavascriptEnabled()) {
                     //create a href to interact with the checkbox on browser
                     buffer.elementStart("a");
-                    Map hrefParameters =
+                    Map<String, String> hrefParameters =
                         Collections.singletonMap(SELECT_TREE_NODE_PARAM,
                                                  treeNode.getId());
                     buffer.appendAttribute("href", getHref(hrefParameters));

Modified: click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/tree/Tree.java Thu Jul  8 10:27:35 2010
@@ -565,7 +565,7 @@ public class Tree extends AbstractContro
      * the tree's nodes.
      */
     public void bindExpandOrCollapseValues() {
-        expandOrCollapseNodeIds = getExpandLink().getParameterValues(EXPAND_TREE_NODE_PARAM);
+        expandOrCollapseNodeIds = getExpandLink().getParameterValues(EXPAND_TREE_NODE_PARAM); 
     }
 
     /**
@@ -658,8 +658,8 @@ public class Tree extends AbstractContro
      * notify listeners of any change.
      */
     public void expandAll() {
-        for (Iterator it = iterator(); it.hasNext();) {
-            TreeNode node = (TreeNode) it.next();
+        for (Iterator<TreeNode> it = iterator(); it.hasNext();) {
+            TreeNode node = it.next();
             boolean oldValue = node.isExpanded();
             node.setExpanded(true);
             if (isNotifyListeners()) {
@@ -674,8 +674,8 @@ public class Tree extends AbstractContro
      * notify listeners of any change.
      */
     public void collapseAll() {
-        for (Iterator it = iterator(); it.hasNext();) {
-            TreeNode node = (TreeNode) it.next();
+        for (Iterator<TreeNode> it = iterator(); it.hasNext();) {
+            TreeNode node = it.next();
             boolean oldValue = node.isExpanded();
             node.setExpanded(false);
             if (isNotifyListeners()) {
@@ -746,8 +746,8 @@ public class Tree extends AbstractContro
      * notify listeners of any change.
      */
     public void selectAll() {
-        for (Iterator it = iterator(); it.hasNext();) {
-            TreeNode node = (TreeNode) it.next();
+        for (Iterator<TreeNode> it = iterator(); it.hasNext();) {
+            TreeNode node = it.next();
             boolean oldValue = node.isSelected();
             node.setSelected(true);
             if (isNotifyListeners()) {
@@ -762,8 +762,8 @@ public class Tree extends AbstractContro
      * notify listeners of any change.
      */
     public void deselectAll() {
-        for (Iterator it = iterator(); it.hasNext();) {
-            TreeNode node = (TreeNode) it.next();
+        for (Iterator<TreeNode> it = iterator(); it.hasNext();) {
+            TreeNode node = it.next();
             boolean oldValue = node.isSelected();
             node.setSelected(false);
             if (isNotifyListeners()) {
@@ -781,8 +781,8 @@ public class Tree extends AbstractContro
      */
     public List<TreeNode> getExpandedNodes(boolean includeInvisibleNodes) {
         List<TreeNode> currentlyExpanded = new ArrayList<TreeNode>();
-        for (Iterator it = iterator(); it.hasNext();) {
-            TreeNode node = (TreeNode) it.next();
+        for (Iterator<TreeNode> it = iterator(); it.hasNext();) {
+            TreeNode node = it.next();
             if (node.isExpanded())  {
                 if (includeInvisibleNodes || isVisible(node)) {
                     currentlyExpanded.add(node);
@@ -800,8 +800,8 @@ public class Tree extends AbstractContro
      */
     public List<TreeNode> getSelectedNodes(boolean includeInvisibleNodes) {
         List<TreeNode> currentlySelected = new ArrayList<TreeNode>();
-        for (Iterator it = iterator(); it.hasNext();) {
-            TreeNode node = (TreeNode) it.next();
+        for (Iterator<TreeNode> it = iterator(); it.hasNext();) {
+            TreeNode node = it.next();
             if (node.isSelected()) {
                 if (includeInvisibleNodes || isVisible(node)) {
                     currentlySelected.add(node);
@@ -1078,10 +1078,7 @@ public class Tree extends AbstractContro
         }
         buffer.append("\">\n");
 
-        Iterator it = treeNode.getChildren().iterator();
-        while (it.hasNext()) {
-            TreeNode child = (TreeNode) it.next();
-
+        for (TreeNode child : treeNode.getChildren()) {
             if (isJavascriptEnabled()) {
                 javascriptHandler.getJavascriptRenderer().init(child);
             }
@@ -1441,7 +1438,7 @@ public class Tree extends AbstractContro
      * @param nodes specifies the collection of a TreeNodes which expand states will be set
      * @param newValue specifies the new expand state
      */
-    protected void setExpandState(final Collection nodes, final boolean newValue) {
+    protected void setExpandState(final Collection<TreeNode> nodes, final boolean newValue) {
         processNodes(nodes, new Callback() {
             public void callback(TreeNode node) {
                 setExpandState(node, newValue);
@@ -1503,7 +1500,7 @@ public class Tree extends AbstractContro
      * @param nodes specifies the collection of a TreeNodes which select states will be set
      * @param newValue specifies the new select state
      */
-    protected void setSelectState(final Collection nodes, final boolean newValue) {
+    protected void setSelectState(final Collection<TreeNode> nodes, final boolean newValue) {
         processNodes(nodes, new Callback() {
             public void callback(TreeNode node) {
                 setSelectState(node, newValue);
@@ -1540,12 +1537,11 @@ public class Tree extends AbstractContro
      * @param nodes the collection of nodes to process
      * @param callback object on which callbacks are made
      */
-    protected void processNodes(Collection nodes, Callback callback) {
+    protected void processNodes(Collection<TreeNode> nodes, Callback callback) {
         if (nodes == null) {
             return;
         }
-        for (Iterator it = nodes.iterator(); it.hasNext();) {
-            TreeNode node = (TreeNode) it.next();
+        for (TreeNode node : nodes) {
             callback.callback(node);
         }
     }
@@ -1559,8 +1555,8 @@ public class Tree extends AbstractContro
      * @return TreeNode the first node matching the id or null if no match was found.
      */
     protected TreeNode find(TreeNode node, String id) {
-        for (Iterator it = iterator(node); it.hasNext();) {
-            TreeNode result = (TreeNode) it.next();
+        for (Iterator<TreeNode> it = iterator(node); it.hasNext();) {
+            TreeNode result = it.next();
             if (result.getId().equals(id)) {
                 return result;
             }
@@ -1605,7 +1601,7 @@ public class Tree extends AbstractContro
      * @param parameters the href parameters
      * @return the HTML href attribute
      */
-    protected String getHref(Map parameters) {
+    protected String getHref(Map<String, ? extends Object> parameters) {
         Context context = getContext();
         String uri = ClickUtils.getRequestURI(context.getRequest());
 
@@ -1615,11 +1611,10 @@ public class Tree extends AbstractContro
         buffer.append(uri);
         if (parameters != null && !parameters.isEmpty()) {
             buffer.append("?");
-            Iterator i = parameters.entrySet().iterator();
+            Iterator<String> i = parameters.keySet().iterator();
             while (i.hasNext()) {
-                Map.Entry entry = (Map.Entry) i.next();
-                String name = entry.getKey().toString();
-                String value = entry.getValue().toString();
+                String name = i.next();
+                String value = parameters.get(name).toString();
 
                 buffer.append(name);
                 buffer.append("=");
@@ -1680,10 +1675,10 @@ public class Tree extends AbstractContro
      *      node2.2
      * </pre>
      */
-    static class BreadthTreeIterator implements Iterator {
+    static class BreadthTreeIterator implements Iterator<TreeNode> {
 
         /**queue for storing node's. */
-        private List<TreeNode> queue = new ArrayList();
+        private List<TreeNode> queue = new ArrayList<TreeNode>();
 
         /** indicator to iterate collapsed node's. */
         private boolean iterateCollapsedNodes = true;
@@ -2131,10 +2126,10 @@ public class Tree extends AbstractContro
         protected JavascriptRenderer javascriptRenderer;
 
         /** Tracker for the expanded node id's. */
-        private Set expandTracker;
+        private Set<String> expandTracker;
 
         /** Tracker for the collapsed node id's. */
-        private Set collapsedTracker;
+        private Set<String> collapsedTracker;
 
         /** Value of the cookie responsible for tracking the expanded node id's. */
         private String expandedNodeCookieValue = null;
@@ -2164,8 +2159,8 @@ public class Tree extends AbstractContro
             if (expandTracker != null || collapsedTracker != null) {
                 return;
             }
-            expandTracker = new HashSet();
-            collapsedTracker = new HashSet();
+            expandTracker = new HashSet<String>();
+            collapsedTracker = new HashSet<String>();
 
             if (context == null) {
                 throw new IllegalArgumentException("context cannot be null");
@@ -2178,11 +2173,11 @@ public class Tree extends AbstractContro
             }
 
             //build hashes of id's for fast lookup
-            Set expandHash = asSet(expandedNodeCookieValue, DELIM);
-            Set collapsedHash = asSet(collapsedNodeCookieValue, DELIM);
+            Set<String> expandHash = asSet(expandedNodeCookieValue, DELIM);
+            Set<String> collapsedHash = asSet(collapsedNodeCookieValue, DELIM);
 
-            for (Iterator it = iterator(getRootNode()); it.hasNext();) {
-                TreeNode currentNode = (TreeNode) it.next();
+            for (Iterator<TreeNode> it = iterator(getRootNode()); it.hasNext();) {
+                TreeNode currentNode = it.next();
 
                 //If currentNode was expanded by user in browser
                 if (expandHash.contains(currentNode.getId())) {
@@ -2350,8 +2345,8 @@ public class Tree extends AbstractContro
          * @param delim delimiter used to tokenize the value
          * @return set of tokens
          */
-        protected Set asSet(String value, String delim) {
-            Set set = new HashSet();
+        protected Set<String> asSet(String value, String delim) {
+            Set<String> set = new HashSet<String>();
             if (value  == null) {
                 return set;
             }
@@ -2484,7 +2479,7 @@ public class Tree extends AbstractContro
          * have been added to the map. This helps keep track of the number of
          * parallel paths.
          */
-        private Map selectTracker = null;
+        private Map<String, Entry> selectTracker = null;
 
         /**
          * This class is dependant on {@link org.apache.click.Context}, so this
@@ -2506,6 +2501,7 @@ public class Tree extends AbstractContro
          *
          * @param context provides access to the http request, and session
          */
+        @SuppressWarnings("unchecked")
         public void init(Context context) {
             //If already initialized
             if (selectTracker != null) {
@@ -2517,9 +2513,9 @@ public class Tree extends AbstractContro
             StringBuffer buffer = new StringBuffer(JS_HANDLER_SESSION_KEY).
                     append(getName());
             String key = buffer.toString();
-            selectTracker = (Map) context.getSessionAttribute(key);
+            selectTracker = (Map<String, Entry>) context.getSessionAttribute(key);
             if (selectTracker == null) {
-                selectTracker = new HashMap();
+                selectTracker = new HashMap<String, Entry>();
                 context.setSessionAttribute(key, selectTracker);
             }
         }
@@ -2535,7 +2531,7 @@ public class Tree extends AbstractContro
          * @see #renderAsExpanded(TreeNode)
          */
         public boolean renderAsExpanded(TreeNode treeNode) {
-            Entry entry = (Entry) selectTracker.get(treeNode.getId());
+            Entry entry = selectTracker.get(treeNode.getId());
             if (entry == null || entry.lastNodeInPath) {
                 return false;
             }
@@ -2602,7 +2598,7 @@ public class Tree extends AbstractContro
                     }
                 }
                 String id = currentNode.getId();
-                Entry entry = (Entry) selectTracker.get(id);
+                Entry entry = selectTracker.get(id);
 
                 //If node is not yet tracked, add it to the selected path tracker,
                 //otherwise increment the overlaid path count
@@ -2640,7 +2636,7 @@ public class Tree extends AbstractContro
             for (int i = 0; i < nodes.length; i++) {
                 TreeNode currentNode = nodes[i];
                 String id = currentNode.getId();
-                Entry entry = (Entry) selectTracker.get(id);
+                Entry entry = selectTracker.get(id);
 
                 //This node is not tracked, so we continue looping.
                 if (entry == null) {

Modified: click/trunk/click/extras/src/org/apache/click/extras/tree/TreeNode.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/tree/TreeNode.java?rev=961690&r1=961689&r2=961690&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/tree/TreeNode.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/tree/TreeNode.java Thu Jul  8 10:27:35 2010
@@ -485,7 +485,7 @@ public class TreeNode implements Seriali
         //Iterate over the tree using a breadth first iterator. The level of the
         //last node found will indicate the depth of the tree.
         Object o = null;
-        for (Iterator it = new Tree.BreadthTreeIterator(this); it.hasNext();) {
+        for (Iterator<TreeNode> it = new Tree.BreadthTreeIterator(this); it.hasNext();) {
             o = it.next();
         }
         TreeNode node = (TreeNode) o;



Mime
View raw message