org.cruxframework.crux.core.clientoffline
Class ApplicationCacheHandler

java.lang.Object
  extended by org.cruxframework.crux.core.clientoffline.ApplicationCacheHandler
All Implemented Interfaces:
com.google.gwt.core.client.EntryPoint

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

Author:
Thiago da Rosa de Bustamante

Nested Class Summary
static class ApplicationCacheHandler.CacheEvent
           
 
Field Summary
static int CHECKING
           
static int DOWNLOADING
           
static int IDLE
           
static int OBSOLETE
           
static int UNCACHED
           
static int UPDATEREADY
           
 
Constructor Summary
ApplicationCacheHandler()
           
 
Method Summary
static com.google.gwt.event.shared.HandlerRegistration addApplicationCacheHandler(ApplicationCacheEvent.Handler handler)
           
protected  void hookAllListeners(ApplicationCacheHandler instance)
          Hooks all listeners to the specified instance.
static boolean isSupported()
           
protected  void onCached()
          Called when a cached event is triggered
protected  void onChecking()
          Called when a checking event is triggered
protected  void onDownloading()
          Called when a downloading event is triggered
protected  void onError()
          Called when an error event is triggered.
 void onModuleLoad()
          Initializes and starts the monitoring.
protected  void onNoUpdate()
          Called when a noupdate event is triggered
protected  void onObsolete()
          Called when an error event is triggered.
protected  void onProgress(ProgressEvent event)
          Called when a progress event is triggered
protected  void onUpdateReady()
          Called when a update ready event is triggered
protected  void requestUpdate(boolean force)
          Called when a new version of the application cache has been detected.
static void swapCache()
           
static void updateCache()
          Asks the application cache to update itself.
static void updateCacheNative()
          Asks the application cache to update itself.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNCACHED

public static final int UNCACHED
See Also:
Constant Field Values

IDLE

public static final int IDLE
See Also:
Constant Field Values

CHECKING

public static final int CHECKING
See Also:
Constant Field Values

DOWNLOADING

public static final int DOWNLOADING
See Also:
Constant Field Values

UPDATEREADY

public static final int UPDATEREADY
See Also:
Constant Field Values

OBSOLETE

public static final int OBSOLETE
See Also:
Constant Field Values
Constructor Detail

ApplicationCacheHandler

public ApplicationCacheHandler()
Method Detail

addApplicationCacheHandler

public static com.google.gwt.event.shared.HandlerRegistration addApplicationCacheHandler(ApplicationCacheEvent.Handler handler)

onModuleLoad

public void onModuleLoad()
Initializes and starts the monitoring.

Specified by:
onModuleLoad in interface com.google.gwt.core.client.EntryPoint

updateCache

public static void updateCache()
Asks the application cache to update itself.


updateCacheNative

public static void updateCacheNative()
Asks the application cache to update itself.


swapCache

public static void swapCache()

onCached

protected void onCached()
Called when a cached event is triggered

Parameters:
event - The event.

onChecking

protected void onChecking()
Called when a checking event is triggered

Parameters:
event - The event.

onDownloading

protected void onDownloading()
Called when a downloading event is triggered

Parameters:
event - The event.

onNoUpdate

protected void onNoUpdate()
Called when a noupdate event is triggered

Parameters:
event - The event.

onUpdateReady

protected void onUpdateReady()
Called when a update ready event is triggered

Parameters:
event - The event.

onProgress

protected void onProgress(ProgressEvent event)
Called when a progress event is triggered

Parameters:
event - The event.

onError

protected void onError()
Called when an error event is triggered.

Parameters:
event - The error event.

onObsolete

protected void onObsolete()
Called when an error event is triggered.

Parameters:
event - The error event.

requestUpdate

protected void requestUpdate(boolean force)
Called when a new version of the application cache has been detected. Asks the user if we should update now unless forced.

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

isSupported

public static boolean isSupported()
Returns:

hookAllListeners

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

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


Copyright © 2014. All rights reserved.