Coverage Report - javax.faces.component.html.HtmlMessages
 
Classes in this File Line Coverage Branch Coverage Complexity
HtmlMessages
100%
116/116
100%
32/32
1.897
 
 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.UIMessages;
 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 HtmlMessages extends UIMessages {
 29  
 
 30  
     public static final String COMPONENT_TYPE = "javax.faces.HtmlMessages";
 31  
 
 32  
     private static final String DEFAULT_RENDERER_TYPE = "javax.faces.Messages";
 33  
 
 34  
     private static final String DEFAULT_LAYOUT = "list";
 35  
 
 36  
     private static final boolean DEFAULT_TOOLTIP = false;
 37  
 
 38  148
     private String errorClass = null;
 39  
 
 40  148
     private String errorStyle = null;
 41  
 
 42  148
     private String fatalClass = null;
 43  
 
 44  148
     private String fatalStyle = null;
 45  
 
 46  148
     private String infoClass = null;
 47  
 
 48  148
     private String infoStyle = null;
 49  
 
 50  148
     private String layout = null;
 51  
 
 52  148
     private String style = null;
 53  
 
 54  148
     private String styleClass = null;
 55  
 
 56  148
     private String title = null;
 57  
 
 58  148
     private Boolean tooltip = null;
 59  
 
 60  148
     private String warnClass = null;
 61  
 
 62  148
     private String warnStyle = null;
 63  
 
 64  
     public HtmlMessages() {
 65  148
         super();
 66  148
         setRendererType(DEFAULT_RENDERER_TYPE);
 67  148
     }
 68  
 
 69  
     public void setErrorClass(String errorClass) {
 70  7
         this.errorClass = errorClass;
 71  7
     }
 72  
 
 73  
     public String getErrorClass() {
 74  5
         if (errorClass != null) {
 75  3
             return errorClass;
 76  
         }
 77  2
         return ComponentUtil_.getValueBindingValueAsString(this,
 78  
                 JsfConstants.ERROR_CLASS_ATTR);
 79  
     }
 80  
 
 81  
     public void setErrorStyle(String errorStyle) {
 82  8
         this.errorStyle = errorStyle;
 83  8
     }
 84  
 
 85  
     public String getErrorStyle() {
 86  5
         if (errorStyle != null) {
 87  4
             return errorStyle;
 88  
         }
 89  1
         return ComponentUtil_.getValueBindingValueAsString(this,
 90  
                 JsfConstants.ERROR_STYLE_ATTR);
 91  
     }
 92  
 
 93  
     public void setFatalClass(String fatalClass) {
 94  7
         this.fatalClass = fatalClass;
 95  7
     }
 96  
 
 97  
     public String getFatalClass() {
 98  5
         if (fatalClass != null) {
 99  4
             return fatalClass;
 100  
         }
 101  1
         return ComponentUtil_.getValueBindingValueAsString(this,
 102  
                 JsfConstants.FATAL_CLASS_ATTR);
 103  
     }
 104  
 
 105  
     public void setFatalStyle(String fatalStyle) {
 106  7
         this.fatalStyle = fatalStyle;
 107  7
     }
 108  
 
 109  
     public String getFatalStyle() {
 110  5
         if (fatalStyle != null) {
 111  4
             return fatalStyle;
 112  
         }
 113  1
         return ComponentUtil_.getValueBindingValueAsString(this,
 114  
                 JsfConstants.FATAL_STYLE_ATTR);
 115  
     }
 116  
 
 117  
     public void setInfoClass(String infoClass) {
 118  8
         this.infoClass = infoClass;
 119  8
     }
 120  
 
 121  
     public String getInfoClass() {
 122  28
         if (infoClass != null) {
 123  4
             return infoClass;
 124  
         }
 125  24
         return ComponentUtil_.getValueBindingValueAsString(this,
 126  
                 JsfConstants.INFO_CLASS_ATTR);
 127  
     }
 128  
 
 129  
     public void setInfoStyle(String infoStyle) {
 130  8
         this.infoStyle = infoStyle;
 131  8
     }
 132  
 
 133  
     public String getInfoStyle() {
 134  28
         if (infoStyle != null) {
 135  4
             return infoStyle;
 136  
         }
 137  24
         return ComponentUtil_.getValueBindingValueAsString(this,
 138  
                 JsfConstants.INFO_STYLE_ATTR);
 139  
     }
 140  
 
 141  
     public void setLayout(String layout) {
 142  8
         this.layout = layout;
 143  8
     }
 144  
 
 145  
     public String getLayout() {
 146  31
         if (layout != null) {
 147  8
             return layout;
 148  
         }
 149  23
         final String str = ComponentUtil_.getValueBindingValueAsString(this,
 150  
                 JsfConstants.LAYOUT_ATTR);
 151  23
         return (str != null) ? str : DEFAULT_LAYOUT;
 152  
     }
 153  
 
 154  
     public void setStyle(String style) {
 155  9
         this.style = style;
 156  9
     }
 157  
 
 158  
     public String getStyle() {
 159  27
         if (style != null) {
 160  4
             return style;
 161  
         }
 162  23
         return ComponentUtil_.getValueBindingValueAsString(this,
 163  
                 JsfConstants.STYLE_ATTR);
 164  
     }
 165  
 
 166  
     public void setStyleClass(String styleClass) {
 167  9
         this.styleClass = styleClass;
 168  9
     }
 169  
 
 170  
     public String getStyleClass() {
 171  27
         if (styleClass != null) {
 172  4
             return styleClass;
 173  
         }
 174  23
         return ComponentUtil_.getValueBindingValueAsString(this,
 175  
                 JsfConstants.STYLE_CLASS_ATTR);
 176  
     }
 177  
 
 178  
     public void setTitle(String title) {
 179  4
         this.title = title;
 180  4
     }
 181  
 
 182  
     public String getTitle() {
 183  34
         if (title != null) {
 184  4
             return title;
 185  
         }
 186  30
         return ComponentUtil_.getValueBindingValueAsString(this,
 187  
                 JsfConstants.TITLE_ATTR);
 188  
     }
 189  
 
 190  
     public void setTooltip(boolean tooltip) {
 191  4
         this.tooltip = Boolean.valueOf(tooltip);
 192  4
     }
 193  
 
 194  
     public boolean isTooltip() {
 195  34
         if (tooltip != null) {
 196  4
             return tooltip.booleanValue();
 197  
         }
 198  30
         ValueBinding vb = getValueBinding("tooltip");
 199  30
         Boolean v = vb != null ? (Boolean) vb.getValue(getFacesContext())
 200  
                 : null;
 201  30
         return v != null ? v.booleanValue() : DEFAULT_TOOLTIP;
 202  
     }
 203  
 
 204  
     public void setWarnClass(String warnClass) {
 205  8
         this.warnClass = warnClass;
 206  8
     }
 207  
 
 208  
     public String getWarnClass() {
 209  5
         if (warnClass != null) {
 210  4
             return warnClass;
 211  
         }
 212  1
         return ComponentUtil_.getValueBindingValueAsString(this,
 213  
                 JsfConstants.WARN_CLASS_ATTR);
 214  
     }
 215  
 
 216  
     public void setWarnStyle(String warnStyle) {
 217  7
         this.warnStyle = warnStyle;
 218  7
     }
 219  
 
 220  
     public String getWarnStyle() {
 221  5
         if (warnStyle != null) {
 222  3
             return warnStyle;
 223  
         }
 224  2
         return ComponentUtil_.getValueBindingValueAsString(this,
 225  
                 JsfConstants.WARN_STYLE_ATTR);
 226  
     }
 227  
 
 228  
     public Object saveState(FacesContext context) {
 229  3
         Object values[] = new Object[14];
 230  3
         values[0] = super.saveState(context);
 231  3
         values[1] = errorClass;
 232  3
         values[2] = errorStyle;
 233  3
         values[3] = fatalClass;
 234  3
         values[4] = fatalStyle;
 235  3
         values[5] = infoClass;
 236  3
         values[6] = infoStyle;
 237  3
         values[7] = layout;
 238  3
         values[8] = style;
 239  3
         values[9] = styleClass;
 240  3
         values[10] = title;
 241  3
         values[11] = tooltip;
 242  3
         values[12] = warnClass;
 243  3
         values[13] = warnStyle;
 244  3
         return ((Object) (values));
 245  
     }
 246  
 
 247  
     public void restoreState(FacesContext context, Object state) {
 248  2
         Object values[] = (Object[]) state;
 249  2
         super.restoreState(context, values[0]);
 250  2
         errorClass = (String) values[1];
 251  2
         errorStyle = (String) values[2];
 252  2
         fatalClass = (String) values[3];
 253  2
         fatalStyle = (String) values[4];
 254  2
         infoClass = (String) values[5];
 255  2
         infoStyle = (String) values[6];
 256  2
         layout = (String) values[7];
 257  2
         style = (String) values[8];
 258  2
         styleClass = (String) values[9];
 259  2
         title = (String) values[10];
 260  2
         tooltip = (Boolean) values[11];
 261  2
         warnClass = (String) values[12];
 262  2
         warnStyle = (String) values[13];
 263  2
     }
 264  
 }