Package jenkins.model
Class ModelObjectWithContextMenu.ContextMenu
java.lang.Object
jenkins.model.ModelObjectWithContextMenu.ContextMenu
- All Implemented Interfaces:
org.kohsuke.stapler.HttpResponse
- Enclosing interface:
- ModelObjectWithContextMenu
@ExportedBean
public static class ModelObjectWithContextMenu.ContextMenu
extends Object
implements org.kohsuke.stapler.HttpResponse
Data object that represents the context menu.
Via
HttpResponse
, this class is capable of converting itself to JSON that <l:breadcrumb/>
understands.-
Field Summary
Modifier and TypeFieldDescriptionThe actual contents of the menu. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Adds a child item when rendering context menu of its parent.Adds a nodeadd
(String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation) add
(String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation, Badge badge) add
(String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation, Badge badge, String message) Adds aIComputer
instance.Adds a manually constructedModelObjectWithContextMenu.MenuItem
addAll
(Collection<? extends Action> actions) Add a header row (no icon, no URL, rendered in header style).Add a separator row (no icon, no URL, no text).from
(ModelObjectWithContextMenu self, org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) Default implementation of the context menu generation.from
(ModelObjectWithContextMenu self, org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response, String view) from
(ModelObjectWithContextMenu self, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) void
generateResponse
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, Object o) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.kohsuke.stapler.HttpResponse
generateResponse
-
Field Details
-
items
The actual contents of the menu.
-
-
Constructor Details
-
ContextMenu
public ContextMenu()
-
-
Method Details
-
generateResponse
public void generateResponse(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, Object o) throws IOException, jakarta.servlet.ServletException - Specified by:
generateResponse
in interfaceorg.kohsuke.stapler.HttpResponse
- Throws:
IOException
jakarta.servlet.ServletException
-
add
-
addAll
-
add
-
add
-
add
public ModelObjectWithContextMenu.ContextMenu add(String url, String icon, String text, boolean post) - Since:
- 1.504
-
add
public ModelObjectWithContextMenu.ContextMenu add(String url, String icon, String text, boolean post, boolean requiresConfirmation) - Since:
- 1.512
-
add
public ModelObjectWithContextMenu.ContextMenu add(String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation) - Since:
- 2.335
-
add
public ModelObjectWithContextMenu.ContextMenu add(String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation, Badge badge) - Since:
- 2.401
-
add
public ModelObjectWithContextMenu.ContextMenu add(String url, String icon, String iconXml, String text, boolean post, boolean requiresConfirmation, Badge badge, String message) - Since:
- 2.415
-
addHeader
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public ModelObjectWithContextMenu.ContextMenu addHeader(String title) Add a header row (no icon, no URL, rendered in header style).- Since:
- 2.231
-
addSeparator
Add a separator row (no icon, no URL, no text).- Since:
- 2.340
-
add
Adds a manually constructedModelObjectWithContextMenu.MenuItem
- Since:
- 1.513
-
add
Adds a node- Since:
- 1.513
-
add
Deprecated.useadd(IComputer)
instead.Adds a computer- Since:
- 1.513
-
add
Adds aIComputer
instance.- Parameters:
c
- the computer to add to the menu- Returns:
- this
- Since:
- 2.480
-
add
-
add
Adds a child item when rendering context menu of its parent.- Since:
- 1.513
-
from
public ModelObjectWithContextMenu.ContextMenu from(ModelObjectWithContextMenu self, org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response) throws org.apache.commons.jelly.JellyException, IOException Default implementation of the context menu generation.This method uses
sidepanel.groovy
to run the side panel generation, captures the use of<l:task>
tags, and then converts those intoModelObjectWithContextMenu.MenuItem
s. This is supposed to make this work with most existingModelObject
s that follow the standard convention.Unconventional
ModelObject
implementations that do not usesidepanel.groovy
can overrideModelObjectWithContextMenu.doContextMenu(StaplerRequest2, StaplerResponse2)
directly to provide alternative semantics.- Throws:
org.apache.commons.jelly.JellyException
IOException
-
from
public ModelObjectWithContextMenu.ContextMenu from(ModelObjectWithContextMenu self, org.kohsuke.stapler.StaplerRequest request, org.kohsuke.stapler.StaplerResponse response) throws org.apache.commons.jelly.JellyException, IOException - Throws:
org.apache.commons.jelly.JellyException
IOException
-
from
public ModelObjectWithContextMenu.ContextMenu from(ModelObjectWithContextMenu self, org.kohsuke.stapler.StaplerRequest2 request, org.kohsuke.stapler.StaplerResponse2 response, String view) throws org.apache.commons.jelly.JellyException, IOException - Throws:
org.apache.commons.jelly.JellyException
IOException
-
add(IComputer)
instead.