Coverage Report - javax.faces.component.UIForm
 
Classes in this File Line Coverage Branch Coverage Complexity
UIForm
0%
0/62
0%
0/26
0
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *   http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing,
 13  
  * software distributed under the License is distributed on an
 14  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 15  
  * KIND, either express or implied.  See the License for the
 16  
  * specific language governing permissions and limitations
 17  
  * under the License.
 18  
  */
 19  
 package javax.faces.component;
 20  
 
 21  
 import java.util.Iterator;
 22  
 
 23  
 import javax.faces.context.FacesContext;
 24  
 
 25  
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent;
 26  
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty;
 27  
 
 28  
 
 29  
 /**
 30  
  * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
 31  
  *
 32  
  * @author Manfred Geiler (latest modification by $Author: lu4242 $)
 33  
  * @version $Revision: 949326 $ $Date: 2010-05-28 19:39:48 -0500 (Fri, 28 May 2010) $
 34  
  */
 35  
 @JSFComponent(type = "javax.faces.Form",
 36  
     family = "javax.faces.Form")
 37  
 public class UIForm
 38  
         extends UIComponentBase
 39  
         implements NamingContainer
 40  
 {
 41  
     //private static final Log log = LogFactory.getLog(UIForm.class);
 42  
 
 43  
     private boolean _submitted;
 44  
     
 45  
     private Boolean _prependId;
 46  
     
 47  
     public boolean isSubmitted()
 48  
     {
 49  0
         return _submitted;
 50  
     }
 51  
 
 52  
     public void setSubmitted(boolean submitted)
 53  
     {
 54  0
         _submitted = submitted;
 55  0
     }
 56  
 
 57  
     public void processDecodes(javax.faces.context.FacesContext context)
 58  
     {
 59  0
         if (context == null)
 60  
         {
 61  0
             throw new NullPointerException("context");
 62  
         }
 63  
         try
 64  
         {
 65  0
             setCachedFacesContext(context);
 66  0
             decode(context);
 67  0
             if (!isSubmitted()) return;
 68  0
             for (Iterator it = getFacetsAndChildren(); it.hasNext(); )
 69  
             {
 70  0
                 UIComponent childOrFacet = (UIComponent)it.next();
 71  0
                 childOrFacet.processDecodes(context);
 72  0
             }
 73  
         }
 74  
         finally
 75  
         {
 76  0
             setCachedFacesContext(null);
 77  0
         }
 78  0
     }
 79  
 
 80  
     public void processValidators(javax.faces.context.FacesContext context)
 81  
     {
 82  0
         if (context == null)
 83  
         {
 84  0
             throw new NullPointerException("context");
 85  
         }
 86  
         try
 87  
         {
 88  0
             setCachedFacesContext(context);
 89  
             // SF issue #1050022: a form used within a datatable will loose it's submitted state
 90  
             // as UIForm is no EditableValueHolder and therefore it's state is not saved/restored by UIData
 91  
             // to restore the submitted state we call decode here again
 92  0
             if (!isSubmitted()) {
 93  0
                 decode(context);
 94  
             }
 95  0
             if (!isSubmitted()) return;
 96  0
             for (Iterator it = getFacetsAndChildren(); it.hasNext(); )
 97  
             {
 98  0
                 UIComponent childOrFacet = (UIComponent)it.next();
 99  0
                 childOrFacet.processValidators(context);
 100  0
             }
 101  
         }
 102  
         finally
 103  
         {
 104  0
             setCachedFacesContext(null);
 105  0
         }
 106  0
     }
 107  
 
 108  
     public void processUpdates(javax.faces.context.FacesContext context)
 109  
     {
 110  0
         if (context == null)
 111  
         {
 112  0
             throw new NullPointerException("context");
 113  
         }
 114  
         try
 115  
         {
 116  0
             setCachedFacesContext(context);
 117  
             // SF issue #1050022: a form used within a datatable will loose it's submitted state
 118  
             // as UIForm is no EditableValueHolder and therefore it's state is not saved/restored by UIData
 119  
             // to restore the submitted state we call decode here again
 120  0
             if (!isSubmitted()) {
 121  0
                 decode(context);
 122  
             }
 123  0
             if (!isSubmitted()) return;
 124  0
             for (Iterator it = getFacetsAndChildren(); it.hasNext(); )
 125  
             {
 126  0
                 UIComponent childOrFacet = (UIComponent)it.next();
 127  0
                 childOrFacet.processUpdates(context);
 128  0
             }
 129  
         }
 130  
         finally
 131  
         {
 132  0
             setCachedFacesContext(null);
 133  0
         }
 134  0
     }
 135  
 
 136  
     public Object saveState(javax.faces.context.FacesContext context)
 137  
     {
 138  0
         Object[] state = new Object[2];
 139  0
         state[0] = super.saveState(context);
 140  0
         state[1] = _prependId;
 141  0
         return state;
 142  
     }
 143  
     
 144  
     @Override
 145  
     public void restoreState(FacesContext context, Object state)
 146  
     {
 147  0
         Object[] values = (Object[]) state;
 148  0
         super.restoreState(context, values[0]);
 149  0
         _prependId = (Boolean) values[1];
 150  0
     }
 151  
 
 152  
     //------------------ GENERATED CODE BEGIN (do not modify!) --------------------
 153  
 
 154  
     public static final String COMPONENT_TYPE = "javax.faces.Form";
 155  
     public static final String COMPONENT_FAMILY = "javax.faces.Form";
 156  
     private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Form";
 157  
 
 158  
 
 159  
     public UIForm()
 160  0
     {
 161  0
         setRendererType(DEFAULT_RENDERER_TYPE);
 162  0
     }
 163  
 
 164  
     public String getFamily()
 165  
     {
 166  0
         return COMPONENT_FAMILY;
 167  
     }
 168  
 
 169  
 
 170  
     //------------------ GENERATED CODE END ---------------------------------------
 171  
     
 172  
     public String getContainerClientId(FacesContext ctx)
 173  
     {
 174  0
         if (isPrependId())
 175  
         {
 176  0
             return super.getContainerClientId(ctx);
 177  
         }
 178  0
         UIComponent parentNamingContainer = _ComponentUtils.findParentNamingContainer(this, false);
 179  0
         if (parentNamingContainer != null)
 180  
         {
 181  0
             return parentNamingContainer.getContainerClientId(ctx);
 182  
         }
 183  0
         return null;
 184  
     }
 185  
     
 186  
     @JSFProperty(defaultValue = "true")
 187  
     public boolean isPrependId()
 188  
     {
 189  0
         return getExpressionValue("prependId", _prependId, true);
 190  
     }
 191  
 
 192  
     public void setPrependId(boolean prependId)
 193  
     {
 194  0
         _prependId = prependId;
 195  0
     }
 196  
     
 197  
 }