public class ActionManager extends Object implements Action.Container, Action.Handler, Action.Notifier
Empties the keymapper for each repaint to avoid leaks; can cause problems in the future if the client assumes key don't change. (if lazyloading, one must not cache results)
Modifier and Type | Field and Description |
---|---|
protected HashSet<Action.Handler> |
actionHandlers
List of action handlers.
|
protected KeyMapper<Action> |
actionMapper
Action mapper
|
protected HashSet<Action> |
ownActions
List of action handlers.
|
protected Component |
viewer |
Constructor and Description |
---|
ActionManager() |
ActionManager(T viewer) |
Modifier and Type | Method and Description |
---|---|
<T extends Action & Action.Listener> |
addAction(T action) |
void |
addActionHandler(Action.Handler actionHandler)
Registers a new action handler for this container
|
Action[] |
getActions(Object target,
Object sender)
Gets the list of actions applicable to this handler.
|
void |
handleAction(Action action,
Object sender,
Object target)
Handles an action for the given target.
|
void |
handleActions(Map<String,Object> variables,
Action.Container sender) |
void |
paintActions(Object actionTarget,
PaintTarget paintTarget) |
<T extends Action & Action.Listener> |
removeAction(T action) |
void |
removeActionHandler(Action.Handler actionHandler)
Removes a previously registered action handler for the contents of
this container.
|
void |
removeAllActionHandlers() |
<T extends Component & Action.Container & VariableOwner> |
setViewer(T viewer) |
protected HashSet<Action> ownActions
protected HashSet<Action.Handler> actionHandlers
protected Component viewer
public ActionManager()
public ActionManager(T viewer)
public <T extends Component & Action.Container & VariableOwner> void setViewer(T viewer)
public <T extends Action & Action.Listener> void addAction(T action)
addAction
in interface Action.Notifier
public <T extends Action & Action.Listener> void removeAction(T action)
removeAction
in interface Action.Notifier
public void addActionHandler(Action.Handler actionHandler)
Action.Container
addActionHandler
in interface Action.Container
actionHandler
- the new handler to be added.public void removeActionHandler(Action.Handler actionHandler)
Action.Container
removeActionHandler
in interface Action.Container
actionHandler
- the handler to be removed.public void removeAllActionHandlers()
public void paintActions(Object actionTarget, PaintTarget paintTarget) throws PaintException
PaintException
public void handleActions(Map<String,Object> variables, Action.Container sender)
public Action[] getActions(Object target, Object sender)
Action.Handler
getActions
in interface Action.Handler
target
- the target handler to list actions for. For item
containers this is the item id.sender
- the party that would be sending the actions. Most of this
is the action container.public void handleAction(Action action, Object sender, Object target)
Action.Handler
handleAction
in interface Action.Handler
action
- the action to be handled.sender
- the sender of the action. This is most often the action
container.target
- the target of the action. For item containers this is the
item id.Copyright © 2016 Vaadin Ltd. All rights reserved.