com.vaadin.event.Action.Handler Java Examples
The following examples show how to use
com.vaadin.event.Action.Handler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Calendar.java From calendar-component with Apache License 2.0 | 6 votes |
private void setActionsForEachHalfHour(Map<CalendarDateRange, Set<Action>> actionMap, ZonedDateTime start, ZonedDateTime end, Action.Handler actionHandler) { ZonedDateTime actionTime = start; while (actionTime.isBefore(end)) { ZonedDateTime endTime = actionTime.plus(30, ChronoUnit.MINUTES); CalendarDateRange range = new CalendarDateRange(actionTime, endTime); Action[] actions = actionHandler.getActions(range, this); if (actions != null) { Set<Action> actionSet = new LinkedHashSet<>(Arrays.asList(actions)); actionMap.put(range, actionSet); } actionTime = endTime; } }
Example #2
Source File: Calendar.java From calendar-component with Apache License 2.0 | 5 votes |
private void setActionsForDay(Map<CalendarDateRange, Set<Action>> actionMap, ZonedDateTime start, ZonedDateTime end, Action.Handler actionHandler) { CalendarDateRange range = new CalendarDateRange(start, end); Action[] actions = actionHandler.getActions(range, this); if (actions != null) { Set<Action> actionSet = new LinkedHashSet<>(Arrays.asList(actions)); actionMap.put(range, actionSet); } }
Example #3
Source File: Calendar.java From calendar-component with Apache License 2.0 | 5 votes |
@Override public void removeActionHandler(Handler actionHandler) { if (actionHandlers != null && actionHandlers.contains(actionHandler)) { actionHandlers.remove(actionHandler); if (actionHandlers.isEmpty()) { actionHandlers = null; actionMapper = null; } markAsDirty(); } }
Example #4
Source File: Calendar.java From calendar-component with Apache License 2.0 | 5 votes |
@Override public void actionOnEmptyCell(String actionKey, CalDate startDate, CalDate endDate) { Action action = actionMapper.get(actionKey); for (Action.Handler ah : actionHandlers) { ah.handleAction(action, Calendar.this, ZonedDateTime.of(startDate.y, startDate.m, startDate.d, startDate.t.h, startDate.t.m, startDate.t.s, 0, getZoneId())); } }
Example #5
Source File: Calendar.java From calendar-component with Apache License 2.0 | 5 votes |
@Override public void actionOnItem(String actionKey, CalDate startDate, CalDate endDate, int itemIndex) { Action action = actionMapper.get(actionKey); for (Action.Handler ah : actionHandlers) { ah.handleAction(action, Calendar.this, items.get(itemIndex)); } }
Example #6
Source File: Calendar.java From calendar-component with Apache License 2.0 | 3 votes |
/** * Adds an action handler to the calendar that handles event produced by the * context menu. * * <p> * The {@link Handler#getActions(Object, Object)} parameters depend on what * view the Calendar is in: * <ul> * <li>If the Calendar is in <i>Day or Week View</i> then the target * parameter will be a {@link CalendarDateRange} with a range of * half-an-hour. The {@link Handler#getActions(Object, Object)} method will * be called once per half-hour slot.</li> * <li>If the Calendar is in <i>Month View</i> then the target parameter * will be a {@link CalendarDateRange} with a range of one day. The * {@link Handler#getActions(Object, Object)} will be called once for each * day. * </ul> * The Dates passed into the {@link CalendarDateRange} are in the same * timezone as the calendar is. * </p> * * <p> * The {@link Handler#handleAction(Action, Object, Object)} parameters * depend on what the context menu is called upon: * <ul> * <li>If the context menu is called upon an item then the target parameter * is the item, i.e. instanceof {@link CalendarItem}</li> * <li>If the context menu is called upon an empty slot then the target is a * {@link Date} representing that slot * </ul> * </p> */ @Override public void addActionHandler(Handler actionHandler) { if (actionHandler != null) { if (actionHandlers == null) { actionHandlers = new LinkedList<>(); actionMapper = new KeyMapper<>(); } if (!actionHandlers.contains(actionHandler)) { actionHandlers.add(actionHandler); markAsDirty(); } } }
Example #7
Source File: AbstractTableLayout.java From hawkbit with Eclipse Public License 1.0 | 2 votes |
/** * Get the action handler for the short cut keys. * * @return reference of {@link Handler} to handler the short cut keys. * Default is null. */ protected Handler getShortCutKeysHandler(final VaadinMessageSource i18n) { return new TableShortCutHandler(i18n); }