hudson.model
Class Actionable

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.Actionable
All Implemented Interfaces:
ModelObject, SearchableModelObject, SearchItem, ModelObjectWithContextMenu
Direct Known Subclasses:
AbstractItem, Computer, Label, Queue.Item, Run

@ExportedBean
public abstract class Actionable
extends AbstractModelObject
implements ModelObjectWithContextMenu

ModelObject that can have additional Actions.

Author:
Kohsuke Kawaguchi

Nested Class Summary
 
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.MenuItem
 
Constructor Summary
Actionable()
           
 
Method Summary
 void addAction(Action a)
          Adds a new action.
 ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response)
          Generates the context menu.
<T extends Action>
T
getAction(Class<T> type)
          Gets the action (first instance to be found) of a specified type that contributed to this build.
 Action getAction(int index)
           
 List<Action> getActions()
          Gets actions contributed to this build.
<T extends Action>
List<T>
getActions(Class<T> type)
          Gets all actions of a specified type that contributed to this build.
 Object getDynamic(String token, org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface hudson.model.ModelObject
getDisplayName
 
Methods inherited from interface hudson.search.SearchItem
getSearchUrl
 

Constructor Detail

Actionable

public Actionable()
Method Detail

getActions

@Exported
public List<Action> getActions()
Gets actions contributed to this build.

A new Action can be added by getActions().add(...).

Returns:
may be empty but never null.

getActions

public <T extends Action> List<T> getActions(Class<T> type)
Gets all actions of a specified type that contributed to this build.

Parameters:
type - The type of action to return.
Returns:
may be empty but never null.
See Also:
getAction(Class)

addAction

public void addAction(Action a)
Adds a new action. Short for getActions().add(a)


getAction

public Action getAction(int index)

getAction

public <T extends Action> T getAction(Class<T> type)
Gets the action (first instance to be found) of a specified type that contributed to this build.

Parameters:
type -
Returns:
The action or null if no such actions exist.
See Also:
getActions(Class)

getDynamic

public Object getDynamic(String token,
                         org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)

doContextMenu

public ModelObjectWithContextMenu.ContextMenu doContextMenu(org.kohsuke.stapler.StaplerRequest request,
                                                            org.kohsuke.stapler.StaplerResponse response)
                                                     throws Exception
Description copied from interface: ModelObjectWithContextMenu
Generates the context menu. The typical implementation is return new ContextMenu().from(this,request,response);, which implements the default behaviour. See ModelObjectWithContextMenu.ContextMenu.from(ModelObjectWithContextMenu, StaplerRequest, StaplerResponse) for more details of what it does. This should suit most implementations.

Specified by:
doContextMenu in interface ModelObjectWithContextMenu
Throws:
Exception


Copyright © 2004-2013. All Rights Reserved.