01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08: package com.gwtext.sample.showcase2.client.misc;
09:
10: import com.gwtext.client.widgets.Panel;
11: import com.gwtext.client.widgets.DatePicker;
12: import com.gwtext.client.widgets.event.DatePickerListenerAdapter;
13: import com.gwtext.client.widgets.form.TextField;
14: import com.gwtext.sample.showcase2.client.ShowcasePanel;
15: import com.google.gwt.user.client.ui.VerticalPanel;
16:
17: import java.util.Date;
18:
19: public class DatePickerSample extends ShowcasePanel {
20:
21: public String getSourceUrl() {
22: return "source/misc/DatePickerSample.java.html";
23: }
24:
25: public Panel getViewPanel() {
26: if (panel == null) {
27: panel = new Panel();
28:
29: VerticalPanel verticalPanel = new VerticalPanel();
30: verticalPanel.setSpacing(15);
31:
32: final TextField textField = new TextField("Date");
33: textField.setWidth(200);
34:
35: DatePicker datePicker = new DatePicker();
36: datePicker.setValue(new Date(101, 1, 2));
37: datePicker.setTodayText("Now!!");
38: datePicker.addListener(new DatePickerListenerAdapter() {
39: public void onSelect(DatePicker dataPicker, Date date) {
40: textField.setValue(date.toString());
41: }
42: });
43: verticalPanel.add(datePicker);
44: verticalPanel.add(textField);
45:
46: panel.add(verticalPanel);
47: }
48: return panel;
49: }
50:
51: public String getIntro() {
52: return "A customizable DatePicker. You can selectively enable / disable date ranges and attach listeners to determine the date selected by the user.";
53: }
54: }
|