Package hudson.model
Class TopLevelItemDescriptor
- Direct Known Subclasses:
AbstractProject.AbstractProjectDescriptor
Descriptor
for TopLevelItem
s.- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Nested classes/interfaces inherited from class hudson.model.Descriptor
Descriptor.FormException, Descriptor.PropertyType, Descriptor.Self
-
Field Summary
Fields inherited from class hudson.model.Descriptor
clazz
-
Constructor Summary
ModifierConstructorDescriptionprotected
Infers the type of the correspondingTopLevelItem
from the outer class.protected
TopLevelItemDescriptor
(Class<? extends TopLevelItem> clazz) -
Method Summary
Modifier and TypeMethodDescriptionstatic ExtensionList<TopLevelItemDescriptor>
all()
Returns all the registeredTopLevelItem
descriptors.final void
checkApplicableIn
(ItemGroup parent) Checks if this top level item is applicable within the specified item group.doCheckDisplayNameOrNull
(TopLevelItem item, String value) Used to categorize this kind of item type.A description of this kind of item type.Human readable name of this kind of configurable object.Get the Item's Icon class specification e.g.getIconFilePath
(String size) Deprecated.Deprecated.prefergetIconClassName()
boolean
isApplicable
(Descriptor descriptor) TopLevelItemDescriptor
s often uses other descriptors to decorate itself.boolean
isApplicableIn
(ItemGroup parent) TopLevelItemDescriptor
s often may want to limit the scope within which they can be created.abstract TopLevelItem
newInstance
(ItemGroup parent, String name) Creates a newTopLevelItem
for the specified parent.newInstance
(String name) Deprecated.as of 1.390 UsenewInstance(ItemGroup, String)
newInstance
(org.kohsuke.stapler.StaplerRequest req) Deprecated.since 2007-01-19.boolean
Tests if the given instance belongs to this descriptor, in the sense that this descriptor can produce items like the given one.Methods inherited from class hudson.model.Descriptor
addHelpFileRedirect, bindJSON, bindJSON, calcAutoCompleteSettings, calcFillSettings, configure, configure, configure, doHelp, doHelp, find, find, findByDescribableClassName, findById, getCategory, getCheckMethod, getCheckUrl, getConfigFile, getConfigPage, getCurrentDescriptorByNameUrl, getDescriptorFullUrl, getDescriptorUrl, getGlobalConfigPage, getGlobalPropertyType, getHelpFile, getHelpFile, getHelpFile, getId, getJsonSafeClassName, getKlass, getPlugin, getPossibleViewNames, getPropertyType, getPropertyType, getPropertyTypeOrDie, getRequiredGlobalConfigPagePermission, getStaticHelpUrl, getStaticHelpUrl, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
Constructor Details
-
TopLevelItemDescriptor
-
TopLevelItemDescriptor
protected TopLevelItemDescriptor()Infers the type of the correspondingTopLevelItem
from the outer class. This version works when you follow the common convention, where a descriptor is written as the static nested class of the describable class.- Since:
- 1.278
-
-
Method Details
-
isApplicable
TopLevelItemDescriptor
s often uses other descriptors to decorate itself. This method allows the subtype ofTopLevelItemDescriptor
s to filter them out.This is useful for a workflow/company specific item type that wants to eliminate options that the user would see.
- Since:
- 1.294
-
isApplicableIn
TopLevelItemDescriptor
s often may want to limit the scope within which they can be created. This method allows the subtype ofTopLevelItemDescriptor
s to filter them out.- Since:
- 1.607
-
checkApplicableIn
Checks if this top level item is applicable within the specified item group.This is just a convenience function.
- Since:
- 1.607
-
testInstance
Tests if the given instance belongs to this descriptor, in the sense that this descriptor can produce items like the given one.TopLevelItemDescriptor
s that act like a wizard and produces different object types thanDescriptor.clazz
can override this method to augment instance-descriptor relationship.- Since:
- 1.410
-
getDisplayName
Human readable name of this kind of configurable object. Should be overridden for most descriptors, if the display name is visible somehow. As a fallback it usesClass.getSimpleName()
onDescriptor.clazz
, so for exampleMyThing
fromsome.pkg.MyThing.DescriptorImpl
. Historically some implementations returned null as a way of hiding the descriptor from the UI, but this is generally managed by an explicit method such asisEnabled
orisApplicable
.Used as the caption when the user chooses what item type to create. The descriptor implementation also needs to have
newInstanceDetail.jelly
script, which will be used to render the text below the caption that explains the item type.- Overrides:
getDisplayName
in classDescriptor<TopLevelItem>
-
getDescription
A description of this kind of item type. This description can contain HTML code but it is recommended that you use plain text in order to be consistent with the rest of Jenkins. This method should be called from a thread where Stapler is handling an HTTP request, otherwise it will return an empty string.- Returns:
- A string, by default the value from newInstanceDetail view is taken.
- Since:
- 2.0
-
getCategoryId
Used to categorize this kind of item type. @seeItemCategory
- Returns:
- A string with the category identifier,
ItemCategory.UncategorizedCategory.getId()
by default. - Since:
- 2.0
-
getIconFilePathPattern
Deprecated.prefergetIconClassName()
Represents a file path pattern to get the Item icon in different sizes. For example: plugin/plugin-shortname/images/:size/item.png, where:size
represents the different icon sizes used commonly in Jenkins project: 16x16, 24x24, 32x32 or 48x48- Returns:
- A string or null if it is not defined.
- Since:
- 2.0
- See Also:
-
getIconFilePath
Deprecated.prefergetIconClassName()
An icon file path associated to a specific size.- Parameters:
size
- A string with values that represent the common sizes: 16x16, 24x24, 32x32 or 48x48- Returns:
- A string or null if it is not defined.
- Since:
- 2.0
-
getIconClassName
Get the Item's Icon class specification e.g. 'icon-notepad'.Note: do NOT include icon size specifications (such as 'icon-sm').
- Specified by:
getIconClassName
in interfaceIconSpec
- Returns:
- The Icon class specification e.g. 'icon-notepad'.
-
newInstance
@Deprecated public TopLevelItem newInstance(org.kohsuke.stapler.StaplerRequest req) throws Descriptor.FormException Deprecated.since 2007-01-19. This is not a valid operation forItem
s.- Overrides:
newInstance
in classDescriptor<TopLevelItem>
- Throws:
Descriptor.FormException
-
newInstance
Deprecated.as of 1.390 UsenewInstance(ItemGroup, String)
Creates a newTopLevelItem
. -
newInstance
Creates a newTopLevelItem
for the specified parent.- Since:
- 1.390
-
all
Returns all the registeredTopLevelItem
descriptors. -
doCheckDisplayNameOrNull
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public FormValidation doCheckDisplayNameOrNull(@AncestorInPath TopLevelItem item, @QueryParameter String value)
-
getIconClassName()