Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

oracle.cabo.ui
Interface RenderingContext

All Superinterfaces:
java.lang.Cloneable
All Known Implementing Classes:
LogicalNodeRenderingContext, RenderingContextProxy

public interface RenderingContext
extends java.lang.Cloneable

Context for a single rendering pass over a tree of UINodes. RendererContexts do not last longer than a single rendering, so any state stored on the context will not be persistent.


Field Summary
static java.lang.Object CONTEXT_PATH_PROPERTY
          This property is used to retrieve the file system path corresponding to the root of the current servlet context.
static java.lang.Object CONTEXT_URI_PROPERTY
          This property is used to retrieve the URI corresponding to the root of the current servlet context.
static java.lang.Object SHARED_CONTEXT_PATH_PROPERTY
          This property is used to retrieve the file system path corresponding to the root of a shared servlet context which contains a copy of the UIX installable resource files that are shared across multiple web applications.
static java.lang.Object SHARED_CONTEXT_URI_PROPERTY
          This property is used to retrieve the URI corresponding to the root of the shared deployment of the UIX installable resource files.
 
Method Summary
 void addDataProvider(DataProvider provider)
          Adds a DataProvider.
 java.lang.Object clone()
          Returns a clone of the RenderingContext.
 Agent getAgent()
          Returns an Agent object that can be used to identify what device will display the rendering.
 UINode getAncestorNode(int index)
          Returns a logical ancestor of the node currently being processed.
 int getAncestorNodeCount()
          Returns the number of logical nodes in the path form the current node to the root of the tree of nodes being rendered.
 Configuration getConfiguration()
          Returns a Configuration object that will be used to locate paths and return global properties.
 DataObject getCurrentDataObject()
          Returns a DataObject for the current node (such as a row of a table).
 DataObject getDataObject(RenderingContext outerContext, java.lang.String namespaceURI, java.lang.String name)
          Internal version of getDataObject().
 DataObject getDataObject(java.lang.String namespaceURI, java.lang.String name)
          Returns the DataObject for the given namespace and name pair.
 ErrorLog getErrorLog()
          Get an interface that can be used to log errors.
 ImageContext getImageContext()
          Get an interface that can be used for image lookups and rendering.
 LocaleContext getLocaleContext()
          Returns the LocaleContext that should be used for rendering.
 java.lang.Object getLocalProperty(int ancestorIndex, java.lang.Object key, java.lang.Object defaultValue)
          Retrieves the specifed property from the stack frame of a rendering UINode.
 LookAndFeel getLookAndFeel()
          Returns the LookAndFeel to use for this render.
 OutputMethod getOutputMethod()
          Returns the OutputMethod that should be used for rendering text.
 RenderingContext getParentContext()
          Returns the RenderingContext that this context should delegate calls to pushRenderedChild, popRenderedChild, and addDataProvider to.
 Path getPath()
          Returns the path to the current logical node.
 java.lang.Object getProperty(java.lang.String namespace, java.lang.Object key)
          Gets a property stored on the context.
 UINode getRenderedAncestorNode(int index)
          Returns an ancestor of the node currently being processed.
 int getRenderedAncestorNodeCount()
          Returns the number of rendered nodes in the path form the current node being rendered to the root of the tree of nodes being rendered.
 RendererManager getRendererManager()
          Returns the RendererManager that should be used for finding renderers.
 StyleContext getStyleContext()
          Get an interface that can be used for style lookups and generation.
 URLEncoder getURLEncoder()
           
 void popChild()
          Removes a logical UINode from the stack.
 void popRenderedChild()
          Removes the UINode to actually use to render from the rendered UINode stack.
 void pushChild(UINode child, java.lang.String childName, int childIndex)
          Adds the logical UINode to render to the logical stack.
 void pushRenderedChild(UINode renderedChild)
          Adds the UINode to actually use to render to the rendered UINode stack.
 DataObject setCurrentDataObject(DataObject newDataObject)
          Sets the new currentDataObject, returning the current currentDataObject.
 void setLocalProperty(java.lang.Object key, java.lang.Object value)
          Sets a property on the stack frame of the currently rendering UINode using a key.
 void setProperty(java.lang.String namespace, java.lang.Object key, java.lang.Object value)
          Stores a property on the context.
 java.lang.String transformName(java.lang.String baseName)
          Transforms a UINode Name to a Name suitable for rendering, given the current RenderingContext state.
 

Field Detail

CONTEXT_PATH_PROPERTY

public static final java.lang.Object CONTEXT_PATH_PROPERTY
This property is used to retrieve the file system path corresponding to the root of the current servlet context. ServletRenderingContext will automatically provide this value. Clients that need to explicitly set this value must also set the CONTEXT_URI_PROPERTY to the correct corresponding value, but such cients should instead use a non-default Configuration object.

CONTEXT_URI_PROPERTY

public static final java.lang.Object CONTEXT_URI_PROPERTY
This property is used to retrieve the URI corresponding to the root of the current servlet context. ServletRenderingContext will automatically provide this value. Clients that need to explicitly set this value must also set the CONTEXT_PATH_PROPERTY to the correct corresponding value, but such cients should instead use a non-default Configuration object. This value must not be terminated with a "/".

SHARED_CONTEXT_PATH_PROPERTY

public static final java.lang.Object SHARED_CONTEXT_PATH_PROPERTY
This property is used to retrieve the file system path corresponding to the root of a shared servlet context which contains a copy of the UIX installable resource files that are shared across multiple web applications.

The UIX installable resource files can be installed in three possible locations:

  1. Locally, in the web application. In this case, the web application includes its own private copy of the installable files, which can be found in the web application under the directory specified by the CONTEXT_PATH_PROPERTY.
  2. Remotely, but within a web application hosted in the the same servlet container instance. The UIX installable resource files may be deployed as a separate web application which is bound to the Configuration.BASE_DIRECTORY URI. In this case, the ServletRenderingContext will automatically detect the presence of the ServletContext and set the SHARED_CONTEXT_PATH_PROPERTY based on the real path of the shared ServletContext.
  3. Remotely, deployed to a separate servlet container or web server instance. In this case, UIX can not automatically determine the location of the installable files. Clients must explicitly specify the location of the remote copy of the installable files via the "oracle.cabo.ui.sharedContextPath" system property.

If a local copy of the UIX installable resource files exists, it is always preferred over other (remote) copies of these files. In this case, the SHARED_CONTEXT_PATH_PROPERTY defaults to null to indicate that no shared installable files are available. If a copy of the UIX installable resource files are found within the same servlet container as the web application, these files are favored over a remote copy of the files (as specified via the oracle.cabo.ui.sharedContextPath system property.)


SHARED_CONTEXT_URI_PROPERTY

public static final java.lang.Object SHARED_CONTEXT_URI_PROPERTY
This property is used to retrieve the URI corresponding to the root of the shared deployment of the UIX installable resource files.

ServletRenderingContext automatically provides this value as follows. If a local copy of the installable files are found in the current web application, SHARED_CONTEXT_URI_PROPERTY defaults to null, and the local installable files are used. Otherwise, if a remote copy of the installable files are found, the SHARED_CONTEXT_URI_PROPERTY is set to the empty string (""). The assumption is that the shared copy of the installable files can be accessed at the URI associated with the Configuration.BASE_DIRECTORY (by default, "/cabo/").

Method Detail

getLookAndFeel

public LookAndFeel getLookAndFeel()
Returns the LookAndFeel to use for this render.

getRendererManager

public RendererManager getRendererManager()
Returns the RendererManager that should be used for finding renderers.

getOutputMethod

public OutputMethod getOutputMethod()
                             throws java.io.IOException
Returns the OutputMethod that should be used for rendering text.

getAgent

public Agent getAgent()
Returns an Agent object that can be used to identify what device will display the rendering.

getLocaleContext

public LocaleContext getLocaleContext()
Returns the LocaleContext that should be used for rendering. The LocaleContext is the owner of all LocaleSpecific information about the Locale.

getAncestorNodeCount

public int getAncestorNodeCount()
Returns the number of logical nodes in the path form the current node to the root of the tree of nodes being rendered.

See Also:
getAncestorNode(int), getRenderedAncestorNodeCount(), getPath()

getAncestorNode

public UINode getAncestorNode(int index)
Returns a logical ancestor of the node currently being processed. The zero-based index from least to most distant - getAncestorNode(0) will always return the current node. Returns null if the index is greater than or equal to the number of ancestors.

See Also:
getAncestorNodeCount(), getRenderedAncestorNode(int), getPath()

getRenderedAncestorNodeCount

public int getRenderedAncestorNodeCount()
Returns the number of rendered nodes in the path form the current node being rendered to the root of the tree of nodes being rendered.

Because a single logical node may be transformed into multiple nodes for rendering, the rendered node count will always be equal to or greater than the logical node count.

Typically, Renderer implementations are the only callers to this method.

See Also:
getAncestorNodeCount()

getRenderedAncestorNode

public UINode getRenderedAncestorNode(int index)
Returns an ancestor of the node currently being processed. The zero-based index from least to most distant - getRenderedAncestorNode(0) will always return the current rendering node. Returns null if the index is greater than or equal to the number of ancestors.

Because a single logical node may be transformed into multiple nodes for rendering, the rendered node count will always be equal to or greater than the logical node count.

Typically, Renderer implementations are the only callers to this method.

See Also:
getAncestorNode(int)

getPath

public Path getPath()
Returns the path to the current logical node.

See Also:
getAncestorNodeCount(), getAncestorNode(int)

pushChild

public void pushChild(UINode child,
                      java.lang.String childName,
                      int childIndex)
Adds the logical UINode to render to the logical stack. Clients should never call this method. They should instead subclass BaseRenderer, which calls this method when needed.

See Also:
popChild(), getAncestorNode(int), getAncestorNodeCount(), getPath()

popChild

public void popChild()
Removes a logical UINode from the stack. Clients should never call this method; they should instead subclass BaseRenderer, which calls this method when needed.

See Also:
pushChild(oracle.cabo.ui.UINode, java.lang.String, int), getAncestorNode(int), getAncestorNodeCount(), getPath()

pushRenderedChild

public void pushRenderedChild(UINode renderedChild)
Adds the UINode to actually use to render to the rendered UINode stack.

Clients shuld never need to call this method as calls to this method are typically made on their behalf by the composite UINode framework.

See Also:
popRenderedChild(), getRenderedAncestorNode(int), getRenderedAncestorNodeCount()

popRenderedChild

public void popRenderedChild()
Removes the UINode to actually use to render from the rendered UINode stack.

Clients shuld never need to call this method as calls to this method are typically made on their behalf by the composite UINode framework.

See Also:
pushRenderedChild(oracle.cabo.ui.UINode), getRenderedAncestorNode(int), getRenderedAncestorNodeCount()

addDataProvider

public void addDataProvider(DataProvider provider)
Adds a DataProvider. If the RenderingContext is currently inactive (that is, not rendering any nodes), the data provider will be added permanently. Otherwise, the data provider will automatically be removed when the current node (and all its children) finish rendering.

DataProviders added last will receive precedence in serving data.

Parameters:
provider - the DataProvider to add; if null, the method is a no-op
See Also:
getDataObject(java.lang.String, java.lang.String)

getDataObject

public DataObject getDataObject(java.lang.String namespaceURI,
                                java.lang.String name)
Returns the DataObject for the given namespace and name pair. It will call each data provider added with addDataProvider, starting with the most recently added, until one returns non-null. It can then check for any implementation-specific DataObjects.
See Also:
addDataProvider(oracle.cabo.ui.data.DataProvider)

getCurrentDataObject

public DataObject getCurrentDataObject()
Returns a DataObject for the current node (such as a row of a table).


setCurrentDataObject

public DataObject setCurrentDataObject(DataObject newDataObject)
Sets the new currentDataObject, returning the current currentDataObject.

See Also:
getCurrentDataObject()

getProperty

public java.lang.Object getProperty(java.lang.String namespace,
                                    java.lang.Object key)
Gets a property stored on the context.

setProperty

public void setProperty(java.lang.String namespace,
                        java.lang.Object key,
                        java.lang.Object value)
Stores a property on the context. Since RendererContexts are not persistent, state stored on a RendererContext will not be present in subsequent rendering passes.

setLocalProperty

public void setLocalProperty(java.lang.Object key,
                             java.lang.Object value)
Sets a property on the stack frame of the currently rendering UINode using a key.

This method is for use by rendering code that needs to save some state while it is rendering.

Parameters:
key - Key used to identify this property on the stack frame.
value - Value to store. null is an acceptable value.

See Also:
getLocalProperty(int, java.lang.Object, java.lang.Object)

getLocalProperty

public java.lang.Object getLocalProperty(int ancestorIndex,
                                         java.lang.Object key,
                                         java.lang.Object defaultValue)
Retrieves the specifed property from the stack frame of a rendering UINode. If the property is not present, defaultValue is returned.

The keys are compared by identity for performance.

This method is for use by rendering code that needs to save some state while it is rendering.

Parameters:
ancestorIndex - index into the rendered ancestor stack. If 0, uses the currently rendering node
key - Key used to identify the property on the stack frame to retrieve.
defaultValue - Value to return if the property doesn't exist in the stack frame.

See Also:
setLocalProperty(java.lang.Object, java.lang.Object)

transformName

public java.lang.String transformName(java.lang.String baseName)
Transforms a UINode Name to a Name suitable for rendering, given the current RenderingContext state.

getURLEncoder

public URLEncoder getURLEncoder()
Returns:
the encoder that must be used for form parameter names and URLs

getConfiguration

public Configuration getConfiguration()
Returns a Configuration object that will be used to locate paths and return global properties.

getErrorLog

public ErrorLog getErrorLog()
Get an interface that can be used to log errors.

getImageContext

public ImageContext getImageContext()
Get an interface that can be used for image lookups and rendering.

getStyleContext

public StyleContext getStyleContext()
Get an interface that can be used for style lookups and generation.

getParentContext

public RenderingContext getParentContext()
Returns the RenderingContext that this context should delegate calls to pushRenderedChild, popRenderedChild, and addDataProvider to. The parent context acts to segregate the logical node structure internal to a composite UINode from the deceloper's logical UINode structure. By calling getParentContext.getAncestorNode(0) the composite UINode gains access to the UINode that the composite UINode is attempting to render.

Typically, only composite UINode implementors ever need to call this method.


getDataObject

public DataObject getDataObject(RenderingContext outerContext,
                                java.lang.String namespaceURI,
                                java.lang.String name)
Internal version of getDataObject(). Do not call this function unless you are yourself a RenderingContext.

clone

public java.lang.Object clone()
Returns a clone of the RenderingContext.
Overrides:
clone in class java.lang.Object

Oracle UIX API Reference
Release 2.1.22.0.0
B12196-01

Copyright © 2002,2003, Oracle. All Rights Reserved.