org.apache.wicket.markup.head
Class JavaScriptHeaderItem

java.lang.Object
  extended by org.apache.wicket.markup.head.HeaderItem
      extended by org.apache.wicket.markup.head.JavaScriptHeaderItem
Direct Known Subclasses:
JavaScriptContentHeaderItem, JavaScriptReferenceHeaderItem, JavaScriptUrlReferenceHeaderItem

public abstract class JavaScriptHeaderItem
extends HeaderItem

Base class for all HeaderItems that represent javascripts. This class mainly contains factory methods.

Author:
papegaaij

Constructor Summary
protected JavaScriptHeaderItem(String condition)
           
 
Method Summary
static JavaScriptReferenceHeaderItem forReference(ResourceReference reference)
          Creates a JavaScriptReferenceHeaderItem for the given reference.
static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, boolean defer)
          Creates a JavaScriptReferenceHeaderItem for the given reference.
static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String id)
          Creates a JavaScriptReferenceHeaderItem for the given reference.
static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String id, boolean defer)
          Creates a JavaScriptReferenceHeaderItem for the given reference.
static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String id, boolean defer, String charset)
          Creates a JavaScriptReferenceHeaderItem for the given reference.
static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String id, boolean defer, String charset, String condition)
          Creates a JavaScriptReferenceHeaderItem for the given reference.
static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, String id)
          Creates a JavaScriptReferenceHeaderItem for the given reference.
static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, String id, boolean defer)
          Creates a JavaScriptReferenceHeaderItem for the given reference.
static JavaScriptContentHeaderItem forScript(CharSequence javascript, String id)
          Creates a JavaScriptContentHeaderItem for the given content.
static JavaScriptContentHeaderItem forScript(CharSequence javascript, String id, String condition)
          Creates a JavaScriptContentHeaderItem for the given content.
static JavaScriptUrlReferenceHeaderItem forUrl(String url)
          Creates a JavaScriptUrlReferenceHeaderItem for the given url.
static JavaScriptUrlReferenceHeaderItem forUrl(String url, String id)
          Creates a JavaScriptUrlReferenceHeaderItem for the given url.
static JavaScriptUrlReferenceHeaderItem forUrl(String url, String id, boolean defer)
          Creates a JavaScriptUrlReferenceHeaderItem for the given url.
static JavaScriptUrlReferenceHeaderItem forUrl(String url, String id, boolean defer, String charset)
          Creates a JavaScriptUrlReferenceHeaderItem for the given url.
static JavaScriptUrlReferenceHeaderItem forUrl(String url, String id, boolean defer, String charset, String condition)
          Creates a JavaScriptUrlReferenceHeaderItem for the given url.
 String getCondition()
           
protected  void internalRenderJavaScriptReference(Response response, String url, String id, boolean defer, String charset, String condition)
           
 
Methods inherited from class org.apache.wicket.markup.head.HeaderItem
getDependencies, getProvidedResources, getRenderTokens, render
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaScriptHeaderItem

protected JavaScriptHeaderItem(String condition)
Method Detail

getCondition

public String getCondition()
Returns:
the condition to use for Internet Explorer conditional comments. E.g. "IE 7".

forReference

public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference)
Creates a JavaScriptReferenceHeaderItem for the given reference.

Parameters:
reference - resource reference pointing to the javascript resource
Returns:
A newly created JavaScriptReferenceHeaderItem for the given reference.

forReference

public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference,
                                                         String id)
Creates a JavaScriptReferenceHeaderItem for the given reference.

Parameters:
reference - resource reference pointing to the javascript resource
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
Returns:
A newly created JavaScriptReferenceHeaderItem for the given reference.

forReference

public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference,
                                                         PageParameters pageParameters,
                                                         String id)
Creates a JavaScriptReferenceHeaderItem for the given reference.

Parameters:
reference - resource reference pointing to the javascript resource
pageParameters - the parameters for this Javascript resource reference
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
Returns:
A newly created JavaScriptReferenceHeaderItem for the given reference.

forReference

public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference,
                                                         PageParameters pageParameters,
                                                         String id,
                                                         boolean defer)
Creates a JavaScriptReferenceHeaderItem for the given reference.

Parameters:
reference - resource reference pointing to the javascript resource
pageParameters - the parameters for this Javascript resource reference
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
defer - specifies that the execution of a script should be deferred (delayed) until after the page has been loaded.
Returns:
A newly created JavaScriptReferenceHeaderItem for the given reference.

forReference

public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference,
                                                         String id,
                                                         boolean defer)
Creates a JavaScriptReferenceHeaderItem for the given reference.

Parameters:
reference - resource reference pointing to the JavaScript resource
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
defer - specifies that the execution of a script should be deferred (delayed) until after the page has been loaded.
Returns:
A newly created JavaScriptReferenceHeaderItem for the given reference.

forReference

public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference,
                                                         boolean defer)
Creates a JavaScriptReferenceHeaderItem for the given reference.

Parameters:
reference - resource reference pointing to the JavaScript resource
defer - specifies that the execution of a script should be deferred (delayed) until after the page has been loaded.
Returns:
A newly created JavaScriptReferenceHeaderItem for the given reference.

forReference

public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference,
                                                         PageParameters pageParameters,
                                                         String id,
                                                         boolean defer,
                                                         String charset)
Creates a JavaScriptReferenceHeaderItem for the given reference.

Parameters:
reference - resource reference pointing to the javascript resource
pageParameters - the parameters for this Javascript resource reference
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
defer - specifies that the execution of a script should be deferred (delayed) until after the page has been loaded.
charset - a non null value specifies the charset attribute of the script tag
Returns:
A newly created JavaScriptReferenceHeaderItem for the given reference.

forReference

public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference,
                                                         PageParameters pageParameters,
                                                         String id,
                                                         boolean defer,
                                                         String charset,
                                                         String condition)
Creates a JavaScriptReferenceHeaderItem for the given reference.

Parameters:
reference - resource reference pointing to the javascript resource
pageParameters - the parameters for this Javascript resource reference
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
defer - specifies that the execution of a script should be deferred (delayed) until after the page has been loaded.
charset - a non null value specifies the charset attribute of the script tag
condition - the condition to use for Internet Explorer conditional comments. E.g. "IE 7".
Returns:
A newly created JavaScriptReferenceHeaderItem for the given reference.

forScript

public static JavaScriptContentHeaderItem forScript(CharSequence javascript,
                                                    String id)
Creates a JavaScriptContentHeaderItem for the given content.

Parameters:
javascript - javascript content to be rendered.
id - unique id for the javascript element. This can be null, however in that case the ajax header contribution can't detect duplicate script fragments.
Returns:
A newly created JavaScriptContentHeaderItem for the given content.

forScript

public static JavaScriptContentHeaderItem forScript(CharSequence javascript,
                                                    String id,
                                                    String condition)
Creates a JavaScriptContentHeaderItem for the given content.

Parameters:
javascript - javascript content to be rendered.
id - unique id for the javascript element. This can be null, however in that case the ajax header contribution can't detect duplicate script fragments.
condition - the condition to use for Internet Explorer conditional comments. E.g. "IE 7".
Returns:
A newly created JavaScriptContentHeaderItem for the given content.

forUrl

public static JavaScriptUrlReferenceHeaderItem forUrl(String url)
Creates a JavaScriptUrlReferenceHeaderItem for the given url.

Parameters:
url - context-relative url of the the javascript resource
Returns:
A newly created JavaScriptUrlReferenceHeaderItem for the given url.

forUrl

public static JavaScriptUrlReferenceHeaderItem forUrl(String url,
                                                      String id)
Creates a JavaScriptUrlReferenceHeaderItem for the given url.

Parameters:
url - context-relative url of the the javascript resource
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
Returns:
A newly created JavaScriptUrlReferenceHeaderItem for the given url.

forUrl

public static JavaScriptUrlReferenceHeaderItem forUrl(String url,
                                                      String id,
                                                      boolean defer)
Creates a JavaScriptUrlReferenceHeaderItem for the given url.

Parameters:
url - context-relative url of the the javascript resource
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
defer - specifies that the execution of a script should be deferred (delayed) until after the page has been loaded.
Returns:
A newly created JavaScriptUrlReferenceHeaderItem for the given url.

forUrl

public static JavaScriptUrlReferenceHeaderItem forUrl(String url,
                                                      String id,
                                                      boolean defer,
                                                      String charset)
Creates a JavaScriptUrlReferenceHeaderItem for the given url.

Parameters:
url - context-relative url of the the javascript resource
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
defer - specifies that the execution of a script should be deferred (delayed) until after the page has been loaded.
charset - a non null value specifies the charset attribute of the script tag
Returns:
A newly created JavaScriptUrlReferenceHeaderItem for the given url.

forUrl

public static JavaScriptUrlReferenceHeaderItem forUrl(String url,
                                                      String id,
                                                      boolean defer,
                                                      String charset,
                                                      String condition)
Creates a JavaScriptUrlReferenceHeaderItem for the given url.

Parameters:
url - context-relative url of the the javascript resource
id - id that will be used to filter duplicate reference (it's still filtered by URL too)
defer - specifies that the execution of a script should be deferred (delayed) until after the page has been loaded.
charset - a non null value specifies the charset attribute of the script tag
Returns:
A newly created JavaScriptUrlReferenceHeaderItem for the given url.

internalRenderJavaScriptReference

protected final void internalRenderJavaScriptReference(Response response,
                                                       String url,
                                                       String id,
                                                       boolean defer,
                                                       String charset,
                                                       String condition)


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.