Coverage Report - org.kuali.rice.core.api.uif.RemotableRadioButtonGroup
 
Classes in this File Line Coverage Branch Coverage Complexity
RemotableRadioButtonGroup
0%
0/9
N/A
1.5
RemotableRadioButtonGroup$1
N/A
N/A
1.5
RemotableRadioButtonGroup$Builder
0%
0/13
0%
0/6
1.5
RemotableRadioButtonGroup$Constants
0%
0/1
N/A
1.5
RemotableRadioButtonGroup$Elements
0%
0/1
N/A
1.5
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
 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, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.rice.core.api.uif;
 17  
 
 18  
 import org.kuali.rice.core.api.CoreConstants;
 19  
 import org.kuali.rice.core.api.util.jaxb.MapStringStringAdapter;
 20  
 import org.w3c.dom.Element;
 21  
 
 22  
 import javax.xml.bind.annotation.XmlAccessType;
 23  
 import javax.xml.bind.annotation.XmlAccessorType;
 24  
 import javax.xml.bind.annotation.XmlAnyElement;
 25  
 import javax.xml.bind.annotation.XmlElement;
 26  
 import javax.xml.bind.annotation.XmlRootElement;
 27  
 import javax.xml.bind.annotation.XmlType;
 28  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 29  
 import java.util.Collection;
 30  
 import java.util.Collections;
 31  
 import java.util.HashMap;
 32  
 import java.util.Map;
 33  
 import java.util.SortedMap;
 34  
 
 35  
 /**
 36  
  * A radio button group control type.
 37  
  */
 38  
 @XmlRootElement(name = RemotableRadioButtonGroup.Constants.ROOT_ELEMENT_NAME)
 39  
 @XmlAccessorType(XmlAccessType.NONE)
 40  
 @XmlType(name = RemotableRadioButtonGroup.Constants.TYPE_NAME, propOrder = {
 41  
         RemotableRadioButtonGroup.Elements.KEY_LABELS,
 42  
                 CoreConstants.CommonElements.FUTURE_ELEMENTS })
 43  0
 public final class RemotableRadioButtonGroup extends RemotableAbstractControl implements KeyLabeled {
 44  
 
 45  
     @XmlElement(name = Elements.KEY_LABELS, required = true)
 46  
     @XmlJavaTypeAdapter(value = MapStringStringAdapter.class)
 47  
     private final Map<String, String> keyLabels;
 48  
 
 49  0
     @SuppressWarnings("unused")
 50  
     @XmlAnyElement
 51  
     private final Collection<Element> _futureElements = null;
 52  
 
 53  
     /**
 54  
      * Should only be invoked by JAXB.
 55  
      */
 56  
     @SuppressWarnings("unused")
 57  0
     private RemotableRadioButtonGroup() {
 58  0
         keyLabels = null;
 59  0
     }
 60  
 
 61  0
     private RemotableRadioButtonGroup(Builder b) {
 62  0
         keyLabels = b.keyLabels;
 63  0
     }
 64  
 
 65  
     @Override
 66  
     public Map<String, String> getKeyLabels() {
 67  0
         return keyLabels;
 68  
     }
 69  
 
 70  0
     public static final class Builder extends RemotableAbstractControl.Builder implements KeyLabeled {
 71  
         private Map<String, String> keyLabels;
 72  
 
 73  0
         private Builder(Map<String, String> keyLabels) {
 74  0
             setKeyLabels(keyLabels);
 75  0
         }
 76  
 
 77  
         public static Builder create(Map<String, String> keyLabels) {
 78  0
             return new Builder(keyLabels);
 79  
         }
 80  
 
 81  
         @Override
 82  
         public Map<String, String> getKeyLabels() {
 83  0
             return keyLabels;
 84  
         }
 85  
 
 86  
         public void setKeyLabels(Map<String, String> keyLabels) {
 87  0
             if (keyLabels == null || keyLabels.isEmpty()) {
 88  0
                 throw new IllegalArgumentException("keyLabels must be non-null & non-empty");
 89  
             }
 90  
             // keep previously SortedMaps (such as by sequence number) sorted. 
 91  0
             if (keyLabels instanceof SortedMap) {
 92  0
                 this.keyLabels = Collections.unmodifiableSortedMap((SortedMap)keyLabels);
 93  
             } else {
 94  0
                 this.keyLabels = Collections.unmodifiableMap(new HashMap<String, String>(keyLabels));
 95  
             }
 96  0
         }
 97  
 
 98  
         @Override
 99  
         public RemotableRadioButtonGroup build() {
 100  0
             return new RemotableRadioButtonGroup(this);
 101  
         }
 102  
     }
 103  
 
 104  
     /**
 105  
      * Defines some internal constants used on this class.
 106  
      */
 107  0
     static final class Constants {
 108  
         static final String TYPE_NAME = "RadioButtonGroupType";
 109  
         final static String ROOT_ELEMENT_NAME = "radioButtonGroup";
 110  
     }
 111  
 
 112  0
     static final class Elements {
 113  
         static final String KEY_LABELS = "keyLabels";
 114  
     }
 115  
 }