Class SourceListCategory

  • All Implemented Interfaces:
    TextProvider

    public class SourceListCategory
    extends java.lang.Object
    implements TextProvider
    A category in a SourceList. SourceListCategorys are top level containers for SourceListItems. SourceListCategorys are text only, and rendered in full caps (regardless of supplied text capitalization).
    • Constructor Summary

      Constructors 
      Constructor Description
      SourceListCategory​(java.lang.String text)
      Creates a SourceListCategory with the given text.
      SourceListCategory​(java.lang.String text, boolean collapsable)
      Creates a SourceListCategory with the given text.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean containsItem​(SourceListItem item)
      Returns true if the given SourceListItem is contained by this category, to include being a sub-element of another SourceListItem contained by this category.
      int getItemCount()
      Gets the number of child SourceListItems that are part of this category.
      java.util.List<SourceListItem> getItems()
      Gets a list of this SourceListCategory's SourceListItems.
      java.lang.String getText()
      Gets the category text.
      boolean isCollapsable()
      true if this SourceListCategory is collapsable.
      void setText​(java.lang.String text)
      Sets the text to use for this SourceListCategory.
      java.lang.String toString()
      Returns a String representation of this SourceListCategory.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SourceListCategory

        public SourceListCategory​(java.lang.String text)
        Creates a SourceListCategory with the given text. The capitalization of the text will be ignored, as categories are rendered in full caps.
        Parameters:
        text - the category text. Cannot be null.
      • SourceListCategory

        public SourceListCategory​(java.lang.String text,
                                  boolean collapsable)
        Creates a SourceListCategory with the given text. The capitalization of the text will be ignored, as categories are rendered in full caps. If this SourceListCategory is marked as not collapsable, then no disclosure icon will be shown, making the SourceListCategory always expanded.
        Parameters:
        text - the SourceListCategory text. Cannot be null.
        collapsable - true if this SourceListCategory should be collapsable.
    • Method Detail

      • getText

        public java.lang.String getText()
        Gets the category text. The returned will be the text that was set on the category - that is, this method does not return an all caps version of the text.
        Specified by:
        getText in interface TextProvider
        Returns:
        the category text.
      • setText

        public void setText​(java.lang.String text)
        Sets the text to use for this SourceListCategory. The capitalization of the text will be ignored, as categories are rendered in full caps.
        Parameters:
        text - the category text.
      • isCollapsable

        public boolean isCollapsable()
        true if this SourceListCategory is collapsable.
        Returns:
        true if this SourceListCategory is collapsable.
      • getItemCount

        public int getItemCount()
        Gets the number of child SourceListItems that are part of this category.
        Returns:
        the number of SourceListItems that are part of this category.
      • containsItem

        public boolean containsItem​(SourceListItem item)
        Returns true if the given SourceListItem is contained by this category, to include being a sub-element of another SourceListItem contained by this category.
        Parameters:
        item - the SourceListItem to determine whether or not is contained by this category.
        Returns:
        true if the given SourceListItem is contained within this category or within on of this categories SourceListItems.
      • toString

        public java.lang.String toString()
        Returns a String representation of this SourceListCategory.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a String representation of this SourceListCategory.
      • getItems

        public java.util.List<SourceListItem> getItems()
        Gets a list of this SourceListCategory's SourceListItems.
        Returns:
        a list of this SourceListCategory's SourceListItems.