org.apache.turbine.services.ui
Class TurbineUI

java.lang.Object
  extended byorg.apache.turbine.services.ui.TurbineUI

public class TurbineUI
extends java.lang.Object

This is a convenience class provided to allow access to the UIService through static methods. The UIService should ALWAYS be accessed via either this class or UITool.

Version:
$Id$
Author:
Scott Eade
See Also:
UIService, UITool

Constructor Summary
TurbineUI()
           
 
Method Summary
static java.lang.String get(java.lang.String key)
          Retrieve a skin property from the default skin for the webapp.
static java.lang.String get(java.lang.String skinName, java.lang.String key)
          Retrieve a skin property from the named skin.
static java.lang.String getScript(java.lang.String skinName, java.lang.String filename)
          Retrieve the URL for a given script that is part of the skin.
static java.lang.String getScript(java.lang.String skinName, java.lang.String filename, ServerData serverData)
          Retrieve the URL for a given script that is part of the skin.
static java.lang.String[] getSkinNames()
          Provide access to the list of available skin names.
static java.lang.String getStylecss(java.lang.String skinName)
          Retrieve the URL for the style sheet that is part of a skin.
static java.lang.String getStylecss(java.lang.String skinName, ServerData serverData)
          Retrieve the URL for the style sheet that is part of a skin.
static java.lang.String getWebappSkinName()
          Get the name of the default skin name for the web application from the TurbineResources.properties file.
static java.lang.String image(java.lang.String skinName, java.lang.String imageId)
          Retrieve the URL for an image that is part of a skin.
static java.lang.String image(java.lang.String skinName, java.lang.String imageId, ServerData serverData)
          Retrieve the URL for an image that is part of a skin.
static void refresh()
          Refresh all skins.
static void refresh(java.lang.String skinName)
          Refresh a particular skin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurbineUI

public TurbineUI()
Method Detail

refresh

public static void refresh()
Refresh all skins.


refresh

public static void refresh(java.lang.String skinName)
Refresh a particular skin.

Parameters:
skinName - the name of the skin to clear.

getSkinNames

public static java.lang.String[] getSkinNames()
Provide access to the list of available skin names.

Returns:
the available skin names.

getWebappSkinName

public static java.lang.String getWebappSkinName()
Get the name of the default skin name for the web application from the TurbineResources.properties file. If the property is not present the name of the default skin will be returned. Note that the web application skin name may be something other than default, in which case its properties will default to the skin with the name "default".

Returns:
the name of the default skin for the web application.

get

public static java.lang.String get(java.lang.String skinName,
                                   java.lang.String key)
Retrieve a skin property from the named skin. If the property is not defined in the named skin the value for the default skin will be provided. If the named skin does not exist then the skin configured for the webapp will be used. If the webapp skin does not exist the default skin will be used. If the default skin does not exist then null will be returned.

Parameters:
skinName - the name of the skin to retrieve the property from.
key - the key to retrieve from the skin.
Returns:
the value of the property for the named skin (defaulting to the default skin), the webapp skin, the default skin or null, depending on whether or not the property or skins exist.

get

public static java.lang.String get(java.lang.String key)
Retrieve a skin property from the default skin for the webapp. If the property is not defined in the webapp skin the value for the default skin will be provided. If the webapp skin does not exist the default skin will be used. If the default skin does not exist then null will be returned.

Parameters:
key - the key to retrieve.
Returns:
the value of the property for the webapp skin (defaulting to the default skin), the default skin or null, depending on whether or not the property or skins exist.

image

public static java.lang.String image(java.lang.String skinName,
                                     java.lang.String imageId,
                                     ServerData serverData)
Retrieve the URL for an image that is part of a skin. The images are stored in the WEBAPP/resources/ui/skins/[SKIN]/images directory.

Use this if for some reason your server name, server scheme, or server port change on a per request basis. I'm not sure if this would happen in a load balanced situation. I think in most cases the image(String image) method would probably be enough, but I'm not absolutely positive.

Parameters:
skinName - the name of the skin to retrieve the image from.
imageId - the id of the image whose URL will be generated.

image

public static java.lang.String image(java.lang.String skinName,
                                     java.lang.String imageId)
Retrieve the URL for an image that is part of a skin. The images are stored in the WEBAPP/resources/ui/skins/[SKIN]/images directory.

Parameters:
skinName - the name of the skin to retrieve the image from.
imageId - the id of the image whose URL will be generated.

getStylecss

public static java.lang.String getStylecss(java.lang.String skinName,
                                           ServerData serverData)
Retrieve the URL for the style sheet that is part of a skin. The style is stored in the WEBAPP/resources/ui/skins/[SKIN] directory with the filename skin.css

Use this if for some reason your server name, server scheme, or server port change on a per request basis. I'm not sure if this would happen in a load balanced situation. I think in most cases the style() method would probably be enough, but I'm not absolutely positive.

Parameters:
skinName - the name of the skin to retrieve the style sheet from.

getStylecss

public static java.lang.String getStylecss(java.lang.String skinName)
Retrieve the URL for the style sheet that is part of a skin. The style is stored in the WEBAPP/resources/ui/skins/[SKIN] directory with the filename skin.css

Parameters:
skinName - the name of the skin to retrieve the style sheet from.

getScript

public static java.lang.String getScript(java.lang.String skinName,
                                         java.lang.String filename,
                                         ServerData serverData)
Retrieve the URL for a given script that is part of the skin. The script is stored in the WEBAPP/resources/ui/skins/[SKIN] directory.

Use this if for some reason your server name, server scheme, or server port change on a per request basis. I'm not sure if this would happen in a load balanced situation. I think in most cases the image(String image) method would probably be enough, but I'm not absolutely positive.

Parameters:
skinName - the name of the skin to retrieve the image from.
filename - the name of the script file whose URL will be generated.

getScript

public static java.lang.String getScript(java.lang.String skinName,
                                         java.lang.String filename)
Retrieve the URL for a given script that is part of the skin. The script is stored in the WEBAPP/resources/ui/skins/[SKIN] directory.

Parameters:
skinName - the name of the skin to retrieve the image from.
filename - the name of the script file whose URL will be generated.


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.