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

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

Introduction

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

Prototype

public void addStyleToDates(String styleName, Iterable<Date> dates) 

Source Link

Document

Add a style name to the given dates.

Usage

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()));
        }// ww w. ja v  a  2 s . co 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);
    }
}