org.norther.tammi.spray.template
Class DefaultSkinFilter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.spray.filter.DefaultFilter
          extended by org.norther.tammi.spray.filter.DefaultKeyFilter
              extended by org.norther.tammi.spray.template.DefaultSkinFilter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Manageable, MBeanDelegate, KeyFilter, SkinFilter

public class DefaultSkinFilter
extends DefaultKeyFilter
implements SkinFilter

A default implementation of SkinFilter.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static String SKIN_KEY
          The default key for the skin.
 
Fields inherited from class org.norther.tammi.spray.filter.DefaultKeyFilter
DEFAULT_KEY
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultSkinFilter()
          Constructs a new filter.
DefaultSkinFilter(String key)
          Constructs a new filter with a key.
 
Method Summary
 boolean addSkinName(String name)
          Adds a named skin if absent.
 void clearSkins()
          Clears all skins.
 boolean containsSkin(String name)
          Checks the named skin.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
           
 Skin getCurrentSkin(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the current skin of the specified request.
 String getDefaultAttribute(String attribute)
          Gets the named default page attribute.
 String getDefaultBaseName()
          Gets the default base name.
 String getDefaultBodyAttribute(String attribute)
          Gets the named default body attribute.
 String getDefaultDocType()
          Gets the default doctype.
 String getDefaultFormName()
          Gets the name of the default form.
 String getDefaultHeadScript()
          Gets the URL of the default head script.
 String[] getDefaultHeadScripts()
          Gets the URLs of the default head scripts.
 String getDefaultInlineStyleSheet()
          Gets the default inline style sheet.
 String getDefaultLabel()
          Gets the default label.
 String getDefaultLink()
          Gets the default link.
 String getDefaultLogo()
          Gets the default logo.
 String getDefaultMetaElement(String attribute)
          Gets the named default meta element.
 String getDefaultShortcutIcon()
          Gets the URL of the default shortcut icon.
 String getDefaultSkinName()
          Gets the name of the default skin.
 String getDefaultStyleSheet()
          Gets the URL of the default style sheet.
 String[] getDefaultStyleSheets()
          Gets the URLs of the default style sheets.
 String getDefaultSubtitle()
          Gets the default subtitle.
 String getDefaultTitle()
          Gets the default title.
 String getDefaultXMLNs()
          Gets the default XML namespace.
 Skin getSkin(String name)
          Gets the named skin.
 String getSkinAttribute(String name, String attribute)
          Gets the named attribute of the specified skin.
 String getSkinBaseName(String name)
          Gets the base name of the specified skin.
 String getSkinBodyAttribute(String name, String attribute)
          Gets the named body attribute of the specified skin.
 String getSkinDocType(String name)
          Gets the doctype of the specified skin.
 String getSkinFormName(String name)
          Gets the name of the form of the specified skin.
 String getSkinHeadScript(String name)
          Gets the URL of the head script of the specified skin.
 String[] getSkinHeadScripts(String name)
          Gets the URLs of the head scripts of the specified skin.
 String getSkinInlineStyleSheet(String name)
          Gets the inline style sheet of the specified skin.
 String getSkinLabel(String name)
          Gets the label of the specified skin.
 String getSkinLink(String name)
          Gets the link of the specified skin.
 String getSkinLogo(String name)
          Gets the logo of the specified skin.
 String getSkinMetaElement(String name, String attribute)
          Gets the named meta element of the specified skin.
 String[] getSkinNames()
          Gets the names of all skins.
 String getSkinShortcutIcon(String name)
          Gets the URL of the shortcut icon of the specified skin.
 String getSkinStyleSheet(String name)
          Gets the URL of the style sheet of the specified skin.
 String[] getSkinStyleSheets(String name)
          Gets the URLs of the style sheets of the specified skin.
 String getSkinSubtitle(String name)
          Gets the subtitle of the specified skin.
 String getSkinTitle(String name)
          Gets the title of the specified skin.
 String getSkinXMLNs(String name)
          Gets the XML namespace of the specified skin.
 boolean isLocalizedSkins()
          Gets the localized skins flag.
 boolean isSkinLocalized(String name)
          Checks whether the specified skin is localized.
 void removeSkin(String name)
          Removes the named skin.
 Skin resetCurrentSkin(ServletRequest request, ServletResponse response, FilterChain chain)
          Resets the current skin of the session of the specified request to the default skin.
 Skin resetCurrentSkin(String name, ServletRequest request, ServletResponse response, FilterChain chain)
          Resets the current skin of the session of the specified request to the named skin.
 Skin resetCurrentSkin(String name, ServletRequest request, ServletResponse response, FilterChain chain, Principal principal)
          Resets the current skin of the session of the principal of the specified request to the named skin.
 void setDefaultAttribute(String attribute, String value)
          Sets the named default page attribute.
 void setDefaultAttributes(String[] attributes)
          Sets the named default page attributes as consecutive pairs of names and values.
 void setDefaultBaseName(String baseName)
          Sets the default base name.
 void setDefaultBodyAttribute(String attribute, String value)
          Sets the named default body attribute.
 void setDefaultBodyAttributes(String[] attributes)
          Sets the named deafult body attributes as consecutive pairs of names and values.
 void setDefaultDocType(String type)
          Sets the default doctype.
 void setDefaultFormName(String form)
          Sets the name of the default form.
 void setDefaultHeadScript(String url)
          Sets the URL of the default head script.
 void setDefaultHeadScripts(String[] urls)
          Sets the URLs of the default head scripts.
 void setDefaultInlineStyleSheet(String sheet)
          Sets the default inline style sheet.
 void setDefaultLabel(String label)
          Sets the default label.
 void setDefaultLink(String url)
          Sets the default link.
 void setDefaultLogo(String path)
          Sets the default logo.
 void setDefaultMetaElement(String attribute, String value)
          Sets the named default meta element.
 void setDefaultMetaElements(String[] attributes)
          Sets the named default meta elements as consecutive pairs of names and values.
 void setDefaultShortcutIcon(String url)
          Sets the URL of the default shortcut icon.
 void setDefaultSkinName(String name)
          Sets the name of the default skin.
 void setDefaultStyleSheet(String url)
          Sets the URL of the default style sheet.
 void setDefaultStyleSheets(String[] urls)
          Sets the URLs of the default style sheets.
 void setDefaultSubtitle(String title)
          Sets the defaultsubtitle.
 void setDefaultTitle(String title)
          Sets the default title.
 void setDefaultXMLNs(String ns)
          Sets the default XML namespace.
 void setLocalizedSkins(boolean flag)
          Sets the localized skins flag.
 void setSkinAttribute(String name, String attribute, String value)
          Sets the named attribute of the specified skin.
 void setSkinAttributes(String name, String[] attributes)
          Sets the named attributes of the specified skin as consecutive pairs of names and values.
 void setSkinBaseName(String name, String baseName)
          Sets the base name of the specified skin.
 void setSkinBodyAttribute(String name, String attribute, String value)
          Sets the named body attribute of the specified skin.
 void setSkinBodyAttributes(String name, String[] attributes)
          Sets the named body attributes of the specified skin as consecutive pairs of names and values.
 void setSkinDocType(String name, String type)
          Sets the doctype of the specified skin.
 void setSkinFormName(String name, String form)
          Sets the name of the form of the specified skin.
 void setSkinHeadScript(String name, String url)
          Sets the URL of the head script of the specified skin.
 void setSkinHeadScripts(String name, String[] urls)
          Sets the URLs of the head scripts of the specified skin.
 void setSkinInlineStyleSheet(String name, String sheet)
          Sets the inline style sheet of the specified skin.
 void setSkinLabel(String name, String label)
          Sets the label of the specified skin.
 void setSkinLink(String name, String url)
          Sets the link of the specified skin.
 void setSkinLocalized(String name, boolean flag)
          Sets whether the specified skin is localized.
 void setSkinLogo(String name, String path)
          Sets the logo of the specified skin.
 void setSkinMetaElement(String name, String attribute, String value)
          Sets the named meta element of the specified skin.
 void setSkinMetaElements(String name, String[] attributes)
          Sets the named meta elements of the specified skin as consecutive pairs of names and values.
 void setSkinName(String name)
          Sets or replaces a named skin.
 void setSkinNames(String[] names)
          Sets the names of absent skins.
 void setSkinShortcutIcon(String name, String url)
          Sets the URL of the shortcut icon of the specified skin.
 void setSkinStyleSheet(String name, String url)
          Sets the URL of the style sheet of the specified skin.
 void setSkinStyleSheets(String name, String[] urls)
          Sets the URLs of the style sheets of the specified skin.
 void setSkinSubtitle(String name, String title)
          Sets the subtitle of the specified skin.
 void setSkinTitle(String name, String title)
          Sets the title of the specified skin.
 void setSkinXMLNs(String name, String ns)
          Sets the XML namespace of the specified skin.
 Set skinNameSet()
          Returns a read-only set of skin names.
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultKeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultFilter
destroy, getFilterConfig, getRequestMap, getSessionMap, init
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, postmanaged, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unmanaged, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.spray.filter.KeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from interface javax.servlet.Filter
destroy, init
 

Field Detail

SKIN_KEY

public static final String SKIN_KEY
The default key for the skin.

See Also:
Constant Field Values
Constructor Detail

DefaultSkinFilter

public DefaultSkinFilter()
Constructs a new filter.


DefaultSkinFilter

public DefaultSkinFilter(String key)
Constructs a new filter with a key.

Parameters:
key - the filter key.
Method Detail

getDefaultSkinName

public String getDefaultSkinName()
Description copied from interface: SkinFilter
Gets the name of the default skin.

Specified by:
getDefaultSkinName in interface SkinFilter
Returns:
the name of the skin or null.

setDefaultSkinName

public void setDefaultSkinName(String name)
Description copied from interface: SkinFilter
Sets the name of the default skin.

Specified by:
setDefaultSkinName in interface SkinFilter
Parameters:
name - the name of the skin.

getDefaultLabel

public String getDefaultLabel()
Description copied from interface: SkinFilter
Gets the default label.

Specified by:
getDefaultLabel in interface SkinFilter
Returns:
the label.

setDefaultLabel

public void setDefaultLabel(String label)
Description copied from interface: SkinFilter
Sets the default label.

Specified by:
setDefaultLabel in interface SkinFilter
Parameters:
label - the label.

getDefaultFormName

public String getDefaultFormName()
Description copied from interface: SkinFilter
Gets the name of the default form.

Specified by:
getDefaultFormName in interface SkinFilter
Returns:
the name of the form or null.

setDefaultFormName

public void setDefaultFormName(String form)
Description copied from interface: SkinFilter
Sets the name of the default form.

Specified by:
setDefaultFormName in interface SkinFilter
Parameters:
form - the name of the form.

isLocalizedSkins

public boolean isLocalizedSkins()
Description copied from interface: SkinFilter
Gets the localized skins flag.

Specified by:
isLocalizedSkins in interface SkinFilter
Returns:
the localized skins flag.

setLocalizedSkins

public void setLocalizedSkins(boolean flag)
Description copied from interface: SkinFilter
Sets the localized skins flag.

Specified by:
setLocalizedSkins in interface SkinFilter
Parameters:
flag - the localized skins flag.

getDefaultBaseName

public String getDefaultBaseName()
Description copied from interface: SkinFilter
Gets the default base name.

Specified by:
getDefaultBaseName in interface SkinFilter
Returns:
the base name of the default bundle or null.

setDefaultBaseName

public void setDefaultBaseName(String baseName)
Description copied from interface: SkinFilter
Sets the default base name.

Specified by:
setDefaultBaseName in interface SkinFilter
Parameters:
baseName - the base name of the default bundle.

getDefaultDocType

public String getDefaultDocType()
Description copied from interface: SkinFilter
Gets the default doctype.

Specified by:
getDefaultDocType in interface SkinFilter
Returns:
the doctype or null.

setDefaultDocType

public void setDefaultDocType(String type)
Description copied from interface: SkinFilter
Sets the default doctype.

Specified by:
setDefaultDocType in interface SkinFilter
Parameters:
type - the doctype.

getDefaultLink

public String getDefaultLink()
Description copied from interface: SkinFilter
Gets the default link.

Specified by:
getDefaultLink in interface SkinFilter
Returns:
the URL of the link or null.

setDefaultLink

public void setDefaultLink(String url)
Description copied from interface: SkinFilter
Sets the default link.

Specified by:
setDefaultLink in interface SkinFilter
Parameters:
url - the URL of the link.

getDefaultLogo

public String getDefaultLogo()
Description copied from interface: SkinFilter
Gets the default logo.

Specified by:
getDefaultLogo in interface SkinFilter
Returns:
the path of the logo or null.

setDefaultLogo

public void setDefaultLogo(String path)
Description copied from interface: SkinFilter
Sets the default logo.

Specified by:
setDefaultLogo in interface SkinFilter
Parameters:
path - the path of the logo.

getDefaultTitle

public String getDefaultTitle()
Description copied from interface: SkinFilter
Gets the default title.

Specified by:
getDefaultTitle in interface SkinFilter
Returns:
the title or null.

setDefaultTitle

public void setDefaultTitle(String title)
Description copied from interface: SkinFilter
Sets the default title.

Specified by:
setDefaultTitle in interface SkinFilter
Parameters:
title - the title.

getDefaultSubtitle

public String getDefaultSubtitle()
Description copied from interface: SkinFilter
Gets the default subtitle.

Specified by:
getDefaultSubtitle in interface SkinFilter
Returns:
the subtitle or null.

setDefaultSubtitle

public void setDefaultSubtitle(String title)
Description copied from interface: SkinFilter
Sets the defaultsubtitle.

Specified by:
setDefaultSubtitle in interface SkinFilter
Parameters:
title - the subtitle.

getDefaultHeadScript

public String getDefaultHeadScript()
Description copied from interface: SkinFilter
Gets the URL of the default head script.

Note that if several scripts are defined, the first one is returned.

Specified by:
getDefaultHeadScript in interface SkinFilter
Returns:
the URL of the head script or null.

setDefaultHeadScript

public void setDefaultHeadScript(String url)
Description copied from interface: SkinFilter
Sets the URL of the default head script.

Note that all previously defined scripts are replaced with the new one.

Specified by:
setDefaultHeadScript in interface SkinFilter
Parameters:
url - the URL of the head script.

getDefaultHeadScripts

public String[] getDefaultHeadScripts()
Description copied from interface: SkinFilter
Gets the URLs of the default head scripts.

Specified by:
getDefaultHeadScripts in interface SkinFilter
Returns:
the URLs of the head scripts or null.

setDefaultHeadScripts

public void setDefaultHeadScripts(String[] urls)
Description copied from interface: SkinFilter
Sets the URLs of the default head scripts. New scripts are added to existing ones.

Specified by:
setDefaultHeadScripts in interface SkinFilter
Parameters:
urls - the URLs of the head scripts.

getDefaultStyleSheet

public String getDefaultStyleSheet()
Description copied from interface: SkinFilter
Gets the URL of the default style sheet.

Note that if several styles are defined, the first one is returned.

Specified by:
getDefaultStyleSheet in interface SkinFilter
Returns:
the URL of the style sheet or null.

setDefaultStyleSheet

public void setDefaultStyleSheet(String url)
Description copied from interface: SkinFilter
Sets the URL of the default style sheet.

Note that all previously defined styles are replaced with the new one.

Specified by:
setDefaultStyleSheet in interface SkinFilter
Parameters:
url - the URL of the style sheet.

getDefaultStyleSheets

public String[] getDefaultStyleSheets()
Description copied from interface: SkinFilter
Gets the URLs of the default style sheets.

Specified by:
getDefaultStyleSheets in interface SkinFilter
Returns:
the URLs of the style sheets or null.

setDefaultStyleSheets

public void setDefaultStyleSheets(String[] urls)
Description copied from interface: SkinFilter
Sets the URLs of the default style sheets. New styles are added to existing ones.

Specified by:
setDefaultStyleSheets in interface SkinFilter
Parameters:
urls - the URLs of the style sheets.

getDefaultShortcutIcon

public String getDefaultShortcutIcon()
Description copied from interface: SkinFilter
Gets the URL of the default shortcut icon.

Specified by:
getDefaultShortcutIcon in interface SkinFilter
Returns:
the URL of the shortcut icon or null.

setDefaultShortcutIcon

public void setDefaultShortcutIcon(String url)
Description copied from interface: SkinFilter
Sets the URL of the default shortcut icon.

Specified by:
setDefaultShortcutIcon in interface SkinFilter
Parameters:
url - the URL of the shortcut icon.

getDefaultInlineStyleSheet

public String getDefaultInlineStyleSheet()
Description copied from interface: SkinFilter
Gets the default inline style sheet.

Specified by:
getDefaultInlineStyleSheet in interface SkinFilter
Returns:
the inline style sheet or null.

setDefaultInlineStyleSheet

public void setDefaultInlineStyleSheet(String sheet)
Description copied from interface: SkinFilter
Sets the default inline style sheet.

Specified by:
setDefaultInlineStyleSheet in interface SkinFilter
Parameters:
sheet - the inline style sheet.

getDefaultMetaElement

public String getDefaultMetaElement(String attribute)
Description copied from interface: SkinFilter
Gets the named default meta element.

Specified by:
getDefaultMetaElement in interface SkinFilter
Parameters:
attribute - the name of the attribute.
Returns:
the value of the attribute or null.

setDefaultMetaElement

public void setDefaultMetaElement(String attribute,
                                  String value)
Description copied from interface: SkinFilter
Sets the named default meta element.

Specified by:
setDefaultMetaElement in interface SkinFilter
Parameters:
attribute - the name of the attribute.
value - the value of the attribute.

setDefaultMetaElements

public void setDefaultMetaElements(String[] attributes)
Description copied from interface: SkinFilter
Sets the named default meta elements as consecutive pairs of names and values.

Specified by:
setDefaultMetaElements in interface SkinFilter
Parameters:
attributes - the names values of the attributes.

getDefaultBodyAttribute

public String getDefaultBodyAttribute(String attribute)
Description copied from interface: SkinFilter
Gets the named default body attribute.

Specified by:
getDefaultBodyAttribute in interface SkinFilter
Parameters:
attribute - the name of the attribute.
Returns:
the value of the attribute or null.

setDefaultBodyAttribute

public void setDefaultBodyAttribute(String attribute,
                                    String value)
Description copied from interface: SkinFilter
Sets the named default body attribute.

Specified by:
setDefaultBodyAttribute in interface SkinFilter
Parameters:
attribute - the name of the attribute.
value - the value of the attribute.

setDefaultBodyAttributes

public void setDefaultBodyAttributes(String[] attributes)
Description copied from interface: SkinFilter
Sets the named deafult body attributes as consecutive pairs of names and values.

Specified by:
setDefaultBodyAttributes in interface SkinFilter
Parameters:
attributes - the names values of the attributes.

getDefaultAttribute

public String getDefaultAttribute(String attribute)
Description copied from interface: SkinFilter
Gets the named default page attribute.

Specified by:
getDefaultAttribute in interface SkinFilter
Parameters:
attribute - the name of the attribute.
Returns:
the value of the attribute or null.

setDefaultAttribute

public void setDefaultAttribute(String attribute,
                                String value)
Description copied from interface: SkinFilter
Sets the named default page attribute.

Specified by:
setDefaultAttribute in interface SkinFilter
Parameters:
attribute - the name of the attribute.
value - the value of the attribute.

setDefaultAttributes

public void setDefaultAttributes(String[] attributes)
Description copied from interface: