org.millstone.webadapter
Class Theme

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--org.millstone.webadapter.Theme
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class Theme
extends org.xml.sax.helpers.DefaultHandler

This class provides an interface to the meta-information regarding a particular webadapter theme. This entails for instanace the inheritance tree of the various xsl-template files, the different requirments that the theme imposes on the client browser, etc.

The WebAdapter uses themes to convert the UIDL description into client representation, typically HTML or XHTML. A theme consists of set of XSL template files which are used to perform XSL transform.

XSL files are divided into sets, which can have requirements. A file set is included in transformation only if the given requirements are met. Following requirements are supported:

Additionally following boolean operators may be applied to above requirements: The requirements are introduced in XML description file. See example below.

The theme description is XML data, and it can be loaded from file or stream. The default filename is specified by Theme.DESCRIPTIONFILE. Example of theme description file:

  <?xml version="1.0" encoding="UTF-8"?>

	<theme name="normal">
 
	<extends theme="simple"/>
     
	<description>The normal theme for all browsers</description>
 	<author name="IT Mill Ltd" email="millstone@itmill.com" />

		<fileset>
  		<require>
   			<supports javascript="JavaScript 1.0"/>
   		</require>

			<file name="common/error.xsl" /> 
			<file name="components/button.xsl" /> 
			<file name="components/select.xsl" />
			<file name="components/textfield.xsl" />
			<file name="components/table.xsl" />
 		</fileset>
 	</theme>
  

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.

Nested Class Summary
 class Theme.AgentRequirement
          HTTP user agent requirement This requirements is used to ensure that the User-Agent string provided in HTTP request headers contains given substring.
 class Theme.AndRequirement
          Logical AND requirement.
 class Theme.Author
          Author information class.
 class Theme.File
          Theme XSL file description Description of a single XSL file included a theme.
 class Theme.Fileset
          A recursive set of files sharing the same requirements.
 class Theme.JavaScriptRequirement
          Javascript version requirement This requirement is used to ensure a certain level of JavaScript version support.
 class Theme.MarkupLanguageRequirement
          Markup language version requirement This requirement is used to ensure a certain level of Markup language version support.
 class Theme.NotRequirement
          Logical NOT requirement.
 class Theme.OrRequirement
          Logical OR requirement.
static interface Theme.Requirement
          Generic requirement.
static interface Theme.RequirementCollection
          Generic requirement collection interface.
 
Field Summary
static java.lang.String DESCRIPTIONFILE
          Default description file name.
 
Constructor Summary
Theme(java.io.File descriptionFile)
          Creates a new instance using XML description file.
Theme(java.io.InputStream descriptionStream)
          Creates a new instance using XML description stream.
 
Method Summary
 void characters(char[] data, int start, int length)
          Parse character data in XML stream.
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Parse end tag in XML stream.
 Theme.Author getAuthor()
          Returns the author of this theme.
 java.util.List getFileNames()
          Get list of all files in this theme.
 java.util.List getFileNames(WebBrowser terminal)
          Get list of file names matching WebBrowserType.
 java.lang.String getName()
          Returns the name of this theme.
 java.util.List getParentThemes()
          Returns the list of parent themes of this theme.
 java.lang.String getVersion()
          Returns the version of this theme.
 void startElement(java.lang.String uri, java.lang.String local, java.lang.String qName, org.xml.sax.Attributes atts)
          Parse start tag in XML stream.
 java.lang.String toString()
          String representation of Theme object.
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DESCRIPTIONFILE

public static final java.lang.String DESCRIPTIONFILE
Default description file name.

See Also:
Constant Field Values
Constructor Detail

Theme

public Theme(java.io.File descriptionFile)
      throws java.io.FileNotFoundException
Creates a new instance using XML description file. Instantiate new theme, by loading the description from given File.

Parameters:
descriptionFile - Description file
Throws:
java.io.FileNotFoundException - Thrown if the given file is not found.

Theme

public Theme(java.io.InputStream descriptionStream)
Creates a new instance using XML description stream. Instantiate new theme, by loading the description from given InputSource.

Parameters:
descriptionStream - XML input to parse
Method Detail

startElement

public void startElement(java.lang.String uri,
                         java.lang.String local,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
Parse start tag in XML stream.

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Parse end tag in XML stream.

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException
See Also:
ContentHandler.endElement(String, String, String)

characters

public void characters(char[] data,
                       int start,
                       int length)
Parse character data in XML stream.

Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler
See Also:
ContentHandler.characters(char[], int, int)

getFileNames

public java.util.List getFileNames()
Get list of all files in this theme.

Returns:
List of filenames belonging to this theme.

getFileNames

public java.util.List getFileNames(WebBrowser terminal)
Get list of file names matching WebBrowserType.

Returns:
list of filenames in this theme supporting the given terminal.

toString

public java.lang.String toString()
String representation of Theme object. Used for debugging purposes only.

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

getAuthor

public Theme.Author getAuthor()
Returns the author of this theme.

Returns:
Author of the theme.

getName

public java.lang.String getName()
Returns the name of this theme.

Returns:
Name of the theme.

getParentThemes

public java.util.List getParentThemes()
Returns the list of parent themes of this theme. Returns list of all inherited themes in the inheritance order.

Returns:
List of parent theme instances.

getVersion

public java.lang.String getVersion()
Returns the version of this theme.

Returns:
Version string


Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.