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 allHeaderItems that represent javascripts. This class mainly contains factory methods.- Author:
- papegaaij
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedJavaScriptHeaderItem(java.lang.String condition)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)static JavaScriptReferenceHeaderItemforReference(ResourceReference reference)Creates aJavaScriptReferenceHeaderItemfor the given reference.static JavaScriptReferenceHeaderItemforReference(ResourceReference reference, boolean defer)Creates aJavaScriptReferenceHeaderItemfor the given reference.static JavaScriptReferenceHeaderItemforReference(ResourceReference reference, java.lang.String id)Creates aJavaScriptReferenceHeaderItemfor the given reference.static JavaScriptReferenceHeaderItemforReference(ResourceReference reference, java.lang.String id, boolean defer)Creates aJavaScriptReferenceHeaderItemfor the given reference.static JavaScriptReferenceHeaderItemforReference(ResourceReference reference, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id)Creates aJavaScriptReferenceHeaderItemfor the given reference.static JavaScriptReferenceHeaderItemforReference(ResourceReference reference, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id, boolean defer)Creates aJavaScriptReferenceHeaderItemfor the given reference.static JavaScriptReferenceHeaderItemforReference(ResourceReference reference, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id, boolean defer, java.lang.String charset)Creates aJavaScriptReferenceHeaderItemfor the given reference.static JavaScriptReferenceHeaderItemforReference(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 aJavaScriptReferenceHeaderItemfor the given reference.static JavaScriptContentHeaderItemforScript(java.lang.CharSequence javascript, java.lang.String id)Creates aJavaScriptContentHeaderItemfor the given content.static JavaScriptContentHeaderItemforScript(java.lang.CharSequence javascript, java.lang.String id, java.lang.String condition)Creates aJavaScriptContentHeaderItemfor the given content.static JavaScriptUrlReferenceHeaderItemforUrl(java.lang.String url)Creates aJavaScriptUrlReferenceHeaderItemfor the given url.static JavaScriptUrlReferenceHeaderItemforUrl(java.lang.String url, java.lang.String id)Creates aJavaScriptUrlReferenceHeaderItemfor the given url.static JavaScriptUrlReferenceHeaderItemforUrl(java.lang.String url, java.lang.String id, boolean defer)Creates aJavaScriptUrlReferenceHeaderItemfor the given url.static JavaScriptUrlReferenceHeaderItemforUrl(java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset)Creates aJavaScriptUrlReferenceHeaderItemfor the given url.static JavaScriptUrlReferenceHeaderItemforUrl(java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset, java.lang.String condition)Creates aJavaScriptUrlReferenceHeaderItemfor the given url.java.lang.StringgetCondition()java.lang.StringgetId()inthashCode()protected voidinternalRenderJavaScriptReference(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)JavaScriptHeaderItemsetId(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:
thisobject, 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 aJavaScriptReferenceHeaderItemfor the given reference.- Parameters:
reference- resource reference pointing to the javascript resource- Returns:
- A newly created
JavaScriptReferenceHeaderItemfor the given reference.
-
forReference
public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, java.lang.String id)
Creates aJavaScriptReferenceHeaderItemfor 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
JavaScriptReferenceHeaderItemfor the given reference.
-
forReference
public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, org.apache.wicket.request.mapper.parameter.PageParameters pageParameters, java.lang.String id)
Creates aJavaScriptReferenceHeaderItemfor 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
JavaScriptReferenceHeaderItemfor 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 aJavaScriptReferenceHeaderItemfor 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
JavaScriptReferenceHeaderItemfor the given reference.
-
forReference
public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, java.lang.String id, boolean defer)
Creates aJavaScriptReferenceHeaderItemfor 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
JavaScriptReferenceHeaderItemfor the given reference.
-
forReference
public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, boolean defer)
Creates aJavaScriptReferenceHeaderItemfor 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
JavaScriptReferenceHeaderItemfor 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 aJavaScriptReferenceHeaderItemfor 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
JavaScriptReferenceHeaderItemfor 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 aJavaScriptReferenceHeaderItemfor 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
JavaScriptReferenceHeaderItemfor the given reference.
-
forScript
public static JavaScriptContentHeaderItem forScript(java.lang.CharSequence javascript, java.lang.String id)
Creates aJavaScriptContentHeaderItemfor 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
JavaScriptContentHeaderItemfor the given content.
-
forScript
public static JavaScriptContentHeaderItem forScript(java.lang.CharSequence javascript, java.lang.String id, java.lang.String condition)
Creates aJavaScriptContentHeaderItemfor 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
JavaScriptContentHeaderItemfor the given content.
-
forUrl
public static JavaScriptUrlReferenceHeaderItem forUrl(java.lang.String url)
Creates aJavaScriptUrlReferenceHeaderItemfor the given url.- Parameters:
url- context-relative url of the the javascript resource- Returns:
- A newly created
JavaScriptUrlReferenceHeaderItemfor the given url.
-
forUrl
public static JavaScriptUrlReferenceHeaderItem forUrl(java.lang.String url, java.lang.String id)
Creates aJavaScriptUrlReferenceHeaderItemfor 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
JavaScriptUrlReferenceHeaderItemfor the given url.
-
forUrl
public static JavaScriptUrlReferenceHeaderItem forUrl(java.lang.String url, java.lang.String id, boolean defer)
Creates aJavaScriptUrlReferenceHeaderItemfor 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
JavaScriptUrlReferenceHeaderItemfor the given url.
-
forUrl
public static JavaScriptUrlReferenceHeaderItem forUrl(java.lang.String url, java.lang.String id, boolean defer, java.lang.String charset)
Creates aJavaScriptUrlReferenceHeaderItemfor 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
JavaScriptUrlReferenceHeaderItemfor 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 aJavaScriptUrlReferenceHeaderItemfor 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
JavaScriptUrlReferenceHeaderItemfor 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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-