Skip navigation links
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
- ResponseHeaderAdder, 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
- implements ResponseHeaderAdder
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 targeted for use by skeleton JSPs in portal look and feel implementations.
- See Also
- Serialized Form
Method Summary |
void |
addCookie(javax.servlet.http.Cookie cookie)
Add a cookie on the response, if possible, even if the servlet specification would normally not allow it to be done. |
void |
addDateHeader(String name, long header)
Add a header on the response, if possible, even if the servlet specification would normally not allow it to be done. |
void |
addHeader(String name, String header)
Add a header on the response, if possible, even if the servlet specification would normally not allow it to be done. |
void |
addIntHeader(String name, int header)
Add a header on the response, if possible, even if the servlet specification would normally not allow it to be done. |
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 preferences. |
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 |
setCharacterEncoding(String value)
Set the charset in the Content-Type header on the response, if possible, even if the servlet specification would normally not allow it to be done. |
void |
setContentType(String value)
Set the Content-Type header on the response, if possible, even if the servlet specification would normally not allow it to be done. |
void |
setVisible(boolean visible)
Set the visibility state of the component. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 preferences. 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. <p/> 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 descendants 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 descendants 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. <p/> 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 descendants of the type PresentationContext
. The returned list is for immediate children only -- there is no recursion into childrens' children. <p/> 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 visibility 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
addCookie
public void addCookie(javax.servlet.http.Cookie cookie)
- Add a cookie on the response, if possible, even if the servlet specification would normally not allow it to be done. Normally, the response is committed during the render lifecycle and adding headers on a response has no effect. In addition, if this action is done inside a RequestDispatcher.include() call, the servlet specification does not allow cookies or headers to be set. However, if the avoid-response-commit setting in the WEB-INF/wlp-framework-common-config.xml file is "true" this method will add a cookie on the underlying response, even if RequestDispatcher.include() has been used, so long as the underlying response has not been committed. In addition, in portlets rendering on the producer in WSRP, this method will work during the getMarkup phase (render lifecycle) for adding cookies if a RequestDispatcher.include() is being used, as long as the underlying response has not been committed. (Note that in a WSRP portlet on the producer, the cookies set will be on the WSRP SOAP response and it is up to the consumer whether they make it to the client or not.) If the underlying response is already committed, this method will have no effect. If the avoid-response-commit setting is
false
or unset, this method will add the cookie on the response, but it most likely will not make it to the underlying response.
-
- Specified by:
addCookie
in interface ResponseHeaderAdder
-
- Parameters
cookie
- the cookie to add to the response.
addDateHeader
public void addDateHeader(String name,
long header)
- Add a header on the response, if possible, even if the servlet specification would normally not allow it to be done. Normally, the response is committed during the render lifecycle and adding headers on a response has no effect. In addition, if this action is done inside a RequestDispatcher.include() call, the servlet specification does not allow cookies or headers to be set. However, if the avoid-response-commit setting in the WEB-INF/wlp-framework-common-config.xml file is "true" this method will add the header on the underlying response, even if RequestDispatcher.include() has been used, so long as the underlying response has not been committed. In addition, in portlets rendering on the producer in WSRP, this method will work during the getMarkup phase (render lifecycle) for adding headers if a RequestDispatcher.include() is being used, as long as the underlying response has not been committed. (Note that in a WSRP portlet on the producer, the headers set will be on the WSRP SOAP response and it is up to the consumer whether they make it to the client or not.) If the underlying response is already committed, this method will have no effect. If the avoid-response-commit setting is
false
or unset, this method will add the header on the response, but it most likely will not make it to the underlying response.
-
- Specified by:
addDateHeader
in interface ResponseHeaderAdder
-
- Parameters
name
- the name of the header to set
header
- the value of the header to set
addHeader
public void addHeader(String name,
String header)
- Add a header on the response, if possible, even if the servlet specification would normally not allow it to be done. Normally, the response is committed during the render lifecycle and adding headers on a response has no effect. In addition, if this action is done inside a RequestDispatcher.include() call, the servlet specification does not allow cookies or headers to be set. However, if the avoid-response-commit setting in the WEB-INF/wlp-framework-common-config.xml file is "true" this method will add the header on the underlying response, even if RequestDispatcher.include() has been used, so long as the underlying response has not been committed. In addition, in portlets rendering on the producer in WSRP, this method will work during the getMarkup phase (render lifecycle) for adding headers if a RequestDispatcher.include() is being used, as long as the underlying response has not been committed. (Note that in a WSRP portlet on the producer, the headers set will be on the WSRP SOAP response and it is up to the consumer whether they make it to the client or not.) If the underlying response is already committed, this method will have no effect. If the avoid-response-commit setting is
false
or unset, this method will add the header on the response, but it most likely will not make it to the underlying response.
-
- Specified by:
addHeader
in interface ResponseHeaderAdder
-
- Parameters
name
- the name of the header to set
header
- the value of the header to set
addIntHeader
public void addIntHeader(String name,
int header)
- Add a header on the response, if possible, even if the servlet specification would normally not allow it to be done. Normally, the response is committed during the render lifecycle and adding headers on a response has no effect. In addition, if this action is done inside a RequestDispatcher.include() call, the servlet specification does not allow cookies or headers to be set. However, if the avoid-response-commit setting in the WEB-INF/wlp-framework-common-config.xml file is "true" this method will add the header on the underlying response, even if RequestDispatcher.include() has been used, so long as the underlying response has not been committed. In addition, in portlets rendering on the producer in WSRP, this method will work during the getMarkup phase (render lifecycle) for adding headers if a RequestDispatcher.include() is being used, as long as the underlying response has not been committed. (Note that in a WSRP portlet on the producer, the headers set will be on the WSRP SOAP response and it is up to the consumer whether they make it to the client or not.) If the underlying response is already committed, this method will have no effect. If the avoid-response-commit setting is
false
or unset, this method will add the header on the response, but it most likely will not make it to the underlying response.
-
- Specified by:
addIntHeader
in interface ResponseHeaderAdder
-
- Parameters
name
- the name of the header to set
header
- the value of the header to set
setCharacterEncoding
public void setCharacterEncoding(String value)
- Set the charset in the Content-Type header on the response, if possible, even if the servlet specification would normally not allow it to be done. Normally, the response is committed during the render lifecycle and adding headers on a response has no effect. In addition, if this action is done inside a RequestDispatcher.include() call, the servlet specification does not allow cookies or headers to be set. However, if the avoid-response-commit setting in the WEB-INF/wlp-framework-common-config.xml file is "true" this method will add the header on the underlying response, even if RequestDispatcher.include() has been used, so long as the underlying response has not been committed. In addition, in portlets rendering on the producer in WSRP, this method will work during the getMarkup phase (render lifecycle) for adding headers if a RequestDispatcher.include() is being used, as long as the underlying response has not been committed. (Note that in a WSRP portlet on the producer, the headers set will be on the WSRP SOAP response and it is up to the consumer whether they make it to the client or not.) If the underlying response is already committed, this method will have no effect. If the avoid-response-commit setting is
false
or unset, this method will add the header on the response, but it most likely will not make it to the underlying response.
-
- Specified by:
setCharacterEncoding
in interface ResponseHeaderAdder
-
- Parameters
value
- the value of the header to set
setContentType
public void setContentType(String value)
- Set the Content-Type header on the response, if possible, even if the servlet specification would normally not allow it to be done. Normally, the response is committed during the render lifecycle and adding headers on a response has no effect. In addition, if this action is done inside a RequestDispatcher.include() call, the servlet specification does not allow cookies or headers to be set. However, if the avoid-response-commit setting in the WEB-INF/wlp-framework-common-config.xml file is "true" this method will add the header on the underlying response, even if RequestDispatcher.include() has been used, so long as the underlying response has not been committed. In addition, in portlets rendering on the producer in WSRP, this method will work during the getMarkup phase (render lifecycle) for adding headers if a RequestDispatcher.include() is being used, as long as the underlying response has not been committed. (Note that in a WSRP portlet on the producer, the headers set will be on the WSRP SOAP response and it is up to the consumer whether they make it to the client or not.) If the underlying response is already committed, this method will have no effect. If the avoid-response-commit setting is
false
or unset, this method will add the header on the response, but it most likely will not make it to the underlying response.
-
- Specified by:
setContentType
in interface ResponseHeaderAdder
-
- Parameters
value
- the value of the header to set
Skip navigation links
Copyright © 2010, Oracle. All rights reserved.