com.vaadin.addon.touchkit.gwt.client.offlinemode
Class DefaultOfflineMode

java.lang.Object
  extended by com.vaadin.addon.touchkit.gwt.client.offlinemode.DefaultOfflineMode
All Implemented Interfaces:
OfflineMode

public class DefaultOfflineMode
extends Object
implements OfflineMode

This class is the default implementation of the offline mode used by Vaadin TouchKit. It is displayed when the network connection is down or if the server cannot be reached for some other reason.

Messages displayed by the default offline mode can be replaced by adding customized properties files for the OfflineModeMessages bundle. See the GWT i18n documentation for more details.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.vaadin.addon.touchkit.gwt.client.offlinemode.OfflineMode
OfflineMode.ActivationEvent, OfflineMode.ActivationReason
 
Field Summary
protected static int Z_INDEX
           
 
Constructor Summary
DefaultOfflineMode()
           
 
Method Summary
 void activate(OfflineMode.ActivationEvent event)
          This method is called when a TouchKit app decides to go offline.
protected  void buildDefaultContent()
          This method is called by the default OfflineMode.activate(ActivationEvent) implementation to build the contents of the offline mode each time it is activated.
 boolean deactivate()
          This method is called when TouchKit detects that it might be possible to go online again (e.g.
 String getActivationMessage()
           
 com.google.gwt.user.client.ui.Panel getPanel()
          Returns the panel created by default activate function.
 boolean isActive()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Z_INDEX

protected static final int Z_INDEX
See Also:
Constant Field Values
Constructor Detail

DefaultOfflineMode

public DefaultOfflineMode()
Method Detail

getPanel

public com.google.gwt.user.client.ui.Panel getPanel()
Returns the panel created by default activate function. Extended offline modes can e.g. use this panel as their root.

Note, that if the super method is not called in activate method, the panel will not be created on null will be returned. Developers have then full control over the offline mode behaviour.

Returns:
the panel created by default activate function.

activate

public void activate(OfflineMode.ActivationEvent event)
Description copied from interface: OfflineMode
This method is called when a TouchKit app decides to go offline. This most commonly happens if there is no network connection available. Offline mode can also be activated e.g. due to an inaccessible server, bad responses or as the result of a request by the server side application.

Specified by:
activate in interface OfflineMode
Parameters:
event - Details about the activation.

isActive

public boolean isActive()

Specified by:
isActive in interface OfflineMode
Returns:
true if offline mode is currently active

getActivationMessage

public String getActivationMessage()
Returns:
The activation message passed to us in the parameter for the OfflineMode.activate(ActivationEvent) method.

buildDefaultContent

protected void buildDefaultContent()
This method is called by the default OfflineMode.activate(ActivationEvent) implementation to build the contents of the offline mode each time it is activated. The simplest method to customize offline mode is to override this method and add a custom app to the panel returned by the getPanel() method.


deactivate

public boolean deactivate()
This method is called when TouchKit detects that it might be possible to go online again (e.g. the network connection has returned). The implementation should e.g. remove or hide offline related elements from the document.

If you have implemented a more advanced offline mode, override this method and gracefully return to normal operation. In that case return false

Specified by:
deactivate in interface OfflineMode
Returns:
true if offline mode was shut down, false if offline mode was not shut down


Copyright © 2014 Vaadin Ltd. All rights reserved.