org.apache.jetspeed.portal
Interface Portlet

All Superinterfaces:
java.io.Serializable
All Known Subinterfaces:
PortletControl, PortletSet
All Known Implementing Classes:
AbstractPortlet, AbstractPortletControl, BasePortletSet, ContainerTestPortlet, PortletWrapper

public interface Portlet
extends java.io.Serializable

A portlet is an implementation of a small control (usually rendered in HTML) that is available to a client application. Portlets were designed to be extensible so that 3rd parties implement their own Portlets.

Version:
$Id: Portlet.java,v 1.49 2005/04/02 17:31:08 jford Exp $
Author:
Kevin A. Burton

Field Summary
static int PORTLET_MAXIMIZED
           
static int PORTLET_MINIMIZED
           
static int PORTLET_NORMAL
           
 
Method Summary
 boolean getAllowEdit(org.apache.turbine.util.RunData rundata)
          Return true if this portlet is allowed to be edited in the rundata's context .
 boolean getAllowMaximize(org.apache.turbine.util.RunData rundata)
          Return true if this portlets is allowed to be maximized.
 boolean getAllowView(org.apache.turbine.util.RunData rundata)
          Return true if this portlet is allowed to be viewed in the rundata's context .
 java.lang.String getAttribute(java.lang.String attrName, java.lang.String attrDefValue, org.apache.turbine.util.RunData rundata)
          Retrieve a portlet attribute from persistent storage
 org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData rundata)
          Returns an HTML representation of this portlet.
 long getCreationTime()
          Get the creation time for this Portlet
 java.lang.String getDescription()
           Returns a description of this portlet.
 java.lang.String getDescription(java.lang.String instanceDescription)
          Get a Description for this instance of the portlet.
 java.lang.String getID()
          Retrieve a unique portlet id
 java.lang.String getImage(java.lang.String instanceImage)
          Getter for property image.
 PortletInstance getInstance(org.apache.turbine.util.RunData rundata)
          Gets the portlet instance associated with this portlet.
 java.lang.String getName()
          Returns a name for this portlet.
 PortletConfig getPortletConfig()
          Get the config of this servlet.
 java.lang.String getTitle()
           Allows a Portlet to define its title.
 java.lang.String getTitle(java.lang.String instanceTitle)
          Get a title for this instance of the portlet.
 void init()
          All initialization should be performed here.
 boolean isShowTitleBar(org.apache.turbine.util.RunData rundata)
          Returns TRUE if the title bar in should be displayed.
 boolean providesCustomization()
           
 void setAttribute(java.lang.String attrName, java.lang.String attrValue, org.apache.turbine.util.RunData rundata)
          Stores a portlet attribute in persistent storage
 void setCreationTime(long creationTime)
          Set the creation time for this Portlet
 void setDescription(java.lang.String description)
          Set the description for this Portlet
 void setID(java.lang.String id)
           
 void setImage(java.lang.String instanceImage)
          Setter for property image.
 void setName(java.lang.String name)
          Sets the name on this Portlet.
 void setPortletConfig(PortletConfig pc)
          Set's the configuration of this servlet.
 void setTitle(java.lang.String title)
          Set the title for this Portlet
 void setTitle(java.lang.String title, org.apache.turbine.util.RunData runData)
           
 boolean supportsType(MimeType mimeType)
          Returns true portlet is able to output content for given mimetype
 

Field Detail

PORTLET_NORMAL

public static final int PORTLET_NORMAL
See Also:
Constant Field Values

PORTLET_MINIMIZED

public static final int PORTLET_MINIMIZED
See Also:
Constant Field Values

PORTLET_MAXIMIZED

public static final int PORTLET_MAXIMIZED
See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Returns a name for this portlet. This is used by PSML to identify a Portlet within the PortletRegistry


setName

public void setName(java.lang.String name)
Sets the name on this Portlet.

See Also:
getName()

getTitle

public java.lang.String getTitle()

Allows a Portlet to define its title. This can be used by a PortletControl for rendering its content.

In order to define a default title you should not override this but should call setTitle() within your init() method

This should return null if not specified.


getTitle

public java.lang.String getTitle(java.lang.String instanceTitle)
Get a title for this instance of the portlet. This method is called from the context variable portlet_instance and from PortletInstance If you wish to append to the title, then you code should look like getTitle( String instanceTitle) { return super.getTitle( instanceTitle) + " - Appened title text"; }

Parameters:
instanceTitle - Title from PSML

setTitle

public void setTitle(java.lang.String title)
Set the title for this Portlet


setTitle

public void setTitle(java.lang.String title,
                     org.apache.turbine.util.RunData runData)

getDescription

public java.lang.String getDescription()

Returns a description of this portlet. This should describe what the capabilities of the portlet and how it can help the user.

In order to define a default title you should not override (in the AbstractPortlet implementation) this but should call setDescription() within your init() method

This should return null if not specified.


getDescription

public java.lang.String getDescription(java.lang.String instanceDescription)
Get a Description for this instance of the portlet. This method is called from the context variable portlet_instance and from PortletInstance If you wish to append to the Description, then you code should look like getDescription( String instanceTitle) { return super.getDescription( instanceDescription) + " - Appened Description text"; }

Parameters:
instanceDescription - Description from PSML

setDescription

public void setDescription(java.lang.String description)
Set the description for this Portlet


getImage

public java.lang.String getImage(java.lang.String instanceImage)
Getter for property image.

Returns:
Name of portlet image, icon. The name is expected to be in the form of a URL.

setImage

public void setImage(java.lang.String instanceImage)
Setter for property image.


getContent

public org.apache.ecs.ConcreteElement getContent(org.apache.turbine.util.RunData rundata)
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.


init

public void init()
          throws PortletException
All initialization should be performed here. If your Portlet wants to do any work it should be done here. You are not guaranteed that any particular order of method call will happen just that init() will happen first. Therefore if you have to calculate things like a title, a description, etc it should happen here.

Throws:
PortletException

setPortletConfig

public void setPortletConfig(PortletConfig pc)
Set's the configuration of this servlet.


getPortletConfig

public PortletConfig getPortletConfig()
Get the config of this servlet.


getAllowEdit

public boolean getAllowEdit(org.apache.turbine.util.RunData rundata)

Return true if this portlet is allowed to be edited in the rundata's context .

Note: PortletControl implementations should pay attention to this so that they don't allow this option if it returns false.


getAllowView

public boolean getAllowView(org.apache.turbine.util.RunData rundata)

Return true if this portlet is allowed to be viewed in the rundata's context .

Note: PortletControl implementations should pay attention to this so that they don't allow this option if it returns false.


getAllowMaximize

public boolean getAllowMaximize(org.apache.turbine.util.RunData rundata)

Return true if this portlets is allowed to be maximized.

Note: PortletControl implementations should pay attention to this so that they don't allow this option if it returns false.


getCreationTime

public long getCreationTime()
Get the creation time for this Portlet


isShowTitleBar

public boolean isShowTitleBar(org.apache.turbine.util.RunData rundata)
Returns TRUE if the title bar in should be displayed. The title bar includes the portlet title and action buttons. This

Parameters:
rundata - The RunData object for the current request

setCreationTime

public void setCreationTime(long creationTime)
Set the creation time for this Portlet


supportsType

public boolean supportsType(MimeType mimeType)
Returns true portlet is able to output content for given mimetype


getAttribute

public java.lang.String getAttribute(java.lang.String attrName,
                                     java.lang.String attrDefValue,
                                     org.apache.turbine.util.RunData rundata)
Retrieve a portlet attribute from persistent storage

Parameters:
attrName - The attribute to retrieve
attrDefValue - The value if the attr doesn't exists
rundata - The RunData object for the current request
Returns:
The attribute value

setAttribute

public void setAttribute(java.lang.String attrName,
                         java.lang.String attrValue,
                         org.apache.turbine.util.RunData rundata)
Stores a portlet attribute in persistent storage

Parameters:
attrName - The attribute to retrieve
rundata - The RunData object for the current request

getInstance

public PortletInstance getInstance(org.apache.turbine.util.RunData rundata)
Gets the portlet instance associated with this portlet.

Returns:
PortletInstance

getID

public java.lang.String getID()
Retrieve a unique portlet id


setID

public void setID(java.lang.String id)

providesCustomization

public boolean providesCustomization()
Returns:
true if the portlet does its own customization


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