Coverage Report - javax.faces.model.SelectItem
 
Classes in this File Line Coverage Branch Coverage Complexity
SelectItem
25%
10/40
0%
0/4
1.158
 
 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 javax.faces.model;
 20  
 
 21  
 import java.io.Serializable;
 22  
 
 23  
 /**
 24  
  * see Javadoc of <a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/index.html">JSF Specification</a>
 25  
  */
 26  
 public class SelectItem implements Serializable
 27  
 {
 28  
     private static final long serialVersionUID = 8841094741464512226L;
 29  
     // FIELDS
 30  
     private Object _value;
 31  
     private String _label;
 32  
     private String _description;
 33  
     private boolean _disabled;
 34  
     private boolean _escape;
 35  
     private boolean _noSelectionOption;
 36  
 
 37  
     // CONSTRUCTORS
 38  
     public SelectItem()
 39  
     {
 40  0
         this(null);
 41  0
     }
 42  
 
 43  
     public SelectItem(Object value)
 44  
     {
 45  0
         this(value, value == null ? null : value.toString());
 46  0
     }
 47  
 
 48  
     public SelectItem(Object value, String label)
 49  
     {
 50  0
         this(value, label, null);
 51  0
     }
 52  
 
 53  
     public SelectItem(Object value, String label, String description)
 54  
     {
 55  0
         this(value, label, description, false);
 56  0
     }
 57  
 
 58  
     public SelectItem(Object value, String label, String description, boolean disabled)
 59  
     {
 60  0
         this(value, label, description, disabled, true);
 61  0
     }
 62  
 
 63  
     public SelectItem(Object value, String label, String description, boolean disabled, boolean escape)
 64  
     {
 65  0
         this(value, label, description, disabled, escape, false);
 66  0
     }
 67  
 
 68  
     /**
 69  
      * 
 70  
      * @param value
 71  
      * @param label
 72  
      * @param description
 73  
      * @param disabled
 74  
      * @param escape
 75  
      * @param noSelectionOption
 76  
      * 
 77  
      * @since 2.0
 78  
      */
 79  
     public SelectItem(Object value, String label, String description, boolean disabled, boolean escape,
 80  
                       boolean noSelectionOption)
 81  84
     {
 82  84
         _value = value;
 83  84
         _label = label;
 84  84
         _description = description;
 85  84
         _disabled = disabled;
 86  84
         _escape = escape;
 87  84
         _noSelectionOption = noSelectionOption;
 88  84
     }
 89  
 
 90  
     // METHODS
 91  
     public String getDescription()
 92  
     {
 93  0
         return _description;
 94  
     }
 95  
 
 96  
     public String getLabel()
 97  
     {
 98  0
         return _label;
 99  
     }
 100  
 
 101  
     public Object getValue()
 102  
     {
 103  88
         return _value;
 104  
     }
 105  
 
 106  
     public boolean isDisabled()
 107  
     {
 108  0
         return _disabled;
 109  
     }
 110  
 
 111  
     public boolean isEscape()
 112  
     {
 113  0
         return _escape;
 114  
     }
 115  
 
 116  
     /**
 117  
      * 
 118  
      * @return
 119  
      * 
 120  
      * @since 2.0
 121  
      */
 122  
     public boolean isNoSelectionOption()
 123  
     {
 124  14
         return _noSelectionOption;
 125  
     }
 126  
 
 127  
     public void setDescription(String description)
 128  
     {
 129  0
         _description = description;
 130  0
     }
 131  
 
 132  
     public void setDisabled(boolean disabled)
 133  
     {
 134  0
         _disabled = disabled;
 135  0
     }
 136  
 
 137  
     public void setEscape(boolean escape)
 138  
     {
 139  0
         _escape = escape;
 140  0
     }
 141  
 
 142  
     public void setLabel(String label)
 143  
     {
 144  0
         if (label == null)
 145  
         {
 146  0
             throw new NullPointerException("label");
 147  
         }
 148  0
         _label = label;
 149  0
     }
 150  
 
 151  
     /**
 152  
      * 
 153  
      * @param noSelectionOption
 154  
      * 
 155  
      * @since 2.0
 156  
      */
 157  
     public void setNoSelectionOption(boolean noSelectionOption)
 158  
     {
 159  0
         _noSelectionOption = noSelectionOption;
 160  0
     }
 161  
 
 162  
     public void setValue(Object value)
 163  
     {
 164  0
         _value = value;
 165  0
     }
 166  
 
 167  
 }