© 2003 BEA Systems, Inc.

com.bea.netuix.servlets.controls
Class PresentationContext

java.lang.Object
  |
  +--com.bea.netuix.servlets.controls.ControlContext
        |
        +--com.bea.netuix.servlets.controls.PresentationContext
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AbstractButtonPresentationContext, BodyPresentationContext, DesktopPresentationContext, FooterPresentationContext, HeaderPresentationContext, HeadPresentationContext, LayoutPresentationContext, MenuPresentationContext, PlaceholderPresentationContext, ShellPresentationContext, ThemePresentationContext, TitlebarPresentationContext, WindowPresentationContext

public abstract class PresentationContext
extends ControlContext

The control framework provides instances of subclasses of PresentationContext during actions and in backing files.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.bea.netuix.servlets.controls.ControlContext
debug
 
Constructor Summary
protected PresentationContext(PresentationControl presentationControl)
           
 
Method Summary
 List getChildren()
          Return an iterator of child PresentationContext objects
 List getChildren(String tagName)
           
static String getControlState(HttpServletRequest request)
          Returns any state prepared for embedding in each URL.
 PresentationContext getFirstChild(String tagName)
          Given a JSP tag name return the controls context.
 Properties getParsedProperties()
          Get the extra properties of the control, if they exist.
 String getPresentationClass()
          Get the presentation class of the control, if it exists.
 String getPresentationId()
          Get the presentation id of the control, if it exists.
 String getPresentationStyle()
          Get the presentation style of the control, if it exists.
 String getProperties()
          Get the extra properties string of the control, if it exists.
 String getProperty(String key)
          Get a property of the underlying control.
 String getProperty(String key, String defaultValue)
          Get a property of the underlying control, using the specified default if none exists.
 boolean getPropertyAsBoolean(String key, boolean defaultValue)
          Get a property of the underlying control, using the specified default if none exists.
 int getPropertyAsInt(String key, int defaultValue)
          Get a property of the underlying control, using the specified default if none exists.
 Locale getResolvedLocale()
          Returns the Locale associated with the best matching Presentation control resource based on user request Locale preferrences.
 String getTagName()
           
 boolean isVisible()
           
 void render(HttpServletRequest request)
          Render the parent control; this will call both begin render and end render methods.
 void setVisible(boolean visible)
          Set the visible state of the control.
 
Methods inherited from class com.bea.netuix.servlets.controls.ControlContext
getContextFromRequest, getContextKey, getControl, getRequestKey, getUniqueId, removeContextFromRequest, setContextInRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PresentationContext

protected PresentationContext(PresentationControl presentationControl)
Method Detail

getPresentationId

public String getPresentationId()
Get the presentation id of the control, if it exists. This value may be null.

Returns:
The control's presentation id, if set

getPresentationClass

public String getPresentationClass()
Get the presentation class of the control, if it exists. This value may be null.

Returns:
The control's presentation class, if set

getPresentationStyle

public String getPresentationStyle()
Get the presentation style of the control, if it exists. This value may be null.

Returns:
The control's presentation style, if set

getTagName

public String getTagName()

getResolvedLocale

public Locale getResolvedLocale()
Returns the Locale associated with the best matching Presentation control resource based on user request Locale preferrences. If no information is available about the matching Locale, the default Locale as specified in netuix-config.xml is returned. This method is most useful for Portlets and Jsps included by Portlets. Note that in streaming mode, the resolved Locale for a Portlet is always the default Locale, since the Portlet is disassembled from the default locale Portal and inlined for requests.


getProperties

public String getProperties()
Get the extra properties string of the control, if it exists. This value may be null. Properties are formatted as in the following example:

      my-first-key: my-first-value; my-second-key: my-second-value;
 
Any number of properties may be in a properties string.

Returns:
The control's extra properties, if set
See Also:
getParsedProperties()

getParsedProperties

public Properties getParsedProperties()
Get the extra properties of the control, if they exist. This value must not be null. The Properties class returned by this method is the parsed view of those from getProperties().

Returns:
The control's extra properties, if set

getProperty

public String getProperty(String key)
Get a property of the underlying control. This is a convenience method. The key argument should not be null.

Parameters:
key - The property key
Returns:
The value associated with the specified key, if it exists

getProperty

public String getProperty(String key,
                          String defaultValue)
Get a property of the underlying control, using the specified default if none exists. This is a convenience method. The key argument should not be null.

Parameters:
key - The property key
defaultValue - The value to use if no value is found for the specified key
Returns:
The value associated with the specified key, if it exists, or the default

getPropertyAsInt

public int getPropertyAsInt(String key,
                            int defaultValue)
Get a property of the underlying control, using the specified default if none exists. The key argument should not be null. This is a convenience method that attempts a conversion of the value from a String to an int. Failure during conversion causes the default value to be returned.

Parameters:
key - The property key
defaultValue - The value to use if no value is found for the specified key
Returns:
The value associated with the specified key, if it exists, or the default

getPropertyAsBoolean

public boolean getPropertyAsBoolean(String key,
                                    boolean defaultValue)
Get a property of the underlying control, using the specified default if none exists. The key argument should not be null. This is a convenience method that attempts a conversion of the value from a String to a boolean. Failure during conversion causes a value of false to be returned. The default value is used if the key lookup in the properties instance returned null.

Parameters:
key - The property key
defaultValue - The value to use if no value is found for the specified key
Returns:
The value associated with the specified key, if it exists, or the default

getFirstChild

public PresentationContext getFirstChild(String tagName)
Given a JSP tag name return the controls context.

Parameters:
tagName - The namespace qualified tag name namespace:tagname
Returns:
The control's context if the control exist otherwise null

getChildren

public List getChildren(String tagName)

getChildren

public List getChildren()
Return an iterator of child PresentationContext objects

Returns:
an Iterator of PresentationContext objects if this control has no child controls of type PresentationControl this method will return an empty iterator.

setVisible

public void setVisible(boolean visible)
Set the visible state of the control. Setting the state to false will cause the beginRender and endRender methods to not be called during the render lifecycle stage.

Parameters:
visible - The boolean value to set the visibility state.

isVisible

public boolean isVisible()

render

public void render(HttpServletRequest request)
            throws IOException,
                   com.bea.netuix.nf.UIControlException
Render the parent control; this will call both begin render and end render methods.

Throws:
IOException - May be thrown when rendering the underlying control
com.bea.netuix.nf.UIControlException

getControlState

public static final String getControlState(HttpServletRequest request)

Returns any state prepared for embedding in each URL. If the state encoding scheme is set use sessions, this method returns an empty string.

Returns:
state

© 2003 BEA Systems, Inc.

Copyright © 2003 BEA Systems, Inc. All Rights Reserved