|
|||||||||||
| 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 JetspeedPowerToolException
public javax.portlet.PortletMode getPortletMode()
throws Exception
getPortletMode in interface JetspeedPowerToolExceptionpublic org.apache.jetspeed.om.page.ContentFragment getCurrentFragment()
getCurrentFragment in interface JetspeedPowerToolpublic void setCurrentFragment(org.apache.jetspeed.om.page.ContentFragment f)
setCurrentFragment in interface JetspeedPowerToolf - public void setCurrentLayout()
setCurrentLayout in interface JetspeedPowerToolpublic org.apache.jetspeed.om.page.ContentFragment getCurrentLayout()
getCurrentLayout in interface JetspeedPowerToolpublic org.apache.jetspeed.om.page.Page getPage()
getPage in interface JetspeedPowerToolpublic List[] getColumns()
getColumns in interface JetspeedPowerToolpublic List getColumnSizes()
getColumnSizes in interface JetspeedPowerTool
public org.apache.pluto.om.entity.PortletEntity getCurrentPortletEntity()
throws Exception
getCurrentPortletEntity in interface JetspeedPowerToolException
public org.apache.pluto.om.entity.PortletEntity getPortletEntity(org.apache.jetspeed.om.page.ContentFragment f)
throws Exception
getPortletEntity in interface JetspeedPowerToolf - Fragment whose PortletEntity we want to
retreive.
Exceptionpublic boolean isHidden(org.apache.jetspeed.om.page.ContentFragment f)
isHidden in interface JetspeedPowerToolf - Fragment
public org.apache.jetspeed.locator.TemplateDescriptor getTemplate(String path,
String templateType)
throws org.apache.jetspeed.locator.TemplateLocatorException
getTemplate in interface JetspeedPowerToolpath - 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 JetspeedPowerToolException
public org.apache.jetspeed.locator.TemplateDescriptor getDecoration(String path,
String templateType)
throws org.apache.jetspeed.locator.TemplateLocatorException
getDecoration in interface JetspeedPowerToolorg.apache.jetspeed.locator.TemplateLocatorException
public String includeTemplate(String template,
String templateType)
throws IOException
includeTemplate in interface JetspeedPowerToolIOException
public String includeDecoration(String template,
String templateType)
throws IOException
includeDecoration in interface JetspeedPowerToolIOException
public String decorateAndInclude(org.apache.jetspeed.om.page.ContentFragment f)
throws Exception
Decorate and include fragment content.
decorateAndInclude in interface JetspeedPowerToolf - 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"
Exceptionprotected 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 JetspeedPowerToolException
public List getPageDecoratorActions()
throws Exception
getPageDecoratorActions in interface JetspeedPowerToolExceptionprotected 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 JetspeedPowerToolentity -
public String getTitle(org.apache.pluto.om.entity.PortletEntity entity)
getTitle
Returns the appropriate for the title based on locale prferences
getTitle in interface JetspeedPowerToolentity -
public Object getComponent(String name)
getComponent in interface JetspeedPowerToolpublic String getAbsoluteUrl(String relativePath)
getAbsoluteUrl in interface JetspeedPowerToolpublic Subject getSubject()
getSubject in interface JetspeedPowerToolpublic boolean getLoggedOn()
getLoggedOn in interface JetspeedPowerToolpublic String getBasePath()
getBasePath in interface JetspeedPowerToolpublic String getPageBasePath()
getPageBasePath in interface JetspeedPowerToolpublic void setVelocityContext(org.apache.velocity.context.Context velocityContext)
JetspeedPowerTool
setVelocityContext in interface JetspeedPowerToolvelocityContext -
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 | ||||||||||