This documentation is for an old version of fiftyfive-wicket (2.0.9).


fiftyfive.wicket.css
Class InternetExplorerCss

java.lang.Object
  extended by fiftyfive.wicket.css.InternetExplorerCss
All Implemented Interfaces:
Serializable, IClusterable, IHeaderContributor

public abstract class InternetExplorerCss
extends Object
implements IHeaderContributor

This class contains static methods for injecting conditional stylesheet references into the HTML header. These methods will create markup like this:

 <!--[if condition]>
 <link rel="stylesheet" type="text/css" href="..." />
 <![endif]-->

In non-Internet Explorer browsers, this stylesheet reference will be ignored. But in IE, the stylesheet will be loaded as long as the condition is met. For example, if the condition is IE 7, the stylesheet will be loaded only in IE7 browsers. Another example: gte IE 7 will load in browsers IE7 or greater.

Here's how you might use it in your Wicket page:

 // Add a <link> to the ie-7.css stylesheet for IE7 browsers only
 add(InternetExplorerCss.getConditionalHeaderContribution("IE 7", "styles/ie-7.css"));

See Also:
MSDN Reference, Serialized Form

Constructor Summary
protected InternetExplorerCss(String condition, List<? extends Serializable> token)
          Internal use only.
 
Method Summary
protected abstract  void doLinkRender(IHeaderResponse response)
          Override to render the stylesheet link element.
static HeaderContributor getConditionalHeaderContribution(String condition, ResourceReference cssReference)
          Creates a Wicket HeaderContributor for the specified stylesheet.
static HeaderContributor getConditionalHeaderContribution(String condition, ResourceReference cssReference, String media)
          Creates a Wicket HeaderContributor for the specified stylesheet and media type.
static HeaderContributor getConditionalHeaderContribution(String condition, String contextRelativeUri)
          Creates a Wicket HeaderContributor for the specified stylesheet.
static HeaderContributor getConditionalHeaderContribution(String condition, String contextRelativeUri, String media)
          Creates a Wicket HeaderContributor for the specified stylesheet and media type.
 void renderHead(IHeaderResponse response)
          Renders the conditional Internet Explorer comment, delegating to doLinkRender(org.apache.wicket.markup.html.IHeaderResponse) to render the actual link element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InternetExplorerCss

protected InternetExplorerCss(String condition,
                              List<? extends Serializable> token)
Internal use only.

Method Detail

getConditionalHeaderContribution

public static HeaderContributor getConditionalHeaderContribution(String condition,
                                                                 ResourceReference cssReference)
Creates a Wicket HeaderContributor for the specified stylesheet. The stylesheet will only load in Internet Explorer versions that meet the specified condition.

Parameters:
condition - The IE version for which this stylesheet applies. Examples: "IE 7", "gte IE 7".
cssReference - A reference to the stylesheet.
Returns:
A HeaderContributor that should be added to your page. Adding it to the page will cause the appropriate markup to be emitted in the HTML header.

getConditionalHeaderContribution

public static HeaderContributor getConditionalHeaderContribution(String condition,
                                                                 ResourceReference cssReference,
                                                                 String media)
Creates a Wicket HeaderContributor for the specified stylesheet and media type. The stylesheet will only load in Internet Explorer versions that meet the specified condition.

Parameters:
condition - The IE version for which this stylesheet applies. Examples: "IE 7", "gte IE 7".
cssReference - A reference to the stylesheet.
media - The CSS media type, like "screen" or "print".
Returns:
A HeaderContributor that should be added to your page. Adding it to the page will cause the appropriate markup to be emitted in the HTML header.

getConditionalHeaderContribution

public static HeaderContributor getConditionalHeaderContribution(String condition,
                                                                 String contextRelativeUri)
Creates a Wicket HeaderContributor for the specified stylesheet. The stylesheet will only load in Internet Explorer versions that meet the specified condition.

Parameters:
condition - The IE version for which this stylesheet applies. Examples: "IE 7", "gte IE 7".
contextRelativeUri - The URI to the stylesheet. If starting with "/", "http:" or "https:", the URI will be emitted as-is. Otherwise the URI is prepended with the context path to make it absolute.
Returns:
A HeaderContributor that should be added to your page. Adding it to the page will cause the appropriate markup to be emitted in the HTML header.

getConditionalHeaderContribution

public static HeaderContributor getConditionalHeaderContribution(String condition,
                                                                 String contextRelativeUri,
                                                                 String media)
Creates a Wicket HeaderContributor for the specified stylesheet and media type. The stylesheet will only load in Internet Explorer versions that meet the specified condition.

Parameters:
condition - The IE version for which this stylesheet applies. Examples: "IE 7", "gte IE 7".
contextRelativeUri - The URI to the stylesheet. If starting with "/", "http:" or "https:", the URI will be emitted as-is. Otherwise the URI is modified so that it resolves relative to the context path (/app-name).
media - The CSS media type, like "screen" or "print".
Returns:
A HeaderContributor that should be added to your page. Adding it to the page will cause the appropriate markup to be emitted in the HTML header.

renderHead

public void renderHead(IHeaderResponse response)
Renders the conditional Internet Explorer comment, delegating to doLinkRender(org.apache.wicket.markup.html.IHeaderResponse) to render the actual link element.

Specified by:
renderHead in interface IHeaderContributor

doLinkRender

protected abstract void doLinkRender(IHeaderResponse response)
Override to render the stylesheet link element.



Copyright © 2011 55 Minutes. All Rights Reserved.