Coverage Report - org.apache.myfaces.component.visit.FullVisitContext
 
Classes in this File Line Coverage Branch Coverage Complexity
FullVisitContext
0%
0/16
0%
0/8
1.857
 
 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 org.apache.myfaces.component.visit;
 20  
 
 21  
 import java.util.Collection;
 22  
 import java.util.Collections;
 23  
 import java.util.EnumSet;
 24  
 import java.util.Set;
 25  
 
 26  
 import javax.faces.component.NamingContainer;
 27  
 import javax.faces.component.UIComponent;
 28  
 import javax.faces.component.visit.VisitCallback;
 29  
 import javax.faces.component.visit.VisitContext;
 30  
 import javax.faces.component.visit.VisitHint;
 31  
 import javax.faces.component.visit.VisitResult;
 32  
 import javax.faces.context.FacesContext;
 33  
 
 34  
 /**
 35  
  * <p>A VisitContext implementation that is
 36  
  * used when performing a full component tree visit.</p>
 37  
  * 
 38  
  * @author Werner Punz, Blake Sullivan (latest modification by $Author$)
 39  
  * @version $Rev$ $Date$
 40  
  */
 41  
 public class FullVisitContext extends VisitContext
 42  
 {
 43  
 
 44  
   /**
 45  
    * Creates a FullVisitorContext instance.
 46  
    * @param facesContext the FacesContext for the current request
 47  
    * @throws NullPointerException  if {@code facesContext}
 48  
    *                               is {@code null}
 49  
    */    
 50  
   public FullVisitContext(FacesContext facesContext)
 51  
   {
 52  0
     this(facesContext, null);
 53  0
   }
 54  
 
 55  
   /**
 56  
    * Creates a FullVisitorContext instance with the specified
 57  
    * hints.
 58  
    *
 59  
    * @param facesContext the FacesContext for the current request
 60  
    * @param hints a the VisitHints for this visit
 61  
    * @param phaseId PhaseId, if any that visit is ocurring under
 62  
    * @throws NullPointerException  if {@code facesContext}
 63  
    *                               is {@code null}
 64  
    * @throws IllegalArgumentException if the phaseId is specified and
 65  
    * hints does not contain VisitHint.EXECUTE_LIFECYCLE
 66  
    */    
 67  
   public FullVisitContext(
 68  
     FacesContext facesContext,
 69  
     Set<VisitHint> hints)
 70  0
   {
 71  0
     if (facesContext == null)
 72  
     {
 73  0
         throw new NullPointerException();
 74  
     }
 75  
 
 76  0
     _facesContext = facesContext;
 77  
 
 78  
     // Copy and store hints - ensure unmodifiable and non-empty
 79  0
     EnumSet<VisitHint> hintsEnumSet = ((hints == null) || (hints.isEmpty()))
 80  
                                           ? EnumSet.noneOf(VisitHint.class)
 81  
                                           : EnumSet.copyOf(hints);
 82  
 
 83  0
     _hints = Collections.unmodifiableSet(hintsEnumSet);
 84  0
   }
 85  
 
 86  
   /**
 87  
    * @see VisitContext#getFacesContext VisitContext.getFacesContext()
 88  
    */
 89  
   @Override
 90  
   public FacesContext getFacesContext()
 91  
   {
 92  0
     return _facesContext;
 93  
   }
 94  
 
 95  
   /**
 96  
    * @see VisitContext#getIdsToVisit VisitContext.getIdsToVisit()
 97  
    */
 98  
   @Override
 99  
   public Collection<String> getIdsToVisit()
 100  
   {
 101  
     // We always visits all ids
 102  0
     return ALL_IDS;
 103  
   }
 104  
 
 105  
   /**
 106  
    * @see VisitContext#getSubtreeIdsToVisit VisitContext.getSubtreeIdsToVisit()
 107  
    */
 108  
   @Override
 109  
   public Collection<String> getSubtreeIdsToVisit(UIComponent component)
 110  
   {
 111  
     // Make sure component is a NamingContainer
 112  0
     if (!(component instanceof NamingContainer))
 113  
     {
 114  0
       throw new IllegalArgumentException("Component is not a NamingContainer: " + component);
 115  
     }
 116  
 
 117  
     // We always visits all ids
 118  0
     return ALL_IDS;
 119  
   }
 120  
 
 121  
   /**
 122  
    * @see VisitContext#getHints VisitContext.getHints
 123  
    */
 124  
   @Override
 125  
   public Set<VisitHint> getHints()
 126  
   {
 127  0
     return _hints;
 128  
   }
 129  
 
 130  
   /**
 131  
    * @see VisitContext#invokeVisitCallback VisitContext.invokeVisitCallback()
 132  
    */
 133  
   @Override
 134  
   public VisitResult invokeVisitCallback(
 135  
     UIComponent component, 
 136  
     VisitCallback callback)
 137  
   {
 138  
     // Nothing interesting here - just invoke the callback.
 139  
     // (PartialVisitContext.invokeVisitCallback() does all of the 
 140  
     // interesting work.)
 141  0
     return callback.visit(this, component);
 142  
   }
 143  
 
 144  
   // The FacesContext for this request
 145  
   private final FacesContext _facesContext;
 146  
 
 147  
   // Our visit hints
 148  
   private final Set<VisitHint> _hints;
 149  
 }