org.apache.jetspeed.portal.portlets
Class GenericMVCPortlet

java.lang.Object
  extended byorg.apache.jetspeed.portal.portlets.AbstractPortlet
      extended byorg.apache.jetspeed.portal.portlets.AbstractInstancePortlet
          extended byorg.apache.jetspeed.portal.portlets.GenericMVCPortlet
All Implemented Interfaces:
Cacheable, Portlet, PortletState, org.apache.turbine.services.cache.Refreshable, java.io.Serializable
Direct Known Subclasses:
JspPortlet, VelocityPortlet, XSLPortlet

public class GenericMVCPortlet
extends AbstractInstancePortlet

Provides the basic MVC Portlet functionality independant of any specific view technology (ie jsp, velocity, xslt, etc). It handles the views via a ViewProcessor, which is a pluggable, factory created, run time module for which ever view technology your portlet uses. There is no need to extend this portlet class, just define your porlet entry in the registy as a child of this class and provide your template and action class (extened from GenericMVCAction of course) and you are good to go. Example .xreg entry: See the Velocity and JSP MVC Portlet examples for template and action class clues. To add new view processor types, simply implement the ViewProcessor interface and add your type into the viewprocessor.properties file as shown in the example below: mvc.viewprocessor.Velocity = org.apache.jetspeedportlets.viewprocessors.VelocityViewProcessor mvc.viewprocessor.JSP = org.apache.jetspeedportlets.viewprocessors.JSPViewProcessor mvc.viewprocessor.XSL = org.apache.jetspeedportlets.viewprocessors.XSLViewProcessor

Version:
$Id: GenericMVCPortlet.java,v 1.11 2003/02/11 23:09:18 tkuebler Exp $
Author:
tkuebler, Scott T. Weaver
See Also:
Serialized Form

Field Summary
static java.lang.String DOC_URL
           
static java.lang.String IS_CACHEABLE
           
static java.lang.String PORTLET
           
static java.lang.String PORTLET_CONFIG
           
static java.lang.String PORTLET_ID
           
static java.lang.String RENDERING_DELAYED
           
static java.lang.String RUNDATA
           
static java.lang.String SIMULATE_DELAY
           
static java.lang.String SKIN
           
static java.lang.String TEMPLATE
           
static java.lang.String VIEW_TYPE
           
 
Fields inherited from class org.apache.jetspeed.portal.portlets.AbstractPortlet
content
 
Fields inherited from interface org.apache.jetspeed.portal.Portlet
PORTLET_MAXIMIZED, PORTLET_MINIMIZED, PORTLET_NORMAL
 
Constructor Summary
GenericMVCPortlet()
           
 
Method Summary
protected  org.apache.ecs.ConcreteElement buildContent(org.apache.turbine.util.RunData rundata)
           
 org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData rundata)
          Returns an HTML representation of this portlet.
protected  java.lang.String getCurrentTemplate(org.apache.turbine.util.RunData data)
           
protected  java.lang.String getViewType()
           
 void init()
          By default don't provide any initialization
 boolean isCacheable()
          By default MVCPortlets are cacheable.
protected  void populateRequest(org.apache.turbine.util.RunData rundata)
          This is called before any action execution happens.
 boolean providesCustomization()
          Whether or not this portlet provides it's own customizer.
protected  org.apache.ecs.ConcreteElement renderJspTemplate(org.apache.turbine.util.RunData rundata, java.lang.String templateName)
           
protected  void setViewType(java.lang.String viewType)
          STW: Added for backward compatibility when using this class to subclass the existing Jsp and Velocity portlets so they can set their view prior to super.init();
protected  boolean useDelayedRendering(org.apache.turbine.util.RunData rundata)
           
 
Methods inherited from class org.apache.jetspeed.portal.portlets.AbstractInstancePortlet
getHandle
 
Methods inherited from class org.apache.jetspeed.portal.portlets.AbstractPortlet
allowClose, allowCustomize, allowInfo, allowMaximize, allowMinimize, allowPrintFriendly, allowView, clearContent, getAllowEdit, getAllowMaximize, getAllowView, getAttribute, getContent, getContent, getCreationTime, getDescription, getDescription, getExpirationMillis, getExpire, getHandle, getID, getImage, getImage, getInstance, getName, getPortletConfig, getTitle, getTitle, isClosed, isMinimized, isShowTitleBar, refresh, setAttribute, setCacheable, setCachedObject, setClosed, setContent, setContent, setContent, setCreationTime, setDescription, setExpirationMillis, setHandle, setID, setImage, setMinimized, setName, setPortletConfig, setTitle, setTitle, supportsType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PORTLET

public static final java.lang.String PORTLET
See Also:
Constant Field Values

TEMPLATE

public static final java.lang.String TEMPLATE
See Also:
Constant Field Values

RUNDATA

public static final java.lang.String RUNDATA
See Also:
Constant Field Values

PORTLET_CONFIG

public static final java.lang.String PORTLET_CONFIG
See Also:
Constant Field Values

SKIN

public static final java.lang.String SKIN
See Also:
Constant Field Values

VIEW_TYPE

public static final java.lang.String VIEW_TYPE
See Also:
Constant Field Values

IS_CACHEABLE

public static final java.lang.String IS_CACHEABLE
See Also:
Constant Field Values

RENDERING_DELAYED

public static final java.lang.String RENDERING_DELAYED
See Also:
Constant Field Values

SIMULATE_DELAY

public static final java.lang.String SIMULATE_DELAY
See Also:
Constant Field Values

PORTLET_ID

public static final java.lang.String PORTLET_ID
See Also:
Constant Field Values

DOC_URL

public static final java.lang.String DOC_URL
See Also:
Constant Field Values
Constructor Detail

GenericMVCPortlet

public GenericMVCPortlet()
Method Detail

init

public void init()
          throws PortletException
Description copied from class: AbstractPortlet
By default don't provide any initialization

Specified by:
init in interface Portlet
Overrides:
init in class AbstractPortlet
Throws:
PortletException

isCacheable

public boolean isCacheable()
By default MVCPortlets are cacheable. This can be overriden by specifying "_IsCacheable" parameter.

Specified by:
isCacheable in interface Cacheable
Overrides:
isCacheable in class AbstractPortlet
Returns:

providesCustomization

public boolean providesCustomization()
Whether or not this portlet provides it's own customizer. This can be set at the registry level by adding a boolean paramter "provides.customization" Defaults to "false"

Specified by:
providesCustomization in interface Portlet
Overrides:
providesCustomization in class AbstractPortlet
Returns:
true if the portlet does its own customization

getContent

public org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData rundata)
Description copied from interface: Portlet
Returns an HTML representation of this portlet. Usually a Portlet would initialized itself within init() and then when getContent is called it would return its presentation.

Specified by:
getContent in interface Portlet
Overrides:
getContent in class AbstractPortlet
Parameters:
rundata - The RunData object for the current request

buildContent

protected org.apache.ecs.ConcreteElement buildContent(org.apache.turbine.util.RunData rundata)

getViewType

protected java.lang.String getViewType()
Returns:
String
See Also:
setViewType()

setViewType

protected void setViewType(java.lang.String viewType)
STW: Added for backward compatibility when using this class to subclass the existing Jsp and Velocity portlets so they can set their view prior to super.init();

Parameters:
viewType - The viewType to set

populateRequest

protected void populateRequest(org.apache.turbine.util.RunData rundata)
This is called before any action execution happens. This provides backward compatibility to JspPortletActions who retreive information, like Portlet, from the request BEFORE the ViewProcessor.processView() is called which normally populates the request with Context objects.


getCurrentTemplate

protected java.lang.String getCurrentTemplate(org.apache.turbine.util.RunData data)

useDelayedRendering

protected boolean useDelayedRendering(org.apache.turbine.util.RunData rundata)

renderJspTemplate

protected org.apache.ecs.ConcreteElement renderJspTemplate(org.apache.turbine.util.RunData rundata,
                                                           java.lang.String templateName)


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.