public class ServerRpcQueue extends Object
Modifier and Type | Field and Description |
---|---|
protected ApplicationConnection |
connection |
Constructor and Description |
---|
ServerRpcQueue() |
Modifier and Type | Method and Description |
---|---|
void |
add(MethodInvocation invocation,
boolean lastOnly)
Adds an explicit RPC method invocation to the send queue.
|
void |
clear()
Clears the queue
|
void |
flush()
Triggers a send of server RPC and legacy variable changes to the server.
|
static ServerRpcQueue |
get(ApplicationConnection connection)
Returns the server RPC queue for the given application
|
Collection<MethodInvocation> |
getAll()
Returns a collection of all queued method invocations
|
boolean |
isEmpty()
Checks if the queue is empty
|
boolean |
isFlushPending()
Checks if a flush operation is pending
|
static boolean |
isJavascriptRpc(MethodInvocation invocation)
Checks if the given method invocation originates from Javascript
|
static boolean |
isLegacyVariableChange(MethodInvocation invocation)
Checks if the given method invocation represents a Vaadin 6 variable
change
|
void |
removeMatching(MethodInvocation invocation)
Removes any pending invocation of the given method from the queue
|
void |
setConnection(ApplicationConnection connection)
Sets the application connection this instance is connected to.
|
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
|
int |
size()
Returns the current size of the queue
|
JsonArray |
toJson()
Returns the current invocations as JSON
|
protected ApplicationConnection connection
public void setConnection(ApplicationConnection connection)
connection
- the application connection this instance is connected topublic void removeMatching(MethodInvocation invocation)
invocation
- The invocation to removepublic void add(MethodInvocation invocation, boolean lastOnly)
invocation
- RPC method invocationdelayed
- false
to trigger sending within a short time
window (possibly combining subsequent calls to a single
request), true
to let the framework delay sending
of RPC calls and variable changes until the next non-delayed
changelastOnly
- true
to remove all previously delayed invocations
of the same method that were also enqueued with lastonly set
to true
. false
to add invocation to
the end of the queue without touching previously enqueued
invocations.public Collection<MethodInvocation> getAll()
The returned collection must not be modified in any way
public void clear()
public int size()
public static ServerRpcQueue get(ApplicationConnection connection)
connection
- the application connection which owns the queuepublic boolean isEmpty()
public void flush()
public boolean isFlushPending()
public boolean showLoadingIndicator()
public JsonArray toJson()
public static boolean isJavascriptRpc(MethodInvocation invocation)
invocation
- the invocation to checkpublic static boolean isLegacyVariableChange(MethodInvocation invocation)
invocation
- the invocation to checkCopyright © 2019 Vaadin Ltd. All rights reserved.