Skip to content

Commit a463512

Browse files
author
wassx
committed
Add documentation and renaming for MaterialDatePicker
1 parent 1672379 commit a463512

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/main/java/gwt/material/design/client/ui/MaterialDatePicker.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@
2828

2929
public 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

Comments
 (0)