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

PortletContext - JBOSS Portal 2.2 API 英文版文档


org.jboss.portal.theme.page
Interface PortletContext

All Known Implementing Classes:
PortletContextImpl

public interface PortletContext

This interface represents one portlet on a page (-region).

Based on the currently requested page, the portal determines the portlets that need to be rendered. Before calling the portlet container for each of them, the layout strategy has a chance to change some of the behavior. The PortletContext is the way for the portal to communicate the state of an individual portlet to the layout strategy.

See Also:
LayoutStrategy, StrategyContext

Method Summary
 int getOrder()
          Get the order of the portlet in its region.
 Mode getPortletMode()
          Get the current portlet mode of this portlet instance.
 java.lang.String getRegionName()
          Get name of the page region this portlet is assigned to.
 java.util.Set getSupportedPortletModes(MediaType contentType)
          Get a set of modes that this portlet supports.
 java.util.Set getSupportedWindowStates()
          Get the set of window states allowed by this portlet.
 WindowContext getWindowContext()
          Get the window context of this portlet on the currently requested page.
 java.lang.String getWindowID()
          Get a handle to the portlet window for this portlet context.
 WindowState getWindowState()
          Get the current portlet window state of this portlet instance.
 boolean isModeSupported(Mode mode, MediaType mediaType)
          Check if the provided mode is valid for the media type (content type) presented.
 boolean isSupportedWindowState(WindowState windowState)
          Check if the provided WindowState is allowed for this portlet.
 void setOrder(int order)
          Set the sort order of this portlet in its region.
 void setRegionName(java.lang.String regionName)
          Assign the portlet to a different region of the page.
 

Method Detail

getWindowID

public java.lang.String getWindowID()
Get a handle to the portlet window for this portlet context.

Returns:
the handle to the window of this portlet context

getWindowContext

public WindowContext getWindowContext()
Get the window context of this portlet on the currently requested page.

The window context is a state holder to get access to the portlet's position on the page.

Returns:
the window context for this portlet window

getWindowState

public WindowState getWindowState()
                           throws ThemeException
Get the current portlet window state of this portlet instance.

Returns:
the current portlet window state of this portlet instance
Throws:
ThemeException - if the current navigational state is unknown
See Also:
WindowState

getSupportedWindowStates

public java.util.Set getSupportedWindowStates()
                                       throws ThemeException
Get the set of window states allowed by this portlet.

Returns:
the set of window states allowed by this portlet
Throws:
ThemeException - if the state provider is unknown

isSupportedWindowState

public boolean isSupportedWindowState(WindowState windowState)
                               throws ThemeException
Check if the provided WindowState is allowed for this portlet.

Parameters:
windowState - the window state to check against the allowed ones
Returns:
true if the getWindows state is allowed
Throws:
ThemeException - if the state provider is unknown
java.lang.IllegalArgumentException - if the window state is null

getPortletMode

public Mode getPortletMode()
                    throws ThemeException
Get the current portlet mode of this portlet instance.

Returns:
the current portlet mode of this portlet
Throws:
ThemeException - if the current navigational state is unknown

getSupportedPortletModes

public java.util.Set getSupportedPortletModes(MediaType contentType)
                                       throws ThemeException
Get a set of modes that this portlet supports.

Portlet modes are defined per content type.

Parameters:
contentType - the content type for which to look for the supported modes.
Returns:
the set of supported modes of this portlet
Throws:
ThemeException - if the mode provider is unknown

isModeSupported

public boolean isModeSupported(Mode mode,
                               MediaType mediaType)
                        throws ThemeException
Check if the provided mode is valid for the media type (content type) presented.

Note: you can also check if the portal supports this mode via the strategy context

Parameters:
mode - the mode to check
mediaType - the content type to check the mode for
Returns:
true if the mode is supported for this content type by this portlet
Throws:
ThemeException - if the mode provider is unknown
See Also:
StrategyContext.isPortalSupportedPortletMode(Mode)

getRegionName

public java.lang.String getRegionName()
Get name of the page region this portlet is assigned to.

Returns:
the name of the page region this portlet is assigned to.

setRegionName

public void setRegionName(java.lang.String regionName)
Assign the portlet to a different region of the page.

In order to assign this portlet to another region, the region must be one of the available regions of the current page. The change will not be persisted outside the current request.

Parameters:
regionName - the name of the region to re-assign the portlet to
See Also:
StrategyContext.getRegions()

getOrder

public int getOrder()
Get the order of the portlet in its region.

Returns:
the order of the portlet in its region

setOrder

public void setOrder(int order)
Set the sort order of this portlet in its region.

Note: this change is only valid for the current request, and will not be persisted

Parameters:
order - the sort order to assign to this portlet