2828
2929public class MaterialDatePicker extends FocusPanel {
3030
31+ /**
32+ * Delegate interface for handling picker events.
33+ */
3134 public interface MaterialDatePickerDelegate {
35+
36+ /**
37+ * Called as soon as a click occurs on the calendar widget. !EXPERIMENTAL!
38+ * @param currDate which is currently selected.
39+ */
3240 void onCalendarClick (Date currDate );
3341 }
3442
@@ -51,7 +59,7 @@ protected void onAttach() {
5159 panel = new HTMLPanel ("<input placeholder='" +placeholder +"' type='date' id='" +id +"' class='datepicker'>" );
5260 this .add (panel );
5361 initDatePicker (id );
54- onValueChange (id , this );
62+ initClickHandler (id , this );
5563 }
5664
5765 public static native String getDatePickerValue (String id )/*-{
@@ -67,14 +75,19 @@ public static native void initDatePicker(String id)/*-{
6775 $wnd.jQuery('#' + id).pickadate();
6876 }-*/ ;
6977
70- native void onValueChange (String id , MaterialDatePicker picker ) /*-{
78+ native void initClickHandler (String id , MaterialDatePicker picker ) /*-{
7179 $wnd.jQuery('.picker__wrap').bind('click',function(){
7280 [email protected] ::notifyDelegate()(); 7381 });
7482 }-*/ ;
7583
76- public void setDelegate (MaterialDatePickerDelegate del ) {
77- this .delegate = del ;
84+ /**
85+ * A delegate which implements handling of events from date picker.
86+ * @param delegate which will be notified on picker events.
87+ * @see MaterialDatePickerDelegate
88+ */
89+ public void setDelegate (MaterialDatePickerDelegate delegate ) {
90+ this .delegate = delegate ;
7891 }
7992
8093 void notifyDelegate () {
0 commit comments