Coverage Report - javax.faces.component.UIMessages
 
Classes in this File Line Coverage Branch Coverage Complexity
UIMessages
100%
49/49
100%
12/12
1.6
 
 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 javax.faces.context.FacesContext;
 19  
 
 20  
 /**
 21  
  * @author shot
 22  
  */
 23  
 public class UIMessages extends UIComponentBase {
 24  
 
 25  
     public static final String COMPONENT_FAMILY = "javax.faces.Messages";
 26  
 
 27  
     public static final String COMPONENT_TYPE = "javax.faces.Messages";
 28  
 
 29  
     private static final String DEFAULT_RENDER_TYPE = "javax.faces.Messages";
 30  
 
 31  174
     private boolean globalOnly = false;
 32  
 
 33  174
     private boolean globalOnlySet = false;
 34  
 
 35  174
     private boolean showDetail = false;
 36  
 
 37  174
     private boolean showDetailSet = false;
 38  
 
 39  174
     private boolean showSummary = true;
 40  
 
 41  174
     private boolean showSummarySet = false;
 42  
 
 43  174
     public UIMessages() {
 44  174
         setRendererType(DEFAULT_RENDER_TYPE);
 45  174
     }
 46  
 
 47  
     public String getFamily() {
 48  24
         return COMPONENT_FAMILY;
 49  
     }
 50  
 
 51  
     public boolean isGlobalOnly() {
 52  36
         if (globalOnlySet) {
 53  4
             return globalOnly;
 54  
         }
 55  32
         Object value = ComponentUtil_.getValueBindingValue(this, "globalOnly");
 56  32
         return (value != null) ? Boolean.TRUE.equals(value) : globalOnly;
 57  
     }
 58  
 
 59  
     public void setGlobalOnly(boolean isGlobalOnly) {
 60  4
         globalOnly = isGlobalOnly;
 61  4
         globalOnlySet = true;
 62  4
     }
 63  
 
 64  
     public boolean isShowDetail() {
 65  38
         if (showDetailSet) {
 66  9
             return showDetail;
 67  
         }
 68  29
         Object value = ComponentUtil_.getValueBindingValue(this, "showDetail");
 69  29
         return (value != null) ? Boolean.TRUE.equals(value) : showDetail;
 70  
     }
 71  
 
 72  
     public void setShowDetail(boolean isShowDetail) {
 73  9
         showDetail = isShowDetail;
 74  9
         showDetailSet = true;
 75  9
     }
 76  
 
 77  
     public boolean isShowSummary() {
 78  38
         if (showSummarySet) {
 79  7
             return showSummary;
 80  
         }
 81  31
         Object value = ComponentUtil_.getValueBindingValue(this, "showSummary");
 82  31
         return (value != null) ? Boolean.TRUE.equals(value) : showSummary;
 83  
     }
 84  
 
 85  
     public void setShowSummary(boolean showSummary) {
 86  7
         this.showSummary = showSummary;
 87  7
         showSummarySet = true;
 88  7
     }
 89  
 
 90  
     public void restoreState(FacesContext context, Object state) {
 91  4
         Object[] values = (Object[]) state;
 92  4
         super.restoreState(context, values[0]);
 93  4
         globalOnly = ((Boolean) values[1]).booleanValue();
 94  4
         globalOnlySet = ((Boolean) values[2]).booleanValue();
 95  4
         showDetail = ((Boolean) values[3]).booleanValue();
 96  4
         showDetailSet = ((Boolean) values[4]).booleanValue();
 97  4
         showSummary = ((Boolean) values[5]).booleanValue();
 98  4
         showSummarySet = ((Boolean) values[6]).booleanValue();
 99  4
     }
 100  
 
 101  
     public Object saveState(FacesContext context) {
 102  5
         Object[] values = new Object[7];
 103  5
         values[0] = super.saveState(context);
 104  5
         values[1] = ComponentUtil_.convertToBoolean(globalOnly);
 105  5
         values[2] = ComponentUtil_.convertToBoolean(globalOnlySet);
 106  5
         values[3] = ComponentUtil_.convertToBoolean(showDetail);
 107  5
         values[4] = ComponentUtil_.convertToBoolean(showDetailSet);
 108  5
         values[5] = ComponentUtil_.convertToBoolean(showSummary);
 109  5
         values[6] = ComponentUtil_.convertToBoolean(showSummarySet);
 110  5
         return values;
 111  
     }
 112  
 
 113  
 }