com.vaadin.signals.impl.
Class CommandsAndHandlers
A list of signal commands together with their result handlers.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty command list.
CommandsAndHandlers
(SignalCommand command, Consumer<CommandResult> resultHandler) Creates a new command list with a single command and optional result handler.
CommandsAndHandlers
(List<SignalCommand> commands, Map<Id, Consumer<CommandResult>> resultHandlers) Creates a new command list with the given commands and result handlers.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(CommandsAndHandlers other) Adds another collection of commands and handlers to this one.
Gets an unmodifiable view of the commands.
Gets an unmodifiable map of the result handlers.
boolean
isEmpty()
Checks whether there are any commands in this list.
void
notifyResultHandlers
(Map<Id, CommandResult> results) Notifies and removes result handlers for the given results.
void
notifyResultHandlers
(Map<Id, CommandResult> results, List<SignalCommand> commandOrder) Notifies and removes result handlers for the given results in the given order.
void
removeHandledCommands
(Collection<Id> handledCommandIds) Removes commands based on a collection of handled commands.
-
Constructor Details
-
CommandsAndHandlers
public CommandsAndHandlers()Creates a new empty command list.
-
CommandsAndHandlers
public CommandsAndHandlers(List<SignalCommand> commands, Map<Id, Consumer<CommandResult>> resultHandlers) Creates a new command list with the given commands and result handlers.
Parameters:
commands
- the commands to use, notnull
resultHandlers
- the result handlers to use, notnull
-
CommandsAndHandlers
Creates a new command list with a single command and optional result handler.
Parameters:
command
- the command to use, notnull
resultHandler
- the result handler to use, ornull
to not use a result handler
-
-
Method Details
-
removeHandledCommands
Removes commands based on a collection of handled commands. Note that the corresponding result handlers are not removed but there's instead an assumption that the caller will invoke
notifyResultHandlers(Map)
separately.Parameters:
handledCommandIds
- a collection of handled commands ids, notnull
-
notifyResultHandlers
Notifies and removes result handlers for the given results.
Parameters:
results
- a map of command results, notnull
-
notifyResultHandlers
Notifies and removes result handlers for the given results in the given order. Commands in the order that have no corresponding result are ignored.
Parameters:
results
- the map of command results, notnull
commandOrder
- a list of commands in the order the results should be applied. -
getCommands
Gets an unmodifiable view of the commands.
Returns:
an unmodifiable list of commands, not
null
-
getResultHandlers
Gets an unmodifiable map of the result handlers.
Returns:
an unmodifiable map of result handlers, not
null
-
add
Adds another collection of commands and handlers to this one.
Parameters:
other
- the instance to import entries from, notnull
-
isEmpty
public boolean isEmpty()Checks whether there are any commands in this list.
Returns:
true
if there are no commands in this list,false
if there are commands
-