Package com.explodingpixels.macwidgets
Class SourceListCategory
- java.lang.Object
-
- com.explodingpixels.macwidgets.SourceListCategory
-
- All Implemented Interfaces:
TextProvider
public class SourceListCategory extends java.lang.Object implements TextProvider
A category in aSourceList.SourceListCategorys are top level containers forSourceListItems.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 aSourceListCategorywith the given text.SourceListCategory(java.lang.String text, boolean collapsable)Creates aSourceListCategorywith the given text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsItem(SourceListItem item)Returnstrueif the givenSourceListItemis contained by this category, to include being a sub-element of anotherSourceListItemcontained by this category.intgetItemCount()Gets the number of childSourceListItems that are part of this category.java.util.List<SourceListItem>getItems()Gets a list of thisSourceListCategory'sSourceListItems.java.lang.StringgetText()Gets the category text.booleanisCollapsable()trueif thisSourceListCategoryis collapsable.voidsetText(java.lang.String text)Sets the text to use for thisSourceListCategory.java.lang.StringtoString()Returns aStringrepresentation of thisSourceListCategory.
-
-
-
Constructor Detail
-
SourceListCategory
public SourceListCategory(java.lang.String text)
Creates aSourceListCategorywith 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 aSourceListCategorywith the given text. The capitalization of the text will be ignored, as categories are rendered in full caps. If thisSourceListCategoryis marked as not collapsable, then no disclosure icon will be shown, making theSourceListCategoryalways expanded.- Parameters:
text- theSourceListCategorytext. Cannot be null.collapsable-trueif thisSourceListCategoryshould 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:
getTextin interfaceTextProvider- Returns:
- the category text.
-
setText
public void setText(java.lang.String text)
Sets the text to use for thisSourceListCategory. The capitalization of the text will be ignored, as categories are rendered in full caps.- Parameters:
text- the category text.
-
isCollapsable
public boolean isCollapsable()
trueif thisSourceListCategoryis collapsable.- Returns:
trueif thisSourceListCategoryis collapsable.
-
getItemCount
public int getItemCount()
Gets the number of childSourceListItems that are part of this category.- Returns:
- the number of
SourceListItems that are part of this category.
-
containsItem
public boolean containsItem(SourceListItem item)
Returnstrueif the givenSourceListItemis contained by this category, to include being a sub-element of anotherSourceListItemcontained by this category.- Parameters:
item- theSourceListItemto determine whether or not is contained by this category.- Returns:
trueif the givenSourceListItemis contained within this category or within on of this categoriesSourceListItems.
-
toString
public java.lang.String toString()
Returns aStringrepresentation of thisSourceListCategory.- Overrides:
toStringin classjava.lang.Object- Returns:
- a
Stringrepresentation of thisSourceListCategory.
-
getItems
public java.util.List<SourceListItem> getItems()
Gets a list of thisSourceListCategory'sSourceListItems.- Returns:
- a list of this
SourceListCategory'sSourceListItems.
-
-