Example usage for com.google.gwt.user.datepicker.client DatePicker setCurrentMonth

List of usage examples for com.google.gwt.user.datepicker.client DatePicker setCurrentMonth

Introduction

In this page you can find the example usage for com.google.gwt.user.datepicker.client DatePicker setCurrentMonth.

Prototype

public void setCurrentMonth(Date month) 

Source Link

Document

Sets the date picker to show the given month, use #getFirstDate() and #getLastDate() to access the exact date range the date picker chose to display.

Usage

From source file:com.gwtmodel.table.view.ewidget.polymer.DateCalendarPolymerPaper.java

License:Apache License

DateCalendarPolymerPaper(IVField v, IFormFieldProperties pr, String pattern, String standErrMess) {
    super(v, pr, pattern, standErrMess, "vaadin-icons:calendar");
    bu.addClickHandler(event -> {//from w ww.java2s.co  m

        final DatePicker dPicker = new DatePicker();
        // Date da = (Date) getValObj();
        Date da = iGet.getVal();
        if (da != null) {
            dPicker.setValue(da);
            dPicker.setCurrentMonth(da);
        }
        final ClickPopUp pUp = new ClickPopUp(bu, dPicker);
        dPicker.addValueChangeHandler(e -> {

            // setValObj(dPicker.getValue());
            iGet.setVal(dPicker.getValue());
            pUp.setVisible(false);

        });
        pUp.setVisible(true);
    });
}

From source file:com.ponysdk.ui.terminal.ui.PTDatePicker.java

License:Apache License

@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()));
        }// w ww.  ja v a2s .c o m
    } 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);
    }
}