click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From med...@apache.org
Subject svn commit: r922796 - in /click/trunk/click: build/ extras/src/org/apache/click/extras/control/ framework/src/EDU/oswego/cs/dl/util/concurrent/ framework/src/ognl/ framework/src/org/apache/click/ framework/src/org/apache/click/control/ framework/src/or...
Date Sun, 14 Mar 2010 09:07:17 GMT
Author: medgar
Date: Sun Mar 14 09:07:17 2010
New Revision: 922796

URL: http://svn.apache.org/viewvc?rev=922796&view=rev
Log:
CLK-606

Modified:
    click/trunk/click/build/checkstyle-suppressions.xml
    click/trunk/click/extras/src/org/apache/click/extras/control/AbstractContainerField.java
    click/trunk/click/framework/src/EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap.java
    click/trunk/click/framework/src/ognl/OgnlOps.java
    click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
    click/trunk/click/framework/src/org/apache/click/ClickServlet.java
    click/trunk/click/framework/src/org/apache/click/control/Panel.java
    click/trunk/click/framework/src/org/apache/click/element/CssImport.java
    click/trunk/click/framework/src/org/apache/click/element/CssStyle.java
    click/trunk/click/framework/src/org/apache/click/element/Element.java
    click/trunk/click/framework/src/org/apache/click/element/JsImport.java
    click/trunk/click/framework/src/org/apache/click/element/JsScript.java
    click/trunk/click/framework/src/org/apache/click/element/ResourceElement.java
    click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java
    click/trunk/click/framework/src/org/apache/click/util/PageImports.java
    click/trunk/click/framework/src/org/apache/velocity/tools/view/servlet/WebappLoader.java

Modified: click/trunk/click/build/checkstyle-suppressions.xml
URL: http://svn.apache.org/viewvc/click/trunk/click/build/checkstyle-suppressions.xml?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/build/checkstyle-suppressions.xml (original)
+++ click/trunk/click/build/checkstyle-suppressions.xml Sun Mar 14 09:07:17 2010
@@ -114,7 +114,7 @@
 
     <suppress checks="MethodLength"
               files="Form.java"
-              lines="2313"/>
+              lines="2316"/>
 
     <suppress checks="MethodLength"
               files="FieldSet.java"

Modified: click/trunk/click/extras/src/org/apache/click/extras/control/AbstractContainerField.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/control/AbstractContainerField.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/control/AbstractContainerField.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/control/AbstractContainerField.java Sun Mar 14 09:07:17 2010
@@ -20,7 +20,6 @@ package org.apache.click.extras.control;
 
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -57,19 +56,19 @@ import org.apache.click.util.HtmlStringB
  */
 public abstract class AbstractContainerField extends Field implements Container {
 
-    // -------------------------------------------------------------- Constants
+    // Constants --------------------------------------------------------------
 
     private static final long serialVersionUID = 1L;
 
-    // ----------------------------------------------------- Instance Variables
+    // Instance Variables -----------------------------------------------------
 
     /** The list of controls. */
-    protected List controls;
+    protected List<Control> controls;
 
     /** The map of controls keyed by field name. */
-    protected Map controlMap;
+    protected Map<String, Control> controlMap;
 
-    // ---------------------------------------------------------- Constructorrs
+    // Constructors -----------------------------------------------------------
 
     /**
      * Create an AbstractContainerField with no name defined.
@@ -96,7 +95,7 @@ public abstract class AbstractContainerF
         super(name, label);
     }
 
-    // --------------------------------------------------------- Public methods
+    // Public methods ---------------------------------------------------------
 
     /**
      * @see org.apache.click.control.Container#add(org.apache.click.Control).
@@ -147,9 +146,9 @@ public abstract class AbstractContainerF
      *
      * @return the sequential list of controls held by the container
      */
-    public List getControls() {
+    public List<Control> getControls() {
         if (controls == null) {
-            controls = new ArrayList();
+            controls = new ArrayList<Control>();
         }
         return controls;
     }
@@ -212,12 +211,12 @@ public abstract class AbstractContainerF
      * @return the HTML includes statements for the contained control stylesheet
      * and JavaScript files
      */
+    @SuppressWarnings("deprecation")
     public String getHtmlImports() {
         if (hasControls()) {
             HtmlStringBuffer buffer = new HtmlStringBuffer(0);
 
-            for (int i = 0, size = getControls().size(); i < size; i++) {
-                Control control = (Control) getControls().get(i);
+            for (Control control : getControls()) {
                 String htmlImports = control.getHtmlImports();
                 if (htmlImports != null) {
                     buffer.append(htmlImports);
@@ -260,8 +259,7 @@ public abstract class AbstractContainerF
         boolean continueProcessing = super.onProcess();
 
         if (hasControls()) {
-            for (Iterator it = getControls().iterator(); it.hasNext();) {
-                Control control = (Control) it.next();
+            for (Control control : getControls()) {
                 if (!control.onProcess()) {
                     continueProcessing = false;
                 }
@@ -359,7 +357,7 @@ public abstract class AbstractContainerF
         return buffer.toString();
     }
 
-    //------------------------------------------------------- Protected Methods
+    // Protected Methods ------------------------------------------------------
 
     /**
      * @see org.apache.click.control.AbstractControl#renderTagEnd(java.lang.String, org.apache.click.util.HtmlStringBuffer)
@@ -412,9 +410,9 @@ public abstract class AbstractContainerF
      *
      * @return the map of controls
      */
-    protected Map getControlMap() {
+    protected Map<String, Control> getControlMap() {
         if (controlMap == null) {
-            controlMap = new HashMap();
+            controlMap = new HashMap<String, Control>();
         }
         return controlMap;
     }

Modified: click/trunk/click/framework/src/EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap.java (original)
+++ click/trunk/click/framework/src/EDU/oswego/cs/dl/util/concurrent/ConcurrentReaderHashMap.java Sun Mar 14 09:07:17 2010
@@ -143,6 +143,7 @@ import java.io.IOException;
  * href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html">
  * Introduction to this package. </a>]
  */
+@SuppressWarnings("unchecked")
 public class ConcurrentReaderHashMap extends AbstractMap implements Map,
         Cloneable, Serializable {
 

Modified: click/trunk/click/framework/src/ognl/OgnlOps.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/ognl/OgnlOps.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/ognl/OgnlOps.java (original)
+++ click/trunk/click/framework/src/ognl/OgnlOps.java Sun Mar 14 09:07:17 2010
@@ -40,6 +40,7 @@ import java.util.Enumeration;
  * @author Luke Blanshard (blanshlu@netscape.net)
  * @author Drew Davidson (drew@ognl.org)
  */
+@SuppressWarnings("unchecked")
 public abstract class OgnlOps implements NumericTypes
 {
     /**

Modified: click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ActionEventDispatcher.java Sun Mar 14 09:07:17 2010
@@ -73,10 +73,7 @@ import org.apache.commons.lang.Validate;
  */
 public class ActionEventDispatcher {
 
-    // -------------------------------------------------------------- Constants
-
-    /** The thread local dispatcher holder. */
-    private static final ThreadLocal THREAD_LOCAL_DISPATCHER = new ThreadLocal();
+    // Constants --------------------------------------------------------------
 
     /**
      * Indicates the listener should fire <tt>AFTER</tt> the onProcess event.
@@ -85,12 +82,16 @@ public class ActionEventDispatcher {
      */
     public static final int POST_ON_PROCESS_EVENT = 300;
 
-    // -------------------------------------------------------------- Variables
+    // Variables --------------------------------------------------------------
+
+    /** The thread local dispatcher holder. */
+    private static final ThreadLocal<DispatcherStack> THREAD_LOCAL_DISPATCHER
+        = new ThreadLocal<DispatcherStack>();
 
     /** The POST_PROCESS events holder. */
     private EventHolder postProcessEventHolder;
 
-    // --------------------------------------------------------- Public Methods
+    //  Public Methods ---------------------------------------------------------
 
     /**
      * Register the event source and event ActionListener to be fired by the
@@ -127,7 +128,7 @@ public class ActionEventDispatcher {
         eventHolder.registerActionEvent(source, listener);
     }
 
-    // ------------------------------------------------------ Protected Methods
+    // Protected Methods ------------------------------------------------------
 
     /**
      * Allow the dispatcher to handle the error that occurred.
@@ -176,14 +177,14 @@ public class ActionEventDispatcher {
      *
      * @return true if the page should continue processing or false otherwise
      */
-    protected boolean fireActionEvents(Context context, List eventSourceList,
-        List eventListenerList, int event) {
+    protected boolean fireActionEvents(Context context, List<Control> eventSourceList,
+        List<ActionListener> eventListenerList, int event) {
 
         boolean continueProcessing = true;
 
         for (int i = 0, size = eventSourceList.size(); i < size; i++) {
-            Control source = (Control) eventSourceList.get(0);
-            ActionListener listener = (ActionListener) eventListenerList.get(0);
+            Control source = eventSourceList.get(0);
+            ActionListener listener = eventListenerList.get(0);
 
             // Pop the first entry in the list
             eventSourceList.remove(0);
@@ -272,7 +273,7 @@ public class ActionEventDispatcher {
         return new EventHolder(event);
     }
 
-    // ------------------------------------------------ Package Private Methods
+    // Package Private Methods ------------------------------------------------
 
     /**
      * Return the {@link #POST_ON_PROCESS_EVENT} {@link EventHolder}.
@@ -318,7 +319,7 @@ public class ActionEventDispatcher {
      * @return stack data structure where ActionEventDispatcher are stored
      */
     static DispatcherStack getDispatcherStack() {
-        DispatcherStack dispatcherStack = (DispatcherStack) THREAD_LOCAL_DISPATCHER.get();
+        DispatcherStack dispatcherStack = THREAD_LOCAL_DISPATCHER.get();
 
         if (dispatcherStack == null) {
             dispatcherStack = new DispatcherStack(2);
@@ -328,7 +329,7 @@ public class ActionEventDispatcher {
         return dispatcherStack;
     }
 
-    // ---------------------------------------------------------- Inner Classes
+    // Inner Classes ----------------------------------------------------------
 
     /**
      * Holds the list of listeners and event sources.
@@ -339,10 +340,10 @@ public class ActionEventDispatcher {
         protected int event;
 
         /** The list of registered event sources. */
-        private List eventSourceList;
+        private List<Control> eventSourceList;
 
         /** The list of registered event listeners. */
-        private List eventListenerList;
+        private List<ActionListener> eventListenerList;
 
         // ------------------------------------------------------- Constructors
 
@@ -387,9 +388,9 @@ public class ActionEventDispatcher {
          *
          * @return list of event listeners
          */
-        public List getEventListenerList() {
+        public List<ActionListener> getEventListenerList() {
             if (eventListenerList == null) {
-                eventListenerList = new ArrayList();
+                eventListenerList = new ArrayList<ActionListener>();
             }
             return eventListenerList;
         }
@@ -399,9 +400,9 @@ public class ActionEventDispatcher {
          *
          * @return list of event sources
          */
-        public List getEventSourceList() {
+        public List<Control> getEventSourceList() {
             if (eventSourceList == null) {
-                eventSourceList = new ArrayList();
+                eventSourceList = new ArrayList<Control>();
             }
             return eventSourceList;
         }
@@ -437,7 +438,7 @@ public class ActionEventDispatcher {
     /**
      * Provides an unsynchronized Stack.
      */
-    static class DispatcherStack extends ArrayList {
+    static class DispatcherStack extends ArrayList<ActionEventDispatcher> {
 
         /** Serialization version indicator. */
         private static final long serialVersionUID = 1L;
@@ -490,7 +491,7 @@ public class ActionEventDispatcher {
                 throw new RuntimeException(msg);
             }
 
-            return (ActionEventDispatcher) get(length - 1);
+            return get(length - 1);
         }
     }
 }

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=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Sun Mar 14 09:07:17 2010
@@ -375,7 +375,7 @@ public class ClickServlet extends HttpSe
             }
 
         } catch (Exception e) {
-            Class pageClass =
+            Class<? extends Page> pageClass =
                 configService.getPageClass(ClickUtils.getResourcePath(request));
 
             handleException(request, response, isPost, e, pageClass);
@@ -384,7 +384,7 @@ public class ClickServlet extends HttpSe
             Throwable cause = eiie.getException();
             cause = (cause != null) ? cause : eiie;
 
-            Class pageClass =
+            Class<? extends Page> pageClass =
                 configService.getPageClass(ClickUtils.getResourcePath(request));
 
             handleException(request, response, isPost, cause, pageClass);
@@ -442,7 +442,7 @@ public class ClickServlet extends HttpSe
      */
     protected void handleException(HttpServletRequest request,
         HttpServletResponse response, boolean isPost, Throwable exception,
-        Class pageClass) {
+        Class<? extends Page> pageClass) {
 
         if (exception instanceof TemplateException == false) {
             logger.error("handleException: ", exception);
@@ -523,6 +523,7 @@ public class ClickServlet extends HttpSe
      * @param page the Page to process
      * @throws Exception if an error occurs
      */
+    @SuppressWarnings("deprecation")
     protected void processPage(Page page) throws Exception {
 
         final Context context = page.getContext();
@@ -593,10 +594,10 @@ public class ClickServlet extends HttpSe
         }
 
         if (page.hasControls()) {
-            List controls = page.getControls();
+            List<Control> controls = page.getControls();
 
             for (int i = 0, size = controls.size(); i < size; i++) {
-                Control control = (Control) controls.get(i);
+                Control control = controls.get(i);
                 control.onInit();
 
                 if (logger.isTraceEnabled()) {
@@ -627,10 +628,10 @@ public class ClickServlet extends HttpSe
 
         // Make sure don't process a forwarded request
         if (page.hasControls() && !context.isForward()) {
-            List controls = page.getControls();
+            List<Control> controls = page.getControls();
 
             for (int i = 0, size = controls.size(); i < size; i++) {
-                Control control = (Control) controls.get(i);
+                Control control = controls.get(i);
 
                 boolean onProcessResult = control.onProcess();
                 if (!onProcessResult) {
@@ -705,10 +706,10 @@ public class ClickServlet extends HttpSe
         }
 
         if (page.hasControls()) {
-            List controls = page.getControls();
+            List<Control> controls = page.getControls();
 
             for (int i = 0, size = controls.size(); i < size; i++) {
-                Control control = (Control) controls.get(i);
+                Control control = controls.get(i);
                 control.onRender();
 
                 if (logger.isTraceEnabled()) {
@@ -819,7 +820,7 @@ public class ClickServlet extends HttpSe
 
         long startTime = System.currentTimeMillis();
 
-        final Map model = createTemplateModel(page);
+        final Map<String, Object> model = createTemplateModel(page);
 
         Context context = page.getContext();
         HttpServletResponse response = context.getResponse();
@@ -909,13 +910,14 @@ 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();
 
         // Log request parameters
         if (logger.isTraceEnabled()) {
-            Map requestParams = new TreeMap();
+            Map<String, Object> requestParams = new TreeMap<String, Object>();
 
             Enumeration e = request.getParameterNames();
             while (e.hasMoreElements()) {
@@ -951,7 +953,7 @@ public class ClickServlet extends HttpSe
             return forwardPage;
         }
 
-        Class pageClass = configService.getPageClass(path);
+        Class<? extends Page> pageClass = configService.getPageClass(path);
 
         if (pageClass == null) {
             pageClass = configService.getNotFoundPageClass();
@@ -990,13 +992,14 @@ public class ClickServlet extends HttpSe
      * @param startTime the start time to log if greater than 0 and not in
      * production mode
      */
+    @SuppressWarnings("deprecation")
     protected void processPageOnDestroy(Page page, long startTime) {
         if (page.hasControls()) {
-            List controls = page.getControls();
+            List<Control> controls = page.getControls();
 
             for (int i = 0, size = controls.size(); i < size; i++) {
                 try {
-                    Control control = (Control) controls.get(i);
+                    Control control = controls.get(i);
                     control.onDestroy();
 
                     if (logger.isTraceEnabled()) {
@@ -1101,7 +1104,7 @@ public class ClickServlet extends HttpSe
      * @param request the page request
      * @return initialized page
      */
-    protected Page initPage(String path, Class pageClass,
+    protected Page initPage(String path, Class<? extends Page> pageClass,
             HttpServletRequest request) {
 
         try {
@@ -1184,14 +1187,14 @@ public class ClickServlet extends HttpSe
             return;
         }
 
-        Map ognlContext = null;
+        Map<?, ?> ognlContext = null;
 
         boolean customConverter =
             ! getTypeConverter().getClass().equals(RequestTypeConverter.class);
 
         HttpServletRequest request = page.getContext().getRequest();
 
-        for (Enumeration e = request.getParameterNames(); e.hasMoreElements();) {
+        for (Enumeration<?> e = request.getParameterNames(); e.hasMoreElements();) {
             String name = e.nextElement().toString();
             String value = request.getParameter(name);
 
@@ -1200,7 +1203,7 @@ public class ClickServlet extends HttpSe
                 Field field = configService.getPageField(page.getClass(), name);
 
                 if (field != null) {
-                    Class type = field.getType();
+                    Class<?> type = field.getType();
 
                     if (customConverter
                         || (type.isPrimitive()
@@ -1265,7 +1268,7 @@ public class ClickServlet extends HttpSe
      * @return a new Page object
      * @throws Exception if an error occurs creating the Page
      */
-    protected Page newPageInstance(String path, Class pageClass,
+    protected Page newPageInstance(String path, Class<? extends Page> pageClass,
             HttpServletRequest request) throws Exception {
 
         return (Page) pageClass.newInstance();
@@ -1305,7 +1308,8 @@ public class ClickServlet extends HttpSe
      * @param page the page to create a VelocityContext for
      * @return a new VelocityContext
      */
-    protected Map createTemplateModel(final Page page) {
+    @SuppressWarnings("deprecation")
+    protected Map<String, Object> createTemplateModel(final Page page) {
 
         if (configService.getAutoBindingMode() != AutoBinding.NONE) {
 
@@ -1326,7 +1330,7 @@ public class ClickServlet extends HttpSe
         }
 
         final Context context = page.getContext();
-        final Map model = ClickUtils.createTemplateModel(page, context);
+        final Map<String, Object> model = ClickUtils.createTemplateModel(page, context);
 
         PageImports pageImports = page.getPageImports();
         pageImports.populateTemplateModel(model);
@@ -1342,11 +1346,10 @@ public class ClickServlet extends HttpSe
      * @param headers the map of HTTP headers to set in the response
      */
     protected void setPageResponseHeaders(HttpServletResponse response,
-            Map headers) {
+            Map<String, Object> headers) {
 
-        for (Iterator i = headers.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            String name = entry.getKey().toString();
+        for (Map.Entry<String, Object> entry : headers.entrySet()) {
+            String name = entry.getKey();
             Object value = entry.getValue();
 
             if (value instanceof String) {
@@ -1382,6 +1385,7 @@ public class ClickServlet extends HttpSe
      *
      * @param page the page to set the request attributes on
      */
+    @SuppressWarnings("deprecation")
     protected void setRequestAttributes(final Page page) {
         final HttpServletRequest request = page.getContext().getRequest();
 
@@ -1399,10 +1403,9 @@ public class ClickServlet extends HttpSe
             }
         });
 
-        Map model = page.getModel();
-        for (Iterator i = model.entrySet().iterator(); i.hasNext();)  {
-            Map.Entry entry = (Map.Entry) i.next();
-            String name = entry.getKey().toString();
+        Map<String, Object> model = page.getModel();
+        for (Map.Entry<String, Object> entry : model.entrySet()) {
+            String name = entry.getKey();
             Object value = entry.getValue();
 
             request.setAttribute(name, value);
@@ -1468,9 +1471,10 @@ public class ClickServlet extends HttpSe
      * @return the request parameters OGNL <tt>TypeConverter</tt>
      * @throws RuntimeException if the TypeConverter instance could not be created
      */
+    @SuppressWarnings("unchecked")
     protected TypeConverter getTypeConverter() throws RuntimeException {
         if (typeConverter == null) {
-            Class converter = RequestTypeConverter.class;
+            Class<? extends TypeConverter> converter = RequestTypeConverter.class;
 
             try {
                 String classname = getInitParameter(TYPE_CONVERTER_CLASS);
@@ -1539,7 +1543,7 @@ public class ClickServlet extends HttpSe
      * @param exception the error causing exception
      * @return a new ErrorPage instance
      */
-    protected ErrorPage createErrorPage(Class pageClass, Throwable exception) {
+    protected ErrorPage createErrorPage(Class<? extends Page> pageClass, Throwable exception) {
         try {
             return (ErrorPage) configService.getErrorPageClass().newInstance();
         } catch (Exception e) {
@@ -1565,7 +1569,7 @@ public class ClickServlet extends HttpSe
      * @throws IllegalArgumentException if the Page is not found
      */
     protected Page createPage(String path, HttpServletRequest request) {
-        Class pageClass = getConfigService().getPageClass(path);
+        Class<? extends Page> pageClass = getConfigService().getPageClass(path);
 
         if (pageClass == null) {
             String msg = "No Page class configured for path: " + path;
@@ -1584,7 +1588,7 @@ public class ClickServlet extends HttpSe
      * @throws IllegalArgumentException if the Page Class is not configured
      * with a unique path
      */
-    protected Page createPage(Class pageClass, HttpServletRequest request) {
+    protected Page createPage(Class<? extends Page> pageClass, HttpServletRequest request) {
         String path = getConfigService().getPagePath(pageClass);
 
         if (path == null) {
@@ -1628,10 +1632,11 @@ public class ClickServlet extends HttpSe
     * @return a new application ConfigService instance
     * @throws Exception if an initialization error occurs
     */
+    @SuppressWarnings("unchecked")
     ConfigService createConfigService(ServletContext servletContext)
         throws Exception {
 
-        Class serviceClass = XmlConfigService.class;
+        Class<? extends ConfigService> serviceClass = XmlConfigService.class;
 
         String classname = servletContext.getInitParameter(CONFIG_SERVICE_CLASS);
         if (StringUtils.isNotBlank(classname)) {

Modified: click/trunk/click/framework/src/org/apache/click/control/Panel.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/control/Panel.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/control/Panel.java (original)
+++ click/trunk/click/framework/src/org/apache/click/control/Panel.java Sun Mar 14 09:07:17 2010
@@ -239,7 +239,7 @@ public class Panel extends AbstractConta
 
     private static final long serialVersionUID = 1L;
 
-    // ----------------------------------------------------- Instance Variables
+    // Instance Variables -----------------------------------------------------
 
     /** The panel disabled value. */
     protected boolean disabled;
@@ -251,15 +251,15 @@ public class Panel extends AbstractConta
     protected String label;
 
     /** A temporary storage for model objects until the Page is set. */
-    protected Map model;
+    protected Map<String, Object> model;
 
     /** The list of sub panels. */
-    protected List panels;
+    protected List<Panel> panels;
 
     /** The path of the template to render. */
     protected String template;
 
-    // ----------------------------------------------------------- Constructors
+    // Constructors -----------------------------------------------------------
 
     /**
      * Create a Panel with the given name.
@@ -302,7 +302,7 @@ public class Panel extends AbstractConta
     public Panel() {
     }
 
-    // ------------------------------------------------------------- Properties
+    // Properties -------------------------------------------------------------
 
     /**
      * @see #add(org.apache.click.Control)
@@ -357,7 +357,7 @@ public class Panel extends AbstractConta
         }
 
         if (control instanceof Panel) {
-            getPanels().add(control);
+            getPanels().add((Panel) control);
         }
 
         return control;
@@ -551,9 +551,9 @@ public class Panel extends AbstractConta
      *
      * @return the Page's model map
      */
-    public Map getModel() {
+    public Map<String, Object> getModel() {
         if (model == null) {
-             model = new HashMap();
+             model = new HashMap<String, Object>();
         }
         return model;
     }
@@ -564,9 +564,9 @@ public class Panel extends AbstractConta
      *
      * @return the list of sub-panels, if any
      */
-    public List getPanels() {
+    public List<Panel> getPanels() {
         if (panels == null) {
-            panels = new ArrayList();
+            panels = new ArrayList<Panel>();
         }
         return panels;
     }
@@ -589,7 +589,7 @@ public class Panel extends AbstractConta
         this.template = template;
     }
 
-    // --------------------------------------------------------- Public Methods
+    // Public Methods ---------------------------------------------------------
 
     /**
      * Render the HTML string representation of the Panel. The panel will be
@@ -614,7 +614,7 @@ public class Panel extends AbstractConta
         }
     }
 
-    // ------------------------------------------------------ Protected Methods
+    // Protected Methods ------------------------------------------------------
 
     /**
      * Create a model to merge with the template. The model will
@@ -636,7 +636,7 @@ public class Panel extends AbstractConta
      *
      * @return a new model to merge with the template.
      */
-    protected Map createTemplateModel() {
+    protected Map<String, Object> createTemplateModel() {
 
         Context context = getContext();
 
@@ -644,7 +644,7 @@ public class Panel extends AbstractConta
 
         final Page page = ClickUtils.getParentPage(this);
 
-        final Map renderModel = new HashMap(page.getModel());
+        final Map<String, Object> renderModel = new HashMap<String, Object>(page.getModel());
 
         renderModel.putAll(getModel());
 
@@ -663,7 +663,7 @@ public class Panel extends AbstractConta
             renderModel.put("format", format);
         }
 
-        Map templateMessages = new HashMap(getMessages());
+        Map<String, String> templateMessages = new HashMap<String, String>(getMessages());
         templateMessages.putAll(page.getMessages());
         renderModel.put("messages", templateMessages);
 

Modified: click/trunk/click/framework/src/org/apache/click/element/CssImport.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/CssImport.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/CssImport.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/CssImport.java Sun Mar 14 09:07:17 2010
@@ -54,7 +54,7 @@ public class CssImport extends ResourceE
 
     private static final long serialVersionUID = 1L;
 
-    // ----------------------------------------------------------- Constructors
+    // Constructors -----------------------------------------------------------
 
     /**
      * Constructs a new Css import element.
@@ -127,7 +127,7 @@ public class CssImport extends ResourceE
         setVersionIndicator(versionIndicator);
     }
 
-    // ------------------------------------------------------ Public Properties
+    // Public Properties ------------------------------------------------------
 
     /**
      * Returns the Css import HTML tag: &lt;link&gt;.
@@ -193,7 +193,7 @@ public class CssImport extends ResourceE
         return getAttribute("href");
     }
 
-    // --------------------------------------------------------- Public Methods
+    // Public Methods ---------------------------------------------------------
 
     /**
      * Render the HTML representation of the CssImport element to the specified
@@ -230,6 +230,7 @@ public class CssImport extends ResourceE
      * @param o the object with which to compare this instance with
      * @return true if the specified object is the same as this object
      */
+    @Override
     public boolean equals(Object o) {
         if (getHref() == null) {
             throw new IllegalStateException("'href' attribute is not defined.");
@@ -257,6 +258,7 @@ public class CssImport extends ResourceE
      *
      * @return a hash code value for this object
      */
+    @Override
     public int hashCode() {
         return new HashCodeBuilder(17, 37).append(getHref()).toHashCode();
     }

Modified: click/trunk/click/framework/src/org/apache/click/element/CssStyle.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/CssStyle.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/CssStyle.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/CssStyle.java Sun Mar 14 09:07:17 2010
@@ -145,7 +145,7 @@ public class CssStyle extends ResourceEl
 
     private static final long serialVersionUID = 1L;
 
-     // -------------------------------------------------------------- Variables
+     // Variables -------------------------------------------------------------
 
     /** The inline Css content. */
     private String content;
@@ -153,15 +153,15 @@ public class CssStyle extends ResourceEl
     /**
      * Indicates if the HeadElement's content should be wrapped in a CDATA tag.
      */
-    private boolean characterData = false;
+    private boolean characterData;
 
     /** The path of the template to render. */
     private String template;
 
     /** The model of the template to render. */
-    private Map model;
+    private Map<String, Object> model;
 
-    // ------------------------------------------------------------ Constructor
+    // Constructor ------------------------------------------------------------
 
     /**
      * Construct a new Css style element.
@@ -211,13 +211,13 @@ public class CssStyle extends ResourceEl
      * @param template the path of the template to render
      * @param model the template model
      */
-    public CssStyle(String template, Map model) {
+    public CssStyle(String template, Map<String, Object> model) {
         this(null);
         setTemplate(template);
         setModel(model);
     }
 
-    // ------------------------------------------------------ Public properties
+    // Public Properties ------------------------------------------------------
 
     /**
      * Returns the Css HTML tag: &lt;style&gt;.
@@ -300,7 +300,7 @@ public class CssStyle extends ResourceEl
      *
      * @return the model of the template to render
      */
-    public Map getModel() {
+    public Map<String, Object> getModel() {
         return model;
     }
 
@@ -313,11 +313,11 @@ public class CssStyle extends ResourceEl
      *
      * @param model the model of the template to render
      */
-    public void setModel(Map model) {
+    public void setModel(Map<String, Object> model) {
         this.model = model;
     }
 
-    // --------------------------------------------------------- Public Methods
+    // Public Methods ---------------------------------------------------------
 
     /**
      * Render the HTML representation of the CssStyle element to the specified
@@ -357,8 +357,10 @@ public class CssStyle extends ResourceEl
      * @see java.lang.Object#equals(java.lang.Object)
      *
      * @param o the object with which to compare this instance with
+     *
      * @return true if the specified object is the same as this object
      */
+    @Override
     public boolean equals(Object o) {
         if (!isUnique()) {
             return super.equals(o);
@@ -387,6 +389,7 @@ public class CssStyle extends ResourceEl
      *
      * @return a hash code value for this object
      */
+    @Override
     public int hashCode() {
         if (!isUnique()) {
             return super.hashCode();
@@ -394,7 +397,7 @@ public class CssStyle extends ResourceEl
         return new HashCodeBuilder(17, 37).append(getId()).toHashCode();
     }
 
-    // ------------------------------------------------------ Protected Methods
+    // Protected Methods ------------------------------------------------------
 
     /**
      * Render the CssStyle {@link #setContent(java.lang.String) content}
@@ -413,9 +416,9 @@ public class CssStyle extends ResourceEl
         if (getTemplate() != null) {
             Context context = getContext();
 
-            Map templateModel = getModel();
+            Map<String, Object> templateModel = getModel();
             if (templateModel == null) {
-                templateModel = new HashMap();
+                templateModel = new HashMap<String, Object>();
             }
             buffer.append(context.renderTemplate(getTemplate(), templateModel));
 
@@ -426,7 +429,7 @@ public class CssStyle extends ResourceEl
         }
     }
 
-    // ------------------------------------------------ Package Private Methods
+    // Package Private Methods ------------------------------------------------
 
     /**
      * Render the CDATA tag prefix to the specified buffer if

Modified: click/trunk/click/framework/src/org/apache/click/element/Element.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/Element.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/Element.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/Element.java Sun Mar 14 09:07:17 2010
@@ -21,6 +21,7 @@ package org.apache.click.element;
 import java.io.Serializable;
 import java.util.HashMap;
 import java.util.Map;
+
 import org.apache.click.Context;
 import org.apache.click.util.HtmlStringBuffer;
 
@@ -35,12 +36,12 @@ public class Element implements Serializ
 
     private static final long serialVersionUID = 1L;
 
-    // -------------------------------------------------------------- Variables
+    // Variables --------------------------------------------------------------
 
     /** The Element attributes Map. */
-    private Map attributes;
+    private Map<String, String> attributes;
 
-    // ------------------------------------------------------ Public properties
+    // Public Properties ------------------------------------------------------
 
     /**
      * Returns the Element HTML tag, the default value is <tt>null</tt>.
@@ -91,9 +92,9 @@ public class Element implements Serializ
      *
      * @return the Element attributes Map.
      */
-    public Map getAttributes() {
+    public Map<String, String> getAttributes() {
         if (attributes == null) {
-            attributes = new HashMap();
+            attributes = new HashMap<String, String>();
         }
         return attributes;
     }
@@ -144,7 +145,7 @@ public class Element implements Serializ
         }
     }
 
-    // --------------------------------------------------------- Public methods
+    // Public Methods ---------------------------------------------------------
 
     /**
      * Return the thread local Context.
@@ -177,6 +178,7 @@ public class Element implements Serializ
      *
      * @return the HTML string representation of the Element
      */
+    @Override
     public String toString() {
         if (getTag() == null) {
             return "";
@@ -186,7 +188,7 @@ public class Element implements Serializ
         return buffer.toString();
     }
 
-    // ------------------------------------------------------ Protected Methods
+    // Protected Methods ------------------------------------------------------
 
     /**
      * Append all the Element attributes to the specified buffer.
@@ -199,7 +201,7 @@ public class Element implements Serializ
         }
     }
 
-    // ------------------------------------------------ Package Private Methods
+    // Package Private Methods ------------------------------------------------
 
     /**
      * Render the specified {@link #getTag() tag} and {@link #getAttributes()}.

Modified: click/trunk/click/framework/src/org/apache/click/element/JsImport.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/JsImport.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/JsImport.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/JsImport.java Sun Mar 14 09:07:17 2010
@@ -54,7 +54,7 @@ public class JsImport extends ResourceEl
 
     private static final long serialVersionUID = 1L;
 
-    // ----------------------------------------------------------- Constructors
+    // Constructors -----------------------------------------------------------
 
     /**
      * Constructs a new JavaScript import element.
@@ -126,7 +126,7 @@ public class JsImport extends ResourceEl
         setVersionIndicator(versionIndicator);
     }
 
-    // ------------------------------------------------------ Public properties
+    // Public Properties ------------------------------------------------------
 
     /**
      * Returns the JavaScript import HTML tag: &lt;script&gt;.
@@ -192,7 +192,7 @@ public class JsImport extends ResourceEl
         return getAttribute("src");
     }
 
-    // ------------------------------------------------ Package Private Methods
+    // Package Private Methods ------------------------------------------------
 
     /**
      * Render the HTML representation of the JsImport element to the specified
@@ -231,6 +231,7 @@ public class JsImport extends ResourceEl
      * @param o the object with which to compare this instance with
      * @return true if the specified object is the same as this object
      */
+    @Override
     public boolean equals(Object o) {
         //1. Use the == operator to check if the argument is a reference to this object.
         if (o == this) {
@@ -245,8 +246,8 @@ public class JsImport extends ResourceEl
         //3. Cast the argument to the correct type.
         JsImport that = (JsImport) o;
 
-        return getSrc() == null ? that.getSrc() == null
-            : getSrc().equals(that.getSrc());
+        return (getSrc() == null) ? (that.getSrc() == null)
+                                  : (getSrc().equals(that.getSrc()));
     }
 
     /**
@@ -254,6 +255,7 @@ public class JsImport extends ResourceEl
      *
      * @return a hash code value for this object
      */
+    @Override
     public int hashCode() {
         return new HashCodeBuilder(17, 37).append(getSrc()).toHashCode();
     }

Modified: click/trunk/click/framework/src/org/apache/click/element/JsScript.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/JsScript.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/JsScript.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/JsScript.java Sun Mar 14 09:07:17 2010
@@ -146,7 +146,7 @@ public class JsScript extends ResourceEl
 
     private static final long serialVersionUID = 1L;
 
-    // -------------------------------------------------------------- Variables
+    // Variables --------------------------------------------------------------
 
     /** The inline JavaScript content. */
     private String content;
@@ -166,9 +166,9 @@ public class JsScript extends ResourceEl
     private String template;
 
     /** The model of the template to render. */
-    private Map model;
+    private Map<String, Object> model;
 
-    // ----------------------------------------------------------- Constructors
+    // Constructors -----------------------------------------------------------
 
     /**
      * Construct a new inline JavaScript element.
@@ -218,13 +218,13 @@ public class JsScript extends ResourceEl
      * @param template the path of the template to render
      * @param model the template model
      */
-    public JsScript(String template, Map model) {
+    public JsScript(String template, Map<String, Object> model) {
         this(null);
         setTemplate(template);
         setModel(model);
     }
 
-    // ------------------------------------------------------ Public Properties
+    // Public Properties ------------------------------------------------------
 
     /**
      * Returns the JavaScript HTML tag: &lt;script&gt;.
@@ -344,7 +344,7 @@ public class JsScript extends ResourceEl
      *
      * @return the model of the template to render
      */
-    public Map getModel() {
+    public Map<String, Object> getModel() {
         return model;
     }
 
@@ -357,11 +357,11 @@ public class JsScript extends ResourceEl
      *
      * @param model the model of the template to render
      */
-    public void setModel(Map model) {
+    public void setModel(Map<String, Object> model) {
         this.model = model;
     }
 
-    // --------------------------------------------------------- Public Methods
+    // Public Methods ---------------------------------------------------------
 
     /**
      * Render the HTML representation of the JsScript element to the specified
@@ -418,6 +418,7 @@ public class JsScript extends ResourceEl
      * @param o the object with which to compare this instance with
      * @return true if the specified object is the same as this object
      */
+    @Override
     public boolean equals(Object o) {
         if (!isUnique()) {
             return super.equals(o);
@@ -446,6 +447,7 @@ public class JsScript extends ResourceEl
      *
      * @return a hash code value for this object
      */
+    @Override
     public int hashCode() {
         if (!isUnique()) {
             return super.hashCode();
@@ -453,7 +455,7 @@ public class JsScript extends ResourceEl
         return new HashCodeBuilder(17, 37).append(getId()).toHashCode();
     }
 
-    // ------------------------------------------------------ Protected Methods
+    // Protected Methods ------------------------------------------------------
 
     /**
      * Render the JsScript {@link #setContent(java.lang.String) content}
@@ -472,9 +474,9 @@ public class JsScript extends ResourceEl
     protected void renderContent(HtmlStringBuffer buffer, Context context) {
         if (getTemplate() != null) {
 
-            Map templateModel = getModel();
+            Map<String, Object> templateModel = getModel();
             if (templateModel == null) {
-                templateModel = new HashMap();
+                templateModel = new HashMap<String, Object>();
             }
             buffer.append(context.renderTemplate(getTemplate(), templateModel));
 
@@ -516,7 +518,7 @@ public class JsScript extends ResourceEl
         }
     }
 
-    // ------------------------------------------------ Package Private Methods
+    // Package Private Methods ------------------------------------------------
 
     /**
      * Render the CDATA tag prefix to the specified buffer if

Modified: click/trunk/click/framework/src/org/apache/click/element/ResourceElement.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/element/ResourceElement.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/element/ResourceElement.java (original)
+++ click/trunk/click/framework/src/org/apache/click/element/ResourceElement.java Sun Mar 14 09:07:17 2010
@@ -171,7 +171,7 @@ public class ResourceElement extends Ele
 
     private static final long serialVersionUID = 1L;
 
-    // -------------------------------------------------------------- Constants
+    // Constants --------------------------------------------------------------
 
     /**
      * A predefined conditional comment to test if browser is IE. Value:
@@ -191,7 +191,7 @@ public class ResourceElement extends Ele
      */
     public static final String IF_IE7 = "[if IE 7]";
 
-    // -------------------------------------------------------------- Variables
+    // Variables --------------------------------------------------------------
 
     /**
      * The Internet Explorer conditional comment to wrap the Resource with.
@@ -270,7 +270,7 @@ public class ResourceElement extends Ele
         this.conditionalComment = conditionalComment;
     }
 
-    // --------------------------------------------------------- Public methods
+    // Public Methods ---------------------------------------------------------
 
     /**
      * Render the HTML representation of the Resource element to the specified
@@ -294,7 +294,7 @@ public class ResourceElement extends Ele
         renderConditionalCommentSuffix(buffer);
     }
 
-    // ------------------------------------------------ Package Private Methods
+    // Package Private Methods ------------------------------------------------
 
     /**
      * Render the given attribute and resourcePath and append the

Modified: click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/HtmlStringBuffer.java Sun Mar 14 09:07:17 2010
@@ -18,7 +18,6 @@
  */
 package org.apache.click.util;
 
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -343,16 +342,13 @@ public class HtmlStringBuffer {
      * @return a reference to this <tt>HtmlStringBuffer</tt> object
      * @throws IllegalArgumentException if attributes is null
      */
-    public HtmlStringBuffer appendAttributes(Map attributes) {
+    public HtmlStringBuffer appendAttributes(Map<String, String> attributes) {
         if (attributes == null) {
             throw new IllegalArgumentException("Null attributes parameter");
         }
-        for (Iterator i = attributes.entrySet().iterator(); i.hasNext();) {
-            Map.Entry entry = (Map.Entry) i.next();
-            String name = entry.getKey().toString();
-
+        for (String name : attributes.keySet()) {
             if (!name.equals("id")) {
-                Object value = entry.getValue();
+                Object value = attributes.get(name);
                 appendAttributeEscaped(name, value);
             }
         }
@@ -368,7 +364,7 @@ public class HtmlStringBuffer {
      * @return a reference to this <tt>HtmlStringBuffer</tt> object
      * @throws IllegalArgumentException if attributes is null
      */
-    public HtmlStringBuffer appendStyleAttributes(Map attributes) {
+    public HtmlStringBuffer appendStyleAttributes(Map<String, String> attributes) {
         if (attributes == null) {
             throw new IllegalArgumentException("Null attributes parameter");
         }
@@ -376,14 +372,10 @@ public class HtmlStringBuffer {
         if (!attributes.isEmpty()) {
             append(" style=\"");
 
-            for (Iterator i = attributes.entrySet().iterator(); i.hasNext();) {
-                Map.Entry entry = (Map.Entry) i.next();
-                String name = entry.getKey().toString();
-                String value = entry.getValue().toString();
-
+            for (String name : attributes.keySet()) {
                 append(name);
                 append(":");
-                append(value);
+                append(attributes.get(name));
                 append(";");
             }
 

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=922796&r1=922795&r2=922796&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 Sun Mar 14 09:07:17 2010
@@ -19,11 +19,10 @@
 package org.apache.click.util;
 
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-
 import java.util.StringTokenizer;
+
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.click.Control;
@@ -37,7 +36,6 @@ import org.apache.click.element.JsImport
 import org.apache.click.element.JsScript;
 import org.apache.click.element.ResourceElement;
 import org.apache.click.service.LogService;
-
 import org.apache.commons.lang.StringUtils;
 
 /**
@@ -108,24 +106,24 @@ public class PageImports {
     protected boolean initialized = false;
 
     /** The list of head elements. */
-    protected List headElements = new ArrayList();
+    protected List<Element> headElements = new ArrayList<Element>(5);
 
     /** The list of CSS import lines. */
-    protected List cssImports = new ArrayList();
+    protected List<CssImport> cssImports = new ArrayList<CssImport>(2);
 
     /** The list of JS import lines. */
-    protected List jsImports = new ArrayList();
+    protected List<JsImport> jsImports = new ArrayList<JsImport>(2);
 
     /** The list of JS script block lines. */
-    protected List jsScripts = new ArrayList();
+    protected List<JsScript> jsScripts = new ArrayList<JsScript>(2);
 
     /** The list of CSS styles. */
-    protected List cssStyles = new ArrayList();
+    protected List<CssStyle> cssStyles = new ArrayList<CssStyle>(2);
 
     /** The page instance. */
     protected final Page page;
 
-    // ------------------------------------------------------------ Constructor
+    // Constructor ------------------------------------------------------------
 
     /**
      * Create a page control HTML includes object.
@@ -136,7 +134,7 @@ public class PageImports {
         this.page = page;
     }
 
-    // --------------------------------------------------------- Public Methods
+    // Public Methods ---------------------------------------------------------
 
     /**
      * Add the given Element to the Page HEAD elements.
@@ -153,7 +151,7 @@ public class PageImports {
             if (jsImports.contains(element)) {
                 return;
             }
-            jsImports.add(element);
+            jsImports.add((JsImport) element);
 
         } else if (element instanceof JsScript) {
             if (((JsScript) element).isUnique()) {
@@ -161,13 +159,13 @@ public class PageImports {
                     return;
                 }
             }
-            jsScripts.add(element);
+            jsScripts.add((JsScript) element);
 
         } else if (element instanceof CssImport) {
             if (cssImports.contains(element)) {
                 return;
             }
-            cssImports.add(element);
+            cssImports.add((CssImport) element);
 
         } else if (element instanceof CssStyle) {
             if (((CssStyle) element).isUnique()) {
@@ -175,7 +173,7 @@ public class PageImports {
                     return;
                 }
             }
-            cssStyles.add(element);
+            cssStyles.add((CssStyle) element);
 
         } else {
             headElements.add(element);
@@ -271,7 +269,7 @@ public class PageImports {
      *
      * @param model the model to populate with html import keys
      */
-    public void populateTemplateModel(Map model) {
+    public void populateTemplateModel(Map<String, Object> model) {
         LogService logger = ClickUtils.getLogService();
 
         Object pop = model.put("headElements", new HeadElements());
@@ -329,7 +327,7 @@ public class PageImports {
      * @param request the http request to populate
      * @param model the model to populate with html import keys
      */
-    public void populateRequest(HttpServletRequest request, Map model) {
+    public void populateRequest(HttpServletRequest request, Map<String, Object> model) {
         LogService logger = ClickUtils.getLogService();
 
         request.setAttribute("headElements", new HeadElements());
@@ -391,9 +389,9 @@ public class PageImports {
      *
      * @param controls the list of Controls which HEAD elements to process
      */
-    public void processControls(List controls) {
-        for (int i = 0; i < controls.size(); i++) {
-            Control control = (Control) controls.get(i);
+    @SuppressWarnings("deprecation")
+    public void processControls(List<Control> controls) {
+        for (Control control : controls) {
 
             // import from getHtmlImports
             addImport(control.getHtmlImports());
@@ -420,18 +418,16 @@ public class PageImports {
         if (control instanceof Container) {
             Container container = (Container) control;
             if (container.hasControls()) {
-                List controls = container.getControls();
-                for (int i = 0, size = controls.size(); i < size; i++) {
-                    processControl((Control) controls.get(i));
+                for (Control childControl  : container.getControls()) {
+                    processControl(childControl);
                 }
             }
 
         } else if (control instanceof Table) {
             Table table = (Table) control;
             if (table.hasControls()) {
-                List controls = table.getControls();
-                for (int i = 0, size = controls.size(); i < size; i++) {
-                    processControl((Control) controls.get(i));
+                for (Control childControl : table.getControls()) {
+                    processControl(childControl);
                 }
             }
         }
@@ -444,8 +440,8 @@ public class PageImports {
      *
      * @return the list of processed HEAD elements
      */
-    public final List getHeadElements() {
-        List result = new ArrayList(headElements);
+    public final List<Element> getHeadElements() {
+        List<Element> result = new ArrayList<Element>(headElements);
         result.addAll(cssImports);
         result.addAll(cssStyles);
         return result;
@@ -456,8 +452,8 @@ public class PageImports {
      *
      * @return the list of processed JavaScript elements
      */
-    public final List getJsElements() {
-        List result = new ArrayList(jsImports);
+    public final List<Element> getJsElements() {
+        List<Element> result = new ArrayList<Element>(jsImports);
         result.addAll(jsScripts);
         return result;
     }
@@ -472,8 +468,7 @@ public class PageImports {
      */
     protected void renderHeadElements(HtmlStringBuffer buffer) {
         // First include miscellaneous elements e.g. Title and Meta elements.
-        for (Iterator it = headElements.iterator(); it.hasNext();) {
-            Element element = (Element) it.next();
+        for (Element element : headElements) {
             element.render(buffer);
             buffer.append('\n');
         }
@@ -504,15 +499,13 @@ public class PageImports {
      */
     protected void renderCssElements(HtmlStringBuffer buffer) {
         // First include all the imports e.g. <link href="...">
-        for (Iterator it = cssImports.iterator(); it.hasNext();) {
-            CssImport cssImport = (CssImport) it.next();
+        for (CssImport cssImport : cssImports) {
             cssImport.render(buffer);
             buffer.append('\n');
         }
 
         // Then include all the styles e.g. <style>...</style>
-        for (Iterator it = cssStyles.iterator(); it.hasNext();) {
-            CssStyle cssStyle = (CssStyle) it.next();
+        for (CssStyle cssStyle : cssStyles) {
             cssStyle.render(buffer);
             buffer.append('\n');
         }
@@ -526,15 +519,13 @@ public class PageImports {
      */
     protected void renderJsElements(HtmlStringBuffer buffer) {
         // First include all the imports e.g. <script src="...">
-        for (Iterator it = jsImports.iterator(); it.hasNext();) {
-            JsImport jsImport = (JsImport) it.next();
+        for (JsImport jsImport : jsImports) {
             jsImport.render(buffer);
             buffer.append('\n');
         }
 
         // Then include all the scripts e.g. <script>...</script>
-        for (Iterator it = jsScripts.iterator(); it.hasNext();) {
-            JsScript jsScript = (JsScript) it.next();
+        for (JsScript jsScript : jsScripts) {
             jsScript.render(buffer);
             buffer.append('\n');
         }
@@ -543,6 +534,7 @@ public class PageImports {
     /**
      * Process the Page's set of control HEAD elements.
      */
+    @SuppressWarnings("deprecation")
     protected void processPageControls() {
         if (isInitialized()) {
             return;
@@ -569,23 +561,15 @@ public class PageImports {
      *
      * @param elements the list of HEAD elements to process
      */
-    protected void processHeadElements(List elements) {
-        if (elements == null || elements.isEmpty()) {
-            return;
-        }
-
-        Iterator it = elements.iterator();
-        while (it.hasNext()) {
-            Object item = it.next();
-            if (!(item instanceof Element)) {
-                throw new IllegalStateException(item.getClass() + " is not"
-                    + " of type " + Element.class);
+    protected void processHeadElements(List<Element> elements) {
+        if (elements != null) {
+            for (Element element : elements) {
+                add(element);
             }
-            add((Element) item);
         }
     }
 
-    // ------------------------------------------------------- Internal Classes
+    // Internal Classes -------------------------------------------------------
 
     /**
      * This class enables lazy, on demand importing for

Modified: click/trunk/click/framework/src/org/apache/velocity/tools/view/servlet/WebappLoader.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/velocity/tools/view/servlet/WebappLoader.java?rev=922796&r1=922795&r2=922796&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/velocity/tools/view/servlet/WebappLoader.java (original)
+++ click/trunk/click/framework/src/org/apache/velocity/tools/view/servlet/WebappLoader.java Sun Mar 14 09:07:17 2010
@@ -53,6 +53,7 @@ import org.apache.velocity.runtime.resou
  * @author <a href="mailto:claude@savoirweb.com">Claude Brisson</a>
  * @version $Id$
  */
+@SuppressWarnings("unchecked")
 public class WebappLoader extends ResourceLoader
 {
 



Mime
View raw message