Clover Coverage Report - KS Common UI 1.2-M4-SNAPSHOT
Coverage timestamp: Wed Jul 20 2011 12:41:05 EDT
../../../../../../../img/srcFileCovDistChart0.png 4% of files have more coverage
25   193   24   1.14
4   102   0.96   22
22     1.09  
1    
 
  KSDropDown       Line # 41 25 0% 24 51 0% 0.0
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15   
16    package org.kuali.student.common.ui.client.widgets;
17   
18   
19    import java.util.List;
20   
21    import org.kuali.student.common.ui.client.mvc.Callback;
22    import org.kuali.student.common.ui.client.widgets.impl.KSDropDownImpl;
23    import org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract;
24    import org.kuali.student.common.ui.client.widgets.list.ListItems;
25    import org.kuali.student.common.ui.client.widgets.list.SelectionChangeHandler;
26   
27    import com.google.gwt.core.client.GWT;
28    import com.google.gwt.event.dom.client.BlurHandler;
29    import com.google.gwt.event.dom.client.FocusHandler;
30    import com.google.gwt.event.shared.HandlerRegistration;
31    import com.google.gwt.user.client.ui.Widget;
32   
33    /**
34    * KSDropDown wraps gwt Listbox in a KSSelectItemWidgetAbstract. This provides
35    * the same basic functionality as a listbox, but allows it to be interchangable
36    * with other select item widget implementations.
37    *
38    * @author Kuali Student Team
39    *
40    */
 
41    public class KSDropDown extends KSSelectItemWidgetAbstract{
42   
43    KSSelectItemWidgetAbstract dropDown = GWT.create(KSDropDownImpl.class);
44    /**
45    * This constructs a KSDropDown that wraps an impl
46    *
47    */
 
48  0 toggle public KSDropDown(){
49  0 this.initWidget(dropDown);
50    }
51   
52    /**
53    * Select an item whose text equals the name passed in.
54    *
55    * @param id of the item to be selected.
56    */
 
57  0 toggle @Override
58    public void selectItem(String id) {
59  0 dropDown.selectItem(id);
60    }
61   
62    /**
63    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#deSelectItem(java.lang.String)
64    */
 
65  0 toggle @Override
66    public void deSelectItem(String id) {
67  0 dropDown.deSelectItem(id);
68    }
69   
70    /**
71    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#getSelectedItems()
72    */
 
73  0 toggle @Override
74    public List<String> getSelectedItems() {
75  0 return dropDown.getSelectedItems();
76    }
77   
78    /**
79    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#getSelectedItem()
80    */
 
81  0 toggle @Override
82    public String getSelectedItem() {
83  0 return dropDown.getSelectedItem();
84    }
85   
86    /**
87    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#onLoad()
88    */
 
89  0 toggle @Override
90    public void onLoad() {
91  0 dropDown.onLoad();
92    }
93   
94    /**
95    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#setListItems(org.kuali.student.common.ui.client.widgets.list.ListItems)
96    */
 
97  0 toggle @Override
98    public void setListItems(ListItems listItems) {
99  0 dropDown.setListItems(listItems);
100    }
101   
102    /**
103    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#addSelectionChangeHandler(org.kuali.student.common.ui.client.widgets.list.SelectionChangeHandler)
104    */
 
105  0 toggle public HandlerRegistration addSelectionChangeHandler(SelectionChangeHandler selectionHandler) {
106  0 return dropDown.addSelectionChangeHandler(selectionHandler);
107    }
108   
109    /**
110    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#getListItems()
111    */
 
112  0 toggle public ListItems getListItems() {
113  0 return dropDown.getListItems();
114    }
115   
116    /**
117    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#getName()
118    */
 
119  0 toggle public String getName() {
120  0 return dropDown.getName();
121    }
122   
123    /**
124    * @see org.kuali.student.common.ui.client.widgets.list.KSSelectItemWidgetAbstract#setName(java.lang.String)
125    */
 
126  0 toggle @Override
127    public void setName(String name) {
128  0 dropDown.setName(name);
129    }
130   
 
131  0 toggle public void setEnabled(boolean b) {
132  0 dropDown.setEnabled(b);
133    }
134   
 
135  0 toggle @Override
136    public boolean isEnabled() {
137  0 return dropDown.isEnabled();
138    }
139   
 
140  0 toggle public boolean isBlankFirstItem() {
141  0 if (dropDown instanceof KSDropDownImpl){
142  0 return ((KSDropDownImpl)dropDown).isBlankFirstItem();
143    } else {
144  0 return false;
145    }
146    }
147   
148    /**
149    * Use when the first item in list should be blank. If set, it must be called before call to setListItems()
150    *
151    * @param blankFirstItem
152    */
 
153  0 toggle public void setBlankFirstItem(boolean blankFirstItem) {
154  0 if (dropDown instanceof KSDropDownImpl){
155  0 ((KSDropDownImpl)dropDown).setBlankFirstItem(blankFirstItem);
156    }
157    }
158   
 
159  0 toggle @Override
160    public void redraw() {
161  0 dropDown.redraw();
162    }
163   
 
164  0 toggle @Override
165    public HandlerRegistration addFocusHandler(FocusHandler handler) {
166  0 return dropDown.addFocusHandler(handler);
167    }
168   
 
169  0 toggle @Override
170    public HandlerRegistration addBlurHandler(BlurHandler handler) {
171  0 return dropDown.addBlurHandler(handler);
172    }
173   
 
174  0 toggle @Override
175    public void addWidgetReadyCallback(Callback<Widget> callback) {
176  0 dropDown.addWidgetReadyCallback(callback);
177    }
178   
 
179  0 toggle @Override
180    public boolean isInitialized() {
181  0 return dropDown.isInitialized();
182    }
183   
 
184  0 toggle @Override
185    public void setInitialized(boolean initialized) {
186  0 dropDown.setInitialized(initialized);
187    }
188   
 
189  0 toggle @Override
190    public void clear() {
191  0 dropDown.clear();
192    }
193    }