com.bea.netuix.servlets.controls
Class PresentationContext

java.lang.Object
  extended by com.bea.netuix.servlets.controls.ControlContext
      extended by 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 com.bea.netuix.servlets.controls.ControlContext

The portal framework provides instances of subclasses of PresentationContext during portal rendering, actions, and in backing files. PresentationContext subclasses are used to represent portal framework components during the portal's rendering phase and are almost exclusively read only (the exception being the setVisible method to allow fine-grained rendering of components in skeleton files). PresentationContext subclasses are primarily targetted for use by skeleton JSPs in portal look and feel implementations.

See Also
Serialized Form

Method Summary
 PresentationContextAttributeRenderer getAttributeRenderer()
          Returns a renderer for the component's attributes.
 List getChildren()
          Returns a list of PresentationContext children of this context, if any.
 List getChildren(String tagName)
          Returns a list of PresentationContext children of this context, if any, narrowed by by the specified tag name.
 PresentationContext getFirstChild(String tagName)
          Given a tag name, return an instance of the component's PresentationContext subclass, if it exists as a child.
 List<PresentationContext> getOrderedChildren()
          Returns a list of PresentationContext children of this context, if any, in the order that they are specified in the portal tree hierarchy.
 Properties getParsedProperties()
          Get the extra properties of the component, if they exist.
 String getPresentationClass()
          Get the presentation class of the component, if it exists.
 String getPresentationId()
          Get the presentation id of the component, if it exists.
 String getPresentationStyle()
          Get the presentation style of the component, if it exists.
 String getProperties()
          Get the extra properties string of the component, if it exists.
 String getProperty(String key)
          Get a property of the underlying component.
 String getProperty(String key, String defaultValue)
          Get a property of the underlying component, using the specified default if none exists.
 boolean getPropertyAsBoolean(String key, boolean defaultValue)
          Get a property of the underlying component, using the specified default if none exists.
 int getPropertyAsInt(String key, int defaultValue)
          Get a property of the underlying component, using the specified default if none exists.
 RenderFormat getRenderFormat()
          Returns the currently configured render format information detailing the format in which the portal will be rendered for the current request.
 Locale getResolvedLocale()
          Returns the Locale associated with the best matching portal component resource based on user request locale preferrences.
 String getTagName()
          Get the tag name of the component this context represents.
 boolean isVisible()
          Tests whether or not the component represented by this context is visible, and therefore whether or not it should be rendered.
 void setVisible(boolean visible)
          Set the visiblity state of the component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getAttributeRenderer

public PresentationContextAttributeRenderer getAttributeRenderer()
Returns a renderer for the component's attributes. This renderer is intended to be used in skeleton files.


getPresentationId

public String getPresentationId()
Get the presentation id of the component, if it exists. This value may be null. The presentation id is typically mapped to an id attribute when rendering HTML-type output.

Returns
The control's presentation id, if set

getPresentationClass

public String getPresentationClass()
Get the presentation class of the component, if it exists. This value may be null. The presentation id is typically mapped to an id attribute when rendering HTML-type output.

Returns
The control's presentation class, if set

getPresentationStyle

public String getPresentationStyle()
Get the presentation style of the component, if it exists. This value may be null. The presentation id is typically mapped to an id attribute when rendering HTML-type output.

Returns
The control's presentation style, if set

getTagName

public String getTagName()
Get the tag name of the component this context represents. The tag name is a short name used to identify the component of the form namespace:tagname, where the namespace corresponds to the parent package in which the context is defined (e.g. a book's full tag name would be page:book).

Returns
The tag name of the component this context represents; this should never be null
See Also
#getChildren

getResolvedLocale

public Locale getResolvedLocale()
Returns the Locale associated with the best matching portal component 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.

Returns
The resolved locale associated with the best matching portal resource

getProperties

public String getProperties()
Get the extra properties string of the component, 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 component, if they exist. This value will 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; an empty Properties instance if not
See Also
getProperties()

getProperty

public String getProperty(String key)
Get a property of the underlying component. 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 component, 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 component, 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 or the key being null 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 component, 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 or if the key itself was 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 tag name, return an instance of the component's PresentationContext subclass, if it exists as a child. The first child matching the specified tag name is returned.

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

getChildren

public List getChildren(String tagName)
Returns a list of PresentationContext children of this context, if any, narrowed by by the specified tag name. If no children exist for that tag name, an empty list is returned. Elements of the list are all descendents of the type PresentationContext. The returned list is for immediate children only -- there is no recursion into childrens' children. This list is unmodifiable.

Parameters
tagName - The namespace-qualified tag name namespace:tagname
Returns
The list of all immediate children with the given tag name

getChildren

public List getChildren()
Returns a list of PresentationContext children of this context, if any. If no children exist, an empty list is returned. Elements of the list are all descendents of the type PresentationContext, and are returned with like elements grouped together, but otherwise in no particular order. The returned list is for immediate children only -- there is no recursion into childrens' children.

Note, this list is modifiable! Avoid mutating the list (or at least use caution if you do).

Returns
The list of all immediate children or an empty list if none exist
See Also
getOrderedChildren()

getOrderedChildren

public List<PresentationContext> getOrderedChildren()
Returns a list of PresentationContext children of this context, if any, in the order that they are specified in the portal tree hierarchy. Elements of the list are all descendents of the type PresentationContext. The returned list is for immediate children only -- there is no recursion into childrens' children.

Note, this list is modifiable! Avoid mutating the list (or at least use caution if you do).

Returns
The list of all immediate children in hierarchical order, or an empty list if no children exist
See Also
getChildren()

setVisible

public void setVisible(boolean visible)
Set the visiblity state of the component. 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()
Tests whether or not the component represented by this context is visible, and therefore whether or not it should be rendered. Typically, this is only important to the renderer and not the skeletons using this context.

Returns
The true if visible

getRenderFormat

public RenderFormat getRenderFormat()
Returns the currently configured render format information detailing the format in which the portal will be rendered for the current request. Checking this information allows skeleton files and content areas to attempt to tailor their rendered output to the overall doctype of the rendered portal.

Returns
A RenderFormat instance describing the current request's output format


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.