Java Code Examples for com.vaadin.event.Action#Handler

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 vote down vote up
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: CubaMainTabSheet.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
public void performAction(int tabIndex, String actionKey) {
    Tab tab = getTab(tabIndex);
    if (tab != null) {
        if (actionMapper != null) {
            Action action = actionMapper.get(actionKey);
            Action.Handler[] handlers;

            if (actionHandlers != null) {
                handlers = actionHandlers.toArray(new Action.Handler[0]);
            } else {
                handlers = new Action.Handler[0];
            }

            for (Action.Handler handler : handlers) {
                handler.handleAction(action, this, CubaMainTabSheet.this.getActionTarget(tab));
            }

            // forget all painted actions after perform one
            actionMapper = null;
        }
    }
}
 
Example 3
Source File: Calendar.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
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 4
Source File: CubaMainTabSheet.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void addActionHandler(Action.Handler actionHandler) {
    if (actionHandlers == null) {
        actionHandlers = new LinkedHashSet<>();
    }
    actionHandlers.add(actionHandler);
}
 
Example 5
Source File: CubaWindow.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected Collection<Action> getContextActions(Component actionTarget) {
    List<Action> actions = new ArrayList<>();
    if (contextActionHandlers != null) {
        for (Action.Handler handler : contextActionHandlers) {
            Action[] as = handler.getActions(actionTarget, this);
            if (as != null) {
                Collections.addAll(actions, as);
            }
        }
    }
    return actions;
}
 
Example 6
Source File: CubaGridLayout.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void removeActionHandler(Action.Handler actionHandler) {
    if (actionManager != null) {
        actionManager.removeActionHandler(actionHandler);
        markAsDirty();
    }
}
 
Example 7
Source File: CubaCssActionsLayout.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void removeActionHandler(Action.Handler actionHandler) {
    if (actionManager != null) {
        actionManager.removeActionHandler(actionHandler);
        markAsDirty();
    }
}
 
Example 8
Source File: CubaOrderedActionsLayout.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
public void removeActionHandler(Action.Handler actionHandler) {
    if (actionManager != null) {
        actionManager.removeActionHandler(actionHandler);
        markAsDirty();
    }
}
 
Example 9
Source File: Calendar.java    From calendar-component with Apache License 2.0 5 votes vote down vote up
@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 10
Source File: CubaCssActionsLayout.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void addActionHandler(Action.Handler actionHandler) {
    getActionManager().addActionHandler(actionHandler);
    markAsDirty();
}
 
Example 11
Source File: CubaGridLayout.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void addActionHandler(Action.Handler actionHandler) {
    getActionManager().addActionHandler(actionHandler);
    markAsDirty();
}
 
Example 12
Source File: CubaOrderedActionsLayout.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void addActionHandler(Action.Handler actionHandler) {
    getActionManager().addActionHandler(actionHandler);
    markAsDirty();
}
 
Example 13
Source File: CubaComboBox.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void removeActionHandler(Action.Handler actionHandler) {
    getActionManager().removeActionHandler(actionHandler);
}
 
Example 14
Source File: CubaDateField.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void removeActionHandler(Action.Handler actionHandler) {
    getActionManager().removeActionHandler(actionHandler);
}
 
Example 15
Source File: CubaPickerField.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void addActionHandler(Action.Handler actionHandler) {
    container.addActionHandler(actionHandler);
}
 
Example 16
Source File: CubaPickerField.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void removeActionHandler(Action.Handler actionHandler) {
    container.removeActionHandler(actionHandler);
}
 
Example 17
Source File: CubaComboBox.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void addActionHandler(Action.Handler actionHandler) {
    getActionManager().addActionHandler(actionHandler);
}
 
Example 18
Source File: CubaWindow.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void addContextActionHandler(Action.Handler actionHandler) {
    contextActionHandlers.add(actionHandler);
}
 
Example 19
Source File: CubaMainTabSheet.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void removeActionHandler(Action.Handler actionHandler) {
    if (actionHandlers != null) {
        actionHandlers.remove(actionHandler);
    }
}
 
Example 20
Source File: CubaWindow.java    From cuba with Apache License 2.0 4 votes vote down vote up
public void removeContextActionHandler(Action.Handler actionHandler) {
    contextActionHandlers.remove(actionHandler);
}