|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jetspeed.velocity.JetspeedPowerToolImpl
JetspeedPowerTool
The JetspeedPowerTool is meant to be used by template designers to build templates for internal Jetspeed portlet applications. It hides the implementation details of the more common template actions so that future changes to said implementation have minimal effect on template.
Where applicable, methods have been marked with a BEST PRATICES meaning that this method should be used instead the synonymous code listed within the method docuementation.
Field Summary | |
private static String |
ACTION_IMAGE_EXTENSION_ATTR
|
protected org.apache.jetspeed.capabilities.CapabilityMap |
capabilityMap
|
protected static String |
COLUMN_SIZES
|
protected static String |
COLUMNS_ATTR
|
protected org.apache.jetspeed.locator.TemplateLocator |
decorationLocator
|
protected org.apache.jetspeed.locator.LocatorDescriptor |
decorationLocatorDescriptor
|
private static String |
DECORATOR_ID_ATTR
|
protected org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent |
entityAccess
|
protected Locale |
locale
|
protected static org.apache.commons.logging.Log |
log
|
protected static String |
PORTLET_CONFIG_ATTR
|
protected javax.portlet.PortletConfig |
portletConfig
|
protected static String |
POWER_TOOL_SESSION_ACTIONS
|
protected static String |
RENDER_REQUEST_ATTR
|
protected static String |
RENDER_RESPONSE_ATTR
|
protected javax.portlet.RenderRequest |
renderRequest
|
protected javax.portlet.RenderResponse |
renderResponse
|
protected org.apache.jetspeed.request.RequestContext |
requestContext
|
protected org.apache.jetspeed.locator.TemplateLocator |
templateLocator
|
protected org.apache.jetspeed.locator.LocatorDescriptor |
templateLocatorDescriptor
|
protected Writer |
templateWriter
|
private DynamicTitleService |
titleService
|
protected org.apache.velocity.context.Context |
velocityContext
|
protected org.apache.jetspeed.container.window.PortletWindowAccessor |
windowAccess
|
Fields inherited from interface org.apache.jetspeed.velocity.JetspeedPowerTool |
DECORATOR_TYPE, FRAGMENT_ATTR, FRAGMENT_PROCESSING_ERROR_PREFIX, GENERIC_TEMPLATE_TYPE, HIDDEN, LAYOUT_ATTR, LAYOUT_TEMPLATE_TYPE |
Constructor Summary | |
JetspeedPowerToolImpl(org.apache.jetspeed.request.RequestContext requestContext,
DynamicTitleService titleService)
|
Method Summary | |
protected void |
checkState()
|
protected DecoratorAction |
createDecoratorAction(String resourceBase,
String actionName)
|
protected DecoratorAction |
createPortletModeAction(org.apache.pluto.om.window.PortletWindow window,
String actionName,
javax.portlet.PortletMode mode,
String resourceBase)
Creates a Decorator PortletMode Action to be added to the list of actions decorating a portlet. |
protected DecoratorAction |
createWindowStateAction(org.apache.pluto.om.window.PortletWindow window,
String actionName,
javax.portlet.WindowState state,
String resourceBase)
Creates a Decorator WindowState Action to be added to the list of actions decorating a portlet. |
String |
decorateAndInclude(org.apache.jetspeed.om.page.ContentFragment f)
Decorate and include fragment content. |
protected String |
decorateAndIncludePortlet(org.apache.jetspeed.om.page.ContentFragment f)
The decorator template itself is responsible for including the content of the target Fragment which is easily acheived like so: in Velocity: |
String |
getAbsoluteUrl(String relativePath)
|
String |
getBasePath()
|
List[] |
getColumns()
|
List |
getColumnSizes()
|
Object |
getComponent(String name)
|
org.apache.jetspeed.om.page.ContentFragment |
getCurrentFragment()
|
org.apache.jetspeed.om.page.ContentFragment |
getCurrentLayout()
|
org.apache.pluto.om.entity.PortletEntity |
getCurrentPortletEntity()
|
org.apache.jetspeed.locator.TemplateDescriptor |
getDecoration(String path,
String templateType)
|
List |
getDecoratorActions()
Gets the list of decorator actions for a window. |
protected List |
getDecoratorActions(boolean layout)
|
boolean |
getLoggedOn()
|
org.apache.jetspeed.om.page.Page |
getPage()
|
String |
getPageBasePath()
|
List |
getPageDecoratorActions()
Gets the list of decorator actions for a page. |
org.apache.pluto.om.entity.PortletEntity |
getPortletEntity(org.apache.jetspeed.om.page.ContentFragment f)
|
javax.portlet.PortletMode |
getPortletMode()
Gets the portlet mode for a current portlet window (fragment) |
protected org.apache.jetspeed.request.RequestContext |
getRequestContext()
getRequestContext |
Subject |
getSubject()
|
org.apache.jetspeed.locator.TemplateDescriptor |
getTemplate(String path,
String templateType)
Retreives a template using Jetspeed's |
protected org.apache.jetspeed.locator.TemplateDescriptor |
getTemplate(String path,
String templateType,
org.apache.jetspeed.locator.TemplateLocator locator,
org.apache.jetspeed.locator.LocatorDescriptor descriptor)
|
String |
getTitle(org.apache.pluto.om.entity.PortletEntity entity)
getTitle |
String |
getTitle(org.apache.pluto.om.entity.PortletEntity entity,
org.apache.jetspeed.om.page.ContentFragment f)
getTitle |
org.apache.commons.configuration.Configuration |
getTypeConfiguration(String type,
String name,
String location)
|
javax.portlet.WindowState |
getWindowState()
Gets the window state for the current portlet window (fragment) |
protected void |
handleError(Exception e,
String msg,
org.apache.jetspeed.om.page.ContentFragment fragment)
handleError |
String |
includeDecoration(String template,
String templateType)
|
String |
includeTemplate(String template,
String templateType)
|
boolean |
isHidden(org.apache.jetspeed.om.page.ContentFragment f)
Checks the the visibilty of this fragment with respect to the current RenderReqeust. |
protected void |
setAttribute(String name,
Object object)
Sets an attribute for use within your layout and decoration templates. |
void |
setCurrentFragment(org.apache.jetspeed.om.page.ContentFragment f)
|
void |
setCurrentLayout()
|
void |
setVelocityContext(org.apache.velocity.context.Context velocityContext)
Sets the Velocity Context object for this powertool instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String DECORATOR_ID_ATTR
private static final String ACTION_IMAGE_EXTENSION_ATTR
protected static final String PORTLET_CONFIG_ATTR
protected static final String RENDER_RESPONSE_ATTR
protected static final String RENDER_REQUEST_ATTR
protected static final String COLUMNS_ATTR
protected static final String COLUMN_SIZES
protected javax.portlet.RenderRequest renderRequest
protected javax.portlet.RenderResponse renderResponse
protected javax.portlet.PortletConfig portletConfig
protected Writer templateWriter
protected static final String POWER_TOOL_SESSION_ACTIONS
protected static final org.apache.commons.logging.Log log
protected org.apache.jetspeed.capabilities.CapabilityMap capabilityMap
protected Locale locale
protected org.apache.jetspeed.locator.LocatorDescriptor templateLocatorDescriptor
protected org.apache.jetspeed.locator.TemplateLocator templateLocator
protected org.apache.jetspeed.components.portletentity.PortletEntityAccessComponent entityAccess
protected org.apache.jetspeed.locator.TemplateLocator decorationLocator
protected org.apache.jetspeed.locator.LocatorDescriptor decorationLocatorDescriptor
protected org.apache.jetspeed.container.window.PortletWindowAccessor windowAccess
protected org.apache.jetspeed.request.RequestContext requestContext
protected org.apache.velocity.context.Context velocityContext
private DynamicTitleService titleService
Constructor Detail |
public JetspeedPowerToolImpl(org.apache.jetspeed.request.RequestContext requestContext, DynamicTitleService titleService) throws Exception
Method Detail |
protected final org.apache.jetspeed.request.RequestContext getRequestContext()
getRequestContext
public javax.portlet.WindowState getWindowState() throws Exception
getWindowState
in interface JetspeedPowerTool
Exception
public javax.portlet.PortletMode getPortletMode() throws Exception
getPortletMode
in interface JetspeedPowerTool
Exception
public org.apache.jetspeed.om.page.ContentFragment getCurrentFragment()
getCurrentFragment
in interface JetspeedPowerTool
public void setCurrentFragment(org.apache.jetspeed.om.page.ContentFragment f)
setCurrentFragment
in interface JetspeedPowerTool
f
- public void setCurrentLayout()
setCurrentLayout
in interface JetspeedPowerTool
public org.apache.jetspeed.om.page.ContentFragment getCurrentLayout()
getCurrentLayout
in interface JetspeedPowerTool
public org.apache.jetspeed.om.page.Page getPage()
getPage
in interface JetspeedPowerTool
public List[] getColumns()
getColumns
in interface JetspeedPowerTool
public List getColumnSizes()
getColumnSizes
in interface JetspeedPowerTool
public org.apache.pluto.om.entity.PortletEntity getCurrentPortletEntity() throws Exception
getCurrentPortletEntity
in interface JetspeedPowerTool
Exception
public org.apache.pluto.om.entity.PortletEntity getPortletEntity(org.apache.jetspeed.om.page.ContentFragment f) throws Exception
getPortletEntity
in interface JetspeedPowerTool
f
- Fragment whose PortletEntity
we want to
retreive.
Exception
public boolean isHidden(org.apache.jetspeed.om.page.ContentFragment f)
isHidden
in interface JetspeedPowerTool
f
- Fragment
public org.apache.jetspeed.locator.TemplateDescriptor getTemplate(String path, String templateType) throws org.apache.jetspeed.locator.TemplateLocatorException
getTemplate
in interface JetspeedPowerTool
path
- Expected to the template. This may actually be changed by the
TL service based the capability and localization information
provided by the client.templateType
- Type off template we are interested in.
org.apache.jetspeed.locator.TemplateLocatorException
- if the path
does not exist.TemplateLocator
public org.apache.commons.configuration.Configuration getTypeConfiguration(String type, String name, String location) throws Exception
getTypeConfiguration
in interface JetspeedPowerTool
Exception
public org.apache.jetspeed.locator.TemplateDescriptor getDecoration(String path, String templateType) throws org.apache.jetspeed.locator.TemplateLocatorException
getDecoration
in interface JetspeedPowerTool
org.apache.jetspeed.locator.TemplateLocatorException
public String includeTemplate(String template, String templateType) throws IOException
includeTemplate
in interface JetspeedPowerTool
IOException
public String includeDecoration(String template, String templateType) throws IOException
includeDecoration
in interface JetspeedPowerTool
IOException
public String decorateAndInclude(org.apache.jetspeed.om.page.ContentFragment f) throws Exception
Decorate and include fragment content.
decorateAndInclude
in interface JetspeedPowerTool
f
- Fragment to include and decorate
Exception
protected String decorateAndIncludePortlet(org.apache.jetspeed.om.page.ContentFragment f) throws Exception
The decorator template itself is responsible for including the content of
the target Fragment which is easily acheived like so:
in Velocity:
$jetspeed.include($jetspeed.currentFragment)
In JSP:
<%
JetspeedPowerTool jetspeed = new JetspeedPowerTool(renderRequest, renderResponse, portletConfig);
jetspeed.include(jetspeed.getCurrentFragment());
%>
f
- Portlet fragment to "decorate"
Exception
protected void checkState()
IllegalStateException
- if the PortletConfig
,
RenderRequest
or RenderReponse
is null.protected org.apache.jetspeed.locator.TemplateDescriptor getTemplate(String path, String templateType, org.apache.jetspeed.locator.TemplateLocator locator, org.apache.jetspeed.locator.LocatorDescriptor descriptor) throws org.apache.jetspeed.locator.TemplateLocatorException
org.apache.jetspeed.locator.TemplateLocatorException
protected void handleError(Exception e, String msg, org.apache.jetspeed.om.page.ContentFragment fragment)
handleError
e
- msg
- public List getDecoratorActions()
getDecoratorActions
in interface JetspeedPowerTool
Exception
public List getPageDecoratorActions() throws Exception
getPageDecoratorActions
in interface JetspeedPowerTool
Exception
protected List getDecoratorActions(boolean layout)
protected DecoratorAction createDecoratorAction(String resourceBase, String actionName)
protected DecoratorAction createPortletModeAction(org.apache.pluto.om.window.PortletWindow window, String actionName, javax.portlet.PortletMode mode, String resourceBase)
protected DecoratorAction createWindowStateAction(org.apache.pluto.om.window.PortletWindow window, String actionName, javax.portlet.WindowState state, String resourceBase)
public String getTitle(org.apache.pluto.om.entity.PortletEntity entity, org.apache.jetspeed.om.page.ContentFragment f)
getTitle
Returns the appropriate for the title based on locale prferences
getTitle
in interface JetspeedPowerTool
entity
-
public String getTitle(org.apache.pluto.om.entity.PortletEntity entity)
getTitle
Returns the appropriate for the title based on locale prferences
getTitle
in interface JetspeedPowerTool
entity
-
public Object getComponent(String name)
getComponent
in interface JetspeedPowerTool
public String getAbsoluteUrl(String relativePath)
getAbsoluteUrl
in interface JetspeedPowerTool
public Subject getSubject()
getSubject
in interface JetspeedPowerTool
public boolean getLoggedOn()
getLoggedOn
in interface JetspeedPowerTool
public String getBasePath()
getBasePath
in interface JetspeedPowerTool
public String getPageBasePath()
getPageBasePath
in interface JetspeedPowerTool
public void setVelocityContext(org.apache.velocity.context.Context velocityContext)
JetspeedPowerTool
setVelocityContext
in interface JetspeedPowerTool
velocityContext
- protected void setAttribute(String name, Object object)
javax.portlet.Renderrequest
and is also stored within the current
org.apache.velocity.Context
if it is available.
name
- to store the attribute under.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |