|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.client.ResourceLoader
public class ResourceLoader
ResourceLoader lets you dynamically include external scripts and styles on the page and lets you know when the resource has been loaded. You can also preload resources, allowing them to get cached by the browser without being evaluated. This enables downloading multiple resources at once while still controlling in which order e.g. scripts are executed.
| Nested Class Summary | |
|---|---|
static class |
ResourceLoader.ResourceLoadEvent
Event fired when a resource has been loaded. |
static interface |
ResourceLoader.ResourceLoadListener
Event listener that gets notified when a resource has been loaded |
| Constructor Summary | |
|---|---|
protected |
ResourceLoader()
Creates a new resource loader. |
| Method Summary | |
|---|---|
static void |
addOnloadHandler(Element element,
ResourceLoader.ResourceLoadListener listener,
ResourceLoader.ResourceLoadEvent event)
Adds an onload listener to the given element, which should be a link or a script tag. |
static ResourceLoader |
get()
Returns the default ResourceLoader |
void |
loadScript(java.lang.String scriptUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener)
Load a script and notify a listener when the script is loaded. |
void |
loadScript(java.lang.String scriptUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener,
boolean async)
Load a script and notify a listener when the script is loaded. |
void |
loadStylesheet(java.lang.String stylesheetUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener)
Load a stylesheet and notify a listener when the stylesheet is loaded. |
void |
preloadResource(java.lang.String url,
ResourceLoader.ResourceLoadListener resourceLoadListener)
Download a resource and notify a listener when the resource is loaded without attempting to interpret the resource. |
static boolean |
supportsInOrderScriptExecution()
The current browser supports script.async='false' for maintaining execution order for dynamically-added scripts. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
protected ResourceLoader()
get() to get an
instance.
| Method Detail |
|---|
public static ResourceLoader get()
public void loadScript(java.lang.String scriptUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener)
scriptUrl - the url of the script to loadresourceLoadListener - the listener that will get notified when the script is loaded
public void loadScript(java.lang.String scriptUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener,
boolean async)
scriptUrl - url of script to loadresourceLoadListener - listener to notify when script is loadedasync - What mode the script.async attribute should be set topublic static boolean supportsInOrderScriptExecution()
public void preloadResource(java.lang.String url,
ResourceLoader.ResourceLoadListener resourceLoadListener)
url - the url of the resource to preloadresourceLoadListener - the listener that will get notified when the resource is
preloaded
public static void addOnloadHandler(Element element,
ResourceLoader.ResourceLoadListener listener,
ResourceLoader.ResourceLoadEvent event)
element - the element to attach a listener tolistener - the listener to callevent - the event passed to the listener
public void loadStylesheet(java.lang.String stylesheetUrl,
ResourceLoader.ResourceLoadListener resourceLoadListener)
stylesheetUrl - the url of the stylesheet to loadresourceLoadListener - the listener that will get notified when the stylesheet is
loaded
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||