hudson.model
Class TreeView

java.lang.Object
  extended by hudson.model.AbstractModelObject
      extended by hudson.model.View
          extended by hudson.model.TreeView
All Implemented Interfaces:
ExtensionPoint, Describable<View>, ModelObject, Saveable, ViewGroup, SearchableModelObject, SearchItem, AccessControlled

public class TreeView
extends View
implements ViewGroup

EXPERIMENTAL

The intention is to eventually merge this with the ListView. This class is here for experimentation.

Until this class is sufficiently stable, there's no need for l10n. TODO: use ViewGroupMixIn

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class TreeView.DescriptorImpl
           
 
Nested classes/interfaces inherited from class hudson.model.View
View.AsynchPeople, View.People, View.PropertyList, View.UserInfo
 
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
 
Field Summary
 
Fields inherited from class hudson.model.View
CONFIGURE, CREATE, DELETE, description, filterExecutors, filterQueue, LIST, name, NEW_PRONOUN, owner, PERMISSIONS, READ, SORTER, transientActions
 
Fields inherited from interface hudson.model.Saveable
NOOP
 
Constructor Summary
TreeView(String name)
           
 
Method Summary
 boolean canDelete(View view)
          Determine whether a view may be deleted.
 boolean contains(TopLevelItem item)
          Checks if the job is in this collection.
 Indenter createFixedIndenter(String d)
          Returns Indenter that has the fixed indentation width.
 void deleteView(View view)
          Deletes a view in this group.
 TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
          Creates a new Item in this collection.
 void doCreateView(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
           
 ItemGroup<? extends TopLevelItem> getItemGroup()
          Returns the ItemGroup from which the views in this group should render items.
 List<TopLevelItem> getItems()
          Returns a read-only view of all Jobs in this view.
 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.
 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.
 void onJobRenamed(Item item, String oldName, String newName)
          Called when a job name is changed or deleted.
 void onViewRenamed(View view, String oldName, String newName)
          View calls this method when it's renamed.
static ViewDescriptor register()
           
protected  void submit(org.kohsuke.stapler.StaplerRequest req)
          Handles the configuration submission.
 
Methods inherited from class hudson.model.View
all, allInstantiable, checkPermission, create, createViewFromXML, doConfigDotXml, doConfigSubmit, doDoDelete, doRssAll, doRssFailed, doRssLatest, doSubmitDescription, getAbsoluteUrl, getACL, getActions, getAllProperties, getApi, getApplicablePropertyDescriptors, getApproximateQueueItemsQuickly, getAsynchPeople, getBuilds, getColumns, getComputers, getDescription, getDescriptor, getDisplayName, getDynamic, getIndenter, getItem, getItemCreatePermission, getJob, getNewPronoun, getOwner, getOwnerItemGroup, getOwnerPrimaryView, getOwnerViewActions, getPeople, getPostConstructLandingPage, getProperties, getQueueItems, getSearchUrl, getTimeline, getUrl, getViewName, getViewUrl, getWidgets, hasPeople, hasPermission, isDefault, isEditable, isFilterExecutors, isFilterQueue, makeSearchIndex, rename, save, toString, updateByXml, updateTransientActions
 
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, requirePOST, sendError, sendError, sendError, sendError, sendError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface hudson.model.ViewGroup
getUrl
 
Methods inherited from interface hudson.model.Saveable
save
 
Methods inherited from interface hudson.model.ModelObject
getDisplayName
 
Methods inherited from interface hudson.security.AccessControlled
checkPermission, getACL, hasPermission
 

Constructor Detail

TreeView

@DataBoundConstructor
public TreeView(String name)
Method Detail

createFixedIndenter

public Indenter createFixedIndenter(String d)
Returns Indenter that has the fixed indentation width. Used for assisting view rendering.


getItems

public List<TopLevelItem> getItems()
Returns a read-only view of all Jobs in this view.

This method returns a separate copy each time to avoid concurrent modification issue.

Specified by:
getItems in class View

contains

public boolean contains(TopLevelItem item)
Description copied from class: View
Checks if the job is in this collection.

Specified by:
contains in class View

doCreateItem

public TopLevelItem doCreateItem(org.kohsuke.stapler.StaplerRequest req,
                                 org.kohsuke.stapler.StaplerResponse rsp)
                          throws IOException,
                                 javax.servlet.ServletException
Description copied from class: View
Creates a new Item in this collection.

This method should call ModifiableItemGroup.doCreateItem(StaplerRequest, StaplerResponse) and then add the newly created item to this view.

Specified by:
doCreateItem in class View
Returns:
null if fails.
Throws:
IOException
javax.servlet.ServletException

onJobRenamed

public void onJobRenamed(Item item,
                         String oldName,
                         String newName)
Description copied from class: View
Called when a job name is changed or deleted.

If this view contains this job, it should update the view membership so that the renamed job will remain in the view, and the deleted job is removed.

Specified by:
onJobRenamed in class View
Parameters:
item - The item whose name is being changed.
oldName - Old name of the item. Always non-null.
newName - New name of the item, if the item is renamed. Or null, if the item is removed.

submit

protected void submit(org.kohsuke.stapler.StaplerRequest req)
               throws IOException,
                      javax.servlet.ServletException,
                      Descriptor.FormException
Description copied from class: View
Handles the configuration submission. Load view-specific properties here.

Specified by:
submit in class View
Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException

canDelete

public boolean canDelete(View view)
Description copied from interface: ViewGroup
Determine whether a view may be deleted.

Specified by:
canDelete in interface ViewGroup

deleteView

public void deleteView(View view)
                throws IOException
Description copied from interface: ViewGroup
Deletes a view in this group.

Specified by:
deleteView in interface ViewGroup
Throws:
IOException

getViews

public Collection<View> getViews()
Description copied from interface: ViewGroup
Gets all the views in this group.

Specified by:
getViews in interface ViewGroup
Returns:
can be empty but never null.

getView

public View getView(String name)
Description copied from interface: ViewGroup
Gets a view of the given name. This also creates the URL binding for views (in the form of ".../view/FOOBAR/...")

Specified by:
getView in interface ViewGroup

getPrimaryView

public View getPrimaryView()
Description copied from interface: ViewGroup
If the view group renders one view in its own URL (like Jenkins top page does), then that view is called the primary view. In this case, the hyperlink to the primary view points to the view group itself.

If 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().

Specified by:
getPrimaryView in interface ViewGroup

onViewRenamed

public void onViewRenamed(View view,
                          String oldName,
                          String newName)
Description copied from interface: ViewGroup
View 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.

Specified by:
onViewRenamed in interface ViewGroup

doCreateView

public void doCreateView(org.kohsuke.stapler.StaplerRequest req,
                         org.kohsuke.stapler.StaplerResponse rsp)
                  throws IOException,
                         javax.servlet.ServletException,
                         Descriptor.FormException
Throws:
IOException
javax.servlet.ServletException
Descriptor.FormException

register

@Extension
public static ViewDescriptor register()

getViewsTabBar

public ViewsTabBar getViewsTabBar()
Description copied from interface: ViewGroup
Gets the TabBar for the views. TabBar for views can be provided by extension. Only one TabBar can be active at a given time (Selectable by user in the global Configuration page). Default TabBar is provided by Hudson Platform.

Specified by:
getViewsTabBar in interface ViewGroup

getItemGroup

public ItemGroup<? extends TopLevelItem> getItemGroup()
Description copied from interface: ViewGroup
Returns the ItemGroup 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().

Specified by:
getItemGroup in interface ViewGroup
Returns:
Never null. Sometimes this is ModifiableItemGroup (if the container allows arbitrary addition)

getViewActions

public List<Action> getViewActions()
Description copied from interface: ViewGroup
Returns actions that should be displayed in views.

In 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().

Specified by:
getViewActions in interface ViewGroup
Returns:
may be empty but never null.
See Also:
Actionable.getActions()


Copyright © 2004-2013. All Rights Reserved.