Package com.vaadin.client.communication
Class ServerRpcQueue
java.lang.Object
com.vaadin.client.communication.ServerRpcQueue
Manages the queue of server invocations (RPC) which are waiting to be sent to
the server.
- Since:
- 1.0
- Author:
- Vaadin Ltd
-
Constructor Summary
ConstructorsConstructorDescriptionServerRpcQueue(Registry registry) Creates a new instance connected to the given registry. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(elemental.json.JsonValue invocation) Adds an explicit RPC method invocation to the send queue.voidclear()Clears the queue.voidflush()Triggers a send of server RPC and legacy variable changes to the server.booleanisEmpty()Checks if the queue is empty.booleanChecks if a flush operation is pending.booleanChecks if a loading indicator should be shown when the RPCs have been sent to the server and we are waiting for a response.intsize()Returns the current size of the queue.elemental.json.JsonArraytoJson()Returns the current invocations as JSON.
-
Constructor Details
-
ServerRpcQueue
Creates a new instance connected to the given registry.- Parameters:
registry- the global registry
-
-
Method Details
-
add
public void add(elemental.json.JsonValue invocation) Adds an explicit RPC method invocation to the send queue.- Parameters:
invocation- RPC method invocation
-
clear
public void clear()Clears the queue. -
size
public int size()Returns the current size of the queue.- Returns:
- the number of invocations in the queue
-
isEmpty
public boolean isEmpty()Checks if the queue is empty.- Returns:
- true if the queue is empty, false otherwise
-
flush
public void flush()Triggers a send of server RPC and legacy variable changes to the server. -
isFlushPending
public boolean isFlushPending()Checks if a flush operation is pending.- Returns:
- true if a flush is pending, false otherwise
-
showLoadingIndicator
public boolean showLoadingIndicator()Checks if a loading indicator should be shown when the RPCs have been sent to the server and we are waiting for a response.- Returns:
- true if a loading indicator should be shown, false otherwise
-
toJson
public elemental.json.JsonArray toJson()Returns the current invocations as JSON.- Returns:
- the current invocations in a JSON format ready to be sent to the server
-