Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.theme
Class Theme

java.lang.Object
  extended by com.jivesoftware.base.theme.Theme

public class Theme
extends java.lang.Object

A theme is a way to override the user interface in an application. This class is a simple bean which holds meta information about a theme like name, the decorator (the main theme template) and the locale the theme is tied to. A theme can also contain a set of properties.


Constructor Summary
Theme()
           
Theme(java.lang.String name, java.lang.String decorator, java.util.Locale locale, java.util.Properties properties)
           
 
Method Summary
 boolean getBooleanProperty(java.lang.String name)
          Returns the specified property as a boolean or returns false if the property doesn't exist or isn't parseable.
 boolean getBooleanProperty(java.lang.String name, boolean defaultValue)
          Returns the specified property as a boolean or returns defaultValue if the property doesn't exist or isn't parseable.
 java.lang.String getDecorator()
          Gets the name of the decorator file for this theme.
 int getIntProperty(java.lang.String name, int defaultValue)
          Returns the specified property as an integer or returns the defaultValue if the property does't exist or the value isn't a number.
 java.util.Locale getLocale()
          Gets the locale for this theme.
 java.lang.String getName()
          Gets the name of this theme.
 java.lang.String getProperty(java.lang.String name)
          Returns the value of the specified property or null if the value doesn't exist.
 java.lang.String getProperty(java.lang.String name, java.lang.String defaultValue)
          Returns a theme property.
 java.util.Set getPropertyNames()
          Returns all theme property names.
 boolean validate()
          Reutrns true if all required properties (name, decorator) of this theme exist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Theme

public Theme()

Theme

public Theme(java.lang.String name,
             java.lang.String decorator,
             java.util.Locale locale,
             java.util.Properties properties)
Method Detail

getDecorator

public java.lang.String getDecorator()
Gets the name of the decorator file for this theme. The ThemeManager will look for this decorator in /templates/ folder. The decorator is specified in the theme.xml as follows: default.ftl.

Returns:
the name of the decorator file for this theme.

getName

public java.lang.String getName()
Gets the name of this theme. Note: The name of the theme is the same as the name of the folder containing the theme.

Returns:
the name of this theme.

getLocale

public java.util.Locale getLocale()
Gets the locale for this theme. If a locale exists, it will be used for all pages associated with this theme. The locale is specified in the theme.xml as follows: en_US.

Returns:
the locale for this theme.

getProperty

public java.lang.String getProperty(java.lang.String name)
Returns the value of the specified property or null if the value doesn't exist.

Parameters:
name - the name of the property to return.
Returns:
the property value specified by name or null if it doesn't exist.

getProperty

public java.lang.String getProperty(java.lang.String name,
                                    java.lang.String defaultValue)
Returns a theme property. If the specified property doesn't exist, the defaultValue will be returned.

Parameters:
name - the name of the property.
defaultValue - value returned if the property doesn't exist.
Returns:
the property value specified by name or the defaultValue if the property doesn't exist.

getPropertyNames

public java.util.Set getPropertyNames()
Returns all theme property names.

Returns:
a Set of all property names (Strings).

getIntProperty

public int getIntProperty(java.lang.String name,
                          int defaultValue)
Returns the specified property as an integer or returns the defaultValue if the property does't exist or the value isn't a number.

Parameters:
name - the name of the property.
defaultValue - value returned if the property doesn't exist or was not a number.
Returns:
the property value specified by name or defaultValue.

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name)
Returns the specified property as a boolean or returns false if the property doesn't exist or isn't parseable.

Parameters:
name - the name of the property to return.
Returns:
true if the property value exists and is set to "true" (ignoring case). Otherwise false is returned.

getBooleanProperty

public boolean getBooleanProperty(java.lang.String name,
                                  boolean defaultValue)
Returns the specified property as a boolean or returns defaultValue if the property doesn't exist or isn't parseable.

Parameters:
name - the name of the property.
defaultValue - value returned if the property doesn't exist.
Returns:
true if the property value exists and is set to "true" or false if the property value is "false" (ignoring case). If the value isn't set or isn't parseable then defaultValue is returned.

validate

public boolean validate()
Reutrns true if all required properties (name, decorator) of this theme exist. Returns false otherwise.

Returns:
true if all required properties (name, decorator) exist, false otherwise.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.