Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
KSDatePicker |
|
| 1.0;1 |
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.Date; | |
20 | ||
21 | import org.kuali.student.common.ui.client.widgets.impl.KSDatePickerImpl; | |
22 | ||
23 | import com.google.gwt.core.client.GWT; | |
24 | import com.google.gwt.event.dom.client.BlurEvent; | |
25 | import com.google.gwt.event.dom.client.BlurHandler; | |
26 | import com.google.gwt.event.dom.client.FocusEvent; | |
27 | import com.google.gwt.event.dom.client.FocusHandler; | |
28 | import com.google.gwt.event.logical.shared.ValueChangeHandler; | |
29 | import com.google.gwt.event.shared.HandlerRegistration; | |
30 | ||
31 | /** | |
32 | * The KSDatePicker widget provides an easy way for a date to be entered by a user. When this widget obtains focus, | |
33 | * a datepicker popup calendar appears below the text field. The user may either select the date using the calendar, | |
34 | * or fill in the date manually (which will automatically selects the date for them in the calendar). | |
35 | * | |
36 | * TODO 03/11/2009 - This widget currently only supports dates entered in the mm/dd/yyyy format. Known unresolved backspace bug in Firefox. | |
37 | * | |
38 | * @author Kuali Student Team | |
39 | * | |
40 | */ | |
41 | 0 | public class KSDatePicker extends KSDatePickerAbstract implements HasWatermark { |
42 | 0 | KSDatePickerAbstract datePicker = GWT.create(KSDatePickerImpl.class); |
43 | ||
44 | /** | |
45 | * Creates a KSDatePicker widget. | |
46 | * | |
47 | */ | |
48 | 0 | public KSDatePicker() { |
49 | 0 | this.initWidget(datePicker); |
50 | ||
51 | 0 | } |
52 | ||
53 | /** | |
54 | * Get the currently selected date. | |
55 | * | |
56 | * @return the Date selected | |
57 | */ | |
58 | @Override | |
59 | public Date getValue() { | |
60 | 0 | return datePicker.getValue(); |
61 | } | |
62 | ||
63 | /** | |
64 | * Sets the date and selects it. | |
65 | * | |
66 | * @param date the Date to set the calendar and associated field to | |
67 | */ | |
68 | @Override | |
69 | public void setValue(Date date) { | |
70 | 0 | datePicker.setValue(date); |
71 | 0 | } |
72 | ||
73 | /** | |
74 | * @see com.google.gwt.user.client.ui.HasValue#setValue(java.lang.Object, boolean) | |
75 | */ | |
76 | @Override | |
77 | public void setValue(Date date, boolean fireEvents) { | |
78 | 0 | datePicker.setValue(date, fireEvents); |
79 | 0 | } |
80 | ||
81 | /** | |
82 | * @see com.google.gwt.event.logical.shared.HasValueChangeHandlers#addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler) | |
83 | */ | |
84 | @Override | |
85 | public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Date> handler) { | |
86 | 0 | return datePicker.addValueChangeHandler(handler); |
87 | } | |
88 | ||
89 | @Override | |
90 | public HandlerRegistration addFocusHandler(FocusHandler handler) { | |
91 | 0 | return datePicker.addFocusHandler(handler); |
92 | } | |
93 | ||
94 | @Override | |
95 | public HandlerRegistration addBlurHandler(BlurHandler handler) { | |
96 | 0 | return datePicker.addBlurHandler(handler); |
97 | } | |
98 | ||
99 | @Override | |
100 | public boolean hasWatermark() { | |
101 | 0 | return datePicker.hasWatermark(); |
102 | } | |
103 | ||
104 | @Override | |
105 | public void setWatermarkText(String waterMark) { | |
106 | 0 | datePicker.setWatermarkText(waterMark); |
107 | 0 | } |
108 | ||
109 | @Override | |
110 | public boolean watermarkShowing() { | |
111 | 0 | return datePicker.watermarkShowing(); |
112 | } | |
113 | ||
114 | ||
115 | } |