DatePicker with selection listener (Ext GWT) : DatePicker « GWT « Java






DatePicker with selection listener (Ext GWT)

DatePicker with selection listener (Ext GWT)
 

/*
 * Ext GWT - Ext for GWT
 * Copyright(c) 2007-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 */
 
 
package com.google.gwt.sample.hello.client;

import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.util.Params;
import com.extjs.gxt.ui.client.widget.DatePicker;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.RootPanel;

public class Hello implements EntryPoint {
  public void onModuleLoad() {
    RootPanel.get().add(new DatePickerExample());
  }
}
class DatePickerExample extends LayoutContainer {

  @Override
  protected void onRender(Element parent, int index) {
    super.onRender(parent, index);
    setLayout(new FlowLayout(10));
    final DatePicker picker = new DatePicker();
    picker.addListener(Events.Select, new Listener<ComponentEvent>() {

      public void handleEvent(ComponentEvent be) {
        String d = DateTimeFormat.getShortDateFormat().format(picker.getValue());
        Info.display("Date Selected", "You selected {0}.", new Params(d));
      }

    });
    add(picker);
  }

}

   
  








Ext-GWT.zip( 4,297 k)

Related examples in the same category

1.DatePicker with GNU license
2.Simple Calendar Widget for GWT
3.Using DateItem to create date picker (Smart GWT)Using DateItem to create date picker (Smart GWT)
4.DateItem with direct date input (Smart GWT)DateItem with direct date input (Smart GWT)
5.Set default value for DateItem (Smart GWT)Set default value for DateItem (Smart GWT)