Package hudson.widgets
Class HistoryWidget<O extends ModelObject,T>
- java.lang.Object
-
- hudson.widgets.Widget
-
- hudson.widgets.HistoryWidget<O,T>
-
- Type Parameters:
O- Owner of the widget.T- Type individual record.
- Direct Known Subclasses:
BuildHistoryWidget
public class HistoryWidget<O extends ModelObject,T> extends Widget
Displays the history of records (normallyRuns) on the side panel.- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceHistoryWidget.Adapter<T>static classHistoryWidget.FactoryImpl
-
Field Summary
Fields Modifier and Type Field Description HistoryWidget.Adapter<? super T>adapterIterable<T>baseListThe given data model of records.StringbaseUrlURL of theowner.static AlternativeUiTextProvider.Message<HistoryWidget<?,?>>DISPLAY_NAMEReplaceable title for describing the kind of tasks this history shows.Oowner
-
Constructor Summary
Constructors Constructor Description HistoryWidget(O owner, Iterable<T> baseList, HistoryWidget.Adapter<? super T> adapter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddoAjax(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, String n)Handles AJAX requests from browsers to update build history.StringgetDisplayName()Title of the widget.StringgetFirstTransientBuildKey()HistoryPageFiltergetHistoryPageFilter()Get aHistoryPageFilterfor rendering a page of queue items.StringgetNextBuildNumberToFetch()protected StringgetOwnerUrl()Iterable<HistoryPageEntry<T>>getRenderList()The records to be rendered this time.StringgetUrlName()Gets the URL path name.booleanisTrimmed()protected HistoryPageFilter<T>newPageFilter()voidsetNextBuildNumberToFetch(String nextBuildNumberToFetch)voidsetTrimmed(boolean trimmed)protected HistoryPageFilterupdateFirstTransientBuildKey(HistoryPageFilter historyPageFilter)Calculates the first transient build record.
-
-
-
Field Detail
-
DISPLAY_NAME
public static final AlternativeUiTextProvider.Message<HistoryWidget<?,?>> DISPLAY_NAME
Replaceable title for describing the kind of tasks this history shows. Defaults to "Build History".
-
owner
public final O extends ModelObject owner
-
adapter
public final HistoryWidget.Adapter<? super T> adapter
-
-
Constructor Detail
-
HistoryWidget
public HistoryWidget(O owner, Iterable<T> baseList, HistoryWidget.Adapter<? super T> adapter)
- Parameters:
owner- The parent model object that owns this widget.
-
-
Method Detail
-
getOwnerUrl
protected String getOwnerUrl()
- Overrides:
getOwnerUrlin classWidget- Returns:
- The URL of the owner of this widget relative to context path. Always ends with a trailing slash.
Can be
nullfor backward compatibility with widgets annotated with @Extension.
-
getDisplayName
public String getDisplayName()
Title of the widget.
-
getUrlName
public String getUrlName()
Description copied from class:WidgetGets the URL path name.For example, if this method returns "xyz", and if the parent object (that this widget is associated with) is bound to /foo/bar/zot, then this widget object will be exposed to /foo/bar/zot/widget/xyz.
This method is useful when the widget needs to expose additional URLs, for example for serving AJAX requests.
This method should return a string that's unique among other
Widgets. The default implementation returns the unqualified class name.- Overrides:
getUrlNamein classWidget
-
getFirstTransientBuildKey
public String getFirstTransientBuildKey()
-
updateFirstTransientBuildKey
protected HistoryPageFilter updateFirstTransientBuildKey(HistoryPageFilter historyPageFilter)
Calculates the first transient build record. Everything ≥ this will be discarded when AJAX call is made.- Parameters:
historyPageFilter- The history page filter containing the list of builds.- Returns:
- The history page filter that was passed in.
-
getRenderList
public Iterable<HistoryPageEntry<T>> getRenderList()
The records to be rendered this time.
-
getHistoryPageFilter
public HistoryPageFilter getHistoryPageFilter()
Get aHistoryPageFilterfor rendering a page of queue items.
-
newPageFilter
protected HistoryPageFilter<T> newPageFilter()
-
isTrimmed
public boolean isTrimmed()
-
setTrimmed
public void setTrimmed(boolean trimmed)
-
doAjax
public void doAjax(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp, @Header("n") String n) throws IOException, javax.servlet.ServletExceptionHandles AJAX requests from browsers to update build history.- Parameters:
n- The build 'number' to fetch. This is string because various variants uses non-numbers as the build key.- Throws:
IOExceptionjavax.servlet.ServletException
-
getNextBuildNumberToFetch
public String getNextBuildNumberToFetch()
-
setNextBuildNumberToFetch
public void setNextBuildNumberToFetch(String nextBuildNumberToFetch)
-
-