You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sl...@apache.org on 2008/10/05 19:06:06 UTC

svn commit: r701829 [3/12] - in /myfaces/core/branches/2_0_0: api/src/main/java/javax/faces/ api/src/main/java/javax/faces/application/ api/src/main/java/javax/faces/component/ api/src/main/java/javax/faces/context/ api/src/main/java/javax/faces/conver...

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIData.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIData.java?rev=701829&r1=701828&r2=701829&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIData.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIData.java Sun Oct  5 10:06:02 2008
@@ -40,76 +40,72 @@
  * <p>
  * The children of this component are expected to be UIColumn components.
  * <p>
- * Note that the same set of child components are reused to implement each row of the table in turn during
- * such phases as apply-request-values and render-response. Altering any of the members of these components
- * therefore affects the attribute for every row, except for the following members:
+ * Note that the same set of child components are reused to implement each row of the table in turn during such phases
+ * as apply-request-values and render-response. Altering any of the members of these components therefore affects the
+ * attribute for every row, except for the following members:
  * <ul>
  * <li>submittedValue
  * <li>value (where no EL binding is used)
  * <li>valid
  * </ul>
  * <p>
- * This reuse of the child components also means that it is not possible to save a reference to a component
- * during table processing, then access it later and expect it to still represent the same row of the table.
+ * This reuse of the child components also means that it is not possible to save a reference to a component during table
+ * processing, then access it later and expect it to still represent the same row of the table.
  * <h1>
- * Implementation Notes
- * </h1>
+ * Implementation Notes</h1>
  * <p>
- * Each of the UIColumn children of this component has a few component children of its own to render the contents
- * of the table cell. However there can be a very large number of rows in a table, so it isn't efficient for the
- * UIColumn and all its child objects to be duplicated for each row in the table. Instead the "flyweight" pattern
- * is used where a serialized state is held for each row. When setRowIndex is invoked, the UIColumn objects and
- * their children serialize their current state then reinitialise themselves from the appropriate saved state.
- * This allows a single set of real objects to represent multiple objects which have the same types but potentially
- * different internal state. When a row is selected for the first time, its state is set to a clean "initial" state.
- * Transient components (including any read-only component) do not save their state; they are just reinitialised as
- * required. The state saved/restored when changing rows is not the complete component state, just the fields that
- * are expected to vary between rows: "submittedValue", "value", "isValid".
+ * Each of the UIColumn children of this component has a few component children of its own to render the contents of the
+ * table cell. However there can be a very large number of rows in a table, so it isn't efficient for the UIColumn and
+ * all its child objects to be duplicated for each row in the table. Instead the "flyweight" pattern is used where a
+ * serialized state is held for each row. When setRowIndex is invoked, the UIColumn objects and their children serialize
+ * their current state then reinitialise themselves from the appropriate saved state. This allows a single set of real
+ * objects to represent multiple objects which have the same types but potentially different internal state. When a row
+ * is selected for the first time, its state is set to a clean "initial" state. Transient components (including any
+ * read-only component) do not save their state; they are just reinitialised as required. The state saved/restored when
+ * changing rows is not the complete component state, just the fields that are expected to vary between rows:
+ * "submittedValue", "value", "isValid".
  * </p>
  * <p>
- * Note that a table is a "naming container", so that components within the table have their ids prefixed with the
- * id of the table. Actually, when setRowIndex has been called on a table with id of "zzz" the table pretends to
- * its children that its ID is "zzz_n" where n is the row index. This means that renderers for child components which
- * call component.getClientId automatically get ids of form "zzz_n:childId" thus ensuring that components in
- * different rows of the table get different ids.
+ * Note that a table is a "naming container", so that components within the table have their ids prefixed with the id of
+ * the table. Actually, when setRowIndex has been called on a table with id of "zzz" the table pretends to its children
+ * that its ID is "zzz_n" where n is the row index. This means that renderers for child components which call
+ * component.getClientId automatically get ids of form "zzz_n:childId" thus ensuring that components in different rows
+ * of the table get different ids.
  * </p>
  * <p>
- * When decoding a submitted page, this class iterates over all its possible rowIndex values, restoring the
- * appropriate serialized row state then calling processDecodes on the child components. Because the child
- * components (or their renderers) use getClientId to get the request key to look for parameter data, and because
- * this object pretends to have a different id per row ("zzz_n") a single child component can decode data from each
- * table row in turn without being aware that it is within a table. The table's data model is updated before each
- * call to child.processDecodes, so the child decode method can assume that the data model's rowData points to the
- * model object associated with the row currently being decoded. Exactly the same process applies for the later
- * validation and updateModel phases.
+ * When decoding a submitted page, this class iterates over all its possible rowIndex values, restoring the appropriate
+ * serialized row state then calling processDecodes on the child components. Because the child components (or their
+ * renderers) use getClientId to get the request key to look for parameter data, and because this object pretends to
+ * have a different id per row ("zzz_n") a single child component can decode data from each table row in turn without
+ * being aware that it is within a table. The table's data model is updated before each call to child.processDecodes, so
+ * the child decode method can assume that the data model's rowData points to the model object associated with the row
+ * currently being decoded. Exactly the same process applies for the later validation and updateModel phases.
  * </p>
  * <p>
- * When the data model for the table is bound to a backing bean property, and no validation errors have occured
- * during processing of a postback, the data model is refetched at the start of the rendering phase (ie after the
- * update model phase) so that the contents of the data model can be changed as a result of the latest form
- * submission. Because the saved row state must correspond to the elements within the data model, the row state
- * must be discarded whenever a new data model is fetched; not doing this would cause all sorts of inconsistency
- * issues. This does imply that changing the state of any of the members "submittedValue", "value" or "valid" of
- * a component within the table during the invokeApplication phase has no effect on the rendering of the table.
- * When a validation error has occurred, a new DataModel is <i>not</i> fetched, and the saved state of the child
- * components is <i>not</i> discarded.
+ * When the data model for the table is bound to a backing bean property, and no validation errors have occured during
+ * processing of a postback, the data model is refetched at the start of the rendering phase (ie after the update model
+ * phase) so that the contents of the data model can be changed as a result of the latest form submission. Because the
+ * saved row state must correspond to the elements within the data model, the row state must be discarded whenever a new
+ * data model is fetched; not doing this would cause all sorts of inconsistency issues. This does imply that changing
+ * the state of any of the members "submittedValue", "value" or "valid" of a component within the table during the
+ * invokeApplication phase has no effect on the rendering of the table. When a validation error has occurred, a new
+ * DataModel is <i>not</i> fetched, and the saved state of the child components is <i>not</i> discarded.
  * </p>
  * see Javadoc of the <a href="http://java.sun.com/j2ee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
  * for more information.
- *
+ * 
  * @author Manfred Geiler (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
 @JSFComponent(defaultRendererType = "javax.faces.Table")
-public class UIData extends UIComponentBase
-                    implements NamingContainer
+public class UIData extends UIComponentBase implements NamingContainer
 {
     public static final String COMPONENT_FAMILY = "javax.faces.Data";
     public static final String COMPONENT_TYPE = "javax.faces.Data"; // for unit tests
 
     private static final String FOOTER_FACET_NAME = "footer";
     private static final String HEADER_FACET_NAME = "header";
-    private static final Class OBJECT_ARRAY_CLASS = (new Object[0]).getClass();
+    private static final Class<Object[]> OBJECT_ARRAY_CLASS = Object[].class;
     private static final int PROCESS_DECODES = 1;
     private static final int PROCESS_VALIDATORS = 2;
     private static final int PROCESS_UPDATES = 3;
@@ -120,16 +116,14 @@
     // Holds for each row the states of the child components of this UIData.
     // Note that only "partial" component state is saved: the component fields
     // that are expected to vary between rows.
-    private Map _rowStates = new HashMap();
+    private Map<String, Collection<Object[]>> _rowStates = new HashMap<String, Collection<Object[]>>();
 
     /**
-     * Handle case where this table is nested inside another table.
-     * See method getDataModel for more details.
+     * Handle case where this table is nested inside another table. See method getDataModel for more details.
      * <p>
-     * Key: parentClientId (aka rowId when nested within a parent table)
-     * Value: DataModel
+     * Key: parentClientId (aka rowId when nested within a parent table) Value: DataModel
      */
-    private Map _dataModelMap = new HashMap();
+    private Map<String, DataModel> _dataModelMap = new HashMap<String, DataModel>();
 
     // will be set to false if the data should not be refreshed at the beginning of the encode phase
     private boolean _isValidChilds = true;
@@ -148,8 +142,7 @@
         private FacesEvent _wrappedFacesEvent;
         private int _rowIndex;
 
-        public FacesEventWrapper(FacesEvent facesEvent, int rowIndex,
-                UIData redirectComponent)
+        public FacesEventWrapper(FacesEvent facesEvent, int rowIndex, UIData redirectComponent)
         {
             super(redirectComponent);
             _wrappedFacesEvent = facesEvent;
@@ -203,7 +196,6 @@
         }
     }
 
-
     private static final DataModel EMPTY_DATA_MODEL = new DataModel()
     {
         @Override
@@ -248,10 +240,9 @@
         {
             if (obj == null)
             {
-                return; //Clearing is allowed
+                return; // Clearing is allowed
             }
-            throw new UnsupportedOperationException(this.getClass().getName()
-                    + " UnsupportedOperationException");
+            throw new UnsupportedOperationException(this.getClass().getName() + " UnsupportedOperationException");
         }
     };
 
@@ -288,13 +279,15 @@
     }
 
     @Override
-    public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback) throws FacesException {
+    public boolean invokeOnComponent(FacesContext context, String clientId, ContextCallback callback)
+        throws FacesException
+    {
         if (context == null || clientId == null || callback == null)
         {
             throw new NullPointerException();
         }
 
-        //searching for this component?
+        // searching for this component?
         boolean returnValue = this.getClientId(context).equals(clientId);
 
         if (returnValue)
@@ -310,7 +303,7 @@
             return returnValue;
         }
 
-        //Now Look throught facets on this UIComponent
+        // Now Look throught facets on this UIComponent
         for (Iterator<UIComponent> it = this.getFacets().values().iterator(); !returnValue && it.hasNext();)
         {
             returnValue = it.next().invokeOnComponent(context, clientId, callback);
@@ -321,40 +314,40 @@
             return returnValue;
         }
 
-        //Now we have to check if it is searching an inner component
+        // Now we have to check if it is searching an inner component
         String baseClientId = super.getClientId(context);
 
-        //First check if the clientId starts with the baseClientId of
-        //this component, to check if continue trying to find the component
-        //inside the children of this component.
+        // First check if the clientId starts with the baseClientId of
+        // this component, to check if continue trying to find the component
+        // inside the children of this component.
         if (clientId.matches(baseClientId + ":[0-9]+:.*"))
         {
 
             String subId = clientId.substring(baseClientId.length() + 1);
             String clientRow = subId.substring(0, subId.indexOf(':'));
 
-            //Now we save the current position
+            // Now we save the current position
             int oldRow = this.getRowIndex();
 
-            //The conversion is safe, because its already checked on the
-            //regular expresion
+            // The conversion is safe, because its already checked on the
+            // regular expresion
             this.setRowIndex(Integer.parseInt(clientRow));
 
             for (Iterator<UIComponent> it1 = getChildren().iterator(); !returnValue && it1.hasNext();)
             {
-                //recursive call to find the component
+                // recursive call to find the component
                 UIComponent child = it1.next();
                 returnValue = child.invokeOnComponent(context, clientId, callback);
             }
 
-            //Restore the old position. Doing this prevent
-            //side effects.
+            // Restore the old position. Doing this prevent
+            // side effects.
             this.setRowIndex(oldRow);
         }
         else
         {
-            //The component that matches this clientId must be outside
-            //of this component
+            // The component that matches this clientId must be outside
+            // of this component
             return false;
         }
 
@@ -369,7 +362,7 @@
     @JSFFacet
     public UIComponent getFooter()
     {
-        return (UIComponent) getFacets().get(FOOTER_FACET_NAME);
+        return getFacets().get(FOOTER_FACET_NAME);
     }
 
     public void setHeader(UIComponent header)
@@ -380,7 +373,7 @@
     @JSFFacet
     public UIComponent getHeader()
     {
-        return (UIComponent) getFacets().get(HEADER_FACET_NAME);
+        return getFacets().get(HEADER_FACET_NAME);
     }
 
     public boolean isRowAvailable()
@@ -408,6 +401,7 @@
      * <p>
      * Param rowIndex can be -1, meaning "no row".
      * <p>
+     * 
      * @param rowIndex
      */
     public void setRowIndex(int rowIndex)
@@ -432,8 +426,7 @@
                 // that we haven't visited before, ie a "saved state" that can
                 // be pushed to the "restoreState" method of all the child
                 // components to set them up to represent a clean row.
-                _initialDescendantComponentState = saveDescendantComponentStates(
-                        getChildren().iterator(), false);
+                _initialDescendantComponentState = saveDescendantComponentStates(getChildren().iterator(), false);
             }
         }
         else
@@ -442,9 +435,7 @@
             // move off it, so save the (partial) state of the components
             // representing the current row. Later if this row is revisited
             // then we can restore this state.
-            _rowStates.put(getClientId(facesContext),
-                    saveDescendantComponentStates(getChildren().iterator(),
-                            false));
+            _rowStates.put(getClientId(facesContext), saveDescendantComponentStates(getChildren().iterator(), false));
         }
 
         _rowIndex = rowIndex;
@@ -467,13 +458,11 @@
                 if (isRowAvailable())
                 {
                     Object rowData = dataModel.getRowData();
-                    facesContext.getExternalContext().getRequestMap().put(var,
-                            rowData);
+                    facesContext.getExternalContext().getRequestMap().put(var, rowData);
                 }
                 else
                 {
-                    facesContext.getExternalContext().getRequestMap().remove(
-                            var);
+                    facesContext.getExternalContext().getRequestMap().remove(var);
                 }
             }
         }
@@ -481,8 +470,7 @@
         if (_rowIndex == -1)
         {
             // reset components to initial state
-            restoreDescendantComponentStates(getChildren().iterator(),
-                    _initialDescendantComponentState, false);
+            restoreDescendantComponentStates(getChildren().iterator(), _initialDescendantComponentState, false);
         }
         else
         {
@@ -492,8 +480,7 @@
                 // We haven't been positioned on this row before, so just
                 // configure the child components of this component with
                 // the standard "initial" state
-                restoreDescendantComponentStates(getChildren().iterator(),
-                        _initialDescendantComponentState, false);
+                restoreDescendantComponentStates(getChildren().iterator(), _initialDescendantComponentState, false);
             }
             else
             {
@@ -501,50 +488,48 @@
                 // the child components of this component with the (partial)
                 // state that was previously saved. Fields not in the
                 // partial saved state are left with their original values.
-                restoreDescendantComponentStates(getChildren().iterator(),
-                        rowState, false);
+                restoreDescendantComponentStates(getChildren().iterator(), rowState, false);
             }
         }
     }
 
     /**
-     * Overwrite the state of the child components of this component
-     * with data previously saved by method saveDescendantComponentStates.
+     * Overwrite the state of the child components of this component with data previously saved by method
+     * saveDescendantComponentStates.
      * <p>
-     * The saved state info only covers those fields that are expected to
-     * vary between rows of a table. Other fields are not modified.
+     * The saved state info only covers those fields that are expected to vary between rows of a table. Other fields are
+     * not modified.
      */
-    private void restoreDescendantComponentStates(Iterator childIterator,
-            Object state, boolean restoreChildFacets)
+    @SuppressWarnings("unchecked")
+    private void restoreDescendantComponentStates(Iterator<UIComponent> childIterator, Object state,
+                                                  boolean restoreChildFacets)
     {
-        Iterator descendantStateIterator = null;
+        Iterator<? extends Object[]> descendantStateIterator = null;
         while (childIterator.hasNext())
         {
             if (descendantStateIterator == null && state != null)
             {
-                descendantStateIterator = ((Collection) state).iterator();
+                descendantStateIterator = ((Collection<? extends Object[]>) state).iterator();
             }
-            UIComponent component = (UIComponent) childIterator.next();
+            UIComponent component = childIterator.next();
 
             // reset the client id (see spec 3.1.6)
             component.setId(component.getId());
-            if(!component.isTransient())
+            if (!component.isTransient())
             {
                 Object childState = null;
                 Object descendantState = null;
-                if (descendantStateIterator != null
-                        && descendantStateIterator.hasNext())
+                if (descendantStateIterator != null && descendantStateIterator.hasNext())
                 {
-                    Object[] object = (Object[]) descendantStateIterator.next();
+                    Object[] object = descendantStateIterator.next();
                     childState = object[0];
                     descendantState = object[1];
                 }
                 if (component instanceof EditableValueHolder)
                 {
-                    ((EditableValueHolderState) childState)
-                            .restoreState((EditableValueHolder) component);
+                    ((EditableValueHolderState) childState).restoreState((EditableValueHolder) component);
                 }
-                Iterator childsIterator;
+                Iterator<UIComponent> childsIterator;
                 if (restoreChildFacets)
                 {
                     childsIterator = component.getFacetsAndChildren();
@@ -553,48 +538,43 @@
                 {
                     childsIterator = component.getChildren().iterator();
                 }
-                restoreDescendantComponentStates(childsIterator, descendantState,
-                        true);
+                restoreDescendantComponentStates(childsIterator, descendantState, true);
             }
         }
     }
 
     /**
-     * Walk the tree of child components of this UIData, saving the parts of
-     * their state that can vary between rows.
+     * Walk the tree of child components of this UIData, saving the parts of their state that can vary between rows.
      * <p>
-     * This is very similar to the process that occurs for normal components
-     * when the view is serialized. Transient components are skipped (no
-     * state is saved for them).
+     * This is very similar to the process that occurs for normal components when the view is serialized. Transient
+     * components are skipped (no state is saved for them).
      * <p>
-     * If there are no children then null is returned. If there are one or
-     * more children, and all children are transient then an empty collection
-     * is returned; this will happen whenever a table contains only read-only
-     * components.
+     * If there are no children then null is returned. If there are one or more children, and all children are transient
+     * then an empty collection is returned; this will happen whenever a table contains only read-only components.
      * <p>
-     * Otherwise a collection is returned which contains an object for every
-     * non-transient child component; that object may itself contain a collection
-     * of the state of that child's child components.
+     * Otherwise a collection is returned which contains an object for every non-transient child component; that object
+     * may itself contain a collection of the state of that child's child components.
      */
-    private Object saveDescendantComponentStates(Iterator childIterator,
-            boolean saveChildFacets)
+    private Collection<Object[]> saveDescendantComponentStates(Iterator<UIComponent> childIterator,
+                                                               boolean saveChildFacets)
     {
-        Collection childStates = null;
+        Collection<Object[]> childStates = null;
         while (childIterator.hasNext())
         {
             if (childStates == null)
             {
-                childStates = new ArrayList();
+                childStates = new ArrayList<Object[]>();
             }
-            UIComponent child = (UIComponent) childIterator.next();
-            if(!child.isTransient())
+            
+            UIComponent child = childIterator.next();
+            if (!child.isTransient())
             {
                 // Add an entry to the collection, being an array of two
                 // elements. The first element is the state of the children
                 // of this component; the second is the state of the current
                 // child itself.
 
-                Iterator childsIterator;
+                Iterator<UIComponent> childsIterator;
                 if (saveChildFacets)
                 {
                     childsIterator = child.getFacetsAndChildren();
@@ -603,13 +583,11 @@
                 {
                     childsIterator = child.getChildren().iterator();
                 }
-                Object descendantState = saveDescendantComponentStates(
-                        childsIterator, true);
+                Object descendantState = saveDescendantComponentStates(childsIterator, true);
                 Object state = null;
                 if (child instanceof EditableValueHolder)
                 {
-                    state = new EditableValueHolderState(
-                            (EditableValueHolder) child);
+                    state = new EditableValueHolderState((EditableValueHolder) child);
                 }
                 childStates.add(new Object[] { state, descendantState });
             }
@@ -618,7 +596,8 @@
     }
 
     @Override
-    public void setValueExpression(String name, ValueExpression binding) {
+    public void setValueExpression(String name, ValueExpression binding)
+    {
         if (name == null)
         {
             throw new NullPointerException("name");
@@ -649,23 +628,17 @@
     }
 
     /**
-     * Modify events queued for any child components so that the
-     * UIData state will be correctly configured before the event's
-     * listeners are executed.
+     * Modify events queued for any child components so that the UIData state will be correctly configured before the
+     * event's listeners are executed.
      * <p>
-     * Child components or their renderers may register events against
-     * those child components. When the listener for that event is
-     * eventually invoked, it may expect the uidata's rowData and
-     * rowIndex to be referring to the same object that caused the
-     * event to fire.
+     * Child components or their renderers may register events against those child components. When the listener for
+     * that event is eventually invoked, it may expect the uidata's rowData and rowIndex to be referring to the same
+     * object that caused the event to fire.
      * <p>
-     * The original queueEvent call against the child component has been
-     * forwarded up the chain of ancestors in the standard way, making
-     * it possible here to wrap the event in a new event whose source
-     * is <i>this</i> component, not the original one. When the event
-     * finally is executed, this component's broadcast method is invoked,
-     * which ensures that the UIData is set to be at the correct row
-     * before executing the original event.
+     * The original queueEvent call against the child component has been forwarded up the chain of ancestors in the
+     * standard way, making it possible here to wrap the event in a new event whose source is <i>this</i> component, not
+     * the original one. When the event finally is executed, this component's broadcast method is invoked, which ensures
+     * that the UIData is set to be at the correct row before executing the original event.
      */
     @Override
     public void queueEvent(FacesEvent event)
@@ -674,8 +647,8 @@
     }
 
     /**
-     * Ensure that before the event's listeners are invoked this UIData
-     * component's "current row" is set to the row associated with the event.
+     * Ensure that before the event's listeners are invoked this UIData component's "current row" is set to the row
+     * associated with the event.
      * <p>
      * See queueEvent for more details.
      */
@@ -684,18 +657,17 @@
     {
         if (event instanceof FacesEventWrapper)
         {
-            FacesEvent originalEvent = ((FacesEventWrapper) event)
-                    .getWrappedFacesEvent();
+            FacesEvent originalEvent = ((FacesEventWrapper) event).getWrappedFacesEvent();
             int eventRowIndex = ((FacesEventWrapper) event).getRowIndex();
             int currentRowIndex = getRowIndex();
             setRowIndex(eventRowIndex);
             try
             {
-              originalEvent.getComponent().broadcast(originalEvent);
+                originalEvent.getComponent().broadcast(originalEvent);
             }
             finally
             {
-              setRowIndex(currentRowIndex);
+                setRowIndex(currentRowIndex);
             }
         }
         else
@@ -705,9 +677,8 @@
     }
 
     /**
-     * Perform necessary actions when rendering of this component starts,
-     * before delegating to the inherited implementation which calls the
-     * associated renderer's encodeBegin method.
+     * Perform necessary actions when rendering of this component starts, before delegating to the inherited
+     * implementation which calls the associated renderer's encodeBegin method.
      */
     @Override
     public void encodeBegin(FacesContext context) throws IOException
@@ -731,10 +702,10 @@
 
     private boolean hasErrorMessages(FacesContext context)
     {
-        for(Iterator iter = context.getMessages(); iter.hasNext();)
+        for (Iterator<FacesMessage> iter = context.getMessages(); iter.hasNext();)
         {
-            FacesMessage message = (FacesMessage) iter.next();
-            if(FacesMessage.SEVERITY_ERROR.compareTo(message.getSeverity()) <= 0)
+            FacesMessage message = iter.next();
+            if (FacesMessage.SEVERITY_ERROR.compareTo(message.getSeverity()) <= 0)
             {
                 return true;
             }
@@ -830,37 +801,35 @@
 
     private void processFacets(FacesContext context, int processAction)
     {
-        for (Iterator it = getFacets().values().iterator(); it.hasNext();)
+        for (UIComponent facet : getFacets().values())
         {
-            UIComponent facet = (UIComponent) it.next();
             process(context, facet, processAction);
         }
     }
 
     /**
-     * Invoke the specified phase on all facets of all UIColumn children
-     * of this component. Note that no methods are called on the UIColumn
-     * child objects themselves.
-     *
-     * @param context is the current faces context.
-     * @param processAction specifies a JSF phase: decode, validate or update.
+     * Invoke the specified phase on all facets of all UIColumn children of this component. Note that no methods are
+     * called on the UIColumn child objects themselves.
+     * 
+     * @param context
+     *            is the current faces context.
+     * @param processAction
+     *            specifies a JSF phase: decode, validate or update.
      */
     private void processColumnFacets(FacesContext context, int processAction)
     {
-        for (Iterator childIter = getChildren().iterator(); childIter.hasNext();)
+        for (UIComponent child : getChildren())
         {
-            UIComponent child = (UIComponent) childIter.next();
             if (child instanceof UIColumn)
             {
                 if (!child.isRendered())
                 {
-                    //Column is not visible
+                    // Column is not visible
                     continue;
                 }
-                for (Iterator facetsIter = child.getFacets().values()
-                        .iterator(); facetsIter.hasNext();)
+                
+                for (UIComponent facet : child.getFacets().values())
                 {
-                    UIComponent facet = (UIComponent) facetsIter.next();
                     process(context, facet, processAction);
                 }
             }
@@ -868,12 +837,13 @@
     }
 
     /**
-     * Invoke the specified phase on all non-facet children of all UIColumn
-     * children of this component. Note that no methods are called on the
-     * UIColumn child objects themselves.
-     *
-     * @param context is the current faces context.
-     * @param processAction specifies a JSF phase: decode, validate or update.
+     * Invoke the specified phase on all non-facet children of all UIColumn children of this component. Note that no
+     * methods are called on the UIColumn child objects themselves.
+     * 
+     * @param context
+     *            is the current faces context.
+     * @param processAction
+     *            specifies a JSF phase: decode, validate or update.
      */
     private void processColumnChildren(FacesContext context, int processAction)
     {
@@ -888,31 +858,27 @@
         {
             last = first + rows;
         }
-        for (int rowIndex = first; last==-1 || rowIndex < last; rowIndex++)
+        for (int rowIndex = first; last == -1 || rowIndex < last; rowIndex++)
         {
             setRowIndex(rowIndex);
 
-            //scrolled past the last row
+            // scrolled past the last row
             if (!isRowAvailable())
             {
                 break;
             }
 
-            for (Iterator it = getChildren().iterator(); it.hasNext();)
+            for (UIComponent child : getChildren())
             {
-                UIComponent child = (UIComponent) it.next();
                 if (child instanceof UIColumn)
                 {
                     if (!child.isRendered())
                     {
-                        //Column is not visible
+                        // Column is not visible
                         continue;
                     }
-                    for (Iterator columnChildIter = child.getChildren()
-                            .iterator(); columnChildIter.hasNext();)
+                    for (UIComponent columnChild : child.getChildren())
                     {
-                        UIComponent columnChild = (UIComponent) columnChildIter
-                                .next();
                         process(context, columnChild, processAction);
                     }
                 }
@@ -920,8 +886,7 @@
         }
     }
 
-    private void process(FacesContext context, UIComponent component,
-            int processAction)
+    private void process(FacesContext context, UIComponent component, int processAction)
     {
         switch (processAction)
         {
@@ -938,19 +903,14 @@
     }
 
     /**
-     * Return the datamodel for this table, potentially fetching the data from
-     * a backing bean via a value-binding if this is the first time this method
-     * has been called.
+     * Return the datamodel for this table, potentially fetching the data from a backing bean via a value-binding if
+     * this is the first time this method has been called.
      * <p>
-     * This is complicated by the fact that this table may be nested within
-     * another table. In this case a different datamodel should be fetched
-     * for each row. When nested within a parent table, the parent reference
-     * won't change but parent.getClientId() will, as the suffix changes
-     * depending upon the current row index. A map object on this component
-     * is therefore used to cache the datamodel for each row of the table.
-     * In the normal case where this table is not nested inside a component
-     * that changes its id (like a table does) then this map only ever has
-     * one entry.
+     * This is complicated by the fact that this table may be nested within another table. In this case a different
+     * datamodel should be fetched for each row. When nested within a parent table, the parent reference won't change
+     * but parent.getClientId() will, as the suffix changes depending upon the current row index. A map object on this
+     * component is therefore used to cache the datamodel for each row of the table. In the normal case where this table
+     * is not nested inside a component that changes its id (like a table does) then this map only ever has one entry.
      */
     protected DataModel getDataModel()
     {
@@ -962,7 +922,7 @@
         {
             clientID = parent.getClientId(getFacesContext());
         }
-        dataModel = (DataModel) _dataModelMap.get(clientID);
+        dataModel = _dataModelMap.get(clientID);
         if (dataModel == null)
         {
             dataModel = createDataModel();
@@ -973,19 +933,16 @@
 
     protected void setDataModel(DataModel dataModel)
     {
-        throw new UnsupportedOperationException(
-                "this method is here only to maintain binary compatibility w/ the RI");
+        throw new UnsupportedOperationException("this method is here only to maintain binary compatibility w/ the RI");
     }
 
     /**
-     * Evaluate this object's value property and convert the result into a
-     * DataModel. Normally this object's value property will be a value-binding
-     * which will cause the value to be fetched from some backing bean.
+     * Evaluate this object's value property and convert the result into a DataModel. Normally this object's value
+     * property will be a value-binding which will cause the value to be fetched from some backing bean.
      * <p>
-     * The result of fetching the value may be a DataModel object, in which
-     * case that object is returned directly. If the value is of type
-     * List, Array, ResultSet, Result, other object or null then an appropriate
-     * wrapper is created and returned.
+     * The result of fetching the value may be a DataModel object, in which case that object is returned directly. If
+     * the value is of type List, Array, ResultSet, Result, other object or null then an appropriate wrapper is created
+     * and returned.
      * <p>
      * Null is never returned by this method.
      */
@@ -1003,7 +960,7 @@
         }
         else if (value instanceof List)
         {
-            return new ListDataModel((List) value);
+            return new ListDataModel((List<?>) value);
         }
         else if (OBJECT_ARRAY_CLASS.isAssignableFrom(value.getClass()))
         {
@@ -1030,30 +987,29 @@
      * </p>
      * <ul>
      * <li>A value of type DataModel is used directly.</li>
-     * <li>Array-like parameters of type array-of-Object, java.util.List, java.sql.ResultSet
-     *  or javax.servlet.jsp.jstl.sql.Result are wrapped in a corresponding DataModel that
-     *  knows how to iterate over the elements.</li>
+     * <li>Array-like parameters of type array-of-Object, java.util.List, java.sql.ResultSet or
+     * javax.servlet.jsp.jstl.sql.Result are wrapped in a corresponding DataModel that knows how to iterate over the
+     * elements.</li>
      * <li>Other values are wrapped in a DataModel as a single row.</li>
      * </ul>
      * <p>
-     * Note in particular that unordered collections, eg Set are not supported. Therefore if the
-     * value expression references such an object then the table will be considered to contain just
-     * one element - the collection itself.
+     * Note in particular that unordered collections, eg Set are not supported. Therefore if the value expression
+     * references such an object then the table will be considered to contain just one element - the collection itself.
      * </p>
      */
     @JSFProperty
     public Object getValue()
     {
-      if (_value != null)
-      {
-        return _value;
-      }
-      ValueExpression expression = getValueExpression("value");
-      if (expression != null)
-      {
-        return expression.getValue(getFacesContext().getELContext());
-      }
-      return null;
+        if (_value != null)
+        {
+            return _value;
+        }
+        ValueExpression expression = getValueExpression("value");
+        if (expression != null)
+        {
+            return expression.getValue(getFacesContext().getELContext());
+        }
+        return null;
     }
 
     public void setValue(Object value)
@@ -1070,16 +1026,16 @@
     @JSFProperty
     public int getFirst()
     {
-      if (_firstSet)
-      {
-        return _first;
-      }
-      ValueExpression expression = getValueExpression("first");
-      if (expression != null)
-      {
-        return (Integer)expression.getValue(getFacesContext().getELContext());
-      }
-      return 0;
+        if (_firstSet)
+        {
+            return _first;
+        }
+        ValueExpression expression = getValueExpression("first");
+        if (expression != null)
+        {
+            return (Integer) expression.getValue(getFacesContext().getELContext());
+        }
+        return 0;
     }
 
     public void setFirst(int first)
@@ -1089,29 +1045,28 @@
             throw new IllegalArgumentException("Illegal value for first row: " + first);
         }
         _first = first;
-        _firstSet=true;
+        _firstSet = true;
     }
 
     /**
      * Defines the maximum number of rows of data to be displayed.
      * <p>
-     * Specify zero to display all rows from the "first" row to the end
-     * of available data.
+     * Specify zero to display all rows from the "first" row to the end of available data.
      * </p>
      */
     @JSFProperty
     public int getRows()
     {
-      if (_rowsSet)
-      {
-        return _rows;
-      }
-      ValueExpression expression = getValueExpression("rows");
-      if (expression != null)
-      {
-        return (Integer)expression.getValue(getFacesContext().getELContext());
-      }
-      return 0;
+        if (_rowsSet)
+        {
+            return _rows;
+        }
+        ValueExpression expression = getValueExpression("rows");
+        if (expression != null)
+        {
+            return (Integer) expression.getValue(getFacesContext().getELContext());
+        }
+        return 0;
     }
 
     /**
@@ -1127,59 +1082,58 @@
         _rowsSet = true;
     }
 
-  /**
-   * Defines the name of the request-scope variable that will hold the current row during iteration.
-   * <p>
-   * During rendering of child components of this UIData, the variable with this name can be read to
-   * learn what the "rowData" object for the row currently being rendered is.
-   * </p>
-   * <p>
-   * This value must be a static value, ie an EL expression is not permitted.
-   * </p>
-   */
-  @JSFProperty(literalOnly = true)
-  public String getVar()
-  {
-    return _var;
-  }
-
-  public void setVar(String var)
-  {
-    this._var = var;
-  }
-
-
-  @Override
-  public Object saveState(FacesContext facesContext)
-  {
-    Object[] values = new Object[7];
-    values[0] = super.saveState(facesContext);
-    values[1] = _value;
-    values[2] = _var;
-    values[3] = _rows;
-    values[4] = _rowsSet;
-    values[5] = _first;
-    values[6] = _firstSet;
-
-    return values;
-  }
-
-  @Override
-  public void restoreState(FacesContext facesContext, Object state)
-  {
-    Object[] values = (Object[])state;
-    super.restoreState(facesContext,values[0]);
-    _value = values[1];
-    _var = (String)values[2];
-    _rows = (Integer)values[3];
-    _rowsSet = (Boolean)values[4];
-    _first = (Integer)values[5];
-    _firstSet = (Boolean)values[6];
-  }
-
-  @Override
-  public String getFamily()
-  {
-    return COMPONENT_FAMILY;
-  }
+    /**
+     * Defines the name of the request-scope variable that will hold the current row during iteration.
+     * <p>
+     * During rendering of child components of this UIData, the variable with this name can be read to learn what the
+     * "rowData" object for the row currently being rendered is.
+     * </p>
+     * <p>
+     * This value must be a static value, ie an EL expression is not permitted.
+     * </p>
+     */
+    @JSFProperty(literalOnly = true)
+    public String getVar()
+    {
+        return _var;
+    }
+
+    public void setVar(String var)
+    {
+        this._var = var;
+    }
+
+    @Override
+    public Object saveState(FacesContext facesContext)
+    {
+        Object[] values = new Object[7];
+        values[0] = super.saveState(facesContext);
+        values[1] = _value;
+        values[2] = _var;
+        values[3] = _rows;
+        values[4] = _rowsSet;
+        values[5] = _first;
+        values[6] = _firstSet;
+
+        return values;
+    }
+
+    @Override
+    public void restoreState(FacesContext facesContext, Object state)
+    {
+        Object[] values = (Object[]) state;
+        super.restoreState(facesContext, values[0]);
+        _value = values[1];
+        _var = (String) values[2];
+        _rows = (Integer) values[3];
+        _rowsSet = (Boolean) values[4];
+        _first = (Integer) values[5];
+        _firstSet = (Boolean) values[6];
+    }
+
+    @Override
+    public String getFamily()
+    {
+        return COMPONENT_FAMILY;
+    }
 }

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIForm.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIForm.java?rev=701829&r1=701828&r2=701829&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIForm.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIForm.java Sun Oct  5 10:06:02 2008
@@ -25,25 +25,21 @@
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
 
-
 /**
  * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
- *
+ * 
  * @author Manfred Geiler (latest modification by $Author$)
  * @version $Revision$ $Date$
  */
-@JSFComponent(type = "javax.faces.Form",
-    family = "javax.faces.Form")
-public class UIForm
-        extends UIComponentBase
-        implements NamingContainer
+@JSFComponent(type = "javax.faces.Form", family = "javax.faces.Form")
+public class UIForm extends UIComponentBase implements NamingContainer
 {
-    //private static final Log log = LogFactory.getLog(UIForm.class);
+    // private static final Log log = LogFactory.getLog(UIForm.class);
 
     private boolean _submitted;
-    
+
     private Boolean _prependId;
-    
+
     public boolean isSubmitted()
     {
         return _submitted;
@@ -54,88 +50,97 @@
         _submitted = submitted;
     }
 
-    public void processDecodes(javax.faces.context.FacesContext context)
+    @Override
+    public void processDecodes(FacesContext context)
     {
-        if (context == null) throw new NullPointerException("context");
+        if (context == null)
+            throw new NullPointerException("context");
         decode(context);
-        if (!isSubmitted()) return;
-        for (Iterator it = getFacetsAndChildren(); it.hasNext(); )
+        if (!isSubmitted())
+            return;
+        for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
         {
-            UIComponent childOrFacet = (UIComponent)it.next();
-            childOrFacet.processDecodes(context);
+            it.next().processDecodes(context);
         }
     }
 
-    public void processValidators(javax.faces.context.FacesContext context)
+    @Override
+    public void processValidators(FacesContext context)
     {
-        if (context == null) throw new NullPointerException("context");
+        if (context == null)
+            throw new NullPointerException("context");
         // SF issue #1050022: a form used within a datatable will loose it's submitted state
         // as UIForm is no EditableValueHolder and therefore it's state is not saved/restored by UIData
         // to restore the submitted state we call decode here again
-        if (!isSubmitted()) {
+        if (!isSubmitted())
+        {
             decode(context);
         }
-        if (!isSubmitted()) return;
-        for (Iterator it = getFacetsAndChildren(); it.hasNext(); )
+        if (!isSubmitted())
+            return;
+        for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
         {
-            UIComponent childOrFacet = (UIComponent)it.next();
-            childOrFacet.processValidators(context);
+            it.next().processValidators(context);
         }
     }
 
-    public void processUpdates(javax.faces.context.FacesContext context)
+    @Override
+    public void processUpdates(FacesContext context)
     {
-        if (context == null) throw new NullPointerException("context");
+        if (context == null)
+            throw new NullPointerException("context");
         // SF issue #1050022: a form used within a datatable will loose it's submitted state
         // as UIForm is no EditableValueHolder and therefore it's state is not saved/restored by UIData
         // to restore the submitted state we call decode here again
-        if (!isSubmitted()) {
+        if (!isSubmitted())
+        {
             decode(context);
         }
-        if (!isSubmitted()) return;
-        for (Iterator it = getFacetsAndChildren(); it.hasNext(); )
+        if (!isSubmitted())
+            return;
+        for (Iterator<UIComponent> it = getFacetsAndChildren(); it.hasNext();)
         {
-            UIComponent childOrFacet = (UIComponent)it.next();
-            childOrFacet.processUpdates(context);
+            it.next().processUpdates(context);
         }
     }
 
-    public Object saveState(javax.faces.context.FacesContext context)
+    @Override
+    public Object saveState(FacesContext context)
     {
         Object[] state = new Object[2];
         state[0] = super.saveState(context);
         state[1] = _prependId;
         return state;
     }
-    
+
     @Override
     public void restoreState(FacesContext context, Object state)
     {
-        Object[] values = (Object[]) state;
+        Object[] values = (Object[])state;
         super.restoreState(context, values[0]);
-        _prependId = (Boolean) values[1];
+        _prependId = (Boolean)values[1];
     }
 
-    //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
+    // ------------------ GENERATED CODE BEGIN (do not modify!) --------------------
 
     public static final String COMPONENT_TYPE = "javax.faces.Form";
     public static final String COMPONENT_FAMILY = "javax.faces.Form";
     private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Form";
 
-
     public UIForm()
     {
         setRendererType(DEFAULT_RENDERER_TYPE);
     }
 
+    @Override
     public String getFamily()
     {
         return COMPONENT_FAMILY;
     }
 
+    // ------------------ GENERATED CODE END ---------------------------------------
 
-    //------------------ GENERATED CODE END ---------------------------------------
-    
+    @Override
     public String getContainerClientId(FacesContext ctx)
     {
         if (isPrependId())
@@ -149,7 +154,7 @@
         }
         return null;
     }
-    
+
     @JSFProperty(defaultValue = "true")
     public boolean isPrependId()
     {
@@ -160,5 +165,5 @@
     {
         _prependId = prependId;
     }
-    
+
 }

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIInput.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIInput.java?rev=701829&r1=701828&r2=701829&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIInput.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UIInput.java Sun Oct  5 10:06:02 2008
@@ -20,6 +20,8 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+
 import javax.el.ValueExpression;
 import javax.faces.FacesException;
 import javax.faces.application.FacesMessage;
@@ -34,28 +36,25 @@
 import javax.faces.event.ValueChangeListener;
 import javax.faces.render.Renderer;
 import javax.faces.validator.Validator;
+
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
 
 /**
  * UICommand is a base abstraction for components that implement ActionSource.
  * <p>
- * See the javadoc for this class in the <a
- * href="http://java.sun.com/j2ee/javaserverfaces/1.2/docs/api/index.html">JSF
+ * See the javadoc for this class in the <a href="http://java.sun.com/j2ee/javaserverfaces/1.2/docs/api/index.html">JSF
  * Specification</a> for further details.
  * <p>
  * <h4>Events:</h4>
  * <table border="1" width="100%" cellpadding="3" summary="">
  * <tr bgcolor="#CCCCFF" class="TableHeadingColor">
- * <th align="left">Type</th>
- * <th align="left">Phases</th>
- * <th align="left">Description</th>
+ * <th align="left">Type</th> <th align="left">Phases</th> <th align="left">Description</th>
  * </tr>
  * <tr class="TableRowColor">
  * <td valign="top"><code>javax.faces.event.ValueChangeEvent</code></td>
  * <td valign="top" nowrap></td>
- * <td valign="top">The valueChange event is delivered when the value attribute
- * is changed.</td>
+ * <td valign="top">The valueChange event is delivered when the value attribute is changed.</td>
  * </tr>
  * </table>
  */
@@ -107,12 +106,12 @@
     }
 
     /**
-     * Store the specified object as the "local value" of this component. The
-     * value-binding named "value" (if any) is ignored; the object is only
-     * stored locally on this component. During the "update model" phase, if
-     * there is a value-binding named "value" then this local value will be
-     * stored via that value-binding and the "local value" reset to null.
+     * Store the specified object as the "local value" of this component. The value-binding named "value" (if any) is
+     * ignored; the object is only stored locally on this component. During the "update model" phase, if there is a
+     * value-binding named "value" then this local value will be stored via that value-binding and the "local value"
+     * reset to null.
      */
+    @Override
     public void setValue(Object value)
     {
         setLocalValueSet(true);
@@ -120,22 +119,19 @@
     }
 
     /**
-     * Set the "submitted value" of this component from the relevant data in the
-     * current servlet request object.
+     * Set the "submitted value" of this component from the relevant data in the current servlet request object.
      * <p>
-     * If this component is not rendered, then do nothing; no output would have
-     * been sent to the client so no input is expected.
+     * If this component is not rendered, then do nothing; no output would have been sent to the client so no input is
+     * expected.
      * <p>
-     * Invoke the inherited functionality, which typically invokes the renderer
-     * associated with this component to extract and set this component's
-     * "submitted value".
-     * <p>
-     * If this component is marked "immediate", then immediately apply
-     * validation to the submitted value found. On error, call context method
-     * "renderResponse" which will force processing to leap to the "render
-     * response" phase as soon as the "decode" step has completed for all other
-     * components.
+     * Invoke the inherited functionality, which typically invokes the renderer associated with this component to
+     * extract and set this component's "submitted value".
+     * <p>
+     * If this component is marked "immediate", then immediately apply validation to the submitted value found. On
+     * error, call context method "renderResponse" which will force processing to leap to the "render
+     * response" phase as soon as the "decode" step has completed for all other components.
      */
+    @Override
     public void processDecodes(FacesContext context)
     {
         if (context == null)
@@ -165,6 +161,7 @@
         }
     }
 
+    @Override
     public void processValidators(FacesContext context)
     {
         if (context == null)
@@ -196,6 +193,7 @@
         }
     }
 
+    @Override
     public void processUpdates(FacesContext context)
     {
         if (context == null)
@@ -224,6 +222,7 @@
         }
     }
 
+    @Override
     public void decode(FacesContext context)
     {
         // We (re)set to valid, so that component automatically gets (re)validated
@@ -231,6 +230,7 @@
         super.decode(context);
     }
 
+    @Override
     public void broadcast(FacesEvent event) throws AbortProcessingException
     {
         // invoke standard listeners attached to this component first
@@ -245,15 +245,12 @@
             {
                 try
                 {
-                    valueChangeListenerBinding.invoke(getFacesContext(),
-                            new Object[]
-                            { event });
+                    valueChangeListenerBinding.invoke(getFacesContext(), new Object[] { event });
                 }
                 catch (EvaluationException e)
                 {
                     Throwable cause = e.getCause();
-                    if (cause != null
-                            && cause instanceof AbortProcessingException)
+                    if (cause != null && cause instanceof AbortProcessingException)
                     {
                         throw (AbortProcessingException) cause;
                     }
@@ -291,61 +288,54 @@
         catch (Exception e)
         {
             context.getExternalContext().log(e.getMessage(), e);
-            _MessageUtils.addErrorMessage(context, this, UPDATE_MESSAGE_ID,
-                    new Object[]
-                    { _MessageUtils.getLabel(context, this) });
+            _MessageUtils.addErrorMessage(context, this, UPDATE_MESSAGE_ID, new Object[] { _MessageUtils.getLabel(
+                context, this) });
             setValid(false);
 
             /*
-             * we are not allowed to throw exceptions here - we still need the
-             * full stack-trace later on to process it later in our
-             * error-handler
+             * we are not allowed to throw exceptions here - we still need the full stack-trace later on to process it
+             * later in our error-handler
              */
             queueExceptionInRequest(context, expression, e);
         }
     }
 
     /**
-     * For development and production, we want to offer a single point to which
-     * error-handlers can attach. So we queue up all ocurring exceptions and
-     * later pass them to the configured error-handler.
+     * For development and production, we want to offer a single point to which error-handlers can attach. So we queue
+     * up all ocurring exceptions and later pass them to the configured error-handler.
      */
-    private void queueExceptionInRequest(FacesContext context,
-            ValueExpression expression, Exception e)
+    @SuppressWarnings("unchecked")
+    private void queueExceptionInRequest(FacesContext context, ValueExpression expression, Exception e)
     {
-        List li = (List) context.getExternalContext().getRequestMap().get(ERROR_HANDLING_EXCEPTION_LIST);
+        Map<String, Object> requestScope = context.getExternalContext().getRequestMap();
+        List<FacesException> li = (List<FacesException>) requestScope.get(ERROR_HANDLING_EXCEPTION_LIST);
         if (null == li)
         {
-            li = new ArrayList();
+            li = new ArrayList<FacesException>();
             context.getExternalContext().getRequestMap().put(ERROR_HANDLING_EXCEPTION_LIST, li);
         }
-        li.add(new FacesException(
-                "Exception while setting value for expression : "
-                        + expression.getExpressionString()
-                        + " of component with path : "
-                        + _ComponentUtils.getPathToComponent(this), e));
+
+        li.add(new FacesException("Exception while setting value for expression : " + expression.getExpressionString()
+                + " of component with path : " + _ComponentUtils.getPathToComponent(this), e));
     }
 
     protected void validateValue(FacesContext context, Object convertedValue)
     {
         boolean empty = convertedValue == null
-                || (convertedValue instanceof String && ((String) convertedValue)
-                        .length() == 0);
+                || (convertedValue instanceof String && ((String) convertedValue).length() == 0);
 
         if (isRequired() && empty)
         {
             if (getRequiredMessage() != null)
             {
                 String requiredMessage = getRequiredMessage();
-                context.addMessage(this.getClientId(context), new FacesMessage(
-                        FacesMessage.SEVERITY_ERROR, requiredMessage,
-                        requiredMessage));
+                context.addMessage(this.getClientId(context), new FacesMessage(FacesMessage.SEVERITY_ERROR,
+                    requiredMessage, requiredMessage));
             }
             else
             {
-                _MessageUtils.addErrorMessage(context, this,
-                        REQUIRED_MESSAGE_ID, new Object[]
-                        { _MessageUtils.getLabel(context, this) });
+                _MessageUtils.addErrorMessage(context, this, REQUIRED_MESSAGE_ID,
+                    new Object[] { _MessageUtils.getLabel(context, this) });
             }
             setValid(false);
             return;
@@ -359,29 +349,24 @@
     }
 
     /**
-     * Determine whether the new value is valid, and queue a ValueChangeEvent if
-     * necessary.
+     * Determine whether the new value is valid, and queue a ValueChangeEvent if necessary.
+     * <p>
+     * The "submitted value" is converted to the necessary type; conversion failure is reported as an error and
+     * validation processing terminates for this component. See documentation for method getConvertedValue for details
+     * on the conversion process.
+     * <p>
+     * Any validators attached to this component are then run, passing the converted value.
      * <p>
-     * The "submitted value" is converted to the necessary type; conversion
-     * failure is reported as an error and validation processing terminates for
-     * this component. See documentation for method getConvertedValue for
-     * details on the conversion process.
-     * <p>
-     * Any validators attached to this component are then run, passing the
-     * converted value.
-     * <p>
-     * The old value of this component is then fetched (possibly involving the
-     * evaluation of a value-binding expression, ie invoking a method on a user
-     * object). The old value is compared to the new validated value, and if
-     * they are different then a ValueChangeEvent is queued for later
-     * processing.
+     * The old value of this component is then fetched (possibly involving the evaluation of a value-binding expression,
+     * ie invoking a method on a user object). The old value is compared to the new validated value, and if they are
+     * different then a ValueChangeEvent is queued for later processing.
      * <p>
      * On successful completion of this method:
      * <ul>
-     * <li> isValid() is true
-     * <li> isLocalValueSet() is true
-     * <li> submittedValue is reset to null
-     * <li> a ValueChangeEvent is queued if the new value != old value
+     * <li>isValid() is true
+     * <li>isLocalValueSet() is true
+     * <li>submittedValue is reset to null
+     * <li>a ValueChangeEvent is queued if the new value != old value
      * </ul>
      */
     public void validate(FacesContext context)
@@ -411,15 +396,13 @@
             setSubmittedValue(null);
             if (compareValues(previousValue, convertedValue))
             {
-                queueEvent(new ValueChangeEvent(this, previousValue,
-                        convertedValue));
+                queueEvent(new ValueChangeEvent(this, previousValue, convertedValue));
             }
         }
         catch (Exception ex)
         {
-            throw new FacesException(
-                    "Exception while validating component with path : "
-                            + _ComponentUtils.getPathToComponent(this), ex);
+            throw new FacesException("Exception while validating component with path : "
+                    + _ComponentUtils.getPathToComponent(this), ex);
         }
 
     }
@@ -427,22 +410,17 @@
     /**
      * Convert the provided object to the desired value.
      * <p>
-     * If there is a renderer for this component, then call the renderer's
-     * getConvertedValue method. While this can of course be implemented in any
-     * way the renderer desires, it typically performs exactly the same
-     * processing that this method would have done anyway (ie that described
-     * below for the no-renderer case).
+     * If there is a renderer for this component, then call the renderer's getConvertedValue method. While this can of
+     * course be implemented in any way the renderer desires, it typically performs exactly the same processing that
+     * this method would have done anyway (ie that described below for the no-renderer case).
      * <p>
      * Otherwise:
      * <ul>
-     * <li>If the submittedValue is not a String then just return the
-     * submittedValue unconverted.
-     * <li>If there is no "value" value-binding then just return the
-     * submittedValue unconverted.
-     * <li>Use introspection to determine the type of the target property
-     * specified by the value-binding, and then use Application.createConverter
-     * to find a converter that can map from String to the required type. Apply
-     * the converter to the submittedValue and return the result.
+     * <li>If the submittedValue is not a String then just return the submittedValue unconverted.
+     * <li>If there is no "value" value-binding then just return the submittedValue unconverted.
+     * <li>Use introspection to determine the type of the target property specified by the value-binding, and then use
+     * Application.createConverter to find a converter that can map from String to the required type. Apply the
+     * converter to the submittedValue and return the result.
      * </ul>
      */
     protected Object getConvertedValue(FacesContext context, Object submittedValue)
@@ -452,17 +430,14 @@
             Renderer renderer = getRenderer(context);
             if (renderer != null)
             {
-                return renderer
-                        .getConvertedValue(context, this, submittedValue);
+                return renderer.getConvertedValue(context, this, submittedValue);
             }
             else if (submittedValue instanceof String)
             {
-                Converter converter = _SharedRendererUtils
-                        .findUIOutputConverter(context, this);
+                Converter converter = _SharedRendererUtils.findUIOutputConverter(context, this);
                 if (converter != null)
                 {
-                    return converter.getAsObject(context, this,
-                            (String) submittedValue);
+                    return converter.getAsObject(context, this, (String) submittedValue);
                 }
             }
         }
@@ -471,9 +446,8 @@
             String converterMessage = getConverterMessage();
             if (converterMessage != null)
             {
-                context.addMessage(getClientId(context), new FacesMessage(
-                        FacesMessage.SEVERITY_ERROR, converterMessage,
-                        converterMessage));
+                context.addMessage(getClientId(context), new FacesMessage(FacesMessage.SEVERITY_ERROR,
+                    converterMessage, converterMessage));
             }
             else
             {
@@ -484,9 +458,8 @@
                 }
                 else
                 {
-                    _MessageUtils.addErrorMessage(context, this,
-                            CONVERSION_MESSAGE_ID, new Object[]
-                            { _MessageUtils.getLabel(context, this) });
+                    _MessageUtils.addErrorMessage(context, this, CONVERSION_MESSAGE_ID,
+                        new Object[] { _MessageUtils.getLabel(context, this) });
                 }
             }
             setValid(false);
@@ -513,9 +486,9 @@
     /**
      * A boolean value that identifies the phase during which action events should fire.
      * <p>
-     * During normal event processing, action methods and action listener methods are fired during
-     * the "invoke application" phase of request processing. If this attribute is set to "true",
-     * these methods are fired instead at the end of the "apply request values" phase.
+     * During normal event processing, action methods and action listener methods are fired during the
+     * "invoke application" phase of request processing. If this attribute is set to "true", these methods are fired
+     * instead at the end of the "apply request values" phase.
      * </p>
      */
     @JSFProperty
@@ -528,8 +501,7 @@
         ValueExpression expression = getValueExpression("immediate");
         if (expression != null)
         {
-            return (Boolean) expression.getValue(getFacesContext()
-                    .getELContext());
+            return (Boolean) expression.getValue(getFacesContext().getELContext());
         }
         return false;
     }
@@ -543,9 +515,8 @@
     /**
      * A boolean value that indicates whether an input value is required.
      * <p>
-     * If this value is true and no input value is provided by a postback operation, then
-     * the "requiredMessage" text is registered as a FacesMessage for the request, and
-     * validation fails. 
+     * If this value is true and no input value is provided by a postback operation, then the "requiredMessage" text is
+     * registered as a FacesMessage for the request, and validation fails.
      * </p>
      * <p>
      * Default value: false.
@@ -561,8 +532,7 @@
         ValueExpression expression = getValueExpression("required");
         if (expression != null)
         {
-            return (Boolean) expression.getValue(getFacesContext()
-                    .getELContext());
+            return (Boolean) expression.getValue(getFacesContext().getELContext());
         }
         return false;
     }
@@ -574,8 +544,8 @@
     }
 
     /**
-     * Text to be displayed to the user as an error message when conversion of a
-     * submitted value to the target type fails.
+     * Text to be displayed to the user as an error message when conversion of a submitted value to the target type
+     * fails.
      * <p>
      * </p>
      */
@@ -589,8 +559,7 @@
         ValueExpression expression = getValueExpression("converterMessage");
         if (expression != null)
         {
-            return (String) expression.getValue(getFacesContext()
-                    .getELContext());
+            return (String) expression.getValue(getFacesContext().getELContext());
         }
         return null;
     }
@@ -601,9 +570,8 @@
     }
 
     /**
-     * Text to be displayed to the user as an error message when this component is
-     * marked as "required" but no input data is present during a postback (ie the
-     * user left the required field blank).
+     * Text to be displayed to the user as an error message when this component is marked as "required" but no input
+     * data is present during a postback (ie the user left the required field blank).
      */
     @JSFProperty
     public String getRequiredMessage()
@@ -615,8 +583,7 @@
         ValueExpression expression = getValueExpression("requiredMessage");
         if (expression != null)
         {
-            return (String) expression.getValue(getFacesContext()
-                    .getELContext());
+            return (String) expression.getValue(getFacesContext().getELContext());
         }
         return null;
     }
@@ -627,11 +594,10 @@
     }
 
     /**
-     * A method-binding EL expression which is invoked during the validation phase for this
-     * component.
+     * A method-binding EL expression which is invoked during the validation phase for this component.
      * <p>
-     * The invoked method is expected to check the submitted value for this component, and if not
-     * acceptable then report a validation error for the component.
+     * The invoked method is expected to check the submitted value for this component, and if not acceptable then report
+     * a validation error for the component.
      * </p>
      * <p>
      * The method is expected to have the prototype
@@ -640,6 +606,7 @@
      * 
      * @deprecated
      */
+    @SuppressWarnings("dep-ann")
     @JSFProperty(stateHolder = true, returnSignature = "void", methodSignature = "javax.faces.context.FacesContext,javax.faces.component.UIComponent,java.lang.Object")
     public MethodBinding getValidator()
     {
@@ -650,8 +617,7 @@
         ValueExpression expression = getValueExpression("validator");
         if (expression != null)
         {
-            return (MethodBinding) expression.getValue(getFacesContext()
-                    .getELContext());
+            return (MethodBinding) expression.getValue(getFacesContext().getELContext());
         }
         return null;
     }
@@ -686,8 +652,8 @@
     /** See getValidator. */
     public Validator[] getValidators()
     {
-        return _validatorList == null ? EMPTY_VALIDATOR_ARRAY : _validatorList
-                .toArray(new Validator[_validatorList.size()]);
+        return _validatorList == null ? EMPTY_VALIDATOR_ARRAY
+                : _validatorList.toArray(new Validator[_validatorList.size()]);
     }
 
     /**
@@ -703,8 +669,7 @@
         ValueExpression expression = getValueExpression("validatorMessage");
         if (expression != null)
         {
-            return (String) expression.getValue(getFacesContext()
-                    .getELContext());
+            return (String) expression.getValue(getFacesContext().getELContext());
         }
         return null;
     }
@@ -715,12 +680,10 @@
     }
 
     /**
-     * A method which is invoked during postback processing for the current
-     * view if the submitted value for this component is not equal to the value
-     * which the "value" expression for this component returns.
+     * A method which is invoked during postback processing for the current view if the submitted value for this
+     * component is not equal to the value which the "value" expression for this component returns.
      * <p>
-     * The phase in which this method is invoked can be controlled via the immediate
-     * attribute.
+     * The phase in which this method is invoked can be controlled via the immediate attribute.
      * </p>
      * 
      * @deprecated
@@ -736,8 +699,7 @@
         ValueExpression expression = getValueExpression("valueChangeListener");
         if (expression != null)
         {
-            return (MethodBinding) expression.getValue(getFacesContext()
-                    .getELContext());
+            return (MethodBinding) expression.getValue(getFacesContext().getELContext());
         }
         return null;
     }
@@ -754,8 +716,8 @@
     }
 
     /**
-     * Specifies whether the component's value is currently valid, ie whether the
-     * validators attached to this component have allowed it.
+     * Specifies whether the component's value is currently valid, ie whether the validators attached to this component
+     * have allowed it.
      */
     @JSFProperty(defaultValue = "true", tagExcluded = true)
     public boolean isValid()
@@ -785,13 +747,10 @@
     }
 
     /**
-     * Gets the current submitted value. This value, if non-null, is set by the
-     * Renderer to store a possibly invalid value for later conversion or
-     * redisplay, and has not yet been converted into the proper type for this
-     * component instance. This method should only be used by the decode() and
-     * validate() method of this component, or its corresponding Renderer;
-     * however, user code may manually set it to null to erase any submitted
-     * value.
+     * Gets the current submitted value. This value, if non-null, is set by the Renderer to store a possibly invalid
+     * value for later conversion or redisplay, and has not yet been converted into the proper type for this component
+     * instance. This method should only be used by the decode() and validate() method of this component, or its
+     * corresponding Renderer; however, user code may manually set it to null to erase any submitted value.
      */
     @JSFProperty(tagExcluded = true)
     public Object getSubmittedValue()
@@ -841,6 +800,7 @@
         return values;
     }
 
+    @SuppressWarnings("unchecked")
     @Override
     public void restoreState(FacesContext facesContext, Object state)
     {
@@ -852,13 +812,10 @@
         _requiredSet = (Boolean) values[4];
         _converterMessage = (String) values[5];
         _requiredMessage = (String) values[6];
-        _validator = (MethodBinding) restoreAttachedState(facesContext,
-                values[7]);
-        _validatorList = (List<Validator>) restoreAttachedState(facesContext,
-                values[8]);
+        _validator = (MethodBinding) restoreAttachedState(facesContext, values[7]);
+        _validatorList = (List<Validator>) restoreAttachedState(facesContext, values[8]);
         _validatorMessage = (String) values[9];
-        _valueChangeListener = (MethodBinding) restoreAttachedState(
-                facesContext, values[10]);
+        _valueChangeListener = (MethodBinding) restoreAttachedState(facesContext, values[10]);
         _valid = (Boolean) values[11];
         _localValueSet = (Boolean) values[12];
         _submittedValue = values[13];

Modified: myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UISelectBoolean.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UISelectBoolean.java?rev=701829&r1=701828&r2=701829&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UISelectBoolean.java (original)
+++ myfaces/core/branches/2_0_0/api/src/main/java/javax/faces/component/UISelectBoolean.java Sun Oct  5 10:06:02 2008
@@ -81,6 +81,8 @@
     /**
      * @deprecated Use getValueExpression instead
      */
+    @Override
+    @Deprecated
     public ValueBinding getValueBinding(String name)
     {
         if (name == null)
@@ -100,6 +102,8 @@
     /**
      * @deprecated Use setValueExpression instead
      */
+    @Override
+    @Deprecated
     public void setValueBinding(String name, ValueBinding binding)
     {
         if (name == null)
@@ -116,6 +120,7 @@
         }
     }
 
+    @Override
     public ValueExpression getValueExpression(String name)
     {
         if (name == null)
@@ -132,6 +137,7 @@
         }
     }
 
+    @Override
     public void setValueExpression(String name, ValueExpression binding)
     {
         if (name == null)