Package hudson.model
Class TopLevelItemDescriptor
- java.lang.Object
-
- hudson.model.Descriptor<TopLevelItem>
-
- hudson.model.TopLevelItemDescriptor
-
- Direct Known Subclasses:
AbstractProject.AbstractProjectDescriptor
public abstract class TopLevelItemDescriptor extends Descriptor<TopLevelItem> implements IconSpec
DescriptorforTopLevelItems.- 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
Constructors Modifier Constructor Description protectedTopLevelItemDescriptor()Infers the type of the correspondingTopLevelItemfrom the outer class.protectedTopLevelItemDescriptor(Class<? extends TopLevelItem> clazz)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static ExtensionList<TopLevelItemDescriptor>all()Returns all the registeredTopLevelItemdescriptors.voidcheckApplicableIn(ItemGroup parent)Checks if this top level item is applicable within the specified item group.StringgetCategoryId()Used to categorize this kind of item type.StringgetDescription()A description of this kind of item type.StringgetDisplayName()Human readable name of this kind of configurable object.StringgetIconClassName()Get the Item's Icon class specification e.g.StringgetIconFilePath(String size)Deprecated.prefergetIconClassName()StringgetIconFilePathPattern()Deprecated.prefergetIconClassName()booleanisApplicable(Descriptor descriptor)TopLevelItemDescriptors often uses other descriptors to decorate itself.booleanisApplicableIn(ItemGroup parent)TopLevelItemDescriptors often may want to limit the scope within which they can be created.abstract TopLevelItemnewInstance(ItemGroup parent, String name)Creates a newTopLevelItemfor the specified parent.TopLevelItemnewInstance(String name)Deprecated.as of 1.390 UsenewInstance(ItemGroup, String)TopLevelItemnewInstance(org.kohsuke.stapler.StaplerRequest req)Deprecated.since 2007-01-19.booleantestInstance(TopLevelItem i)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, calcAutoCompleteSettings, calcFillSettings, configure, configure, 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, getT, getViewPage, isInstance, isSubTypeOf, load, newInstance, newInstancesFromHeteroList, newInstancesFromHeteroList, save, self, toArray, toList, toMap
-
-
-
-
Constructor Detail
-
TopLevelItemDescriptor
protected TopLevelItemDescriptor(Class<? extends TopLevelItem> clazz)
-
TopLevelItemDescriptor
protected TopLevelItemDescriptor()
Infers the type of the correspondingTopLevelItemfrom 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 Detail
-
isApplicable
public boolean isApplicable(Descriptor descriptor)
TopLevelItemDescriptors often uses other descriptors to decorate itself. This method allows the subtype ofTopLevelItemDescriptors 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
public boolean isApplicableIn(ItemGroup parent)
TopLevelItemDescriptors often may want to limit the scope within which they can be created. This method allows the subtype ofTopLevelItemDescriptors to filter them out.- Since:
- 1.607
-
checkApplicableIn
public final void checkApplicableIn(ItemGroup parent)
Checks if this top level item is applicable within the specified item group.This is just a convenience function.
- Since:
- 1.607
-
testInstance
public boolean testInstance(TopLevelItem i)
Tests if the given instance belongs to this descriptor, in the sense that this descriptor can produce items like the given one.TopLevelItemDescriptors that act like a wizard and produces different object types thanDescriptor.clazzcan override this method to augment instance-descriptor relationship.- Since:
- 1.410
-
getDisplayName
@NonNull public String 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 exampleMyThingfromsome.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 asisEnabledorisApplicable.Used as the caption when the user chooses what item type to create. The descriptor implementation also needs to have
newInstanceDetail.jellyscript, which will be used to render the text below the caption that explains the item type.- Overrides:
getDisplayNamein classDescriptor<TopLevelItem>
-
getDescription
@NonNull public String 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
@NonNull public String 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
@CheckForNull @Deprecated public String 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:sizerepresents 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:
FreeStyleProject.DescriptorImpl.getIconFilePathPattern()
-
getIconFilePath
@CheckForNull @Deprecated public String getIconFilePath(String size)
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
public String 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:
getIconClassNamein 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 forItems.- Overrides:
newInstancein classDescriptor<TopLevelItem>- Throws:
Descriptor.FormException
-
newInstance
@Deprecated public TopLevelItem newInstance(String name)
Deprecated.as of 1.390 UsenewInstance(ItemGroup, String)Creates a newTopLevelItem.
-
newInstance
public abstract TopLevelItem newInstance(ItemGroup parent, String name)
Creates a newTopLevelItemfor the specified parent.- Since:
- 1.390
-
all
public static ExtensionList<TopLevelItemDescriptor> all()
Returns all the registeredTopLevelItemdescriptors.
-
-