|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jetspeed.velocity.JetspeedPowerToolImpl
public class 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 | |
|---|---|
protected CapabilityMap |
capabilityMap
|
protected static java.lang.String |
COLUMN_SIZES
|
protected static java.lang.String |
COLUMNS_ATTR
|
protected TemplateLocator |
decorationLocator
|
protected LocatorDescriptor |
decorationLocatorDescriptor
|
protected PortletEntityAccessComponent |
entityAccess
|
protected java.util.Locale |
locale
|
protected static org.apache.commons.logging.Log |
log
|
protected static java.lang.String |
PORTLET_CONFIG_ATTR
|
protected javax.portlet.PortletConfig |
portletConfig
|
protected static java.lang.String |
RENDER_REQUEST_ATTR
|
protected static java.lang.String |
RENDER_RESPONSE_ATTR
|
protected javax.portlet.RenderRequest |
renderRequest
|
protected javax.portlet.RenderResponse |
renderResponse
|
protected RequestContext |
requestContext
|
protected TemplateLocator |
templateLocator
|
protected LocatorDescriptor |
templateLocatorDescriptor
|
protected java.io.Writer |
templateWriter
|
protected org.apache.velocity.context.Context |
velocityContext
|
protected PortletWindowAccessor |
windowAccess
|
| Fields inherited from interface org.apache.jetspeed.layout.JetspeedPowerTool |
|---|
DECORATOR_TYPE, FRAGMENT_ATTR, FRAGMENT_PROCESSING_ERROR_PREFIX, GENERIC_TEMPLATE_TYPE, HIDDEN, LAYOUT_ATTR, LAYOUT_TEMPLATE_TYPE |
| Constructor Summary | |
|---|---|
JetspeedPowerToolImpl(RequestContext requestContext,
DynamicTitleService titleService,
PortletRenderer renderer)
|
|
| Method Summary | |
|---|---|
protected void |
checkState()
|
java.lang.String |
decorateAndInclude(ContentFragment f)
Decorate and include fragment content. |
protected java.lang.String |
decorateAndIncludePortlet(ContentFragment f)
The decorator template itself is responsible for including the content of the target Fragment which is easily acheived like so: in Velocity: |
java.lang.String |
getAbsoluteUrl(java.lang.String relativePath)
|
java.lang.String |
getBasePath()
|
java.util.List[] |
getColumns()
|
java.util.List |
getColumnSizes()
|
java.lang.Object |
getComponent(java.lang.String name)
|
ContentFragment |
getCurrentFragment()
|
ContentFragment |
getCurrentLayout()
|
org.apache.pluto.om.entity.PortletEntity |
getCurrentPortletEntity()
|
TemplateDescriptor |
getDecoration(java.lang.String path,
java.lang.String templateType)
|
java.util.List |
getDecoratorActions()
Deprecated. |
boolean |
getLoggedOn()
|
javax.portlet.PortletMode |
getMappedPortletMode()
Gets the internal (portal) portlet mode for a current portlet window (fragment) |
javax.portlet.WindowState |
getMappedWindowState()
Gets the internal (portal) window state for the current portlet window (fragment) |
Page |
getPage()
|
java.lang.String |
getPageBasePath()
|
java.util.List |
getPageDecoratorActions()
Deprecated. |
org.apache.pluto.om.entity.PortletEntity |
getPortletEntity(ContentFragment f)
|
javax.portlet.PortletMode |
getPortletMode()
Gets the portlet mode for a current portlet window (fragment) |
protected RequestContext |
getRequestContext()
getRequestContext |
javax.security.auth.Subject |
getSubject()
|
TemplateDescriptor |
getTemplate(java.lang.String path,
java.lang.String templateType)
Retreives a template using Jetspeed's |
protected TemplateDescriptor |
getTemplate(java.lang.String path,
java.lang.String templateType,
TemplateLocator locator,
LocatorDescriptor descriptor)
|
java.lang.String |
getTitle(org.apache.pluto.om.entity.PortletEntity entity)
getTitle |
java.lang.String |
getTitle(org.apache.pluto.om.entity.PortletEntity entity,
ContentFragment f)
getTitle |
org.apache.commons.configuration.Configuration |
getTypeConfiguration(java.lang.String type,
java.lang.String name,
java.lang.String location)
|
javax.portlet.WindowState |
getWindowState()
Gets the window state for the current portlet window (fragment) |
protected void |
handleError(java.lang.Exception e,
java.lang.String msg,
ContentFragment fragment)
handleError |
java.lang.String |
includeDecoration(java.lang.String template,
java.lang.String templateType)
|
java.lang.String |
includeTemplate(java.lang.String template,
java.lang.String templateType)
|
boolean |
isHidden(ContentFragment f)
Checks the the visibilty of this fragment with respect to the current RenderReqeust. |
java.lang.String |
renderPortletEntity(java.lang.String entityId,
java.lang.String portletId)
|
protected void |
setAttribute(java.lang.String name,
java.lang.Object object)
Sets an attribute for use within your layout and decoration templates. |
void |
setCurrentFragment(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 |
|---|
protected static final java.lang.String PORTLET_CONFIG_ATTR
protected static final java.lang.String RENDER_RESPONSE_ATTR
protected static final java.lang.String RENDER_REQUEST_ATTR
protected static final java.lang.String COLUMNS_ATTR
protected static final java.lang.String COLUMN_SIZES
protected javax.portlet.RenderRequest renderRequest
protected javax.portlet.RenderResponse renderResponse
protected javax.portlet.PortletConfig portletConfig
protected java.io.Writer templateWriter
protected static final org.apache.commons.logging.Log log
protected CapabilityMap capabilityMap
protected java.util.Locale locale
protected LocatorDescriptor templateLocatorDescriptor
protected TemplateLocator templateLocator
protected PortletEntityAccessComponent entityAccess
protected TemplateLocator decorationLocator
protected LocatorDescriptor decorationLocatorDescriptor
protected PortletWindowAccessor windowAccess
protected RequestContext requestContext
protected org.apache.velocity.context.Context velocityContext
| Constructor Detail |
|---|
public JetspeedPowerToolImpl(RequestContext requestContext,
DynamicTitleService titleService,
PortletRenderer renderer)
throws java.lang.Exception
java.lang.Exception| Method Detail |
|---|
protected final RequestContext getRequestContext()
getRequestContext
public javax.portlet.WindowState getWindowState()
throws java.lang.Exception
getWindowState in interface JetspeedPowerTooljava.lang.Exception
public javax.portlet.WindowState getMappedWindowState()
throws java.lang.Exception
getMappedWindowState in interface JetspeedPowerTooljava.lang.Exception
public javax.portlet.PortletMode getPortletMode()
throws java.lang.Exception
getPortletMode in interface JetspeedPowerTooljava.lang.Exception
public javax.portlet.PortletMode getMappedPortletMode()
throws java.lang.Exception
getMappedPortletMode in interface JetspeedPowerTooljava.lang.Exceptionpublic ContentFragment getCurrentFragment()
getCurrentFragment in interface JetspeedPowerToolpublic void setCurrentFragment(ContentFragment f)
setCurrentFragment in interface JetspeedPowerToolf - public void setCurrentLayout()
setCurrentLayout in interface JetspeedPowerToolpublic ContentFragment getCurrentLayout()
getCurrentLayout in interface JetspeedPowerToolpublic Page getPage()
getPage in interface JetspeedPowerToolpublic java.util.List[] getColumns()
getColumns in interface JetspeedPowerToolpublic java.util.List getColumnSizes()
getColumnSizes in interface JetspeedPowerTool
public org.apache.pluto.om.entity.PortletEntity getCurrentPortletEntity()
throws java.lang.Exception
getCurrentPortletEntity in interface JetspeedPowerTooljava.lang.Exception
public org.apache.pluto.om.entity.PortletEntity getPortletEntity(ContentFragment f)
throws java.lang.Exception
getPortletEntity in interface JetspeedPowerToolf - Fragment whose PortletEntity we want to
retreive.
java.lang.Exceptionpublic boolean isHidden(ContentFragment f)
isHidden in interface JetspeedPowerToolf - Fragment
public TemplateDescriptor getTemplate(java.lang.String path,
java.lang.String templateType)
throws 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.
TemplateLocatorException - if the path does not exist.TemplateLocator
public org.apache.commons.configuration.Configuration getTypeConfiguration(java.lang.String type,
java.lang.String name,
java.lang.String location)
throws java.lang.Exception
java.lang.Exception
public TemplateDescriptor getDecoration(java.lang.String path,
java.lang.String templateType)
throws TemplateLocatorException
getDecoration in interface JetspeedPowerToolTemplateLocatorException
public java.lang.String includeTemplate(java.lang.String template,
java.lang.String templateType)
throws java.io.IOException
includeTemplate in interface JetspeedPowerTooljava.io.IOException
public java.lang.String includeDecoration(java.lang.String template,
java.lang.String templateType)
throws java.io.IOException
includeDecoration in interface JetspeedPowerTooljava.io.IOException
public java.lang.String decorateAndInclude(ContentFragment f)
throws java.lang.Exception
Decorate and include fragment content.
decorateAndInclude in interface JetspeedPowerToolf - Fragment to include and decorate
java.lang.Exception
protected java.lang.String decorateAndIncludePortlet(ContentFragment f)
throws java.lang.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"
java.lang.Exceptionprotected void checkState()
java.lang.IllegalStateException - if the PortletConfig,
RenderRequest or RenderReponse
is null.
protected TemplateDescriptor getTemplate(java.lang.String path,
java.lang.String templateType,
TemplateLocator locator,
LocatorDescriptor descriptor)
throws TemplateLocatorException
TemplateLocatorException
protected void handleError(java.lang.Exception e,
java.lang.String msg,
ContentFragment fragment)
handleError
e - msg - public java.util.List getDecoratorActions()
getDecoratorActions in interface JetspeedPowerTooljava.lang.Exception
public java.util.List getPageDecoratorActions()
throws java.lang.Exception
getPageDecoratorActions in interface JetspeedPowerTooljava.lang.Exception
public java.lang.String getTitle(org.apache.pluto.om.entity.PortletEntity entity,
ContentFragment f)
getTitle
Returns the appropriate for the title based on locale prferences
getTitle in interface JetspeedPowerToolentity -
public java.lang.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 java.lang.Object getComponent(java.lang.String name)
getComponent in interface JetspeedPowerToolpublic java.lang.String getAbsoluteUrl(java.lang.String relativePath)
getAbsoluteUrl in interface JetspeedPowerToolpublic javax.security.auth.Subject getSubject()
getSubject in interface JetspeedPowerToolpublic boolean getLoggedOn()
getLoggedOn in interface JetspeedPowerToolpublic java.lang.String getBasePath()
getBasePath in interface JetspeedPowerToolpublic java.lang.String getPageBasePath()
getPageBasePath in interface JetspeedPowerToolpublic void setVelocityContext(org.apache.velocity.context.Context velocityContext)
JetspeedVelocityPowerTool
setVelocityContext in interface JetspeedVelocityPowerTool
protected void setAttribute(java.lang.String name,
java.lang.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.obj - object to set.
public java.lang.String renderPortletEntity(java.lang.String entityId,
java.lang.String portletId)
renderPortletEntity in interface JetspeedPowerTool
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||