Coverage Report - javax.faces.component.html.HtmlOutputFormat
 
Classes in this File Line Coverage Branch Coverage Complexity
HtmlOutputFormat
100%
43/43
100%
12/12
1.727
 
 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.html;
 17  
 
 18  
 import javax.faces.component.ComponentUtil_;
 19  
 import javax.faces.component.UIOutput;
 20  
 import javax.faces.context.FacesContext;
 21  
 import javax.faces.el.ValueBinding;
 22  
 
 23  
 import org.seasar.teeda.core.JsfConstants;
 24  
 
 25  
 /**
 26  
  * @author shot
 27  
  */
 28  
 public class HtmlOutputFormat extends UIOutput {
 29  
 
 30  
     public static final String COMPONENT_TYPE = "javax.faces.HtmlOutputFormat";
 31  
 
 32  
     private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Format";
 33  
 
 34  
     private static final boolean DEFAULT_ESCAPE = true;
 35  
 
 36  118
     private Boolean escape = null;
 37  
 
 38  118
     private String style = null;
 39  
 
 40  118
     private String styleClass = null;
 41  
 
 42  118
     private String title = null;
 43  
 
 44  
     public HtmlOutputFormat() {
 45  118
         super();
 46  118
         setRendererType(DEFAULT_RENDERER_TYPE);
 47  118
     }
 48  
 
 49  
     public void setEscape(boolean escape) {
 50  4
         this.escape = Boolean.valueOf(escape);
 51  4
     }
 52  
 
 53  
     public boolean isEscape() {
 54  14
         if (escape != null) {
 55  4
             return escape.booleanValue();
 56  
         }
 57  10
         ValueBinding vb = getValueBinding("escape");
 58  10
         Boolean v = vb != null ? (Boolean) vb.getValue(getFacesContext())
 59  
                 : null;
 60  10
         return v != null ? v.booleanValue() : DEFAULT_ESCAPE;
 61  
     }
 62  
 
 63  
     public void setStyle(String style) {
 64  3
         this.style = style;
 65  3
     }
 66  
 
 67  
     public String getStyle() {
 68  22
         if (style != null) {
 69  3
             return style;
 70  
         }
 71  19
         return ComponentUtil_.getValueBindingValueAsString(this,
 72  
                 JsfConstants.STYLE_ATTR);
 73  
     }
 74  
 
 75  
     public void setStyleClass(String styleClass) {
 76  3
         this.styleClass = styleClass;
 77  3
     }
 78  
 
 79  
     public String getStyleClass() {
 80  22
         if (styleClass != null) {
 81  3
             return styleClass;
 82  
         }
 83  19
         return ComponentUtil_.getValueBindingValueAsString(this,
 84  
                 JsfConstants.STYLE_CLASS_ATTR);
 85  
     }
 86  
 
 87  
     public void setTitle(String title) {
 88  3
         this.title = title;
 89  3
     }
 90  
 
 91  
     public String getTitle() {
 92  22
         if (title != null) {
 93  3
             return title;
 94  
         }
 95  19
         return ComponentUtil_.getValueBindingValueAsString(this,
 96  
                 JsfConstants.TITLE_ATTR);
 97  
     }
 98  
 
 99  
     public Object saveState(FacesContext context) {
 100  4
         Object values[] = new Object[5];
 101  4
         values[0] = super.saveState(context);
 102  4
         values[1] = escape;
 103  4
         values[2] = style;
 104  4
         values[3] = styleClass;
 105  4
         values[4] = title;
 106  4
         return ((Object) (values));
 107  
     }
 108  
 
 109  
     public void restoreState(FacesContext context, Object state) {
 110  3
         Object values[] = (Object[]) state;
 111  3
         super.restoreState(context, values[0]);
 112  3
         escape = (Boolean) values[1];
 113  3
         style = (String) values[2];
 114  3
         styleClass = (String) values[3];
 115  3
         title = (String) values[4];
 116  3
     }
 117  
 }