diff options
author | Denis <denis@vaadin.com> | 2016-12-14 13:50:06 +0200 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2016-12-14 13:50:06 +0200 |
commit | fc011f6a8a08064f48fd5f4280f1d4d3647ab7f1 (patch) | |
tree | 3cb8e0f9022aa752b55e9f83f209388e1557b0ba /compatibility-server/src | |
parent | 692bbef040a61388d8ba028a9701a760b64baa43 (diff) | |
download | vaadin-framework-fc011f6a8a08064f48fd5f4280f1d4d3647ab7f1.tar.gz vaadin-framework-fc011f6a8a08064f48fd5f4280f1d4d3647ab7f1.zip |
Provide configuration for events order in month and week views
Diffstat (limited to 'compatibility-server/src')
-rw-r--r-- | compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java index a33cce6eef..d347028895 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Calendar.java @@ -57,6 +57,7 @@ import com.vaadin.v7.data.util.BeanItemContainer; import com.vaadin.v7.shared.ui.calendar.CalendarEventId; import com.vaadin.v7.shared.ui.calendar.CalendarServerRpc; import com.vaadin.v7.shared.ui.calendar.CalendarState; +import com.vaadin.v7.shared.ui.calendar.CalendarState.EventSortOrder; import com.vaadin.v7.shared.ui.calendar.DateConstants; import com.vaadin.v7.ui.components.calendar.CalendarComponentEvent; import com.vaadin.v7.ui.components.calendar.CalendarComponentEvents; @@ -999,6 +1000,36 @@ public class Calendar extends AbstractLegacyComponent } } + /** + * Sets sort order for events. By default sort order is + * {@link EventSortOrder#DURATION_DESC}. + * + * @param order + * sort strategy for events + */ + public void setEventSortOrder(EventSortOrder order) { + if (order == null) { + getState().eventSortOrder = EventSortOrder.DURATION_DESC; + } else { + getState().eventSortOrder = EventSortOrder.values()[order + .ordinal()]; + } + } + + /** + * Returns sort order for events. + * + * @return currently active sort strategy + */ + public EventSortOrder getEventSortOrder() { + EventSortOrder order = getState(false).eventSortOrder; + if (order == null) { + return EventSortOrder.DURATION_DESC; + } else { + return order; + } + } + private DateFormat getWeeklyCaptionFormatter() { if (weeklyCaptionFormat != null) { return new SimpleDateFormat(weeklyCaptionFormat, getLocale()); |