From 20ff39aab17bd04c6d7e94c355593fe53e70ce88 Mon Sep 17 00:00:00 2001 From: Sauli Tähkäpää Date: Fri, 30 Jan 2015 17:46:07 +0200 Subject: Enable navigation on a readonly Calendar. (#16523) - Month view: navigate to week and day views - Week view: navigate to day view and to next and prev weeks - Day view: navigate to next and prev days - Month view: hidden events can be expanded to view. Change-Id: I19c64ae64c55b8e07be7f73be64e18e700f849b5 --- .../client/ui/calendar/CalendarConnector.java | 6 ++-- .../client/ui/calendar/schedule/DayToolbar.java | 2 +- .../client/ui/calendar/schedule/SimpleDayCell.java | 32 ++++++++++------------ 3 files changed, 18 insertions(+), 22 deletions(-) (limited to 'client') diff --git a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java index e9bbf2015c..58cc31a580 100644 --- a/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java +++ b/client/src/com/vaadin/client/ui/calendar/CalendarConnector.java @@ -35,8 +35,8 @@ import com.vaadin.client.ApplicationConnection; import com.vaadin.client.Paintable; import com.vaadin.client.TooltipInfo; import com.vaadin.client.UIDL; -import com.vaadin.client.WidgetUtil; import com.vaadin.client.VConsole; +import com.vaadin.client.WidgetUtil; import com.vaadin.client.communication.RpcProxy; import com.vaadin.client.communication.StateChangeEvent; import com.vaadin.client.ui.AbstractComponentConnector; @@ -138,7 +138,7 @@ public class CalendarConnector extends AbstractComponentConnector implements getWidget().setListener(new DateClickListener() { @Override public void dateClick(String date) { - if (!getWidget().isDisabledOrReadOnly() + if (!getWidget().isDisabled() && hasEventListener(CalendarEventId.DATECLICK)) { rpc.dateClick(date); } @@ -171,7 +171,7 @@ public class CalendarConnector extends AbstractComponentConnector implements getWidget().setListener(new WeekClickListener() { @Override public void weekClick(String event) { - if (!getWidget().isDisabledOrReadOnly() + if (!getWidget().isDisabled() && hasEventListener(CalendarEventId.WEEKCLICK)) { rpc.weekClick(event); } diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java b/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java index db3f47dfed..10ed5bb3f9 100644 --- a/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java +++ b/client/src/com/vaadin/client/ui/calendar/schedule/DayToolbar.java @@ -134,7 +134,7 @@ public class DayToolbar extends HorizontalPanel implements ClickHandler { @Override public void onClick(ClickEvent event) { - if (!calendar.isDisabledOrReadOnly()) { + if (!calendar.isDisabled()) { if (event.getSource() == nextLabel) { if (calendar.getForwardListener() != null) { calendar.getForwardListener().forward(); diff --git a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java index 424531ee58..3bf6930933 100644 --- a/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java +++ b/client/src/com/vaadin/client/ui/calendar/schedule/SimpleDayCell.java @@ -439,24 +439,20 @@ public class SimpleDayCell extends FocusableFlowPanel implements if (calendar.isEventMoveAllowed()) { startCalendarEventDrag(event, (MonthEventLabel) w); } - } else if (!calendar.isReadOnly()) { - // these are not allowed when in read-only - if (w == bottomspacer) { - if (scrollable) { - setLimitedCellHeight(); - } else { - setUnlimitedCellHeight(); - } - reDraw(true); - - } else if (w == this && !scrollable) { - MonthGrid grid = getMonthGrid(); - if (grid.isEnabled() && calendar.isRangeSelectAllowed()) { - grid.setSelectionStart(this); - grid.setSelectionEnd(this); - } - } else if (w instanceof Label) { - labelMouseDown = true; + } else if (w == bottomspacer) { + if (scrollable) { + setLimitedCellHeight(); + } else { + setUnlimitedCellHeight(); + } + reDraw(true); + } else if (w instanceof Label) { + labelMouseDown = true; + } else if (w == this && !scrollable) { + MonthGrid grid = getMonthGrid(); + if (grid.isEnabled() && calendar.isRangeSelectAllowed()) { + grid.setSelectionStart(this); + grid.setSelectionEnd(this); } } -- cgit v1.2.3