Coverage Report - org.kuali.rice.core.api.uif.control.MultiSelect
 
Classes in this File Line Coverage Branch Coverage Complexity
MultiSelect
0%
0/11
N/A
1.25
MultiSelect$1
N/A
N/A
1.25
MultiSelect$Builder
0%
0/18
0%
0/4
1.25
MultiSelect$Constants
0%
0/1
N/A
1.25
MultiSelect$Elements
0%
0/1
N/A
1.25
 
 1  
 package org.kuali.rice.core.api.uif.control;
 2  
 
 3  
 import javax.xml.bind.annotation.XmlAccessType;
 4  
 import javax.xml.bind.annotation.XmlAccessorType;
 5  
 import javax.xml.bind.annotation.XmlElement;
 6  
 import javax.xml.bind.annotation.XmlType;
 7  
 import java.util.ArrayList;
 8  
 import java.util.Collection;
 9  
 import java.util.Collections;
 10  
 
 11  
 @XmlAccessorType(XmlAccessType.NONE)
 12  
 @XmlType(name = MultiSelect.Constants.TYPE_NAME)
 13  0
 public class MultiSelect extends AbstractControl implements MultiSelectContract {
 14  
     @XmlElement(name = Elements.SIZE, required = false)
 15  
     private final Integer size;
 16  
 
 17  
     @XmlElement(name = Elements.DEFAULT_VALUES, required = false)
 18  
     private final Collection<String> defaultValues;
 19  
 
 20  
     @Override
 21  
     public Integer getSize() {
 22  0
         return size;
 23  
     }
 24  
 
 25  
     @Override
 26  
     public Collection<String> getDefaultValues() {
 27  0
         return Collections.unmodifiableCollection(defaultValues);
 28  
     }
 29  
 
 30  0
     private MultiSelect() {
 31  0
         size = null;
 32  0
         defaultValues = null;
 33  0
     }
 34  
 
 35  
     private MultiSelect(Builder b) {
 36  0
         super(b);
 37  0
         size = b.size;
 38  0
         defaultValues = b.defaultValues;
 39  0
     }
 40  
 
 41  0
     public static final class Builder extends AbstractControl.Builder implements MultiSelectContract {
 42  
         private Integer size;
 43  
         private Collection<String> defaultValues;
 44  
 
 45  
         private Builder(String name) {
 46  0
             super(name);
 47  0
         }
 48  
 
 49  
         public static Builder create(String name) {
 50  0
             return new Builder(name);
 51  
         }
 52  
 
 53  
         public static Builder create(MultiSelectContract contract) {
 54  0
             Builder b = create(contract.getName());
 55  
 
 56  0
             partialCreate(contract, b);
 57  
 
 58  0
             b.setSize(contract.getSize());
 59  0
             b.setDefaultValues(contract.getDefaultValues());
 60  0
             return b;
 61  
         }
 62  
 
 63  
         @Override
 64  
         public Integer getSize() {
 65  0
             return size;
 66  
         }
 67  
 
 68  
         public void setSize(Integer size) {
 69  0
             if (size != null && size < 1) {
 70  0
                 throw new IllegalArgumentException("size was < 1");
 71  
             }
 72  
 
 73  0
             this.size = size;
 74  0
         }
 75  
 
 76  
         @Override
 77  
         public Collection<String> getDefaultValues() {
 78  0
             return Collections.unmodifiableCollection(defaultValues);
 79  
         }
 80  
 
 81  
         public void setDefaultValues(Collection<String> defaultValues) {
 82  0
             this.defaultValues = new ArrayList<String>(defaultValues);
 83  0
         }
 84  
 
 85  
         @Override
 86  
         public MultiSelect build() {
 87  0
             return new MultiSelect(this);
 88  
         }
 89  
     }
 90  
 
 91  
     /**
 92  
      * Defines some internal constants used on this class.
 93  
      */
 94  0
     static final class Constants {
 95  
         static final String TYPE_NAME = "SelectType";
 96  
     }
 97  
 
 98  0
     static final class Elements {
 99  
         static final String SIZE = "size";
 100  
         static final String DEFAULT_VALUES = "defaultValues";
 101  
     }
 102  
 }