Package hudson.model

Class ViewGroupMixIn


  • public abstract class ViewGroupMixIn
    extends Object
    Implements ViewGroup to be used as a "mix-in". Not meant for a consumption from outside ViewGroups.

    How to use this class

    1. Create three data fields in your class:
      
       private String primaryView;
       private CopyOnWriteArrayList<View> views;
       private ViewsTabBar viewsTabBar;
       
    2. Define a transient field and store ViewGroupMixIn subtype, then wire up getters and setters:
       private transient ViewGroupMixIn = new ViewGroupMixIn() {
           List<View> views() { return views; }
           ...
       }
       
    Author:
    Kohsuke Kawaguchi
    See Also:
    ItemGroupMixIn
    • Constructor Detail

      • ViewGroupMixIn

        protected ViewGroupMixIn​(ViewGroup owner)
    • Method Detail

      • views

        @NonNull
        protected abstract List<View> views()
        Returns all views in the group. This list must be modifiable and concurrently iterable.
      • primaryView

        @CheckForNull
        protected abstract String primaryView()
        Gets primary view of the mix-in.
        Returns:
        Name of the primary view, null if there is no primary one defined.
      • primaryView

        protected abstract void primaryView​(String newName)
        Sets the primary view.
        Parameters:
        newName - Name of the primary view to be set. null to make the primary view undefined.
      • canDelete

        public boolean canDelete​(@NonNull
                                 View view)
      • getView

        @CheckForNull
        public View getView​(@CheckForNull
                            String name)
        Gets a view by the specified name. The method iterates through ViewGroups if required.
        Parameters:
        name - Name of the view
        Returns:
        View instance or null if it is missing
      • getViews

        @Exported
        public Collection<View> getViews()
        Gets the read-only list of all Views.
      • getPrimaryView

        @Exported
        @CheckForNull
        public View getPrimaryView()
        Returns the primary View that renders the top-page of Hudson or null if there is no primary one defined.
      • onViewRenamed

        public void onViewRenamed​(View view,
                                  String oldName,
                                  String newName)