Coverage Report - org.apache.tapestry5.internal.OptionGroupModelImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
OptionGroupModelImpl
100%
13/13
100%
2/2
0
 
 1  
 // Copyright 2007 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry5.internal;
 16  
 
 17  
 import org.apache.tapestry5.OptionGroupModel;
 18  
 import org.apache.tapestry5.OptionModel;
 19  
 
 20  
 import java.util.List;
 21  
 import java.util.Map;
 22  
 
 23  
 public final class OptionGroupModelImpl implements OptionGroupModel
 24  
 {
 25  
     private final String label;
 26  
 
 27  
     private final boolean disabled;
 28  
 
 29  
     private final List<OptionModel> options;
 30  
 
 31  
     private final Map<String, String> attributes;
 32  
 
 33  
     public OptionGroupModelImpl(String label, boolean disabled, List<OptionModel> options,
 34  
                                 String... attributeKeysAndValues)
 35  
     {
 36  10
         this(label, disabled, options, attributeKeysAndValues.length == 0 ? null : TapestryInternalUtils
 37  
                 .mapFromKeysAndValues(attributeKeysAndValues));
 38  10
     }
 39  
 
 40  
     public OptionGroupModelImpl(String label, boolean disabled, List<OptionModel> options,
 41  
                                 Map<String, String> attributes)
 42  14
     {
 43  14
         this.label = label;
 44  14
         this.disabled = disabled;
 45  14
         this.options = options;
 46  14
         this.attributes = attributes;
 47  14
     }
 48  
 
 49  
     public Map<String, String> getAttributes()
 50  
     {
 51  14
         return attributes;
 52  
     }
 53  
 
 54  
     public String getLabel()
 55  
     {
 56  8
         return label;
 57  
     }
 58  
 
 59  
     public List<OptionModel> getOptions()
 60  
     {
 61  10
         return options;
 62  
     }
 63  
 
 64  
     public boolean isDisabled()
 65  
     {
 66  10
         return disabled;
 67  
     }
 68  
 
 69  
     @Override
 70  
     public String toString()
 71  
     {
 72  2
         return String.format("OptionGroupModel[%s]", label);
 73  
     }
 74  
 
 75  
 }