Class ApplicationConnection
- All Implemented Interfaces:
com.google.gwt.event.shared.HasHandlers
onModuleLoad().-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enumstatic classEvent triggered when a application is stopped by callingsetApplicationRunning(boolean).static interfaceA listener for listening to application stopped events.static interfaceAllows custom handling of communication errors.static interfaceThe communication handler methods are called at certain points during communication with the server.static classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanstatic final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringDeprecated.static final StringA string that, if found in a non-JSON response to a UIDL request, will cause the browser to refresh the page. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringaddGetParameters(String uri, String extraParams) Deprecated.<H extends com.google.gwt.event.shared.EventHandler>
com.google.gwt.event.shared.HandlerRegistrationaddHandler(com.google.gwt.event.shared.GwtEvent.Type<H> type, H handler) voidDeprecated.as of 7.1.voidcaptionSizeUpdated(com.google.gwt.user.client.ui.Widget widget) Deprecated.As of 7.0.2, has not had any effect for a long timevoidexecuteWhenCSSLoaded(com.google.gwt.user.client.Command c) voidfireEvent(com.google.gwt.event.shared.GwtEvent<?> event) voidCallsComponentConnector.flush()on the active connector.voidThis will cause re-layouting of all components.Returns the state of this application.Gets theApplicationConfigurationfor the current application.com.vaadin.client.communication.ConnectionStateHandlerGets the communication error handler for this application.com.vaadin.client.ServerConnectorgetConnector(String connectorId, int connectorType) Get either an existing ComponentConnector or create a new ComponentConnector with the given type and id.com.vaadin.client.ui.VContextMenuSingleton method to get instance of app's context menu.com.vaadin.client.DependencyLoaderGets the instance which handles loading of dependencies.com.vaadin.client.communication.HeartbeatReturns the hearbeat instance.com.vaadin.client.ui.IconGets anIconinstance corresponding to a URI.intcom.vaadin.client.VLoadingIndicatorReturns the loading indicator used by this ApplicationConnection.com.vaadin.client.communication.MessageHandlerGets the (server to client) message handler for this application.com.vaadin.client.communication.MessageSenderGets the (client to server) message sender for this application.com.vaadin.client.ComponentConnectorgetPaintable(com.vaadin.client.UIDL uidl) Deprecated.getResource(String name) Gets a resource that has been pre-loaded via UIDL, such as custom layouts.com.vaadin.client.communication.RpcManagerGets the server rpc manager for this application.com.vaadin.client.communication.ServerRpcQueueGets the server RPC queue for this application.Gets the URI for the current theme.com.vaadin.client.ui.ui.UIConnectorGets the main view.com.vaadin.client.VTooltipGet VTooltip instance related to application connection.com.vaadin.client.WidgetSetvoidhandleCommunicationError(String details, int statusCode) booleanhandleComponentRelativeSize(com.google.gwt.user.client.ui.Widget widget) Deprecated.As of 7.0, serves no purposebooleanhasEventListeners(com.google.gwt.user.client.ui.Widget widget, String eventIdentifier) Deprecated.As of 7.0.booleanhasEventListeners(com.vaadin.client.ComponentConnector connector, String eventIdentifier) Deprecated.As of 7.0.voidinit(com.vaadin.client.WidgetSet widgetSet, ApplicationConfiguration cnf) booleanChecks if the application is in theApplicationConnection.ApplicationState.RUNNINGstate.protected booleanChecks whether or not the CSS is loaded.booleanDeprecated.As of 7.1.voidrunDescendentsLayout(com.google.gwt.user.client.ui.HasWidgets container) Deprecated.As of 7.0, serves no purposevoidDeprecated.as of 7.6, useServerRpcQueue.flush()voidsetApplicationRunning(boolean applicationRunning) voidSets the delegate that is called whenever a communication error occurrs.voidsetResource(String name, String resource) Sets a resource that has been pre-loaded via UIDL, such as custom layouts.voidshowAuthenticationError(String details) Shows the authentication error notification.voidshowCommunicationError(String details, int statusCode) Shows the communication error notification.protected voidshowError(String details, ApplicationConfiguration.ErrorMessage message) Shows an error notification.voidshowSessionExpiredError(String details) Shows the session expiration notification.voidstart()Starts this application.translateVaadinUri(String uidlUri) Translates custom protocols in UIDL URI's to be recognizable by browser.voidunregisterPaintable(com.vaadin.client.ServerConnector p) Deprecated.As of 7.0.booleanupdateComponent(com.google.gwt.user.client.ui.Widget component, com.vaadin.client.UIDL uidl, boolean manageCaption) Deprecated.As of 7.0, no longer serves any purposevoidupdateVariable(String paintableId, String variableName, boolean newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.voidupdateVariable(String paintableId, String variableName, double newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.voidupdateVariable(String paintableId, String variableName, float newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.voidupdateVariable(String paintableId, String variableName, int newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.voidupdateVariable(String paintableId, String variableName, long newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.voidupdateVariable(String paintableId, String variableName, com.vaadin.client.ServerConnector newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.voidupdateVariable(String paintableId, String variableName, Object[] values, boolean immediate) Sends a new value for the given paintables given variable to the server.voidupdateVariable(String paintableId, String variableName, String[] values, boolean immediate) Sends a new value for the given paintables given variable to the server.voidupdateVariable(String paintableId, String variableName, String newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.voidSends a new value for the given paintables given variable to the server.
-
Field Details
-
MODIFIED_CLASSNAME
Deprecated.- See Also:
-
DISABLED_CLASSNAME
Deprecated.- See Also:
-
REQUIRED_CLASSNAME
Deprecated.- See Also:
-
REQUIRED_CLASSNAME_EXT
Deprecated.- See Also:
-
ERROR_CLASSNAME_EXT
Deprecated.- See Also:
-
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. If followed by a colon, optional whitespace, and a URI, causes the browser to synchronously load the URI.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() + " -->"); }- See Also:
-
cssLoaded
protected boolean cssLoaded
-
-
Constructor Details
-
ApplicationConnection
public ApplicationConnection()
-
-
Method Details
-
init
-
start
public void start()Starts this application. Don't call this method directly - it's called byApplicationConfiguration.startApplication(String), 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. -
analyzeLayouts
Deprecated.as of 7.1. Replaced byUIConnector.analyzeLayouts()Requests an analyze of layouts, to find inconsistencies. Exclusively used for debugging during development. -
executeWhenCSSLoaded
public void executeWhenCSSLoaded(com.google.gwt.user.client.Command c) -
isCSSLoaded
protected boolean isCSSLoaded()Checks whether or not the CSS is loaded. By default checks the size of the loading indicator element.- Returns:
-
showCommunicationError
Shows the communication error notification.- Parameters:
details- Optional details.statusCode- The status code returned for the request
-
showAuthenticationError
Shows the authentication error notification.- Parameters:
details- Optional details.
-
showSessionExpiredError
Shows the session expiration notification.- Parameters:
details- Optional details.
-
showError
Shows an error notification.- Parameters:
details- Optional details.message- An ErrorMessage describing the error.
-
getLoadingIndicator
public com.vaadin.client.VLoadingIndicator getLoadingIndicator()Returns the loading indicator used by this ApplicationConnection.- Returns:
- The loading indicator for this ApplicationConnection
-
isLoadingIndicatorVisible
Deprecated.As of 7.1. UsegetLoadingIndicator()andVLoadingIndicator.isVisible().isVisible() instead.Determines whether or not the loading indicator is showing.- Returns:
- true if the loading indicator is visible
-
sendPendingVariableChanges
Deprecated.as of 7.6, useServerRpcQueue.flush() -
updateVariable
public void updateVariable(String paintableId, String variableName, com.vaadin.client.ServerConnector newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
- Parameters:
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 possible
-
updateVariable
public void updateVariable(String paintableId, String variableName, String newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
- Parameters:
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 possible
-
updateVariable
public void updateVariable(String paintableId, String variableName, int newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
- Parameters:
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 possible
-
updateVariable
public void updateVariable(String paintableId, String variableName, long newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
- Parameters:
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 possible
-
updateVariable
public void updateVariable(String paintableId, String variableName, float newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
- Parameters:
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 possible
-
updateVariable
public void updateVariable(String paintableId, String variableName, double newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
- Parameters:
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 possible
-
updateVariable
public void updateVariable(String paintableId, String variableName, boolean newValue, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
- Parameters:
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 possible
-
updateVariable
public 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.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.
- Parameters:
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 possible
-
updateVariable
public void updateVariable(String paintableId, String variableName, String[] values, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
A null array is sent as an empty array.
- Parameters:
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 possible
-
updateVariable
public void updateVariable(String paintableId, String variableName, Object[] values, boolean immediate) Sends a new value for the given paintables given variable to the server.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.
A null array is sent as an empty array.
- Parameters:
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 possible
-
runDescendentsLayout
Deprecated.As of 7.0, serves no purposeDoes absolutely nothing. Replaced byLayoutManager.- Parameters:
container-
-
forceLayout
public void forceLayout()This will cause re-layouting of all components. Mainly used for development. Published to JavaScript. -
handleComponentRelativeSize
Deprecated.As of 7.0, serves no purposeReturns false.- Parameters:
widget-- Returns:
- false, always
-
getPaintable
Deprecated. -
getConnector
Get either an existing ComponentConnector or create a new ComponentConnector with the given type and id. If a ComponentConnector with the given id already exists, returns it. Otherwise creates and registers a new ComponentConnector of the given type.- Parameters:
connectorId- Id of the paintableconnectorType- Type of the connector, as passed from the server side- Returns:
- Either an existing ComponentConnector or a new ComponentConnector of the given type
-
getResource
Gets a resource that has been pre-loaded via UIDL, such as custom layouts.- Parameters:
name- identifier of the resource to get- Returns:
- the resource
-
setResource
Sets a resource that has been pre-loaded via UIDL, such as custom layouts.- Parameters:
name- identifier of the resource to Setresource- the resource- Since:
- 7.6
-
getContextMenu
public com.vaadin.client.ui.VContextMenu getContextMenu()Singleton method to get instance of app's context menu.- Returns:
- VContextMenu object
-
getIcon
Gets anIconinstance corresponding to a URI.- Parameters:
uri-- Returns:
- Icon object
- Since:
- 7.2
-
translateVaadinUri
Translates custom protocols in UIDL URI's to be recognizable by browser. All uri's from UIDL should be routed via this method before giving them to browser due URI's in UIDL may contain custom protocols like theme://.- Parameters:
uidlUri- Vaadin URI from uidl- Returns:
- translated URI ready for browser
-
getThemeUri
Gets the URI for the current theme. Can be used to reference theme resources.- Returns:
- URI to the current theme
-
captionSizeUpdated
Deprecated.As of 7.0.2, has not had any effect for a long timeUse to notify that the given component's caption has changed; layouts may have to be recalculated.- Parameters:
widget- The Widget whose caption has changed
-
getUIConnector
public com.vaadin.client.ui.ui.UIConnector getUIConnector()Gets the main view.- Returns:
- the main view
-
getConfiguration
Gets theApplicationConfigurationfor the current application.- Returns:
- the configuration for this application
- See Also:
-
hasEventListeners
@Deprecated public boolean hasEventListeners(com.vaadin.client.ComponentConnector connector, String eventIdentifier) Deprecated.As of 7.0. UseAbstractConnector.hasEventListener(String)insteadChecks if there is a registered server side listener for the event. The list of events which has server side listeners is updated automatically before the component is updated so the value is correct if called from updatedFromUIDL.- Parameters:
connector- The connector to register event listeners foreventIdentifier- The identifier for the event- Returns:
- true if at least one listener has been registered on server side for the event identified by eventIdentifier.
-
addGetParameters
Deprecated.UseSharedUtil.addGetParameters(String,String)insteadAdds the get parameters to the uri and returns the new uri that contains the parameters.- Parameters:
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.- Returns:
- The modified URI with the get parameters in extraParams added.
-
unregisterPaintable
Deprecated.As of 7.0. No longer serves any purpose. -
getVTooltip
public com.vaadin.client.VTooltip getVTooltip()Get VTooltip instance related to application connection.- Returns:
- VTooltip instance
-
updateComponent
@Deprecated public boolean updateComponent(com.google.gwt.user.client.ui.Widget component, com.vaadin.client.UIDL uidl, boolean manageCaption) Deprecated.As of 7.0, no longer serves any purposeMethod provided for backwards compatibility. Duties previously done by this method is now handled by the state change event handler in AbstractComponentConnector. The only function this method has is to return true if the UIDL is a "cached" update.- Parameters:
component-uidl-manageCaption-- Returns:
-
hasEventListeners
@Deprecated public boolean hasEventListeners(com.google.gwt.user.client.ui.Widget widget, String eventIdentifier) Deprecated.As of 7.0. UseAbstractConnector.hasEventListener(String)instead -
handleCommunicationError
-
setCommunicationErrorDelegate
Sets the delegate that is called whenever a communication error occurrs.- Parameters:
delegate- the delegate.
-
setApplicationRunning
public void setApplicationRunning(boolean applicationRunning) -
isApplicationRunning
public boolean isApplicationRunning()Checks if the application is in theApplicationConnection.ApplicationState.RUNNINGstate.- Returns:
- true if the application is in the running state, false otherwise
- Since:
- 7.6
-
flushActiveConnector
public void flushActiveConnector()CallsComponentConnector.flush()on the active connector. Does nothing if there is no active (focused) connector. -
getHeartbeat
public com.vaadin.client.communication.Heartbeat getHeartbeat()Returns the hearbeat instance. -
getApplicationState
Returns the state of this application. An application state goes from "initializing" to "running" to "stopped". There is no way for an application to go back to a previous state, i.e. a stopped application can never be re-started- Returns:
- the current state of this application
- Since:
- 7.6
-
getServerRpcQueue
public com.vaadin.client.communication.ServerRpcQueue getServerRpcQueue()Gets the server RPC queue for this application.- Returns:
- the server RPC queue
- Since:
- 7.6
-
getConnectionStateHandler
public com.vaadin.client.communication.ConnectionStateHandler getConnectionStateHandler()Gets the communication error handler for this application.- Returns:
- the server RPC queue
- Since:
- 7.6
-
getMessageHandler
public com.vaadin.client.communication.MessageHandler getMessageHandler()Gets the (server to client) message handler for this application.- Returns:
- the message handler
- Since:
- 7.6
-
getRpcManager
public com.vaadin.client.communication.RpcManager getRpcManager()Gets the server rpc manager for this application.- Returns:
- the server rpc manager
- Since:
- 7.6
-
getMessageSender
public com.vaadin.client.communication.MessageSender getMessageSender()Gets the (client to server) message sender for this application.- Returns:
- the message sender
- Since:
- 7.6
-
getWidgetSet
public com.vaadin.client.WidgetSet getWidgetSet()- Returns:
- the widget set
- Since:
- 7.6
-
getLastSeenServerSyncId
public int getLastSeenServerSyncId() -
getDependencyLoader
public com.vaadin.client.DependencyLoader getDependencyLoader()Gets the instance which handles loading of dependencies.- Returns:
- the dependency loader for this connection
-
SharedUtil.addGetParameters(String,String)instead