|
||||||||||
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 JetspeedPowerTool
java.lang.Exception
public javax.portlet.WindowState getMappedWindowState() throws java.lang.Exception
getMappedWindowState
in interface JetspeedPowerTool
java.lang.Exception
public javax.portlet.PortletMode getPortletMode() throws java.lang.Exception
getPortletMode
in interface JetspeedPowerTool
java.lang.Exception
public javax.portlet.PortletMode getMappedPortletMode() throws java.lang.Exception
getMappedPortletMode
in interface JetspeedPowerTool
java.lang.Exception
public ContentFragment getCurrentFragment()
getCurrentFragment
in interface JetspeedPowerTool
public void setCurrentFragment(ContentFragment f)
setCurrentFragment
in interface JetspeedPowerTool
f
- public void setCurrentLayout()
setCurrentLayout
in interface JetspeedPowerTool
public ContentFragment getCurrentLayout()
getCurrentLayout
in interface JetspeedPowerTool
public Page getPage()
getPage
in interface JetspeedPowerTool
public java.util.List[] getColumns()
getColumns
in interface JetspeedPowerTool
public java.util.List getColumnSizes()
getColumnSizes
in interface JetspeedPowerTool
public org.apache.pluto.om.entity.PortletEntity getCurrentPortletEntity() throws java.lang.Exception
getCurrentPortletEntity
in interface JetspeedPowerTool
java.lang.Exception
public org.apache.pluto.om.entity.PortletEntity getPortletEntity(ContentFragment f) throws java.lang.Exception
getPortletEntity
in interface JetspeedPowerTool
f
- Fragment whose PortletEntity
we want to
retreive.
java.lang.Exception
public boolean isHidden(ContentFragment f)
isHidden
in interface JetspeedPowerTool
f
- Fragment
public TemplateDescriptor getTemplate(java.lang.String path, java.lang.String templateType) throws 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.
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 JetspeedPowerTool
TemplateLocatorException
public java.lang.String includeTemplate(java.lang.String template, java.lang.String templateType) throws java.io.IOException
includeTemplate
in interface JetspeedPowerTool
java.io.IOException
public java.lang.String includeDecoration(java.lang.String template, java.lang.String templateType) throws java.io.IOException
includeDecoration
in interface JetspeedPowerTool
java.io.IOException
public java.lang.String decorateAndInclude(ContentFragment f) throws java.lang.Exception
Decorate and include fragment content.
decorateAndInclude
in interface JetspeedPowerTool
f
- 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.Exception
protected 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 JetspeedPowerTool
java.lang.Exception
public java.util.List getPageDecoratorActions() throws java.lang.Exception
getPageDecoratorActions
in interface JetspeedPowerTool
java.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 JetspeedPowerTool
entity
-
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 JetspeedPowerTool
entity
-
public java.lang.Object getComponent(java.lang.String name)
getComponent
in interface JetspeedPowerTool
public java.lang.String getAbsoluteUrl(java.lang.String relativePath)
getAbsoluteUrl
in interface JetspeedPowerTool
public javax.security.auth.Subject getSubject()
getSubject
in interface JetspeedPowerTool
public boolean getLoggedOn()
getLoggedOn
in interface JetspeedPowerTool
public java.lang.String getBasePath()
getBasePath
in interface JetspeedPowerTool
public java.lang.String getPageBasePath()
getPageBasePath
in interface JetspeedPowerTool
public 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 |