Package org.apache.wicket.markup.head
Class JavaScriptHeaderItem
- java.lang.Object
-
- org.apache.wicket.markup.head.HeaderItem
-
- org.apache.wicket.markup.head.AbstractCspHeaderItem
-
- org.apache.wicket.markup.head.JavaScriptHeaderItem
-
- All Implemented Interfaces:
Serializable
,IClusterable
- Direct Known Subclasses:
AbstractJavaScriptReferenceHeaderItem
,JavaScriptContentHeaderItem
public abstract class JavaScriptHeaderItem extends AbstractCspHeaderItem
Base class for allHeaderItem
s that represent javascripts. This class mainly contains factory methods.- Author:
- papegaaij
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JavaScriptHeaderItem()
-
Method Summary
-
Methods inherited from class org.apache.wicket.markup.head.AbstractCspHeaderItem
getNonce, setNonce
-
Methods inherited from class org.apache.wicket.markup.head.HeaderItem
getDependencies, getProvidedResources, getRenderTokens, render
-
-
-
-
Constructor Detail
-
JavaScriptHeaderItem
public JavaScriptHeaderItem()
-
-
Method Detail
-
setId
public JavaScriptHeaderItem setId(String markupId)
Sets the markup id for this header item- Parameters:
markupId
- the markup id- Returns:
this
object, for method chaining
-
forReference
public static JavaScriptReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, 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, 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)
Creates aJavaScriptReferenceHeaderItem
for the given reference.- Parameters:
reference
- resource reference pointing to the JavaScript resource- Returns:
- A newly created
JavaScriptReferenceHeaderItem
for the given reference.
-
forScript
public static JavaScriptContentHeaderItem forScript(CharSequence javascript, 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.
-
forUrl
public static JavaScriptUrlReferenceHeaderItem forUrl(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(String url, 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.
-
-