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

java.lang.Object
  extended by com.vaadin.addon.touchkit.gwt.client.offlinemode.CacheManifestStatusIndicator
All Implemented Interfaces:
com.google.gwt.core.client.EntryPoint

public class CacheManifestStatusIndicator
extends Object
implements com.google.gwt.core.client.EntryPoint

This is a simple application cache monitor. It also notifies demo users when offline mode is ready to be used.


Field Summary
static String UPDATE_CHECK_INTERVAL_KEY
           
static String UPDATE_NOW_MSG_KEY
           
 
Constructor Summary
CacheManifestStatusIndicator()
           
 
Method Summary
protected  void hideProgress()
          Hides the progress element.
protected  void hookAllListeners(CacheManifestStatusIndicator instance)
          Hooks all listeners to the specified instance.
 void init()
          Initializes and starts the monitoring.
protected  void onCacheEvent(com.google.gwt.user.client.Event event)
          Called when a cache event is triggered.
protected  void onError(com.google.gwt.user.client.Event event)
          Called when an error event is triggered.
 void onModuleLoad()
           
protected  void requestUpdate(boolean force)
          Called when a new version of the application cache (i.e.
protected  void showProgress()
          Shows the progress element, which, by default, is styled to be a small animated spinner in the top right corner of the screen.
protected static void updateCache()
          Asks the application cache to update itself, i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UPDATE_NOW_MSG_KEY

public static final String UPDATE_NOW_MSG_KEY
See Also:
Constant Field Values

UPDATE_CHECK_INTERVAL_KEY

public static final String UPDATE_CHECK_INTERVAL_KEY
See Also:
Constant Field Values
Constructor Detail

CacheManifestStatusIndicator

public CacheManifestStatusIndicator()
Method Detail

onModuleLoad

public void onModuleLoad()
Specified by:
onModuleLoad in interface com.google.gwt.core.client.EntryPoint

init

public void init()
Initializes and starts the monitoring.


onCacheEvent

protected void onCacheEvent(com.google.gwt.user.client.Event event)
Called when a cache event is triggered. All events except for error events are handled here.

Parameters:
event - The event.

onError

protected void onError(com.google.gwt.user.client.Event event)
Called when an error event is triggered.

Parameters:
event - The error event.

showProgress

protected void showProgress()
Shows the progress element, which, by default, is styled to be a small animated spinner in the top right corner of the screen.


hideProgress

protected void hideProgress()
Hides the progress element.


requestUpdate

protected void requestUpdate(boolean force)
Called when a new version of the application cache (i.e. the widgetset) has been detected. The default implementation asks the user if we should update now unless forced.

Parameters:
force - true to force reloading the site without asking the user.

hookAllListeners

protected final void hookAllListeners(CacheManifestStatusIndicator instance)
Hooks all listeners to the specified instance.

Parameters:
instance - the instance to hook the listeners to.

updateCache

protected static void updateCache()
Asks the application cache to update itself, i.e. visit the server and check if there's an update available.



Copyright © 2014 Vaadin Ltd. All rights reserved.