Package org.apache.wicket.markup.head
Class JavaScriptHeaderItem
- java.lang.Object
-
- org.apache.wicket.markup.head.HeaderItem
-
- org.apache.wicket.markup.head.JavaScriptHeaderItem
-
- All Implemented Interfaces:
java.io.Serializable
,org.apache.wicket.util.io.IClusterable
- Direct Known Subclasses:
AbstractJavaScriptReferenceHeaderItem
,JavaScriptContentHeaderItem
public abstract class JavaScriptHeaderItem extends HeaderItem
Base class for allHeaderItem
s that represent javascripts. This class mainly contains factory methods.- Author:
- papegaaij
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JavaScriptHeaderItem(java.lang.String condition)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
static JavaScriptReferenceHeaderItem
forReference(ResourceReference reference)
Creates aJavaScriptReferenceHeaderItem
for the given reference.static JavaScriptReferenceHeaderItem
forReference(ResourceReference reference, boolean defer)
Creates aJavaScriptReferenceHeaderItem
for the given reference.static JavaScriptReferenceHeaderItem
forReference(ResourceReference reference, java.lang.String id)
Creates aJavaScriptReferenceHeaderItem
for the given reference.static JavaScriptReferenceHeaderItem
forReference(ResourceReference reference, java.lang.String id, boolean defer)
Creates aJavaScriptReferenceHeaderItem
for the given reference.static JavaScriptReferenceHeaderItem
forReference(ResourceReference reference, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id)
Creates aJavaScriptReferenceHeaderItem
for the given reference.static JavaScriptReferenceHeaderItem
forReference(ResourceReference reference, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id, boolean defer)
Creates aJavaScriptReferenceHeaderItem
for the given reference.static JavaScriptReferenceHeaderItem
forReference(ResourceReference reference, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id, boolean defer, java.lang.String charset)
Creates aJavaScriptReferenceHeaderItem
for the given reference.static JavaScriptReferenceHeaderItem
forReference(ResourceReference reference, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id, boolean defer, java.lang.String charset, java.lang.String condition)
Creates aJavaScriptReferenceHeaderItem
for the given reference.static JavaScriptContentHeaderItem
forScript(java.lang.CharSequence javascript, java.lang.String id)
Creates aJavaScriptContentHeaderItem
for the given content.static JavaScriptContentHeaderItem
forScript(java.lang.CharSequence javascript, java.lang.String id, java.lang.String condition)
Creates aJavaScriptContentHeaderItem
for the given content.static JavaScriptUrlReferenceHeaderItem
forUrl(java.lang.String url)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.static JavaScriptUrlReferenceHeaderItem
forUrl(java.lang.String url, java.lang.String id)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.static JavaScriptUrlReferenceHeaderItem
forUrl(java.lang.String url, java.lang.String id, boolean defer)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.static JavaScriptUrlReferenceHeaderItem
forUrl(java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.static JavaScriptUrlReferenceHeaderItem
forUrl(java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset, java.lang.String condition)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.java.lang.String
getCondition()
java.lang.String
getId()
int
hashCode()
protected void
internalRenderJavaScriptReference(org.apache.wicket.request.Response response, java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset, java.lang.String condition, boolean async)
JavaScriptHeaderItem
setId(java.lang.String markupId)
Sets the markup id for this header item-
Methods inherited from class org.apache.wicket.markup.head.HeaderItem
getDependencies, getProvidedResources, getRenderTokens, render
-
-
-
-
Method Detail
-
getId
public java.lang.String getId()
- Returns:
- unique id for the javascript element.
-
setId
public JavaScriptHeaderItem setId(java.lang.String markupId)
Sets the markup id for this header item- Parameters:
markupId
- the markup id- Returns:
this
object, for method chaining
-
getCondition
public java.lang.String getCondition()
- Returns:
- the condition to use for Internet Explorer conditional comments. E.g. "IE 7".
-
forReference
public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference)
Creates aJavaScriptReferenceHeaderItem
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, java.lang.String id)
Creates aJavaScriptReferenceHeaderItem
for the given reference.- Parameters:
reference
- resource reference pointing to the javascript resourceid
- 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, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id)
Creates aJavaScriptReferenceHeaderItem
for the given reference.- Parameters:
reference
- resource reference pointing to the javascript resourcepageParameters
- the parameters for this Javascript resource referenceid
- 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, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id, boolean defer)
Creates aJavaScriptReferenceHeaderItem
for the given reference.- Parameters:
reference
- resource reference pointing to the javascript resourcepageParameters
- the parameters for this Javascript resource referenceid
- 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, java.lang.String id, boolean defer)
Creates aJavaScriptReferenceHeaderItem
for the given reference.- Parameters:
reference
- resource reference pointing to the JavaScript resourceid
- 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 aJavaScriptReferenceHeaderItem
for the given reference.- Parameters:
reference
- resource reference pointing to the JavaScript resourcedefer
- 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, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id, boolean defer, java.lang.String charset)
Creates aJavaScriptReferenceHeaderItem
for the given reference.- Parameters:
reference
- resource reference pointing to the javascript resourcepageParameters
- the parameters for this Javascript resource referenceid
- 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, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id, boolean defer, java.lang.String charset, java.lang.String condition)
Creates aJavaScriptReferenceHeaderItem
for the given reference.- Parameters:
reference
- resource reference pointing to the javascript resourcepageParameters
- the parameters for this Javascript resource referenceid
- 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 tagcondition
- 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(java.lang.CharSequence javascript, java.lang.String id)
Creates aJavaScriptContentHeaderItem
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(java.lang.CharSequence javascript, java.lang.String id, java.lang.String condition)
Creates aJavaScriptContentHeaderItem
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(java.lang.String url)
Creates aJavaScriptUrlReferenceHeaderItem
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(java.lang.String url, java.lang.String id)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.- Parameters:
url
- context-relative url of the the javascript resourceid
- 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(java.lang.String url, java.lang.String id, boolean defer)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.- Parameters:
url
- context-relative url of the the javascript resourceid
- 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(java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.- Parameters:
url
- context-relative url of the the javascript resourceid
- 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(java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset, java.lang.String condition)
Creates aJavaScriptUrlReferenceHeaderItem
for the given url.- Parameters:
url
- context-relative url of the the javascript resourceid
- 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(org.apache.wicket.request.Response response, java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset, java.lang.String condition, boolean async)
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-