|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.markup.head.HeaderItem org.apache.wicket.markup.head.CssHeaderItem
public abstract class CssHeaderItem
Base class for all HeaderItem
s that represent stylesheets. This class mainly contains
factory methods.
Constructor Summary | |
---|---|
protected |
CssHeaderItem(String condition)
|
Methods inherited from class org.apache.wicket.markup.head.HeaderItem |
---|
getDependencies, getProvidedResources, getRenderTokens, render |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected CssHeaderItem(String condition)
Method Detail |
---|
public String getCondition()
public static CssReferenceHeaderItem forReference(ResourceReference reference)
CssReferenceHeaderItem
for the given reference.
reference
- a reference to a CSS resource
CssReferenceHeaderItem
for the given reference.public static CssReferenceHeaderItem forReference(ResourceReference reference, String media)
CssReferenceHeaderItem
for the given reference.
reference
- a reference to a CSS resourcemedia
- the media type for this CSS ("print", "screen", etc.)
CssReferenceHeaderItem
for the given reference.public static CssReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String media)
CssReferenceHeaderItem
for the given reference.
reference
- a reference to a CSS resourcepageParameters
- the parameters for this CSS resource referencemedia
- the media type for this CSS ("print", "screen", etc.)
CssReferenceHeaderItem
for the given reference.public static CssReferenceHeaderItem forReference(ResourceReference reference, PageParameters pageParameters, String media, String condition)
CssReferenceHeaderItem
for the given reference.
Warning: the conditional comments don't work when injected dynamically
with JavaScript (i.e. in Ajax response). An alternative solution is to use user agent sniffing
at the server side:
public void renderHead(IHeaderResponse response) {
WebClientInfo clientInfo = (WebClientInfo) getSession().getClientInfo();
ClientProperties properties = clientInfo.getProperties();
if (properties.isBrowserInternetExplorer() && properties.getBrowserVersionMajor() >= 8) {
response.renderCSSReference(new PackageResourceReference(MyPage.class, "my-conditional.css" ));
}
}
reference
- a reference to a CSS resourcepageParameters
- the parameters for this CSS resource referencemedia
- the media type for this CSS ("print", "screen", etc.)condition
- the condition to use for Internet Explorer conditional comments. E.g. "IE 7".
CssReferenceHeaderItem
for the given reference.public static CssContentHeaderItem forCSS(CharSequence css, String id)
CssContentHeaderItem
for the given content.
css
- css content to be rendered.id
- unique id for the <style> element. This can be null
, however in
that case the ajax header contribution can't detect duplicate CSS fragments.
CssContentHeaderItem
for the given content.public static CssContentHeaderItem forCSS(CharSequence css, String id, String condition)
CssContentHeaderItem
for the given content.
Warning: the conditional comments don't work when injected dynamically
with JavaScript (i.e. in Ajax response). An alternative solution is to use user agent sniffing
at the server side:
public void renderHead(IHeaderResponse response) {
WebClientInfo clientInfo = (WebClientInfo) getSession().getClientInfo();
ClientProperties properties = clientInfo.getProperties();
if (properties.isBrowserInternetExplorer() && properties.getBrowserVersionMajor() >= 8) {
response.renderCSSReference(new PackageResourceReference(MyPage.class, "my-conditional.css" ));
}
}
css
- css content to be rendered.id
- unique id for the <style> element. This can be null
, however in
that case the ajax header contribution can't detect duplicate CSS fragments.condition
- the condition to use for Internet Explorer conditional comments. E.g. "IE 7".
CssContentHeaderItem
for the given content.public static CssUrlReferenceHeaderItem forUrl(String url)
CssUrlReferenceHeaderItem
for the given url.
url
- context-relative url of the CSS resource
CssUrlReferenceHeaderItem
for the given url.public static CssUrlReferenceHeaderItem forUrl(String url, String media)
CssUrlReferenceHeaderItem
for the given url.
url
- context-relative url of the CSS resourcemedia
- the media type for this CSS ("print", "screen", etc.)
CssUrlReferenceHeaderItem
for the given url.public static CssUrlReferenceHeaderItem forUrl(String url, String media, String condition)
CssUrlReferenceHeaderItem
for the given url.
Warning: the conditional comments don't work when injected dynamically
with JavaScript (i.e. in Ajax response). An alternative solution is to use user agent sniffing
at the server side:
public void renderHead(IHeaderResponse response) {
WebClientInfo clientInfo = (WebClientInfo) getSession().getClientInfo();
ClientProperties properties = clientInfo.getProperties();
if (properties.isBrowserInternetExplorer() && properties.getBrowserVersionMajor() >= 8) {
response.renderCSSReference(new PackageResourceReference(MyPage.class, "my-conditional.css" ));
}
}
url
- context-relative url of the CSS resourcemedia
- the media type for this CSS ("print", "screen", etc.)condition
- the condition to use for Internet Explorer conditional comments. E.g. "IE 7".
CssUrlReferenceHeaderItem
for the given url.protected final void internalRenderCSSReference(Response response, String url, String media, String condition)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |