Coverage Report - javax.faces.component.UIForm
 
Classes in this File Line Coverage Branch Coverage Complexity
UIForm
97%
28/29
83%
5/6
1.556
 
 1  
 /*
 2  
  * Copyright 2004-2011 the Seasar Foundation and the Others.
 3  
  *
 4  
  * Licensed under the Apache License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  *     http://www.apache.org/licenses/LICENSE-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 13  
  * either express or implied. See the License for the specific language
 14  
  * governing permissions and limitations under the License.
 15  
  */
 16  
 package javax.faces.component;
 17  
 
 18  
 import java.util.Iterator;
 19  
 
 20  
 import javax.faces.context.FacesContext;
 21  
 import javax.faces.event.PhaseId;
 22  
 import javax.faces.internal.NamingContainerUtil;
 23  
 
 24  
 import org.seasar.framework.util.AssertionUtil;
 25  
 
 26  
 /**
 27  
  * @author shot
 28  
  */
 29  
 public class UIForm extends UIComponentBase implements NamingContainer {
 30  
 
 31  
     public static final String COMPONENT_FAMILY = "javax.faces.Form";
 32  
 
 33  
     public static final String COMPONENT_TYPE = "javax.faces.Form";
 34  
 
 35  
     private static final String DEFAULT_RENDER_TYPE = "javax.faces.Form";
 36  
 
 37  516
     private transient boolean submitted = false;
 38  
 
 39  516
     public UIForm() {
 40  516
         setRendererType(DEFAULT_RENDER_TYPE);
 41  516
     }
 42  
 
 43  
     public String getFamily() {
 44  28
         return COMPONENT_FAMILY;
 45  
     }
 46  
 
 47  
     public void setId(String id) {
 48  341
         super.setId(id);
 49  333
         NamingContainerUtil.refreshDescendantComponentClientId(this);
 50  333
     }
 51  
 
 52  
     public boolean isSubmitted() {
 53  22
         return submitted;
 54  
     }
 55  
 
 56  
     public void setSubmitted(boolean submitted) {
 57  9
         this.submitted = submitted;
 58  9
     }
 59  
 
 60  
     public void processDecodes(FacesContext context) {
 61  3
         AssertionUtil.assertNotNull("context", context);
 62  1
         decode(context);
 63  1
         processAppropriateAction(context, PhaseId.APPLY_REQUEST_VALUES);
 64  1
     }
 65  
 
 66  
     public void processUpdates(FacesContext context) {
 67  4
         AssertionUtil.assertNotNull("context", context);
 68  2
         processAppropriateAction(context, PhaseId.UPDATE_MODEL_VALUES);
 69  2
     }
 70  
 
 71  
     public void processValidators(FacesContext context) {
 72  4
         AssertionUtil.assertNotNull("context", context);
 73  2
         processAppropriateAction(context, PhaseId.PROCESS_VALIDATIONS);
 74  2
     }
 75  
 
 76  
     protected void processAppropriateAction(FacesContext context, PhaseId phase) {
 77  5
         if (!isRendered()) {
 78  0
             return;
 79  
         }
 80  5
         if (!isSubmitted()) {
 81  2
             return;
 82  
         }
 83  3
         for (Iterator children = getFacetsAndChildren(); children.hasNext();) {
 84  3
             UIComponent component = (UIComponent) children.next();
 85  3
             ComponentUtil_.processAppropriatePhaseAction(context, component,
 86  
                     phase);
 87  
         }
 88  3
     }
 89  
 }