Package com.google.gwt.user.datepicker.client

Examples of com.google.gwt.user.datepicker.client.DatePicker


   *
   * @return
   */
  private VerticalPanel createDatePanel() {
    // Create a basic date picker
    DatePicker datePicker = new DatePicker();
    final Label text = new Label();

    // Set the value in the text box when the user selects a date
    datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
      public void onValueChange(ValueChangeEvent<Date> event) {
        Date date = event.getValue();
        String dateString = DateTimeFormat.getMediumDateFormat().format(date);
        text.setText(dateString);
      }
    });

    // Set the default value
    datePicker.setValue(new Date(), true);

    // Combine the widgets into a panel and return them
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.add(new HTML("Permanent DatePicker:"));
    vPanel.add(text);
View Full Code Here


    dateTimeTag.setWidget(3, 1, endTime);
   
    dateTimeTag.setWidget(4, 0, tagLabel);
    dateTimeTag.setWidget(4, 1, tag);
   
    datePicker = new DatePicker();
    datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
     
      @Override
      public void onValueChange(ValueChangeEvent<Date> event) {
        lastChosenDate = event.getValue();
View Full Code Here

  /**
   * Create a date box with a new {@link DatePicker}.
   */
  public DateBox() {
    this(new DatePicker(), null, DEFAULT_FORMAT);
  }
View Full Code Here

   * Constructs a new DatePickerCell that uses the given date/time format.
   */
  public DatePickerCell(DateTimeFormat format) {
    this.format = format;

    this.datePicker = new DatePicker();
    this.panel = new PopupPanel(true, true) {
      @Override
      protected void onPreviewNativeEvent(NativePreviewEvent event) {
        if (Event.ONKEYUP == event.getTypeInt()) {
          if (event.getNativeEvent().getKeyCode() == ESCAPE) {
View Full Code Here

    public PopupDatePicker() {

        this.lblDate = new Label();
        this.lblDate.getElement().getStyle().setCursor( Cursor.POINTER );
        this.format = DateTimeFormat.getFormat( DATE_FORMAT );
        this.datePicker = new DatePicker();

        // Pressing ESCAPE dismisses the pop-up loosing any changes
        this.panel = new PopupPanel( true,
                                     true ) {
            @Override
View Full Code Here

    flexTable.setSize("100%", "100%");
   
    Label lblWhatDayIs = new Label("what day is today ? ");
    flexTable.setWidget(0, 0, lblWhatDayIs);
   
    DatePicker datePicker = new DatePicker();
    flexTable.setWidget(0, 1, datePicker);
    flexTable.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);
    flexTable.getCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);
   
    Label lblApplyMegaprotocol = new Label("apply megaprotocol ? ");
View Full Code Here

public class DatePickerExample implements EntryPoint {

  public void onModuleLoad() {
    // Create a date picker
    DatePicker datePicker = new DatePicker();
    final Label text = new Label();

    // Set the value in the text box when the user selects a date
    datePicker.addValueChangeHandler(new ValueChangeHandler<Date>() {
      public void onValueChange(ValueChangeEvent<Date> event) {
        Date date = event.getValue();
        String dateString = DateTimeFormat.getMediumDateFormat().format(date);
        text.setText(dateString);
      }
    });

    // Set the default value
    datePicker.setValue(new Date(), true);
   
    // Add the widgets to the page
    RootPanel.get().add(text);
    RootPanel.get().add(datePicker);
  }
View Full Code Here

  @SuppressWarnings("deprecation")
  @ShowcaseSource
  @Override
  public Widget onInitialize() {
    // Create a basic date picker
    DatePicker datePicker = new DatePicker();
    final Label text = new Label();

    // Set the value in the text box when the user selects a date
    datePicker.addValueChangeHandler(new MyDateValueChangeHandler(text));

    // create a date picker where years and months are selectable with drop down lists and where we
    // can navigate trough the years
    DatePicker advancedDatePicker = new DatePicker();
    advancedDatePicker.setYearArrowsVisible(true);
    advancedDatePicker.setYearAndMonthDropdownVisible(true);
    // show 51 years in the years dropdown. The range of years is centered on the selected date
    advancedDatePicker.setVisibleYearCount(51);

    final Label text2 = new Label();
    text2.getElement().getStyle().setMarginTop(15, Unit.PX);

    // Set the value in the text box when the user selects a date
    advancedDatePicker.addValueChangeHandler(new MyDateValueChangeHandler(text2));

    // Set the default value
    datePicker.setValue(new Date(), true);
    advancedDatePicker.setValue(new Date(), true);

    // Create a DateBox
    DateTimeFormat dateFormat = DateTimeFormat.getLongDateFormat();
    DateBox dateBox = new DateBox();
    dateBox.setFormat(new DateBox.DefaultFormat(dateFormat));
View Full Code Here

public class VisualsForDatePicker extends AbstractIssue {

  @Override
  public Widget createIssue() {
    VerticalPanel p = new VerticalPanel();
    final DatePicker picker = new DatePicker();
    p.add(picker);
    final Label value = new Label("value: ");
    p.add(value);
    final Label highlight = new Label("highlight: ");
    p.add(highlight);
    final Label range = new Label("range: ");
    p.add(range);
    picker.addValueChangeHandler(new ValueChangeHandler<Date>() {
      public void onValueChange(ValueChangeEvent<Date> event) {
        value.setText("value: "
            + DateTimeFormat.getShortDateFormat().format(event.getValue()));
      }
    });
    picker.addHighlightHandler(new HighlightHandler<Date>() {

      @SuppressWarnings("deprecation")
      // Should never be seen, as highlight should be cloned.
      public void onHighlight(HighlightEvent<Date> event) {
        event.getHighlighted().setYear(1);
        picker.getHighlightedDate().setYear(1);
      }

    });
    picker.addHighlightHandler(new HighlightHandler<Date>() {
      public void onHighlight(HighlightEvent<Date> event) {
        highlight.setText("highlight: "
            + DateTimeFormat.getShortDateFormat().format(event.getHighlighted()));
      }
    });
    picker.addShowRangeHandler(new ShowRangeHandler<Date>() {
      public void onShowRange(ShowRangeEvent<Date> event) {
        Date start = event.getStart();
        Date end = event.getEnd();
        DateTimeFormat format = DateTimeFormat.getShortDateFormat();
        range.setText("range: " + format.format(start) + " - "
View Full Code Here

  private Widget dateRange() {
    VerticalPanel v = new VerticalPanel();
    HorizontalPanel p = new HorizontalPanel();
    v.add(p);
    final DateBox start = new DateBox(new DatePicker(), null,
        new FormatWithNewYearsEve());

    start.setWidth("13em");
    final DateBox end = new DateBox();
    end.setWidth("13em");
View Full Code Here

TOP

Related Classes of com.google.gwt.user.datepicker.client.DatePicker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.