public class MyViewsProperty extends UserProperty implements ModifiableViewGroup, Action, org.kohsuke.stapler.StaplerFallback
| Modifier and Type | Class and Description |
|---|---|
static class |
MyViewsProperty.DescriptorImpl |
static class |
MyViewsProperty.GlobalAction |
ExtensionPoint.LegacyInstancesAreScopedToHudsonuser| Constructor and Description |
|---|
MyViewsProperty(String primaryViewName) |
| Modifier and Type | Method and Description |
|---|---|
void |
addView(View view)
|
boolean |
canDelete(View view)
Determine whether a view may be deleted.
|
void |
checkPermission(Permission permission)
Convenient short-cut for
getACL().checkPermission(permission) |
void |
deleteView(View view)
Deletes a view in this group.
|
void |
doCreateView(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp) |
org.kohsuke.stapler.HttpResponse |
doIndex() |
FormValidation |
doViewExistsCheck(String value,
boolean exists)
Checks if a private view with the given name exists.
|
ACL |
getACL()
Obtains the ACL associated with this object.
|
String |
getDisplayName()
Gets the string to be displayed.
|
String |
getIconFileName()
Gets the file name of the icon.
|
ItemGroup<? extends TopLevelItem> |
getItemGroup()
Returns the
ItemGroup from which the views in this group should render items. |
MyViewsTabBar |
getMyViewsTabBar() |
View |
getPrimaryView()
If the view group renders one view in its own URL (like Jenkins top page does),
then that view is called the primary view.
|
String |
getPrimaryViewName() |
Object |
getStaplerFallback() |
String |
getUrl()
Returns the path of this group, relative to the context root,
like "foo/bar/zot/".
|
String |
getUrlName()
Gets the URL path name.
|
User |
getUser() |
View |
getView(String name)
Gets a view of the given name.
|
List<Action> |
getViewActions()
Returns actions that should be displayed in views.
|
Collection<View> |
getViews()
Gets all the views in this group.
|
ViewsTabBar |
getViewsTabBar()
Gets the TabBar for the views.
|
boolean |
hasPermission(Permission permission)
Convenient short-cut for
getACL().hasPermission(permission) |
void |
onViewRenamed(View view,
String oldName,
String newName)
View calls this method when it's renamed. |
Object |
readResolve() |
UserProperty |
reconfigure(org.kohsuke.stapler.StaplerRequest req,
net.sf.json.JSONObject form)
When a parent/owner object of a Describable gets a config form submission and instances are
recreated, this method is invoked on the existing instance (meaning the 'this' reference
points to the existing instance) to create a new instance to be added to the parent/owner object.
|
void |
save()
Persists the state of this object into XML.
|
void |
setPrimaryViewName(String primaryViewName) |
all, getDescriptor@DataBoundConstructor public MyViewsProperty(String primaryViewName)
public Object readResolve()
public String getPrimaryViewName()
public void setPrimaryViewName(String primaryViewName)
public User getUser()
public String getUrl()
ViewGrouppublic void save()
throws IOException
Saveable
For making a bulk change efficiently, see BulkChange.
To support listeners monitoring changes to this object, call SaveableListener#fireOnChange
save in interface SaveableIOException - if the persistence failed.public Collection<View> getViews()
ViewGrouppublic View getView(String name)
ViewGrouppublic boolean canDelete(View view)
ViewGrouppublic void deleteView(View view) throws IOException
ViewGroupdeleteView in interface ViewGroupIOExceptionpublic void onViewRenamed(View view, String oldName, String newName)
ViewGroupView calls this method when it's renamed.
This method is intended to work as a notification to the ViewGroup
(so that it can adjust its internal data structure, for example.)
It is the caller's responsibility to ensure that the new name is a legal view name.
onViewRenamed in interface ViewGrouppublic void addView(View view) throws IOException
ModifiableViewGroupaddView in interface ModifiableViewGroupIOExceptionpublic View getPrimaryView()
ViewGroupIf the view group doesn't do such rendering, this method can always return null.
This method was added later to ViewGroup, so old plugins might not be implementing this.
To work around this, Views can use View.getOwnerPrimaryView().
getPrimaryView in interface ViewGrouppublic org.kohsuke.stapler.HttpResponse doIndex()
public void doCreateView(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException,
ParseException,
Descriptor.FormException
IOExceptionjavax.servlet.ServletExceptionParseExceptionDescriptor.FormExceptionpublic FormValidation doViewExistsCheck(@QueryParameter String value, @QueryParameter boolean exists)
public ACL getACL()
AccessControlledgetACL in interface AccessControlledpublic void checkPermission(Permission permission) throws org.acegisecurity.AccessDeniedException
AccessControlledgetACL().checkPermission(permission)checkPermission in interface AccessControlledorg.acegisecurity.AccessDeniedExceptionpublic boolean hasPermission(Permission permission)
AccessControlledgetACL().hasPermission(permission)hasPermission in interface AccessControlledpublic String getDisplayName()
ActiongetDisplayName in interface ActiongetDisplayName in interface ModelObjectpublic String getIconFileName()
ActiongetIconFileName in interface ActionIf an absolute file name that starts from '/' is returned (like "/plugin/foo/abc.gif'), then it will be interpreted as a path from the context root of Jenkins. This is useful to pick up image files from a plugin.
Finally, return null to hide it from the task list. This is normally not very useful, but this can be used for actions that only contribute floatBox.jelly and no task list item. The other case where this is useful is to avoid showing links that require a privilege when the user is anonymous.
Functions.isAnonymous(),
Functions.getIconFilePath(Action)public String getUrlName()
ActionFor example, if this method returns "xyz", and if the parent object (that this action is associated with) is bound to /foo/bar/zot, then this action object will be exposed to /foo/bar/zot/xyz.
This method should return a string that's unique among other Actions.
The returned string can be an absolute URL, like "http://www.sun.com/", which is useful for directly connecting to external systems.
If the returned string starts with '/', like '/foo', then it's assumed to be relative to the context path of the Jenkins webapp.
getUrlName in interface ActionAction.getIconFileName().Functions.getActionUrl(String, Action)public UserProperty reconfigure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject form) throws Descriptor.FormException
ReconfigurableDescribableThe default implementation of this should be the following:
return form==null ? null : getDescriptor().newInstance(req, form);
reconfigure in interface ReconfigurableDescribable<UserProperty>reconfigure in class UserPropertyreq - The current HTTP request being processed.form - JSON fragment that corresponds to this describable object.
If the newly submitted form doesn't include a fragment for this describable
(meaning the user has de-selected your descriptor), then this argument is null.Descriptor.FormExceptionpublic ViewsTabBar getViewsTabBar()
ViewGroupgetViewsTabBar in interface ViewGrouppublic ItemGroup<? extends TopLevelItem> getItemGroup()
ViewGroupItemGroup from which the views in this group should render items.
Generally speaking, Views render a subset of TopLevelItems that belong to this item group.
This method was added later to ViewGroup, so old plugins might not be implementing this.
To work around this, Views can use View.getOwnerItemGroup().
getItemGroup in interface ViewGroupModifiableItemGroup (if the container allows arbitrary addition)public List<Action> getViewActions()
ViewGroupIn this interface, the return value is used read-only. This doesn't prevent subtypes from returning modifiable actions, however.
This method was added later to ViewGroup, so old plugins might not be implementing this.
To work around this, Views can use View.getOwnerViewActions().
getViewActions in interface ViewGroupActionable.getActions()public Object getStaplerFallback()
getStaplerFallback in interface org.kohsuke.stapler.StaplerFallbackpublic MyViewsTabBar getMyViewsTabBar()
Copyright © 2019. All rights reserved.