Coverage Report - org.apache.myfaces.renderkit.html.HtmlHiddenRenderer
 
Classes in this File Line Coverage Branch Coverage Complexity
HtmlHiddenRenderer
0%
0/20
0%
0/4
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 org.apache.myfaces.renderkit.html;
 20  
 
 21  
 import java.io.IOException;
 22  
 
 23  
 import javax.faces.component.UIComponent;
 24  
 import javax.faces.component.UIInput;
 25  
 import javax.faces.component.UIOutput;
 26  
 import javax.faces.context.FacesContext;
 27  
 import javax.faces.context.ResponseWriter;
 28  
 import javax.faces.convert.ConverterException;
 29  
 
 30  
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFRenderer;
 31  
 import org.apache.myfaces.shared_impl.renderkit.JSFAttr;
 32  
 import org.apache.myfaces.shared_impl.renderkit.RendererUtils;
 33  
 import org.apache.myfaces.shared_impl.renderkit.html.HTML;
 34  
 import org.apache.myfaces.shared_impl.renderkit.html.HtmlRenderer;
 35  
 import org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils;
 36  
 
 37  
 
 38  
 /**
 39  
  *   
 40  
  * @author Thomas Spiegl (latest modification by $Author: lu4242 $)
 41  
  * @author Anton Koinov
 42  
  * @version $Revision: 693358 $ $Date: 2008-09-08 22:54:29 -0500 (Mon, 08 Sep 2008) $
 43  
  */
 44  
 @JSFRenderer(
 45  
     renderKitId="HTML_BASIC",
 46  
     family="javax.faces.Input",
 47  
     type="javax.faces.Hidden")
 48  0
 public class HtmlHiddenRenderer
 49  
 extends HtmlRenderer
 50  
 {
 51  
     public void encodeEnd(FacesContext facesContext, UIComponent uiComponent)
 52  
         throws IOException
 53  
     {
 54  0
         RendererUtils.checkParamValidity(facesContext, uiComponent, UIInput.class);
 55  
 
 56  0
         ResponseWriter writer = facesContext.getResponseWriter();
 57  
 
 58  0
         writer.startElement(HTML.INPUT_ELEM, uiComponent);
 59  0
         writer.writeAttribute(HTML.TYPE_ATTR, HTML.INPUT_TYPE_HIDDEN, null);
 60  
 
 61  0
         String clientId = uiComponent.getClientId(facesContext);
 62  0
         writer.writeAttribute(HTML.ID_ATTR, clientId, null);
 63  0
         writer.writeAttribute(HTML.NAME_ATTR, clientId, null);
 64  
 
 65  0
         String value = RendererUtils.getStringValue(facesContext, uiComponent);
 66  0
         if (value != null)
 67  
         {
 68  0
             writer.writeAttribute(HTML.VALUE_ATTR, value, JSFAttr.VALUE_ATTR);
 69  
         }
 70  
 
 71  0
         writer.endElement(HTML.INPUT_ELEM);
 72  0
     }
 73  
 
 74  
     public Object getConvertedValue(FacesContext facesContext, UIComponent uiComponent, Object submittedValue) throws ConverterException
 75  
     {
 76  0
         RendererUtils.checkParamValidity(facesContext, uiComponent, UIOutput.class);
 77  0
         return RendererUtils.getConvertedUIOutputValue(facesContext,
 78  
                                                        (UIOutput)uiComponent,
 79  
                                                        submittedValue);
 80  
     }
 81  
 
 82  
 
 83  
     public void decode(FacesContext facesContext, UIComponent component)
 84  
      {
 85  0
          RendererUtils.checkParamValidity(facesContext,component,null);
 86  
 
 87  0
          if (component instanceof UIInput)
 88  
          {
 89  0
              HtmlRendererUtils.decodeUIInput(facesContext, component);
 90  
          }
 91  
          else
 92  
          {
 93  0
              throw new IllegalArgumentException("Unsupported component class " + component.getClass().getName());
 94  
          }
 95  0
      }
 96  
 
 97  
 }