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

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


    }
  }

  public void testValueChangeEventWithCustomFormat() {
    Format format = new DateBox.DefaultFormat(DateTimeFormat.getFormat("dd/MM/yyyy"));
    final DateBox db = new DateBox(new DatePicker(), null, format);
    RootPanel.get().add(db);

    // Checks setValue(date, true). Should preserve precision so getValue returns the exact value
    // passed by setValue.
    new DateValueChangeTester(db).run();
View Full Code Here


    assertViewLacksStyleOnVisibleDates(STYLE);
    assertPickerLacksStyleOnVisibleDates();
  }

  public void testValueChangeEvent() {
    DatePicker dp = new DatePicker();
    RootPanel.get().add(dp);
    new DateValueChangeTester(dp).run();
  }
View Full Code Here

        HorizontalPanel container = new HorizontalPanel();

        this.txtDate = new DateTextBox( allowEmptyValue );
        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

public class PTDatePicker extends PTWidget<DatePicker> {

    @Override
    public void create(final PTInstruction create, final UIService uiService) {
        init(create, uiService, new DatePicker());
    }
View Full Code Here

    }

    @Override
    public void addHandler(final PTInstruction addHandler, final UIService uiService) {
        if (HANDLER.KEY_.DATE_VALUE_CHANGE_HANDLER.equals(addHandler.getString(HANDLER.KEY))) {
            final DatePicker picker = cast();
            picker.addValueChangeHandler(new ValueChangeHandler<Date>() {

                @Override
                public void onValueChange(final ValueChangeEvent<Date> event) {
                    triggerEvent(addHandler, uiService, event);
                }
            });
        } else if (HANDLER.KEY_.SHOW_RANGE.equals(addHandler.getString(HANDLER.KEY))) {
            final DatePicker picker = cast();
            picker.addShowRangeHandler(new ShowRangeHandler<Date>() {

                @Override
                public void onShowRange(final ShowRangeEvent<Date> event) {
                    final PTInstruction instruction = new PTInstruction();
                    instruction.setObjectID(addHandler.getObjectID());
View Full Code Here

        uiService.sendDataToServer(instruction);
    }

    @Override
    public void update(final PTInstruction update, final UIService uiService) {
        final DatePicker picker = cast();
        if (update.containsKey(PROPERTY.VALUE)) {
            picker.setValue(asDate(update.getString(PROPERTY.VALUE)));
        } else if (update.containsKey(PROPERTY.MONTH)) {
            picker.setCurrentMonth(asDate(update.getString(PROPERTY.MONTH)));
        } else if (update.containsKey(PROPERTY.DATE_ENABLED)) {
            final Boolean enabled = update.getBoolean(PROPERTY.ENABLED);
            final JSONArray jsonArray = update.get(PROPERTY.DATE_ENABLED).isArray();
            for (int i = 0; i < jsonArray.size(); i++) {
                picker.setTransientEnabledOnDates(enabled, asDate(jsonArray.get(i).isString().stringValue()));
            }
        } else if (update.containsKey(PROPERTY.ADD_DATE_STYLE)) {
            final String style = update.getString(PROPERTY.STYLE_NAME);
            final JSONArray jsonArray = update.get(PROPERTY.ADD_DATE_STYLE).isArray();
            for (int i = 0; i < jsonArray.size(); i++) {
                picker.addStyleToDates(style, asDate(jsonArray.get(i).isString().stringValue()));
            }
        } else if (update.containsKey(PROPERTY.REMOVE_DATE_STYLE)) {
            final String style = update.getString(PROPERTY.STYLE_NAME);
            final JSONArray jsonArray = update.get(PROPERTY.REMOVE_DATE_STYLE).isArray();
            for (int i = 0; i < jsonArray.size(); i++) {
                picker.removeStyleFromDates(style, asDate(jsonArray.get(i).isString().stringValue()));
            }
        } else {
            super.update(update, uiService);
        }
    }
View Full Code Here

        this.allowEmptyValue = allowEmptyValue;
        this.txtDate = new DateTextBox( allowEmptyValue );
        this.txtDate.setVisibleLength( DATE_FORMAT.length() );
        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

   */
  @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 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);

    // Create a DateBox
    DateBox dateBox = new DateBox();

    // Combine the widgets into a panel and return them
View Full Code Here

        if ( format == null ) {
            throw new IllegalArgumentException( "format == null" );
        }

        this.format = format;
        this.datePicker = new DatePicker();

        // Hide the panel and call valueUpdater.update when a date is selected
        datePicker.addValueChangeHandler( new ValueChangeHandler<Date>() {

            public void onValueChange(ValueChangeEvent<Date> event) {
View Full Code Here

        if ( format == null ) {
            throw new IllegalArgumentException( "format == null" );
        }

        this.format = format;
        this.datePicker = new DatePicker();

        // Hide the panel and call valueUpdater.update when a date is selected
        datePicker.addValueChangeHandler( new ValueChangeHandler<Date>() {

            public void onValueChange(ValueChangeEvent<Date> event) {
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.