com.bea.netuix.laf
Class PortalLookAndFeel

java.lang.Object
  extended by com.bea.netuix.laf.PortalLookAndFeel

public class PortalLookAndFeel
extends Object

PortalLookAndFeel is the primary interface for interacting with the Look and Feel framework. Instances of this class can be retrieved via calls to the getInstance method(s). Various operations are premitted through this and related interfaces, including: Skin and Skeleton resource lookup, dynamic dependency configuration, and Look and Feel reinitialization.

The Skin and Skeleton classes provide read-only interfaces to retrieve information related to the current Look and Feel configuration such as name and path information, the current chromosomes in effect, and methods to resolve Look and Feel resources such as images and CSS files.

Render and Script dependencies can also be added through mechanisms available on this class. Any such dependencies will be aggregated by the Look and Feel framework and rendered as appropriate on the Poral page. This is the dynamic equivalent of specifying such dependencies via skin or skeleton configuration files.

Also possible through the various reinit() methods provided by this class is the ability to dynamically change the current Look and Feel. This allows, for example, the current skin and/or skeleton to be changed on a per-request basis. NOTE: when using these methods any previously retrieved information related to Look and Feel will be invalid. It is the responsibility of the application developer to ensure that such information is updated as necessary.


Method Summary
 void addDynamicScriptDependency(String eventHandler, String scriptFragment)
          Adds a script fragment associated with the specified event handler.
 DynamicHtmlRenderDependencies getDynamicHtmlRenderDependencies()
          Returns an instance of the DynamicHtmlRenderDependencies class to be used for dynamically adding render dependencies.
static PortalLookAndFeel getInstance(javax.servlet.http.HttpServletRequest request)
          Returns an instance of the PortalLookAndFeel class associated with the current Look and Feel.
static PortalLookAndFeel getInstance(javax.servlet.jsp.JspContext jspContext)
          Returns an instance of the PortalLookAndFeel class associated with the current Look and Feel.
 Skeleton getSkeleton()
          Returns a read-only object related to the current Look and Feel's skeleton.
 Skin getSkin()
          Returns a read-only object related to the current Look and Feel's skin.
 void reinit(String skinName)
          Calling this method reinitializes the Look and Feel with the specified values.
 void reinit(String skinName, String skinPath)
          Calling this method reinitializes the Look and Feel with the specified values.
 void reinit(String skinName, String skinPath, String skinChromosomeName)
          Calling this method reinitializes the Look and Feel with the specified values.
 void reinit(String skinName, String skinPath, String skeletonName, String skeletonPath)
          Calling this method reinitializes the Look and Feel with the specified values.
 void reinit(String skinName, String skinPath, String skinChromosomeName, String skeletonName, String skeletonPath, String skeletonChromosomeName)
          Calling this method reinitializes the Look and Feel with the specified values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getSkeleton

public Skeleton getSkeleton()
Returns a read-only object related to the current Look and Feel's skeleton. NOTE: Calls to reinit() will cause all previously returned Skeleton objects to become invalid.

Returns
A Skeleton object.

getSkin

public Skin getSkin()
Returns a read-only object related to the current Look and Feel's skin. NOTE: Calls to reinit() will cause all previously returned Skin objects to become invalid.

Returns
A Skin object.

getDynamicHtmlRenderDependencies

public DynamicHtmlRenderDependencies getDynamicHtmlRenderDependencies()
Returns an instance of the DynamicHtmlRenderDependencies class to be used for dynamically adding render dependencies. The object returned from this method is valid only as long as the related PortalLookAndFeel object is valid.

Returns
The instance of PortalLookAndFeel associated with the current Look and Feel.

addDynamicScriptDependency

public void addDynamicScriptDependency(String eventHandler,
                                       String scriptFragment)
Adds a script fragment associated with the specified event handler. This method allows for a dynamic equivalent to the skin and skeleton configuration sections for script dependencies. Multiple calls to this method for the same event handler are allowed and the order of the resulting fragments will be preserved. All script dependencies added via this method will be ordered subsequent to the static fragments specified in skin and skeleton configuration files.

NOTE: Calls to reinit() will not affect script fragments added via this method.

An example use of this method for an (X)HTML Look and Feel:

 PortalLookAndFeel plaf = PortalLookAndFeel.getInstance(request);
 plaf.addDynamicScriptDependency("onload", "alert('Page Loaded');");
 

LIFECYCLE RESTRICTION: This method can only be called prior to the render lifecycle; calls during the render lifecycle will cause an IllegalStateException.

Parameters
eventHandler - The name of the event handler (i.e. "onload", "onunload", etc.)
scriptFragment - The script fragment to associate with the specified event handler
Throws
IllegalStateException - If called during an inappropriate lifecycle.
See Also
"Skin and Skeleton configuration element <script-dependencies>"

reinit

public void reinit(String skinName)
Calling this method reinitializes the Look and Feel with the specified values. NOTE: any values previously returned from this or related classes for the current request should be considered invalid.

This is equivalent to calling reinit(skinName, null, null, null, null, null).

LIFECYCLE RESTRICTION: This method should only be called prior to the preRender lifecycle; calls during later lifecycles will cause undefined behavior.

Parameters
skinName - The name of the skin to be used
See Also
reinit(String, String, String, String, String, String)

reinit

public void reinit(String skinName,
                   String skinPath)
Calling this method reinitializes the Look and Feel with the specified values. NOTE: any values previously returned from this or related classes for the current request should be considered invalid.

This is equivalent to calling reinit(skinName, skinPath, null, null, null, null).

LIFECYCLE RESTRICTION: This method should only be called prior to the preRender lifecycle; calls during later lifecycles will cause undefined behavior.

Parameters
skinName - The name of the skin to be used
skinPath - The webapp-relative base skin path
See Also
reinit(String, String, String, String, String, String)

reinit

public void reinit(String skinName,
                   String skinPath,
                   String skeletonName,
                   String skeletonPath)
Calling this method reinitializes the Look and Feel with the specified values. NOTE: any values previously returned from this or related classes for the current request should be considered invalid.

This is equivalent to calling reinit(skinName, skinPath, null, skeletonName, skeletonPath, null).

LIFECYCLE RESTRICTION: This method should only be called prior to the preRender lifecycle; calls during later lifecycles will cause undefined behavior.

Parameters
skinName - The name of the skin to be used
skinPath - The webapp-relative base skin path
skeletonName - The name of the skeleton to be used
skeletonPath - The webapp-relative base skeleton path
See Also
reinit(String, String, String, String, String, String)

reinit

public void reinit(String skinName,
                   String skinPath,
                   String skinChromosomeName)
Calling this method reinitializes the Look and Feel with the specified values. NOTE: any values previously returned from this or related classes for the current request should be considered invalid.

This is equivalent to calling reinit(skinName, skinPath, skinChromosomeName, null, null, null).

LIFECYCLE RESTRICTION: This method should only be called prior to the preRender lifecycle; calls during later lifecycles will cause undefined behavior.

Parameters
skinName - The name of the skin to be used
skinPath - The webapp-relative base skin path
skinChromosomeName - The name of the skin chromosome to be used
See Also
reinit(String, String, String, String, String, String)

reinit

public void reinit(String skinName,
                   String skinPath,
                   String skinChromosomeName,
                   String skeletonName,
                   String skeletonPath,
                   String skeletonChromosomeName)
Calling this method reinitializes the Look and Feel with the specified values. NOTE: any values previously returned from this or related classes for the current request should be considered invalid.

Specifying a null value for a parameter implies the use of configured values or internal defaults. For example, specifying only a skin name (with nulls for the remaining parameters) will imply the following values:

param value
skinPath /framework/skins
skinChromosomeName default
skeletonName default, or skin's target skeleton id
skeletonPath /framework/skeletons, or skin's target skeleton path
skeletonChromosomeName default

This may produce unexpected results if the Look and Feel was originally configured with non-default values. For this reason, current values retrieved from the Skin and Skeleton objects should generally be used instead of null values.

LIFECYCLE RESTRICTION: This method should only be called prior to the preRender lifecycle; calls during later lifecycles will cause undefined behavior.

Parameters
skinName - The name of the skin to be used
skinPath - The webapp-relative base skin path
skinChromosomeName - The name of the skin chromosome to be used
skeletonName - The name of the skeleton to be used
skeletonPath - The webapp-relative base skeleton path
skeletonChromosomeName - The name of the skeleton chromosome to be used

getInstance

public static PortalLookAndFeel getInstance(javax.servlet.http.HttpServletRequest request)
Returns an instance of the PortalLookAndFeel class associated with the current Look and Feel. The object returned from this method is only valid for the specified request.

Parameters
request - The current request
Returns
The instance of PortalLookAndFeel associated with the current Look and Feel.

getInstance

public static PortalLookAndFeel getInstance(javax.servlet.jsp.JspContext jspContext)
Returns an instance of the PortalLookAndFeel class associated with the current Look and Feel. The object returned from this call is only valid for the specified context. This method is intended for use in situations where a HttpServletRequest is not available, such as in certain JSP 2.0 tag classes.

Parameters
jspContext - A valid JspContext
Returns
The instance of PortalLookAndFeel associated with the current Look and Feel.
See Also
getInstance(HttpServletRequest)


Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.