org.jasig.portal
Class StylesheetSet

java.lang.Object
  extended by org.jasig.portal.utils.SAX2FilterImpl
      extended by org.jasig.portal.StylesheetSet
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler, XMLFilter, XMLReader

public class StylesheetSet
extends SAX2FilterImpl

A tool for managing a collection of stylesheets. StylesheetSet allows you to instansiate a list of stylesheets in memory and select one according to the request/title/media parameters.

Version:
$Revision: 19776 $
Author:
Peter Kharchenko

Field Summary
protected static String m_defaultMediaPropsUri
           
protected static Hashtable m_mediaPropsCache
           
protected  String m_myMediaPropsUri
           
protected  Hashtable title_table
           
 
Fields inherited from class org.jasig.portal.utils.SAX2FilterImpl
contentHandler, dtdHandler, entityResolver, errorHandler, lexicalHandler, locator
 
Constructor Summary
StylesheetSet()
           
StylesheetSet(ContentHandler dt)
          Create a SAX filter that will pick up stylesheet bindings in a document that's processed through this filter.
StylesheetSet(String uri)
          Creates a new StylesheetSet instance given a .ssl file URI.
 
Method Summary
 void addStyleSheet(StylesheetDescription sd)
          Add a stylesheet to the list.
protected  String getMedia(BrowserInfo bi)
           
protected  String getMedia(HttpServletRequest req)
           
protected  org.jasig.portal.StylesheetSet.OrderedProps getMediaProps()
           
 Source getStylesheet()
          Obtains a default stylesheet.
 Source getStylesheet(HttpServletRequest req)
          Obtain a stylesheet source.
 Source getStylesheet(String title)
          Obtain a stylesheet transform source
 Source getStylesheet(String title, BrowserInfo bi)
          Obtain a stylesheet
 Source getStylesheet(String title, HttpServletRequest req)
          Obtain a stylesheet source.
 Source getStylesheet(String title, String media)
          Obtain a stylesheet.
 Source getStylesheetByMedia(String media)
          Obtain a stylesheet for a given media.
protected  StylesheetDescription getStylesheetDescription(String media)
           
 String getStylesheetURI(BrowserInfo bi)
          Obtain a matching stylesheet URI
 String getStylesheetURI(HttpServletRequest req)
          Obtain a matching stylesheet.
 String getStylesheetURI(String media)
          Returns the URI of the stylesheet matching the media
 String getStylesheetURI(String title, BrowserInfo bi)
          Describe getStylesheetURI method here.
 String getStylesheetURI(String title, HttpServletRequest req)
          Obtain stylesheet URI
 String getStylesheetURI(String title, String media)
          Obtain a stylesheet URI
protected  Hashtable getTitleTable()
           
 void processingInstruction(String target, String data)
          Fills StylesheetSet by accepting SAX events
 void setMediaProps(String uri)
          Set the location of the media properties object.
 
Methods inherited from class org.jasig.portal.utils.SAX2FilterImpl
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, resolveEntity, setAllHandlers, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setLexicalHandler, setParent, setProperty, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_defaultMediaPropsUri

protected static final String m_defaultMediaPropsUri
See Also:
Constant Field Values

m_mediaPropsCache

protected static Hashtable m_mediaPropsCache

m_myMediaPropsUri

protected String m_myMediaPropsUri

title_table

protected Hashtable title_table
Constructor Detail

StylesheetSet

public StylesheetSet()

StylesheetSet

public StylesheetSet(ContentHandler dt)
Create a SAX filter that will pick up stylesheet bindings in a document that's processed through this filter.

Parameters:
dt - a ContentHandler of the downstream SAX listener..

StylesheetSet

public StylesheetSet(String uri)
              throws PortalException
Creates a new StylesheetSet instance given a .ssl file URI.

Parameters:
uri - a String value
Throws:
PortalException - if an error occurs
Method Detail

getStylesheet

public Source getStylesheet(String title)
Obtain a stylesheet transform source

Parameters:
title - a String value
Returns:
a Source for a given stylesheet

getStylesheet

public Source getStylesheet()
Obtains a default stylesheet.

Returns:
a Source for a default stylesheet.

getStylesheet

public Source getStylesheet(String title,
                            String media)
Obtain a stylesheet.

Parameters:
title - stylesheet title
media - stylesheet media
Returns:
a Source for the stylesheet.

getStylesheet

public Source getStylesheet(String title,
                            BrowserInfo bi)
                     throws PortalException
Obtain a stylesheet

Parameters:
title - stylesheet title
bi - current BrowserInfo value
Returns:
a Source for the stylesheet
Throws:
PortalException - if an error occurs

getStylesheetURI

public String getStylesheetURI(String media)
                        throws GeneralRenderingException
Returns the URI of the stylesheet matching the media

Parameters:
media -
Returns:
the stylesheet URI
Throws:
GeneralRenderingException

getStylesheetURI

public String getStylesheetURI(HttpServletRequest req)
                        throws PortalException
Obtain a matching stylesheet.

Parameters:
req - current request value.
Returns:
a String stylesheet URI
Throws:
PortalException - if an error occurs

getStylesheetURI

public String getStylesheetURI(BrowserInfo bi)
                        throws PortalException
Obtain a matching stylesheet URI

Parameters:
bi - a BrowserInfo value
Returns:
a String styleshet
Throws:
PortalException - if an error occurs

getStylesheetURI

public String getStylesheetURI(String title,
                               HttpServletRequest req)
                        throws PortalException
Obtain stylesheet URI

Parameters:
title - stylesheet title
req - a HttpServletRequest value
Returns:
a String stylesheet URI
Throws:
PortalException - if an error occurs

getStylesheetURI

public String getStylesheetURI(String title,
                               BrowserInfo bi)
                        throws PortalException
Describe getStylesheetURI method here.

Parameters:
title - a stylesheet title
bi - a BrowserInfo value
Returns:
a String stylesheet URI
Throws:
PortalException - if an error occurs

getStylesheetURI

public String getStylesheetURI(String title,
                               String media)
                        throws GeneralRenderingException
Obtain a stylesheet URI

Parameters:
title - stylesheet title
media - media value
Returns:
a String stylesheet URI
Throws:
GeneralRenderingException - if an error occurs

getStylesheetDescription

protected StylesheetDescription getStylesheetDescription(String media)
                                                  throws GeneralRenderingException
Throws:
GeneralRenderingException

getStylesheet

public Source getStylesheet(String title,
                            HttpServletRequest req)
                     throws PortalException
Obtain a stylesheet source.

Parameters:
title - stylesheet title
req - current request
Returns:
a Source for the stylesheet.
Throws:
PortalException - if an error occurs

getStylesheet

public Source getStylesheet(HttpServletRequest req)
                     throws PortalException
Obtain a stylesheet source.

Parameters:
req - an HttpServletRequest value
Returns:
a Source for the stylesheet
Throws:
PortalException - if an error occurs

getStylesheetByMedia

public Source getStylesheetByMedia(String media)
                            throws GeneralRenderingException
Obtain a stylesheet for a given media.

Parameters:
media - desired media
Returns:
a Source for the stylesheet.
Throws:
GeneralRenderingException - if an error occurs

addStyleSheet

public void addStyleSheet(StylesheetDescription sd)
Add a stylesheet to the list.

Parameters:
sd - a StylesheetDescription value

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Fills StylesheetSet by accepting SAX events

Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class SAX2FilterImpl
Parameters:
target -
data -
Throws:
SAXException
See Also:
ContentHandler.processingInstruction(java.lang.String, java.lang.String)

getMediaProps

protected org.jasig.portal.StylesheetSet.OrderedProps getMediaProps()
                                                             throws PortalException
Throws:
PortalException

setMediaProps

public void setMediaProps(String uri)
                   throws PortalException
Set the location of the media properties object.

Parameters:
uri - a String value
Throws:
PortalException - if an error occurs

getTitleTable

protected Hashtable getTitleTable()

getMedia

protected String getMedia(HttpServletRequest req)
                   throws PortalException
Throws:
PortalException

getMedia

protected String getMedia(BrowserInfo bi)
                   throws PortalException
Throws:
PortalException


Copyright © 2010 Jasig. All Rights Reserved.