org.apache.jetspeed.portal
Class BasePortletSet

java.lang.Object
  extended byorg.apache.jetspeed.portal.BasePortletSet
All Implemented Interfaces:
Portlet, PortletSet, PortletState, java.io.Serializable

public class BasePortletSet
extends java.lang.Object
implements PortletSet, Portlet, PortletState

The PortletSet is basically a wrapper around an array of portlets. It provides runtime context for a set of portlets. A portlet can get its current set by calling via its PortletConfig

Version:
$Id: BasePortletSet.java,v 1.37 2005/04/02 17:31:08 jford Exp $
Author:
Raphaël Luta, Kevin A. Burton, David Sean Taylor, Mark Orciuch
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.apache.jetspeed.portal.PortletSet
PortletSet.Constraints
 
Field Summary
 
Fields inherited from interface org.apache.jetspeed.portal.Portlet
PORTLET_MAXIMIZED, PORTLET_MINIMIZED, PORTLET_NORMAL
 
Constructor Summary
BasePortletSet()
          Builds a new empty set for storing portlets
BasePortletSet(PortletController controller)
          Builds a new empty set for storing portlets with a default controller
 
Method Summary
 void addPortlet(Portlet portlet)
          Add a portlet to this set.It updates its config to modify the current set
 void addPortlet(Portlet portlet, int position)
          Add a portlet to this set.It updates its config to modify the current set
 void addPortlet(Portlet portlet, PortletSet.Constraints constraints)
          Add a portlet to this set.It updates its config to modify the current set
 void addPortlet(Portlet portlet, PortletSet.Constraints constraints, int position)
          Add a portlet to this set.It updates its config to modify the current set
 boolean allowClose(org.apache.turbine.util.RunData rundata)
          Implements the default close behavior: any authenticated user may remove a portlet from his page
 boolean allowCustomize(org.apache.turbine.util.RunData rundata)
          Implements the default customize behavior: any authenticated user may customize a portlet
 boolean allowInfo(org.apache.turbine.util.RunData rundata)
          Implements the default info behavior: any authenticated user may get information on a portlet
 boolean allowMaximize(org.apache.turbine.util.RunData rundata)
          Implements the default maximize behavior: any authenticated user may maximize a portlet
 boolean allowMinimize(org.apache.turbine.util.RunData rundata)
          Implements the default info behavior: any authenticated user may minimize a portlet
 boolean allowPrintFriendly(org.apache.turbine.util.RunData rundata)
          Implements the default print friendly format behavior: not available for the portlet set
 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.
 PortletController getController()
          Return the current controller for this set
 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)
          Getter for property description.
 java.lang.String getID()
          Retrieve a unique portlet id
 java.lang.String getImage()
           
 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.
 Portlet getPortletAt(int pos)
          Returns the Portlet at position pos
 Portlet getPortletByID(java.lang.String id)
          Returns the Portlet with the given id
 Portlet getPortletByName(java.lang.String name)
          Returns the Portlet with the given name
 PortletConfig getPortletConfig()
          Get the config of this servlet.
 java.util.Enumeration getPortlets()
          Returns the portlet set as an Enumeration
 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 isClosed(org.apache.turbine.util.RunData data)
          Returns true if this portlet is currently closed
 boolean isMinimized(org.apache.turbine.util.RunData rundata)
          Returns true if this portlet is currently minimized
 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 setClosed(boolean close, org.apache.turbine.util.RunData data)
          Toggles the portlet state between closed and normal
 void setController(PortletController controller)
          Set the controller for this set
 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 setMinimized(boolean minimize, org.apache.turbine.util.RunData rundata)
          Change the portlet visibility state ( minimized <-> normal )
 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)
           
 int size()
          Returns the number of portlets currently stored in this set
 void sortPortletSet()
          Sort the portlets according to Layout position
 boolean supportsType(MimeType mimeType)
          Method retruns true if at least one of the portlets of the portletset fits the requested MimeTyp.
 Portlet[] toArray()
          Returns the portlet set as an array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasePortletSet

public BasePortletSet()
Builds a new empty set for storing portlets


BasePortletSet

public BasePortletSet(PortletController controller)
Builds a new empty set for storing portlets with a default controller

Method Detail

init

public void init()
          throws PortletException
Description copied from interface: Portlet
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.

Specified by:
init in interface Portlet
Throws:
PortletException

size

public int size()
Returns the number of portlets currently stored in this set

Specified by:
size in interface PortletSet

toArray

public Portlet[] toArray()
Returns the portlet set as an array.

Specified by:
toArray in interface PortletSet

getPortletAt

public Portlet getPortletAt(int pos)
Returns the Portlet at position pos

Specified by:
getPortletAt in interface PortletSet

getPortletByID

public Portlet getPortletByID(java.lang.String id)
Returns the Portlet with the given id

Specified by:
getPortletByID in interface PortletSet

getPortletByName

public Portlet getPortletByName(java.lang.String name)
Returns the Portlet with the given name

Specified by:
getPortletByName in interface PortletSet

getPortlets

public java.util.Enumeration getPortlets()
Returns the portlet set as an Enumeration

Specified by:
getPortlets in interface PortletSet

addPortlet

public void addPortlet(Portlet portlet)
Add a portlet to this set.It updates its config to modify the current set

Specified by:
addPortlet in interface PortletSet

addPortlet

public void addPortlet(Portlet portlet,
                       int position)
Add a portlet to this set.It updates its config to modify the current set

Specified by:
addPortlet in interface PortletSet

addPortlet

public void addPortlet(Portlet portlet,
                       PortletSet.Constraints constraints)
Add a portlet to this set.It updates its config to modify the current set

Specified by:
addPortlet in interface PortletSet

addPortlet

public void addPortlet(Portlet portlet,
                       PortletSet.Constraints constraints,
                       int position)
Add a portlet to this set.It updates its config to modify the current set

Specified by:
addPortlet in interface PortletSet

getController

public PortletController getController()
Return the current controller for this set

Specified by:
getController in interface PortletSet

setController

public void setController(PortletController controller)
Set the controller for this set

Specified by:
setController in interface PortletSet

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

getName

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

Specified by:
getName in interface Portlet

setName

public void setName(java.lang.String name)
Description copied from interface: Portlet
Sets the name on this Portlet.

Specified by:
setName in interface Portlet
See Also:
Portlet.getName()

getPortletConfig

public PortletConfig getPortletConfig()
Description copied from interface: Portlet
Get the config of this servlet.

Specified by:
getPortletConfig in interface Portlet

setPortletConfig

public void setPortletConfig(PortletConfig pc)
Description copied from interface: Portlet
Set's the configuration of this servlet.

Specified by:
setPortletConfig in interface Portlet

getDescription

public java.lang.String getDescription()
Description copied from interface: Portlet

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.

Specified by:
getDescription in interface Portlet

getDescription

public java.lang.String getDescription(java.lang.String instanceDescription)
Getter for property description.

Specified by:
getDescription in interface Portlet
Parameters:
instanceDescription - Description from PSML
Returns:
Name of portlet description.

setDescription

public void setDescription(java.lang.String description)
Description copied from interface: Portlet
Set the description for this Portlet

Specified by:
setDescription in interface Portlet

setImage

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

Specified by:
setImage in interface Portlet

getImage

public java.lang.String getImage()

getImage

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

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

getTitle

public java.lang.String getTitle()
Description copied from interface: Portlet

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.

Specified by:
getTitle in interface Portlet

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"; }

Specified by:
getTitle in interface Portlet
Parameters:
instanceTitle - Title from PSML

setTitle

public void setTitle(java.lang.String title)
Description copied from interface: Portlet
Set the title for this Portlet

Specified by:
setTitle in interface Portlet

setTitle

public void setTitle(java.lang.String title,
                     org.apache.turbine.util.RunData rundata)
Specified by:
setTitle in interface Portlet

getAllowEdit

public boolean getAllowEdit(org.apache.turbine.util.RunData rundata)
Description copied from interface: Portlet

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.

Specified by:
getAllowEdit in interface Portlet

getAllowView

public boolean getAllowView(org.apache.turbine.util.RunData rundata)
Description copied from interface: Portlet

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.

Specified by:
getAllowView in interface Portlet

getAllowMaximize

public boolean getAllowMaximize(org.apache.turbine.util.RunData rundata)
Description copied from interface: Portlet

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.

Specified by:
getAllowMaximize in interface Portlet

sortPortletSet

public final void sortPortletSet()
Sort the portlets according to Layout position


getCreationTime

public long getCreationTime()
Description copied from interface: Portlet
Get the creation time for this Portlet

Specified by:
getCreationTime in interface Portlet
See Also:
Portlet.getCreationTime()

setCreationTime

public void setCreationTime(long creationTime)
Description copied from interface: Portlet
Set the creation time for this Portlet

Specified by:
setCreationTime in interface Portlet
See Also:
Portlet.setCreationTime(long)

supportsType

public boolean supportsType(MimeType mimeType)
Method retruns true if at least one of the portlets of the portletset fits the requested MimeTyp. Otherwise it retruns false.

Specified by:
supportsType in interface Portlet

allowClose

public boolean allowClose(org.apache.turbine.util.RunData rundata)
Implements the default close behavior: any authenticated user may remove a portlet from his page

Specified by:
allowClose in interface PortletState
Parameters:
rundata - the RunData object for the current request

isClosed

public boolean isClosed(org.apache.turbine.util.RunData data)
Returns true if this portlet is currently closed

Specified by:
isClosed in interface PortletState

setClosed

public void setClosed(boolean close,
                      org.apache.turbine.util.RunData data)
Toggles the portlet state between closed and normal

Specified by:
setClosed in interface PortletState
Parameters:
data - the RunData for this request

allowInfo

public boolean allowInfo(org.apache.turbine.util.RunData rundata)
Implements the default info behavior: any authenticated user may get information on a portlet

Specified by:
allowInfo in interface PortletState
Parameters:
rundata - the RunData object for the current request

allowPrintFriendly

public boolean allowPrintFriendly(org.apache.turbine.util.RunData rundata)
Implements the default print friendly format behavior: not available for the portlet set

Specified by:
allowPrintFriendly in interface PortletState
Parameters:
rundata - the RunData object for the current request

allowCustomize

public boolean allowCustomize(org.apache.turbine.util.RunData rundata)
Implements the default customize behavior: any authenticated user may customize a portlet

Specified by:
allowCustomize in interface PortletState
Parameters:
rundata - the RunData object for the current request

allowMaximize

public boolean allowMaximize(org.apache.turbine.util.RunData rundata)
Implements the default maximize behavior: any authenticated user may maximize a portlet

Specified by:
allowMaximize in interface PortletState
Parameters:
rundata - the RunData object for the current request

allowMinimize

public boolean allowMinimize(org.apache.turbine.util.RunData rundata)
Implements the default info behavior: any authenticated user may minimize a portlet

Specified by:
allowMinimize in interface PortletState
Parameters:
rundata - the RunData object for the current request

isMinimized

public boolean isMinimized(org.apache.turbine.util.RunData rundata)
Returns true if this portlet is currently minimized

Specified by:
isMinimized in interface PortletState

setMinimized

public void setMinimized(boolean minimize,
                         org.apache.turbine.util.RunData rundata)
Change the portlet visibility state ( minimized <-> normal )

Specified by:
setMinimized in interface PortletState
Parameters:
minimize - True if the portlet change to minimized
rundata - A RunData object

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

Specified by:
getAttribute in interface Portlet
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

Specified by:
setAttribute in interface Portlet
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.

Specified by:
getInstance in interface Portlet
Returns:
PortletInstance

getID

public java.lang.String getID()
Description copied from interface: Portlet
Retrieve a unique portlet id

Specified by:
getID in interface Portlet

setID

public void setID(java.lang.String id)
Specified by:
setID in interface Portlet

providesCustomization

public boolean providesCustomization()
Specified by:
providesCustomization in interface Portlet
Returns:
true if the portlet does its own customization

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

Specified by:
isShowTitleBar in interface Portlet
Parameters:
rundata - The RunData object for the current request


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