Package com.explodingpixels.macwidgets
Class SourceListCategory
java.lang.Object
com.explodingpixels.macwidgets.SourceListCategory
- All Implemented Interfaces:
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
ConstructorsConstructorDescriptionSourceListCategory(String text) Creates aSourceListCategorywith the given text.SourceListCategory(String text, boolean collapsable) Creates aSourceListCategorywith the given text. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsItem(SourceListItem item) Returnstrueif the givenSourceListItemis contained by this category, to include being a sub-element of anotherSourceListItemcontained by this category.intGets the number of childSourceListItems that are part of this category.getItems()Gets a list of thisSourceListCategory'sSourceListItems.getText()Gets the category text.booleantrueif thisSourceListCategoryis collapsable.voidSets the text to use for thisSourceListCategory.toString()Returns aStringrepresentation of thisSourceListCategory.
-
Constructor Details
-
SourceListCategory
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
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 Details
-
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
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
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
Returns aStringrepresentation of thisSourceListCategory. -
getItems
Gets a list of thisSourceListCategory'sSourceListItems.- Returns:
- a list of this
SourceListCategory'sSourceListItems.
-