FacesBean bean) throws IOException
{
ResponseWriter writer = context.getResponseWriter();
StyleContext sContext = ((CoreRenderingContext) arc).getStyleContext();
StyleProvider provider = sContext.getStyleProvider();
if (provider != null)
{
List<String> uris = provider.getStyleSheetURIs(sContext);
// If the requestMap has a skin-id, a skin's stylesheet's id and suppressStylesheet
// is true, and the skin information matches our current skin, then it is safe
// to not write out the css. This means that it will be written out by the external
// source, like the portal container.
boolean suppressStylesheet = _isSuppressStylesheet(context, arc);
if (!suppressStylesheet)
{
if (uris != null && !uris.isEmpty())
{
ExternalContext externalContext = context.getExternalContext();
String contextUri = externalContext.getRequestContextPath();
String baseURL = contextUri + XhtmlConstants.STYLES_CACHE_DIRECTORY;
String outputMode = arc.getOutputMode();
// =-=AEW Don't like hardcoding facet names...
if (XhtmlConstants.OUTPUT_MODE_PORTLET.equals(outputMode) &&
supportsScripting(arc))
{
writer.startElement("script", null);
writer.writeText("var _adfSS;if(!_adfSS){_adfSS=1;", null);
for (String uri : uris)
{
writer.writeText("document.write(\"" +
"<link rel=\\\"stylesheet\\\" "+
"charset=\\\"UTF-8\\\" type=\\\"text/css\\\" " +
"href=\\\"",
null);
uri = context.getExternalContext().encodeResourceURL(baseURL + uri);
writer.writeText(uri, null);
writer.writeText("\\\">\");", null);
}
writer.writeText("}", null);
writer.endElement("script");
}
else
{
for (String uri : uris)
{
writer.startElement("link", null);
renderId(context, comp);
writer.writeAttribute("rel", "stylesheet", null);
writer.writeAttribute("charset", "UTF-8", null);
String type = provider.getContentStyleType(sContext);
writer.writeAttribute("type", type, null);
renderEncodedResourceURI(context, "href", baseURL + uri);
writer.endElement("link");
}