hudson.plugins.warnings.util
Class AbstractProjectAction<T extends ResultAction<?>>

java.lang.Object
  extended by hudson.plugins.warnings.util.AbstractProjectAction<T>
Type Parameters:
T - result action type
All Implemented Interfaces:
hudson.model.Action, hudson.model.ModelObject
Direct Known Subclasses:
WarningsProjectAction

public abstract class AbstractProjectAction<T extends ResultAction<?>>
extends java.lang.Object
implements hudson.model.Action

A project action displays a link on the side panel of a project.

Author:
Ulli Hafner

Constructor Summary
AbstractProjectAction(hudson.model.AbstractProject<?,?> project, java.lang.Class<T> resultActionType, PluginDescriptor plugin, int height)
          Creates a new instance of AbstractProjectAction.
 
Method Summary
 void doFlipTrend(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Changes the trend graph display mode.
 void doIndex(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Redirects the index page to the last result.
 void doTrend(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Display the trend graph.
 void doTrendMap(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Display the trend map.
abstract  java.lang.String getCookieName()
          Returns the flip trend cookie name.
 java.lang.String getIconFileName()
          Returns the icon URL for the side-panel in the project screen.
 ResultAction<?> getLastAction()
          Returns the last valid result action.
 hudson.model.AbstractBuild<?,?> getLastFinishedBuild()
          Returns the last finished build.
 hudson.model.AbstractProject<?,?> getProject()
          Returns the project.
abstract  java.lang.String getTrendName()
          Returns the title of the trend graph.
 java.lang.String getUrlName()
          
 boolean hasValidResults()
          Returns whether we have enough valid results in order to draw a meaningful graph.
 boolean isHealthinessEnabled()
          Returns whether we should display the toggle graph type links.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.model.Action
getDisplayName
 

Constructor Detail

AbstractProjectAction

public AbstractProjectAction(hudson.model.AbstractProject<?,?> project,
                             java.lang.Class<T> resultActionType,
                             PluginDescriptor plugin,
                             int height)
Creates a new instance of AbstractProjectAction.

Parameters:
project - the project that owns this action
resultActionType - the type of the result action
plugin - the plug-in that owns this action
height - the height of the trend graph
Method Detail

isHealthinessEnabled

public final boolean isHealthinessEnabled()
Returns whether we should display the toggle graph type links.

Returns:
true if we should display the toggle graph type links

getProject

public final hudson.model.AbstractProject<?,?> getProject()
Returns the project.

Returns:
the project

hasValidResults

public final boolean hasValidResults()
Returns whether we have enough valid results in order to draw a meaningful graph.

Returns:
true if the results are valid in order to draw a graph

getIconFileName

public java.lang.String getIconFileName()
Returns the icon URL for the side-panel in the project screen. If there is yet no valid result, then null is returned.

Specified by:
getIconFileName in interface hudson.model.Action
Returns:
the icon URL for the side-panel in the project screen

getUrlName

public final java.lang.String getUrlName()

Specified by:
getUrlName in interface hudson.model.Action

getLastAction

public ResultAction<?> getLastAction()
Returns the last valid result action.

Returns:
the last valid result action, or null if no such action is found

doTrend

public void doTrend(org.kohsuke.stapler.StaplerRequest request,
                    org.kohsuke.stapler.StaplerResponse response)
             throws java.io.IOException
Display the trend graph. Delegates to the the associated ResultAction.

Parameters:
request - Stapler request
response - Stapler response
Throws:
java.io.IOException - in case of an error in ResultAction.doGraph(StaplerRequest, StaplerResponse, int)

getTrendName

public abstract java.lang.String getTrendName()
Returns the title of the trend graph.

Returns:
the title of the trend graph.

doTrendMap

public void doTrendMap(org.kohsuke.stapler.StaplerRequest request,
                       org.kohsuke.stapler.StaplerResponse response)
                throws java.io.IOException
Display the trend map. Delegates to the the associated ResultAction.

Parameters:
request - Stapler request
response - Stapler response
Throws:
java.io.IOException - in case of an error

doIndex

public void doIndex(org.kohsuke.stapler.StaplerRequest request,
                    org.kohsuke.stapler.StaplerResponse response)
             throws java.io.IOException
Redirects the index page to the last result.

Parameters:
request - Stapler request
response - Stapler response
Throws:
java.io.IOException - in case of an error

getLastFinishedBuild

public hudson.model.AbstractBuild<?,?> getLastFinishedBuild()
Returns the last finished build.

Returns:
the last finished build or null if there is no such build

doFlipTrend

public void doFlipTrend(org.kohsuke.stapler.StaplerRequest request,
                        org.kohsuke.stapler.StaplerResponse response)
                 throws java.io.IOException
Changes the trend graph display mode.

Parameters:
request - Stapler request
response - Stapler response
Throws:
java.io.IOException - in case of an error

getCookieName

public abstract java.lang.String getCookieName()
Returns the flip trend cookie name.

Returns:
the flip trend cookie name.


Copyright © 2008. All Rights Reserved.