站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.4 API 英文版文档

RenderContext - JBOSS Portal 2.4 API 英文版文档


org.jboss.portal.theme.render
Class RenderContext

java.lang.Object
  extended byorg.jboss.portal.theme.render.RenderContext

public final class RenderContext
extends java.lang.Object

A render context to render a context on a page.

A render context is scoped to a MarkupContainer (a region, or a window). A render context that is not scoped to a MarkupContainer is ment to be a page level template to allow easier creation of the region and window render contexts via the RenderContext.getContext() methods.


Constructor Summary
RenderContext(PortalLayout layout, HTTPStreamInfo streamInfo, MarkupResult result, ServerRequest request)
          Create a new render context for the provided result.
 
Method Summary
 java.lang.String getCharset()
           
 MediaType getContentType()
           
 RenderContext getContext(Region region, java.lang.String cssId, RegionOrientation orientation)
          copy constructor.
 RenderContext getContext(WindowContext windowContext)
          copy constructor.
 DecorationRenderer getDecorationRenderer()
           
 DecorationRenderer getDecorationRenderer(WindowResult result)
          Get the decoration renderer for the window that the provided window result is associated with.
 LayoutInfo getLayoutInfo()
           
 java.util.List getLayoutRegionNames()
           
 java.util.Locale getLocale()
           
 java.util.Locale[] getLocales()
           
 java.lang.StringBuffer getMarkupFragment()
           
 java.util.Map getPageProperties()
           
 Mode getPortletMode(WindowContext portletWindow)
           
 PortletRenderer getPortletRenderer()
          Get the portlet renderer from the render set that was determined for this context.
 PortletRenderer getPortletRenderer(WindowResult result)
          Get the portlet renderer for the render set defined in the window properties that were provided.
 java.lang.String getProperty(WindowResult result, java.lang.String key)
          Get the proerty value that matches the property with the provided key in the provided window properties
 java.lang.String getRegionID()
           
 RegionOrientation getRegionOrientation()
           
 RegionRenderer getRegionRenderer()
           
 RegionRenderer getRegionRenderer(java.lang.String renderSetName)
          Get the region renderer from the render set whose name was provided.
 WindowRenderer getWindowRenderer()
           
 WindowRenderer getWindowRenderer(WindowResult result)
          Get the window renderer for the provided window.
 WindowState getWindowState(WindowContext portletWindow)
           
 void render()
          Render this context and it's children (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RenderContext

public RenderContext(PortalLayout layout,
                     HTTPStreamInfo streamInfo,
                     MarkupResult result,
                     ServerRequest request)
Create a new render context for the provided result.

The result contains information about the markup container (page, region , window context) to render.

Parameters:
layout - the layout that is used for this render context
streamInfo - information about the content type and encoding to use when writing the response
result - the rendered result(s) from the portlet container (PageResult, RegionResult, WindowResult)
request - the current server request
Method Detail

getContext

public RenderContext getContext(Region region,
                                java.lang.String cssId,
                                RegionOrientation orientation)
copy constructor.

Get a render context for a region, based on the state of this render context, but with the provided css id and orientation (which overwrite the values in the provided region)

Parameters:
region - the region to get the render context for
cssId - the id attribute value to generate for this region (needs to be unique in the page for the css to be able to select this region to style)
orientation - the orintation of multiple windows in this region (arranged horizontally or vertically)
Returns:
a new render context for the provided region

getContext

public RenderContext getContext(WindowContext windowContext)
copy constructor.

Get the render context for the provided window context, using the current context as a template for layout, stream info,....

Parameters:
windowContext - the window (context) to get the render context for
Returns:
a render context that can render the markup for the provided window context

getMarkupFragment

public java.lang.StringBuffer getMarkupFragment()
Returns:
a markup fragment

getContentType

public MediaType getContentType()
Returns:
the content type

getCharset

public java.lang.String getCharset()
Returns:
the encoding to use when writing to the output

getRegionOrientation

public RegionOrientation getRegionOrientation()
Returns:
the region orientation

getLayoutInfo

public LayoutInfo getLayoutInfo()
Returns:
metadata about the layout used for this render context

getRegionRenderer

public RegionRenderer getRegionRenderer()
Returns:
the region renderer for the determined renderset of this context

getRegionRenderer

public RegionRenderer getRegionRenderer(java.lang.String renderSetName)
Get the region renderer from the render set whose name was provided.

If no render set name was provided, this method is identical to the no arg version

Parameters:
renderSetName - the name of an alternative render set to get the region renderer from
Returns:
a region renderer

getWindowRenderer

public WindowRenderer getWindowRenderer()
Returns:
the window renderer for the determined render set of this context

getWindowRenderer

public WindowRenderer getWindowRenderer(WindowResult result)
Get the window renderer for the provided window.

The window result can optionally contain a window property that points to a render set to use when getting the window renderer. If no window property was provided, then the default render set of this context will be used.

Parameters:
result - the window result possibly containing the window property that specifies an alternative render set name for the window renderer to use
Returns:
a window renderer

getDecorationRenderer

public DecorationRenderer getDecorationRenderer()
Returns:
a decoration renderer from the determined render set

getDecorationRenderer

public DecorationRenderer getDecorationRenderer(WindowResult result)
Get the decoration renderer for the window that the provided window result is associated with.

If the window result contains a window property that points to a render set, that render set will be used to determine the decoration renderer. Otherwise, the render set that was determined for this context will be used.

Parameters:
result - the window result possibly containing the window property that specifies an alternative render set name for the decoration renderer to use
Returns:
a decoration renderer

getPortletRenderer

public PortletRenderer getPortletRenderer()
Get the portlet renderer from the render set that was determined for this context.

Returns:
a portlet renderer

getPortletRenderer

public PortletRenderer getPortletRenderer(WindowResult result)
Get the portlet renderer for the render set defined in the window properties that were provided.

If the provided window result doesn't contain any window property that defines a render set name, the default render set that was determined for this context will be used to get the portlet renderer.

Parameters:
result - the window result containing the window properties to introspect for a render set name to get the portlet renderer from
Returns:
a portlet renderer

getRegionID

public java.lang.String getRegionID()
Returns:
the region CSS id

getPageProperties

public java.util.Map getPageProperties()
Returns:
the page properties

getLayoutRegionNames

public java.util.List getLayoutRegionNames()
Returns:
the names of all the regions as defined in the layout

getProperty

public java.lang.String getProperty(WindowResult result,
                                    java.lang.String key)
Get the proerty value that matches the property with the provided key in the provided window properties

Parameters:
result - the window result containing the window properties to introspect
key - the property key
Returns:
a property value or null if the property is not present

getLocale

public java.util.Locale getLocale()
Returns:
the prefered locale

getLocales

public java.util.Locale[] getLocales()
Returns:
all locales allowed in the current request

getWindowState

public WindowState getWindowState(WindowContext portletWindow)
Parameters:
portletWindow -
Returns:
the window state of the window

getPortletMode

public Mode getPortletMode(WindowContext portletWindow)
Parameters:
portletWindow -
Returns:
the portlet mode of the window

render

public void render()
            throws RenderException
Render this context and it's children (i.e. create the markup of this context and write it to the markup fragment of this context)

Currently this context only knows how to render fragments of a page (i.e. region,window), not the entire page.

Throws:
RenderException
See Also:
getMarkupFragment()