|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.vaadin.terminal.gwt.client.ApplicationConnection
public class ApplicationConnection
This is the client side communication "engine", managing client-server
communication with its server side counterpart
AbstractCommunicationManager
.
Client-side connectors receive updates from the corresponding server-side
connector (typically component) as state updates or RPC calls. The connector
has the possibility to communicate back with its server side counter part
through RPC calls.
TODO document better
Entry point classes (widgetsets) define onModuleLoad()
.
Nested Class Summary | |
---|---|
static class |
ApplicationConnection.MultiStepDuration
|
Field Summary | |
---|---|
protected boolean |
applicationRunning
|
static String |
CONNECTOR_RESOURCE_PREFIX
|
protected boolean |
cssLoaded
|
static String |
DISABLED_CLASSNAME
|
static String |
ERROR_CLASSNAME_EXT
|
static String |
GENERATED_BODY_CLASSNAME
|
protected int |
lastProcessingTime
Holds the time spent rendering the last request |
static String |
MODIFIED_CLASSNAME
|
static String |
PARAM_UNLOADBURST
|
static String |
REQUIRED_CLASSNAME_EXT
|
static String |
ROOT_ID_PARAMETER
Name of the parameter used to transmit root ids back and forth |
protected int |
totalProcessingTime
Holds the total time spent rendering requests during the lifetime of the session. |
static String |
UIDL_REFRESH_TOKEN
A string that, if found in a non-JSON response to a UIDL request, will cause the browser to refresh the page. |
static String |
UIDL_SECURITY_HEADER
Deprecated. use UIDL_SECURITY_TOKEN_ID instead |
static String |
UIDL_SECURITY_TOKEN_ID
|
static String |
UPDATE_VARIABLE_INTERFACE
|
static String |
UPDATE_VARIABLE_METHOD
|
static char |
VAR_BURST_SEPARATOR
|
static char |
VAR_ESCAPE_CHARACTER
|
Constructor Summary | |
---|---|
ApplicationConnection()
|
Method Summary | |
---|---|
static String |
addGetParameters(String uri,
String extraParams)
Adds the get parameters to the uri and returns the new uri that contains the parameters. |
void |
addMethodInvocationToQueue(MethodInvocation invocation,
boolean immediate)
Adds an explicit RPC method invocation to the send queue. |
void |
analyzeLayouts()
Requests an analyze of layouts, to find inconsistencies. |
void |
captionSizeUpdated(com.google.gwt.user.client.ui.Widget widget)
Use to notify that the given component's caption has changed; layouts may have to be recalculated. |
protected void |
doAsyncUIDLRequest(String uri,
String payload,
com.google.gwt.http.client.RequestCallback requestCallback)
Sends an asynchronous UIDL request to the server using the given URI. |
protected void |
doUidlRequest(String uri,
String payload,
boolean synchronous)
Sends an asynchronous or synchronous UIDL request to the server using the given URI. |
protected void |
endRequest()
|
protected String |
escapeBurstContents(String value)
Encode burst separator characters in a String for transport over the network. |
protected void |
extendLiferaySession()
If on Liferay and logged in, ask the client side session management JavaScript to extend the session duration. |
void |
forceLayout()
This will cause re-layouting of all components. |
String |
getAppUri()
Gets the application base URI. |
ApplicationConfiguration |
getConfiguration()
Gets the ApplicationConfiguration for the current application. |
ServerConnector |
getConnector(String connectorId,
int connectorType)
Get either an existing ComponentConnector or create a new ComponentConnector with the given type and id. |
static Console |
getConsole()
Deprecated. Developers should use VConsole since 6.4.5 |
VContextMenu |
getContextMenu()
Singleton method to get instance of app's context menu. |
ComponentConnector |
getPaintable(UIDL uidl)
Deprecated. |
String |
getResource(String name)
Gets a recource that has been pre-loaded via UIDL, such as custom layouts. |
RootConnector |
getRootConnector()
Gets the main view |
SerializerMap |
getSerializerMap()
|
String |
getThemeUri()
Gets the URI for the current theme. |
protected String |
getUidlSecurityKey()
|
VTooltip |
getVTooltip()
Get VTooltip instance related to application connection |
boolean |
handleComponentRelativeSize(com.google.gwt.user.client.ui.Widget widget)
Converts relative sizes into pixel sizes. |
protected void |
handleUIDLMessage(Date start,
String jsonText,
ValueMap json)
|
protected void |
handleWhenCSSLoaded(String jsonText,
ValueMap json)
|
boolean |
hasActiveRequest()
Indicates whether or not there are currently active UIDL requests. |
boolean |
hasEventListeners(ComponentConnector paintable,
String eventIdentifier)
Deprecated. Use ComponentState#hasEventListener(String) instead |
boolean |
hasEventListeners(com.google.gwt.user.client.ui.Widget widget,
String eventIdentifier)
Deprecated. |
void |
init(WidgetSet widgetSet,
ApplicationConfiguration cnf)
|
protected boolean |
isCSSLoaded()
Checks whether or not the CSS is loaded. |
static boolean |
isDebugMode()
Deprecated. use ApplicationConfiguration isDebugMode instead. |
boolean |
isLoadingIndicatorVisible()
Determines whether or not the loading indicator is showing. |
protected void |
makeUidlRequest(String requestData,
String extraParams,
boolean forceSync)
Makes an UIDL request to the server. |
protected void |
repaintAll()
|
void |
runDescendentsLayout(com.google.gwt.user.client.ui.HasWidgets container)
Causes a re-calculation/re-layout of all paintables in a container. |
void |
sendPendingVariableChanges()
This method sends currently queued variable changes to server. |
protected void |
showAuthenticationError(String details)
Shows the authentication error notification. |
protected void |
showCommunicationError(String details,
int statusCode)
Shows the communication error notification. |
void |
start()
Starts this application. |
protected void |
startRequest()
|
String |
translateVaadinUri(String uidlUri)
Translates custom protocols in UIDL URI's to be recognizable by browser. |
void |
unregisterPaintable(ServerConnector p)
Deprecated. |
boolean |
updateComponent(com.google.gwt.user.client.ui.Widget component,
UIDL uidl,
boolean manageCaption)
Deprecated. |
void |
updateVariable(String paintableId,
String variableName,
boolean newValue,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
double newValue,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
float newValue,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
int newValue,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
long newValue,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
Map<String,Object> map,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
Object[] values,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
ServerConnector newValue,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
String[] values,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
void |
updateVariable(String paintableId,
String variableName,
String newValue,
boolean immediate)
Sends a new value for the given paintables given variable to the server. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CONNECTOR_RESOURCE_PREFIX
public static final String GENERATED_BODY_CLASSNAME
public static final String MODIFIED_CLASSNAME
public static final String DISABLED_CLASSNAME
public static final String REQUIRED_CLASSNAME_EXT
public static final String ERROR_CLASSNAME_EXT
public static final String UPDATE_VARIABLE_INTERFACE
public static final String UPDATE_VARIABLE_METHOD
public static final char VAR_BURST_SEPARATOR
public static final char VAR_ESCAPE_CHARACTER
public static final String UIDL_SECURITY_TOKEN_ID
public static final String ROOT_ID_PARAMETER
@Deprecated public static final String UIDL_SECURITY_HEADER
public static final String PARAM_UNLOADBURST
public static final String UIDL_REFRESH_TOKEN
This allows, for instance, a servlet filter to redirect the application to a custom login page when the session expires. For example:
if (sessionExpired) { response.setHeader("Content-Type", "text/html"); response.getWriter().write( myLoginPageHtml + "<!-- Vaadin-Refresh: " + request.getContextPath() + " -->"); }
protected boolean applicationRunning
protected boolean cssLoaded
protected int lastProcessingTime
protected int totalProcessingTime
Constructor Detail |
---|
public ApplicationConnection()
Method Detail |
---|
public void init(WidgetSet widgetSet, ApplicationConfiguration cnf)
public void start()
ApplicationConfiguration#startNextApplication()
, which should be
called once this application has started (first response received) or
failed to start. This ensures that the applications are started in order,
to avoid session-id problems.
protected void extendLiferaySession()
@Deprecated public static Console getConsole()
VConsole
since 6.4.5
@Deprecated public static boolean isDebugMode()
public String getAppUri()
public boolean hasActiveRequest()
protected void repaintAll()
public void analyzeLayouts()
protected void makeUidlRequest(String requestData, String extraParams, boolean forceSync)
requestData
- Data that is passed to the server.extraParams
- Parameters that are added as GET parameters to the url.
Contains key=value pairs joined by & characters or is empty if
no parameters should be added. Should not start with any
special character.forceSync
- true if the request should be synchronous, false otherwiseprotected void doUidlRequest(String uri, String payload, boolean synchronous)
uri
- The URI to use for the request. May includes GET parameterspayload
- The contents of the request to sendsynchronous
- true if the request should be synchronous, false otherwiseprotected void doAsyncUIDLRequest(String uri, String payload, com.google.gwt.http.client.RequestCallback requestCallback) throws com.google.gwt.http.client.RequestException
uri
- The URI to use for the request. May includes GET parameterspayload
- The contents of the request to sendrequestCallback
- The handler for the response
com.google.gwt.http.client.RequestException
- if the request could not be sentprotected void handleWhenCSSLoaded(String jsonText, ValueMap json)
protected boolean isCSSLoaded()
protected void showCommunicationError(String details, int statusCode)
details
- Optional details for debugging.statusCode
- The status code returned for the requestprotected void showAuthenticationError(String details)
details
- Optional details for debugging.protected void startRequest()
protected void endRequest()
public boolean isLoadingIndicatorVisible()
protected void handleUIDLMessage(Date start, String jsonText, ValueMap json)
public void addMethodInvocationToQueue(MethodInvocation invocation, boolean immediate)
invocation
- RPC method invocationimmediate
- true to trigger sending within a short time window (possibly
combining subsequent calls to a single request), false to let
the framework delay sending of RPC calls and variable changes
until the next immediate changepublic void sendPendingVariableChanges()
public void updateVariable(String paintableId, String variableName, ServerConnector newValue, boolean immediate)
The update is actually queued to be sent at a suitable time. If immediate is true, the update is sent as soon as possible. If immediate is false, the update will be sent along with the next immediate update.
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablenewValue
- the new value to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, String newValue, boolean immediate)
The update is actually queued to be sent at a suitable time. If immediate is true, the update is sent as soon as possible. If immediate is false, the update will be sent along with the next immediate update.
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablenewValue
- the new value to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, int newValue, boolean immediate)
The update is actually queued to be sent at a suitable time. If immediate is true, the update is sent as soon as possible. If immediate is false, the update will be sent along with the next immediate update.
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablenewValue
- the new value to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, long newValue, boolean immediate)
The update is actually queued to be sent at a suitable time. If immediate is true, the update is sent as soon as possible. If immediate is false, the update will be sent along with the next immediate update.
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablenewValue
- the new value to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, float newValue, boolean immediate)
The update is actually queued to be sent at a suitable time. If immediate is true, the update is sent as soon as possible. If immediate is false, the update will be sent along with the next immediate update.
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablenewValue
- the new value to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, double newValue, boolean immediate)
The update is actually queued to be sent at a suitable time. If immediate is true, the update is sent as soon as possible. If immediate is false, the update will be sent along with the next immediate update.
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablenewValue
- the new value to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, boolean newValue, boolean immediate)
The update is actually queued to be sent at a suitable time. If immediate is true, the update is sent as soon as possible. If immediate is false, the update will be sent along with the next immediate update.
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablenewValue
- the new value to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, Map<String,Object> map, boolean immediate)
The update is actually queued to be sent at a suitable time. If immediate is true, the update is sent as soon as possible. If immediate is false, the update will be sent along with the next immediate update.
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablemap
- the new values to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, String[] values, boolean immediate)
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablevalues
- the new value to be sentimmediate
- true if the update is to be sent as soon as possiblepublic void updateVariable(String paintableId, String variableName, Object[] values, boolean immediate)
paintableId
- the id of the paintable that owns the variablevariableName
- the name of the variablevalues
- the new value to be sentimmediate
- true if the update is to be sent as soon as possibleprotected String escapeBurstContents(String value)
value
- to encode
public void runDescendentsLayout(com.google.gwt.user.client.ui.HasWidgets container)
container
- public void forceLayout()
public boolean handleComponentRelativeSize(com.google.gwt.user.client.ui.Widget widget)
child
-
@Deprecated public ComponentConnector getPaintable(UIDL uidl)
public ServerConnector getConnector(String connectorId, int connectorType)
connectorId
- Id of the paintableconnectorType
- Type of the connector, as passed from the server side
public String getResource(String name)
name
- identifier of the resource to get
public VContextMenu getContextMenu()
public String translateVaadinUri(String uidlUri)
uidlUri
- Vaadin URI from uidl
public String getThemeUri()
protected String getUidlSecurityKey()
public void captionSizeUpdated(com.google.gwt.user.client.ui.Widget widget)
component
- the Paintable whose caption has changedpublic RootConnector getRootConnector()
public ApplicationConfiguration getConfiguration()
ApplicationConfiguration
for the current application.
ApplicationConfiguration
@Deprecated public boolean hasEventListeners(ComponentConnector paintable, String eventIdentifier)
ComponentState#hasEventListener(String)
instead
paintable
- The connector to register event listeners foreventIdentifier
- The identifier for the event
public static String addGetParameters(String uri, String extraParams)
uri
- The uri to which the parameters should be added.extraParams
- One or more parameters in the format "a=b" or "c=d&e=f". An
empty string is allowed but will not modify the url.
@Deprecated public void unregisterPaintable(ServerConnector p)
public VTooltip getVTooltip()
@Deprecated public boolean updateComponent(com.google.gwt.user.client.ui.Widget component, UIDL uidl, boolean manageCaption)
component
- uidl
- manageCaption
-
@Deprecated public boolean hasEventListeners(com.google.gwt.user.client.ui.Widget widget, String eventIdentifier)
public SerializerMap getSerializerMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |