Class ViewLabelAction

  • All Implemented Interfaces:
    WebInterface, SpaceAware, Spaced, MessageHolderAware, com.opensymphony.xwork2.Action, com.opensymphony.xwork2.interceptor.ValidationAware, com.opensymphony.xwork2.LocaleProvider, com.opensymphony.xwork2.TextProvider, com.opensymphony.xwork2.Validateable, Serializable

    public class ViewLabelAction
    extends AbstractLabelDisplayingAction
    Action for viewing a label. The label can be specified by either using the labels name(s) or the labels id(s), but not both.

    The names and ids are the parameters passed in, and used for null-input validation, but are not "maintained" once the labels they point to are retrieved. This means that the names and ids fields have trivial state after retrieveLabels has been called and should not be accessed via getter methods.

    See Also:
    Serialized Form
    • Field Detail

      • ITEMS_PER_PAGE

        public static final int ITEMS_PER_PAGE
        The default number of content to be displayed on each page.
        See Also:
        Constant Field Values
      • paginationSupport

        protected PaginationSupport paginationSupport
        Pagination support to assist in the display of the list of content associated with the label.
    • Constructor Detail

      • ViewLabelAction

        public ViewLabelAction()
    • Method Detail

      • setIds

        public void setIds​(long[] ids)
      • setStartIndex

        public void setStartIndex​(int startIndex)
      • setSearchManager

        public void setSearchManager​(SearchManager searchManager)
      • getLabels

        public List getLabels()
      • getContent

        public List getContent()
      • getRelated

        public List getRelated()
      • validate

        public void validate()
        Specified by:
        validate in interface MessageHolderAware
        Specified by:
        validate in interface com.opensymphony.xwork2.Validateable
        Overrides:
        validate in class com.opensymphony.xwork2.ActionSupport
      • execute

        public String execute()
                       throws Exception
        Specified by:
        execute in interface com.opensymphony.xwork2.Action
        Overrides:
        execute in class com.opensymphony.xwork2.ActionSupport
        Throws:
        Exception
      • getOtherLabels

        public List<DisplayableLabel> getOtherLabels​(Labelable content)
        Returns the first nine global labels on the given content that are not this.label. It is expected that the view will only display the first eight such labels, and use the ninth as a signal that a "..." is required
        Parameters:
        content - the content to get labels for
        Returns:
        a list of Labels with size between 0 and 8 inclusive. Not null.
      • getLabel

        public DisplayableLabel getLabel()
        Returns a DisplayableLabel based on all the labels being viewed.
      • getAddLabel

        public DisplayableLabel getAddLabel​(Label label)
        Returns a DisplayableLabel representing the currently viewed labels and the given label.

        For example, if the current viewed labels are "a+b" and the passed label is "c", it returns a DisplayableLabel of "a+b+c"

        Sorts the labels by title before returning them, so the order is canonical.

      • getRemoveLabel

        public DisplayableLabel getRemoveLabel​(Label label)
        Returns a DisplayableLabel representing the currently viewed labels, minus the given label.

        For example, if the current viewed labels are "a+b+c" and the passed label is "a", it returns a DisplayableLabel of "b+c"

        Sorts the labels by title before returning them, so the order is canonical.

      • getPaginationUrl

        public String getPaginationUrl()
      • getDescription

        public String getDescription()
      • setDescription

        public void setDescription​(String description)