Example usage for com.google.gwt.i18n.shared DateTimeFormatInfo firstDayOfTheWeek

List of usage examples for com.google.gwt.i18n.shared DateTimeFormatInfo firstDayOfTheWeek

Introduction

In this page you can find the example usage for com.google.gwt.i18n.shared DateTimeFormatInfo firstDayOfTheWeek.

Prototype

int firstDayOfTheWeek();

Source Link

Document

Returns the day which generally comes first in a weekly calendar view, as an index into the return value of #weekdaysFull() .

Usage

From source file:org.sigmah.client.ui.view.calendar.CalendarView.java

License:Open Source License

/**
 * {@inheritDoc}/*from  w  w w.ja v a2s  .c  o  m*/
 */
@Override
public void initializeCalendarWidget(final CalendarWidget calendarWidget) {

    // Defining the first day of the week
    // BUGFIX #653: Contrary to the deprecated DateTimeConstants, firstDayOfTheWeek starts at 0 (and not 1). No substraction is needed.
    final DateTimeFormatInfo constants = LocaleInfo.getCurrentLocale().getDateTimeFormatInfo();
    calendarWidget.setFirstDayOfWeek(constants.firstDayOfTheWeek());

    // Retrieving the current calendar header
    calendarView.setHeadingHtml(calendarWidget.getHeading());

    // Listening for further calendar header changes
    calendarWidget.setListener(new CalendarWidget.CalendarListener() {

        @Override
        public void afterRefresh() {
            calendarView.setHeadingHtml(calendarWidget.getHeading());
        }
    });

    calendarView.add(calendarWidget,
            Layouts.fitData(Margin.DOUBLE_TOP, Margin.DOUBLE_RIGHT, Margin.DOUBLE_BOTTOM, Margin.DOUBLE_LEFT));
}