org.hackystat.projectbrowser.page.projectportfolio.detailspanel
Class PortfolioMeasureConfiguration

java.lang.Object
  extended by org.hackystat.projectbrowser.page.projectportfolio.detailspanel.PortfolioMeasureConfiguration
All Implemented Interfaces:
java.io.Serializable

public class PortfolioMeasureConfiguration
extends java.lang.Object
implements java.io.Serializable

Configuration for project portfolio measures.

Author:
Shaoxuan Zhang
See Also:
Serialized Form

Constructor Summary
PortfolioMeasureConfiguration(java.lang.String name, java.lang.String alias, java.lang.String merge, boolean enabled, StreamClassifier streamClassifier, ProjectPortfolioDataModel dataModel)
          Create an instance.
 
Method Summary
 java.lang.String getAlias()
           
 java.lang.String getAverageColor()
          Return the color for average value or unstable trend.
 java.lang.String getChartColor(MiniBarChart chart)
          Return the color of the given MiniBarChart.
 java.lang.String getClassiferName()
           
 java.lang.String getColor(PortfolioCategory category)
          Return the color associated with the given category.
 org.apache.wicket.markup.html.panel.Panel getConfigurationPanel(java.lang.String id)
          Return the configuration panel of the stream classifer.
 ProjectPortfolioDataModel getDataModel()
           
 java.lang.String getDisplayName()
          Return the display name of this measure.
 java.lang.String getMerge()
           
 java.lang.String getName()
           
 java.util.List<org.apache.wicket.model.IModel> getParameters()
           
 java.lang.String getParamtersString()
          Return the parameters in a single String.
 StreamClassifier getStreamClassifier()
           
 java.lang.String getValueColor(double value)
          Return the color according to the value.
 boolean hasAlias()
          Check if the alias field is available.
 boolean hasClassifier()
          Check if this instance has the stream classifier.
 boolean hasMerge()
          Check if the merge field is available.
 boolean isEnabled()
           
 void saveClassifierSetting(Measures.Measure measure)
          Save classifier's setting into the given Measures.Measure instance.
 void setAlias(java.lang.String alias)
           
 void setEnabled(boolean enabled)
           
 void setMeasureConfiguration(boolean enabled, StreamClassifier streamClassifier, java.lang.String telemetryParameters)
          Load configuration from a PortfolioMeasure object.
 void setMerge(java.lang.String merge)
           
 void setStreamClassifier(StreamClassifier streamClassifier)
           
 void setStreamClassifier(java.lang.String classifierName)
          Set the stream classifier according to the given classifier name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortfolioMeasureConfiguration

public PortfolioMeasureConfiguration(java.lang.String name,
                                     java.lang.String alias,
                                     java.lang.String merge,
                                     boolean enabled,
                                     StreamClassifier streamClassifier,
                                     ProjectPortfolioDataModel dataModel)
Create an instance.

Parameters:
name - The name of the measure.
alias - The alias of this measure, which will be used as display name.
merge - The method to merge multiple streams. Can be sum, avg, min or max.
enabled - If this measure is enabled.
streamClassifier - the StreamClassifier to use, null means no coloring.
dataModel - The data model this measure belongs to.
Method Detail

setMeasureConfiguration

public void setMeasureConfiguration(boolean enabled,
                                    StreamClassifier streamClassifier,
                                    java.lang.String telemetryParameters)
Load configuration from a PortfolioMeasure object.

Parameters:
enabled - If this measure is enabled.
streamClassifier - The stream classifier.
telemetryParameters - The parameters for telemetry analysis.

getName

public java.lang.String getName()
Returns:
the measureName

setEnabled

public void setEnabled(boolean enabled)
Parameters:
enabled - the enable to set

isEnabled

public boolean isEnabled()
Returns:
the enable

getColor

public java.lang.String getColor(PortfolioCategory category)
Return the color associated with the given category.

Parameters:
category - the PortfolioCategory.
Returns:
Color in String.

getChartColor

public java.lang.String getChartColor(MiniBarChart chart)
Return the color of the given MiniBarChart.

Parameters:
chart - the MiniBarChart
Returns:
the color in String

getValueColor

public java.lang.String getValueColor(double value)
Return the color according to the value. The color method is defined in this measure configuration.

Parameters:
value - the value.
Returns:
the color in String

getAverageColor

public java.lang.String getAverageColor()
Return the color for average value or unstable trend.

Returns:
the color

getParamtersString

public java.lang.String getParamtersString()
Return the parameters in a single String.

Returns:
parameters separated by ',' in a single String.

getParameters

public java.util.List<org.apache.wicket.model.IModel> getParameters()
Returns:
the parameters

getDataModel

public ProjectPortfolioDataModel getDataModel()
Returns:
the dataModel

setStreamClassifier

public void setStreamClassifier(java.lang.String classifierName)
Set the stream classifier according to the given classifier name. If the colorMethod is null or is equals to the name of streamClassifier, nothing will happen. Otherwise, it will create a new stream classifier with information saved in UriCache.

Parameters:
classifierName - the String represents the classifier.

setStreamClassifier

public void setStreamClassifier(StreamClassifier streamClassifier)
Parameters:
streamClassifier - the streamTrendClassifier to set

getStreamClassifier

public StreamClassifier getStreamClassifier()
Returns:
the streamTrendClassifier

setAlias

public void setAlias(java.lang.String alias)
Parameters:
alias - the alias to set

getAlias

public java.lang.String getAlias()
Returns:
the alias

hasAlias

public boolean hasAlias()
Check if the alias field is available.

Returns:
true if alias field is available.

getDisplayName

public java.lang.String getDisplayName()
Return the display name of this measure. If alias is available, alias will be return. Otherwise, measure name will be return.

Returns:
the display name.

setMerge

public void setMerge(java.lang.String merge)
Parameters:
merge - the merge to set

getMerge

public java.lang.String getMerge()
Returns:
the merge

hasMerge

public boolean hasMerge()
Check if the merge field is available.

Returns:
true if merge field is available.

getConfigurationPanel

public org.apache.wicket.markup.html.panel.Panel getConfigurationPanel(java.lang.String id)
Return the configuration panel of the stream classifer.

Parameters:
id - the wicket id.
Returns:
the panel.

getClassiferName

public java.lang.String getClassiferName()
Returns:
the name of the streamClassifier.

saveClassifierSetting

public void saveClassifierSetting(Measures.Measure measure)
Save classifier's setting into the given Measures.Measure instance.

Parameters:
measure - the given Measures.Measure instance

hasClassifier

public boolean hasClassifier()
Check if this instance has the stream classifier.

Returns:
true if it has.