Class YuiContext
- java.lang.Object
-
- org.hippoecm.frontend.plugins.yui.header.YuiContext
-
- All Implemented Interfaces:
Serializable
,org.apache.wicket.markup.html.IHeaderContributor
,org.apache.wicket.util.io.IClusterable
,IYuiContext
public class YuiContext extends Object implements IYuiContext
The YuiContext uses the sharedYuiHeaderCache
service for loading/caching YUI-modules and header contributions.Note: the
addModule(String module)
method will load the provided module within theYahooNamespace
scope.- See Also:
IYuiContext
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description YuiContext(YuiHeaderCache cache)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCssReference(org.apache.wicket.request.resource.ResourceReference reference)
Helper method for adding css referencevoid
addJavascriptReference(org.apache.wicket.request.resource.ResourceReference reference)
Helper method for adding a javascript referencevoid
addModule(String module)
Load YUI module from theYahooNamespace
contextvoid
addModule(org.onehippo.yui.YuiNamespace ns, String module)
Load YUI module from the specifiedYuiNamespace
contextvoid
addOnDomLoad(String string)
Add static javascriptString
that will be executed on the browsers' dom-ready eventvoid
addOnDomLoad(org.apache.wicket.model.IModel<String> model)
Add dynamic javascript that will be executed on the browsers' dom-ready event.void
addOnWinLoad(String string)
Add static javascriptString
that will be executed on the browsers' window-load eventvoid
addOnWinLoad(org.apache.wicket.model.IModel<String> model)
Add dynamic javascript that will be executed on the browsers' window-load event.void
addTemplate(Class<?> clazz, String filename, Map<String,Object> parameters)
Add a staticTextTemplate
to the response.void
addTemplate(org.apache.wicket.markup.html.IHeaderContributor template)
Add a generic template to the header response.void
addTemplate(DynamicTextTemplate template)
Add aDynamicTextTemplate
to the response.void
addTemplate(FinalTextTemplate template)
Add a static template to the response.org.apache.wicket.markup.head.HeaderItem
getHeaderItem()
Return a header item for the modules and referencesvoid
renderHead(org.apache.wicket.markup.head.IHeaderResponse response)
void
renderOnloads(Set<org.hippoecm.frontend.plugins.yui.header.YuiContext.Onload> _onloads, org.apache.wicket.markup.head.IHeaderResponse response)
-
-
-
Constructor Detail
-
YuiContext
public YuiContext(YuiHeaderCache cache)
-
-
Method Detail
-
addModule
public void addModule(String module)
Description copied from interface:IYuiContext
Load YUI module from theYahooNamespace
context- Specified by:
addModule
in interfaceIYuiContext
- Parameters:
module
- YUI module name
-
addModule
public void addModule(org.onehippo.yui.YuiNamespace ns, String module)
Description copied from interface:IYuiContext
Load YUI module from the specifiedYuiNamespace
context- Specified by:
addModule
in interfaceIYuiContext
- Parameters:
ns
-YuiNamespace
to use as context for modulemodule
- YUI module name
-
addTemplate
public void addTemplate(FinalTextTemplate template)
Description copied from interface:IYuiContext
Add a static template to the response.- Specified by:
addTemplate
in interfaceIYuiContext
- Parameters:
template
-TextTemplate
that will be added to the response.
-
addTemplate
public void addTemplate(Class<?> clazz, String filename, Map<String,Object> parameters)
Description copied from interface:IYuiContext
Add a staticTextTemplate
to the response. The model provided by the parametersMap
is final.- Specified by:
addTemplate
in interfaceIYuiContext
- Parameters:
clazz
- Class that acts as contextfilename
- Name of file relative to provided classparameters
- Parameters that will be interpolated with theTextTemplate
-
addTemplate
public void addTemplate(DynamicTextTemplate template)
Description copied from interface:IYuiContext
Add aDynamicTextTemplate
to the response. The model will be refreshed upon every request.- Specified by:
addTemplate
in interfaceIYuiContext
- Parameters:
template
-DynamicTextTemplate
that will be added to the response.
-
addTemplate
public void addTemplate(org.apache.wicket.markup.html.IHeaderContributor template)
Description copied from interface:IYuiContext
Add a generic template to the header response. This method should replace the other add*Template methods.- Specified by:
addTemplate
in interfaceIYuiContext
-
addCssReference
public void addCssReference(org.apache.wicket.request.resource.ResourceReference reference)
Description copied from interface:IYuiContext
Helper method for adding css reference- Specified by:
addCssReference
in interfaceIYuiContext
- Parameters:
reference
-ResourceReference
that should be added to the head
-
addJavascriptReference
public void addJavascriptReference(org.apache.wicket.request.resource.ResourceReference reference)
Description copied from interface:IYuiContext
Helper method for adding a javascript reference- Specified by:
addJavascriptReference
in interfaceIYuiContext
- Parameters:
reference
-ResourceReference
that should be added to the head
-
addOnDomLoad
public void addOnDomLoad(String string)
Description copied from interface:IYuiContext
Add static javascriptString
that will be executed on the browsers' dom-ready event- Specified by:
addOnDomLoad
in interfaceIYuiContext
- Parameters:
string
-String
of javascript code that will be executed on the client.
-
addOnDomLoad
public void addOnDomLoad(org.apache.wicket.model.IModel<String> model)
Description copied from interface:IYuiContext
Add dynamic javascript that will be executed on the browsers' dom-ready event.- Specified by:
addOnDomLoad
in interfaceIYuiContext
- Parameters:
model
-IModel
which returns javascript code that will be executed on the client.
-
addOnWinLoad
public void addOnWinLoad(String string)
Description copied from interface:IYuiContext
Add static javascriptString
that will be executed on the browsers' window-load event- Specified by:
addOnWinLoad
in interfaceIYuiContext
- Parameters:
string
-String
of javascript code that will be executed on the client.
-
addOnWinLoad
public void addOnWinLoad(org.apache.wicket.model.IModel<String> model)
Description copied from interface:IYuiContext
Add dynamic javascript that will be executed on the browsers' window-load event.- Specified by:
addOnWinLoad
in interfaceIYuiContext
- Parameters:
model
-IModel
which returns javascript code that will be executed on the client.
-
getHeaderItem
public org.apache.wicket.markup.head.HeaderItem getHeaderItem()
Description copied from interface:IYuiContext
Return a header item for the modules and references- Specified by:
getHeaderItem
in interfaceIYuiContext
-
renderHead
public void renderHead(org.apache.wicket.markup.head.IHeaderResponse response)
- Specified by:
renderHead
in interfaceorg.apache.wicket.markup.html.IHeaderContributor
-
renderOnloads
public void renderOnloads(Set<org.hippoecm.frontend.plugins.yui.header.YuiContext.Onload> _onloads, org.apache.wicket.markup.head.IHeaderResponse response)
-
-