Package com.vaadin.signals.impl
Class CommandsAndHandlers
java.lang.Object
com.vaadin.signals.impl.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 TypeMethodDescriptionvoidadd(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.booleanisEmpty()Checks whether there are any commands in this list.voidnotifyResultHandlers(Map<Id, CommandResult> results) Notifies and removes result handlers for the given results.voidnotifyResultHandlers(Map<Id, CommandResult> results, List<SignalCommand> commandOrder) Notifies and removes result handlers for the given results in the given order.voidremoveHandledCommands(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, notnullresultHandlers- 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, notnullresultHandler- the result handler to use, ornullto 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 invokenotifyResultHandlers(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, notnullcommandOrder- 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:
trueif there are no commands in this list,falseif there are commands
-