com.atlassian.jira.portal
Class PortletConfigurationImpl

java.lang.Object
  extended by com.atlassian.jira.portal.PortletConfigurationImpl
All Implemented Interfaces:
ObjectConfigurable, PortletConfiguration, Comparable<PortletConfiguration>

public class PortletConfigurationImpl
extends Object
implements PortletConfiguration

Represents the configuration for a portlet. This is the state that is saved to the database. This implmentation uses a passed in PropertySet to store the configurable properties. It is recommended that an in memory PropertySet is used as the store now persists this manually.

Since:
??

Constructor Summary
PortletConfigurationImpl(Long id, Long dashboardPageId, String portletKey, Portlet portlet, Integer column, Integer row, com.opensymphony.module.propertyset.PropertySet configuration, URI gadgetUri, com.atlassian.gadgets.dashboard.Color color, Map<String,String> userPrefs)
           
 
Method Summary
 int compareTo(PortletConfiguration that)
           
 com.atlassian.gadgets.dashboard.Color getColor()
          Returns the color to use when rendering the Chrome of this gadget.
 Integer getColumn()
          Represents the column that the configured portlet resides in.
 Long getDashboardPageId()
          Provides the dashboard page id.
 String getDefaultProperty(String propertyKey)
          Returns the default property value for a key
 URI getGadgetURI()
          Returns the URI pointing to the Gadget XML for this particular portlet.
 Long getId()
          Return the id of the PortletConfiguration.
 String getKey()
          Return the key of this object
 Long getLongProperty(String propertyKey)
          Returns a property of this object with the specified key as a long
 ObjectConfiguration getObjectConfiguration()
          Retrieves an object configuration object with properties that can be set
 Portlet getPortlet()
          Returns the portlet implementation that this PortletConfiguration is for.
 com.opensymphony.module.propertyset.PropertySet getProperties()
          Retrieve all the specified Properties for this object
 String getProperty(String propertyKey)
          Return the property if it is found, else return the default property
 Integer getRow()
          Represents the row that the configured portlet resides in.
 String getTextProperty(String propertyKey)
          Returns a property of this object with the specified key, the property is of type text
 Map<String,String> getUserPrefs()
          An unmodifiable map of user preferences stored for this gadget.
 boolean hasProperty(String propertyKey)
          Checks if this object has a particular property
 boolean isResourcesProvided()
          Normal rendition of the Portlet should have JavaScript and CSS etc.
 void setColor(com.atlassian.gadgets.dashboard.Color color)
          Set the color of the chrome for a gadget.
 void setColumn(Integer column)
          Sets the column for the Portlet, effectively moving the portlet left or right on the page.
 void setDashboardPageId(Long dashboardPageId)
          Sets the dashboard page id.
 void setRow(Integer row)
          Sets the row for the Portlet, effectively moving the portlet up or down on the page.
 void setUserPrefs(Map<String,String> userPrefs)
          Sets the userPreferences for this portletconfig.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PortletConfigurationImpl

public PortletConfigurationImpl(Long id,
                                Long dashboardPageId,
                                String portletKey,
                                Portlet portlet,
                                Integer column,
                                Integer row,
                                com.opensymphony.module.propertyset.PropertySet configuration,
                                URI gadgetUri,
                                com.atlassian.gadgets.dashboard.Color color,
                                Map<String,String> userPrefs)
Method Detail

getId

public Long getId()
Description copied from interface: PortletConfiguration
Return the id of the PortletConfiguration.

Specified by:
getId in interface PortletConfiguration
Returns:
the id of the PortletConfiguration.

getPortlet

public Portlet getPortlet()
Description copied from interface: PortletConfiguration
Returns the portlet implementation that this PortletConfiguration is for.

Specified by:
getPortlet in interface PortletConfiguration
Returns:
the portlet.

getColumn

public Integer getColumn()
Description copied from interface: PortletConfiguration
Represents the column that the configured portlet resides in.

Specified by:
getColumn in interface PortletConfiguration
Returns:
the column number starting from 1.

getKey

public String getKey()
Description copied from interface: ObjectConfigurable
Return the key of this object

Specified by:
getKey in interface ObjectConfigurable
Returns:
Key of object

setColumn

public void setColumn(Integer column)
Description copied from interface: PortletConfiguration
Sets the column for the Portlet, effectively moving the portlet left or right on the page.

Specified by:
setColumn in interface PortletConfiguration
Parameters:
column - the column number starting from 1.

getRow

public Integer getRow()
Description copied from interface: PortletConfiguration
Represents the row that the configured portlet resides in.

Specified by:
getRow in interface PortletConfiguration
Returns:
the row number starting from 1.

getDashboardPageId

public Long getDashboardPageId()
Description copied from interface: PortletConfiguration
Provides the dashboard page id.

Specified by:
getDashboardPageId in interface PortletConfiguration
Returns:
the dashboard page id.

setDashboardPageId

public void setDashboardPageId(Long dashboardPageId)
Description copied from interface: PortletConfiguration
Sets the dashboard page id.

Specified by:
setDashboardPageId in interface PortletConfiguration
Parameters:
dashboardPageId - the dashboard page id.

setRow

public void setRow(Integer row)
Description copied from interface: PortletConfiguration
Sets the row for the Portlet, effectively moving the portlet up or down on the page.

Specified by:
setRow in interface PortletConfiguration
Parameters:
row - the row number starting from 1.

isResourcesProvided

public boolean isResourcesProvided()
Normal rendition of the Portlet should have JavaScript and CSS etc. resources provided somewhere on the page.

Specified by:
isResourcesProvided in interface PortletConfiguration
Returns:
true always.

getGadgetURI

public URI getGadgetURI()
Description copied from interface: PortletConfiguration
Returns the URI pointing to the Gadget XML for this particular portlet. May return null for legacy portlets (that don't implement the Gadget spec).

Specified by:
getGadgetURI in interface PortletConfiguration
Returns:
URI pointing to the Gadget XML or null
See Also:
http://code.google.com/apis/gadgets/docs/reference.html

getUserPrefs

public Map<String,String> getUserPrefs()
Description copied from interface: PortletConfiguration
An unmodifiable map of user preferences stored for this gadget. Will return an empty map in the case of a legacy gadget.

Specified by:
getUserPrefs in interface PortletConfiguration
Returns:
map of user preferences stored for this gadget.
See Also:
http://code.google.com/apis/gadgets/docs/reference.html#Userprefs_Ref

setUserPrefs

public void setUserPrefs(Map<String,String> userPrefs)
Description copied from interface: PortletConfiguration
Sets the userPreferences for this portletconfig.

Specified by:
setUserPrefs in interface PortletConfiguration
Parameters:
userPrefs - A map of key value pairs

getColor

public com.atlassian.gadgets.dashboard.Color getColor()
Description copied from interface: PortletConfiguration
Returns the color to use when rendering the Chrome of this gadget.

Specified by:
getColor in interface PortletConfiguration
Returns:
color to use when rendering the Chrome of this gadget

setColor

public void setColor(com.atlassian.gadgets.dashboard.Color color)
Description copied from interface: PortletConfiguration
Set the color of the chrome for a gadget.

Specified by:
setColor in interface PortletConfiguration
Parameters:
color - the color of the chrome for a gadget.

getObjectConfiguration

public ObjectConfiguration getObjectConfiguration()
                                           throws ObjectConfigurationException
Description copied from interface: ObjectConfigurable
Retrieves an object configuration object with properties that can be set

Specified by:
getObjectConfiguration in interface ObjectConfigurable
Returns:
ObjectConfiguration object
Throws:
ObjectConfigurationException

hasProperty

public boolean hasProperty(String propertyKey)
                    throws ObjectConfigurationException
Description copied from interface: ObjectConfigurable
Checks if this object has a particular property

Specified by:
hasProperty in interface ObjectConfigurable
Parameters:
propertyKey - to look for
Returns:
true If there is a value
Throws:
ObjectConfigurationException

getProperty

public String getProperty(String propertyKey)
                   throws ObjectConfigurationException
Return the property if it is found, else return the default property

Specified by:
getProperty in interface ObjectConfigurable
Parameters:
propertyKey - The key to look up from the PropertySet
Returns:
Property value
Throws:
ObjectConfigurationException

getTextProperty

public String getTextProperty(String propertyKey)
                       throws ObjectConfigurationException
Description copied from interface: ObjectConfigurable
Returns a property of this object with the specified key, the property is of type text

Specified by:
getTextProperty in interface ObjectConfigurable
Parameters:
propertyKey - String key used to retrieve the property value
Returns:
Property value
Throws:
ObjectConfigurationException

getLongProperty

public Long getLongProperty(String propertyKey)
                     throws ObjectConfigurationException
Description copied from interface: ObjectConfigurable
Returns a property of this object with the specified key as a long

Specified by:
getLongProperty in interface ObjectConfigurable
Parameters:
propertyKey - String key used to retrieve the property value
Returns:
Property value
Throws:
ObjectConfigurationException

getDefaultProperty

public String getDefaultProperty(String propertyKey)
                          throws ObjectConfigurationException
Description copied from interface: ObjectConfigurable
Returns the default property value for a key

Specified by:
getDefaultProperty in interface ObjectConfigurable
Parameters:
propertyKey - String key used to retrieve the properties default value
Returns:
Default property key
Throws:
ObjectConfigurationException

getProperties

public com.opensymphony.module.propertyset.PropertySet getProperties()
Description copied from interface: ObjectConfigurable
Retrieve all the specified Properties for this object

Specified by:
getProperties in interface ObjectConfigurable
Returns:
Set of properties for this object

compareTo

public int compareTo(PortletConfiguration that)
Specified by:
compareTo in interface Comparable<PortletConfiguration>

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2010 Atlassian. All Rights Reserved.