Package com.explodingpixels.macwidgets
Class SourceListItem
java.lang.Object
com.explodingpixels.macwidgets.SourceListItem
- All Implemented Interfaces:
MacBadgeContentProvider,SourceListBadgeContentProvider,IconProvider,TextProvider
public class SourceListItem
extends Object
implements TextProvider, IconProvider, SourceListBadgeContentProvider
An item in a
SourceList which is contained within a SourceListCategory.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSourceListItem(String text) Creates aSourceListItemwith the given text.SourceListItem(String text, Icon icon) Creates aSourceListItemwith the given text and icon. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds aPropertyChangeListeneron thisSourceListItem.booleancontainsItem(SourceListItem item) Returnstrueif the givenSourceListItemis contained by this item, to include being a sub-element of another childSourceListItem.Returns the string value of what should be displayed in the badge areaGets a list of thisSourceListItem's childSourceListItems.intGets the counter value to use for this item.getIcon()Gets the icon to use for this item.getText()Gets the text to use for this item.voidRemoves aPropertyChangeListenerfrom thisSourceListItem.voidsetCounterValue(int counterValue) Sets the counter value to use for this item.voidSets the icon to use for this item.voidSets the text to use for this item.toString()Returns aStringrepresentation of thisSourceListItem.
-
Field Details
-
TEXT
- See Also:
-
ICON
- See Also:
-
COUNTER_VALUE
- See Also:
-
-
Constructor Details
-
SourceListItem
Creates aSourceListItemwith the given text.- Parameters:
text- the item text. Cannot be null.- Throws:
IllegalArgumentException- if the text is null.
-
SourceListItem
Creates aSourceListItemwith the given text and icon.- Parameters:
text- the item text. Cannot be null.icon- the item icon. Can be null.- Throws:
IllegalArgumentException- if the text is null.
-
-
Method Details
-
getText
Gets the text to use for this item.- Specified by:
getTextin interfaceTextProvider- Returns:
- the text to use for this item.
-
setText
Sets the text to use for this item.- Parameters:
text- the text to use for this item. Cannot be null.- Throws:
IllegalArgumentException- if the text is null.
-
getIcon
Gets the icon to use for this item.- Specified by:
getIconin interfaceIconProvider- Returns:
- the icon to use for this item.
-
setIcon
Sets the icon to use for this item.- Parameters:
icon- the icon to use for this item. Can be null.
-
getCounterValue
public int getCounterValue()Gets the counter value to use for this item. The counter value will be displayed to the right of the item.- Specified by:
getCounterValuein interfaceSourceListBadgeContentProvider- Returns:
- the counter value to use for this item.
-
getBadgeValue
Returns the string value of what should be displayed in the badge area- Specified by:
getBadgeValuein interfaceMacBadgeContentProvider- Returns:
- text to display
-
setCounterValue
public void setCounterValue(int counterValue) Sets the counter value to use for this item. The counter value will be displayed to the right of the item.- Parameters:
counterValue- the counter value to use for this item. Must be >= 0.- Throws:
IllegalArgumentException- if the counter value is not >= 0.
-
containsItem
Returnstrueif the givenSourceListItemis contained by this item, to include being a sub-element of another childSourceListItem.- Parameters:
item- theSourceListItemto determine whether or not is contained by this item.- Returns:
trueif the givenSourceListItemis contained within this item or within on of this items childSourceListItems.
-
toString
Returns aStringrepresentation of thisSourceListItem. -
getChildItems
Gets a list of thisSourceListItem's childSourceListItems.- Returns:
- a list of this
SourceListItem's childSourceListItems.
-
addPropertyChangeListener
Adds aPropertyChangeListeneron thisSourceListItem.- Parameters:
listener- the listener to add.
-
removePropertyChangeListener
Removes aPropertyChangeListenerfrom thisSourceListItem.- Parameters:
listener- the listener to remove.
-