hudson.plugins.analysis.graph
Class BuildResultGraph

java.lang.Object
  extended by hudson.plugins.analysis.graph.BuildResultGraph
Direct Known Subclasses:
CategoryBuildResultGraph, DifferenceGraph, EmptyGraph

public abstract class BuildResultGraph
extends Object

Base class for build results graphs.

Author:
Ulli Hafner

Constructor Summary
BuildResultGraph()
           
 
Method Summary
static long computeDayDelta(Calendar first, BuildResult second)
          Computes the delta between two dates in days.
static long computeDayDelta(Calendar first, Calendar second)
          Computes the delta between two dates in days.
abstract  org.jfree.chart.JFreeChart create(GraphConfiguration configuration, ResultAction<? extends BuildResult> resultAction, String pluginName)
          Creates a PNG image trend graph with clickable map.
abstract  org.jfree.chart.JFreeChart createAggregation(GraphConfiguration configuration, Collection<ResultAction<? extends BuildResult>> resultActions, String pluginName)
          Creates a PNG image trend graph with clickable map.
 org.jfree.chart.JFreeChart createXYChart(org.jfree.data.xy.XYDataset dataset)
          Creates a XY graph from the specified data set.
 String getExampleImage()
          Returns the URL to an image that shows an example of the graph.
 hudson.util.Graph getGraph(long timestamp, GraphConfiguration configuration, String pluginName, Collection<ResultAction<?>> actions)
          Returns the new graph object that wraps the actual JFreeChart into a PNG image or map.
 hudson.util.Graph getGraph(long timestamp, GraphConfiguration configuration, String pluginName, ResultAction<?> lastAction)
          Returns the new graph object that wraps the actual JFreeChart into a PNG image or map.
abstract  String getId()
          Returns the ID of this graph.
abstract  String getLabel()
          Returns a human readable label describing this graph.
protected  String getPlugin()
          Returns the plug-in that owns this graph and provides an example image.
 String getRootUrl()
          Returns the root URL.
protected  boolean isBuildTooOld(GraphConfiguration configuration, BuildResult current)
          Returns whether the specified build result is too old in order to be considered for the trend graph.
 boolean isDeactivated()
          Returns whether the graph is deactivated.
 boolean isSelectable()
          Returns whether this graph is selectable.
 boolean isVisible()
          Returns whether this graph is visible.
protected  void setPlotProperties(org.jfree.chart.plot.Plot plot)
          Sets properties common to all plots of this plug-in.
 void setRootUrl(String rootUrl)
          Sets the root URL to the specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuildResultGraph

public BuildResultGraph()
Method Detail

isSelectable

public boolean isSelectable()
Returns whether this graph is selectable.

Returns:
true if this graph is selectable, false otherwise

getId

public abstract String getId()
Returns the ID of this graph.

Returns:
the ID of this graph

getLabel

public abstract String getLabel()
Returns a human readable label describing this graph.

Returns:
a label for this graph

getExampleImage

public String getExampleImage()
Returns the URL to an image that shows an example of the graph.

Returns:
a label for this graph

getPlugin

protected String getPlugin()
Returns the plug-in that owns this graph and provides an example image.

Returns:
the plug-in that owns this graph and provides an example image

isVisible

public boolean isVisible()
Returns whether this graph is visible.

Returns:
true if this graph is visible

setRootUrl

public void setRootUrl(String rootUrl)
Sets the root URL to the specified value.

Parameters:
rootUrl - the value to set

getRootUrl

public String getRootUrl()
Returns the root URL.

Returns:
the root URL

create

public abstract org.jfree.chart.JFreeChart create(GraphConfiguration configuration,
                                                  ResultAction<? extends BuildResult> resultAction,
                                                  @CheckForNull
                                                  String pluginName)
Creates a PNG image trend graph with clickable map.

Parameters:
configuration - the configuration parameters
resultAction - the result action to start the graph computation from
pluginName - the name of the plug-in (project action URL) to create links to. If set to null then no links are created
Returns:
the graph

createAggregation

public abstract org.jfree.chart.JFreeChart createAggregation(GraphConfiguration configuration,
                                                             Collection<ResultAction<? extends BuildResult>> resultActions,
                                                             String pluginName)
Creates a PNG image trend graph with clickable map.

Parameters:
configuration - the configuration parameters
resultActions - the result actions to start the graph computation from
pluginName - the name of the plug-in
Returns:
the graph

computeDayDelta

public static long computeDayDelta(Calendar first,
                                   Calendar second)
Computes the delta between two dates in days.

Parameters:
first - the first date
second - the second date
Returns:
the delta between two dates in days

computeDayDelta

public static long computeDayDelta(Calendar first,
                                   BuildResult second)
Computes the delta between two dates in days.

Parameters:
first - the first date
second - the second date (given by the build result)
Returns:
the delta between two dates in days

setPlotProperties

protected void setPlotProperties(org.jfree.chart.plot.Plot plot)
Sets properties common to all plots of this plug-in.

Parameters:
plot - the plot to set the properties for

createXYChart

public org.jfree.chart.JFreeChart createXYChart(org.jfree.data.xy.XYDataset dataset)
Creates a XY graph from the specified data set.

Parameters:
dataset - the values to display
Returns:
the created graph

getGraph

public hudson.util.Graph getGraph(long timestamp,
                                  GraphConfiguration configuration,
                                  String pluginName,
                                  ResultAction<?> lastAction)
Returns the new graph object that wraps the actual JFreeChart into a PNG image or map.

Parameters:
timestamp - the last build time
configuration - the graph configuration
pluginName - the name of the plug-in
lastAction - the last valid action for this project
Returns:
the graph to render

getGraph

public hudson.util.Graph getGraph(long timestamp,
                                  GraphConfiguration configuration,
                                  String pluginName,
                                  Collection<ResultAction<?>> actions)
Returns the new graph object that wraps the actual JFreeChart into a PNG image or map.

Parameters:
timestamp - the last build time
configuration - the graph configuration
pluginName - the name of the plug-in
actions - the actions to get the summary graph for
Returns:
the graph to render

isDeactivated

public boolean isDeactivated()
Returns whether the graph is deactivated. If the graph is deactivated, then no "enable graph" link is shown.

Returns:
true if the graph is deactivated, false otherwise

isBuildTooOld

protected boolean isBuildTooOld(GraphConfiguration configuration,
                                BuildResult current)
Returns whether the specified build result is too old in order to be considered for the trend graph.

Parameters:
configuration - the graph configuration
current - the current build
Returns:
true if the build is too old


Copyright © 2004-2012 Hudson. All Rights Reserved.