public class YuiContext extends Object implements IYuiContext
YuiHeaderCache
service for loading/caching YUI-modules and header
contributions.
Note: the addModule(String module)
method will load the provided module within the
YahooNamespace
scope.
IYuiContext
,
Serialized FormConstructor and Description |
---|
YuiContext(YuiHeaderCache cache) |
Modifier and Type | Method and Description |
---|---|
void |
addCssReference(org.apache.wicket.request.resource.ResourceReference reference)
Helper method for adding css reference
|
void |
addJavascriptReference(org.apache.wicket.request.resource.ResourceReference reference)
Helper method for adding a javascript reference
|
void |
addModule(String module)
Load YUI module from the
YahooNamespace context |
void |
addModule(org.onehippo.yui.YuiNamespace ns,
String module)
Load YUI module from the specified
YuiNamespace context |
void |
addOnDomLoad(org.apache.wicket.model.IModel<String> model)
Add dynamic javascript that will be executed on the browsers' dom-ready event.
|
void |
addOnDomLoad(String string)
Add static javascript
String that will be executed on the browsers' dom-ready event |
void |
addOnWinLoad(org.apache.wicket.model.IModel<String> model)
Add dynamic javascript that will be executed on the browsers' window-load event.
|
void |
addOnWinLoad(String string)
Add static javascript
String that will be executed on the browsers' window-load event |
void |
addTemplate(Class<?> clazz,
String filename,
Map<String,Object> parameters)
Add a static
TextTemplate to the response. |
void |
addTemplate(DynamicTextTemplate template)
Add a
DynamicTextTemplate to the response. |
void |
addTemplate(FinalTextTemplate template)
Add a static template to the response.
|
void |
addTemplate(org.apache.wicket.markup.html.IHeaderContributor template)
Add a generic template to the header response.
|
org.apache.wicket.markup.head.HeaderItem |
getHeaderItem()
Return a header item for the modules and references
|
void |
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) |
public YuiContext(YuiHeaderCache cache)
public void addModule(String module)
IYuiContext
YahooNamespace
contextaddModule
in interface IYuiContext
module
- YUI module namepublic void addModule(org.onehippo.yui.YuiNamespace ns, String module)
IYuiContext
YuiNamespace
contextaddModule
in interface IYuiContext
ns
- YuiNamespace
to use as context for modulemodule
- YUI module namepublic void addTemplate(FinalTextTemplate template)
IYuiContext
addTemplate
in interface IYuiContext
template
- TextTemplate
that will be added to the response.public void addTemplate(Class<?> clazz, String filename, Map<String,Object> parameters)
IYuiContext
TextTemplate
to the response. The model provided by the parameters Map
is final.addTemplate
in interface IYuiContext
clazz
- Class that acts as contextfilename
- Name of file relative to provided classparameters
- Parameters that will be interpolated with the TextTemplate
public void addTemplate(DynamicTextTemplate template)
IYuiContext
DynamicTextTemplate
to the response. The model will be refreshed upon every request.addTemplate
in interface IYuiContext
template
- DynamicTextTemplate
that will be added to the response.public void addTemplate(org.apache.wicket.markup.html.IHeaderContributor template)
IYuiContext
addTemplate
in interface IYuiContext
public void addCssReference(org.apache.wicket.request.resource.ResourceReference reference)
IYuiContext
addCssReference
in interface IYuiContext
reference
- ResourceReference
that should be added to the headpublic void addJavascriptReference(org.apache.wicket.request.resource.ResourceReference reference)
IYuiContext
addJavascriptReference
in interface IYuiContext
reference
- ResourceReference
that should be added to the headpublic void addOnDomLoad(String string)
IYuiContext
String
that will be executed on the browsers' dom-ready eventaddOnDomLoad
in interface IYuiContext
string
- String
of javascript code that will be executed on the client.public void addOnDomLoad(org.apache.wicket.model.IModel<String> model)
IYuiContext
addOnDomLoad
in interface IYuiContext
model
- IModel
which returns javascript code that will be executed on the client.public void addOnWinLoad(String string)
IYuiContext
String
that will be executed on the browsers' window-load eventaddOnWinLoad
in interface IYuiContext
string
- String
of javascript code that will be executed on the client.public void addOnWinLoad(org.apache.wicket.model.IModel<String> model)
IYuiContext
addOnWinLoad
in interface IYuiContext
model
- IModel
which returns javascript code that will be executed on the client.public org.apache.wicket.markup.head.HeaderItem getHeaderItem()
IYuiContext
getHeaderItem
in interface IYuiContext
public void renderHead(org.apache.wicket.markup.head.IHeaderResponse response)
renderHead
in interface org.apache.wicket.markup.html.IHeaderContributor
public void renderOnloads(Set<org.hippoecm.frontend.plugins.yui.header.YuiContext.Onload> _onloads, org.apache.wicket.markup.head.IHeaderResponse response)
Copyright © 2007–2017 Hippo B.V. (http://www.onehippo.com). All rights reserved.