public class SourceListItem extends Object implements TextProvider, IconProvider, SourceListBadgeContentProvider
SourceList
which is contained within a SourceListCategory
.Modifier and Type | Field and Description |
---|---|
static String |
COUNTER_VALUE |
static String |
ICON |
static String |
TEXT |
Constructor and Description |
---|
SourceListItem(String text)
Creates a
SourceListItem with the given text. |
SourceListItem(String text,
Icon icon)
Creates a
SourceListItem with the given text and icon. |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds a
PropertyChangeListener on this SourceListItem . |
boolean |
containsItem(SourceListItem item)
Returns
true if the given SourceListItem is contained by this item, to
include being a sub-element of another child SourceListItem . |
List<SourceListItem> |
getChildItems()
Gets a list of this
SourceListItem 's child SourceListItem s. |
int |
getCounterValue()
Gets the counter value to use for this item.
|
Icon |
getIcon()
Gets the icon to use for this item.
|
String |
getText()
Gets the text to use for this item.
|
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes a
PropertyChangeListener from this SourceListItem . |
void |
setCounterValue(int counterValue)
Sets the counter value to use for this item.
|
void |
setIcon(Icon icon)
Sets the icon to use for this item.
|
void |
setText(String text)
Sets the text to use for this item.
|
String |
toString()
Returns a
String representation of this SourceListItem . |
public static final String TEXT
public static final String ICON
public static final String COUNTER_VALUE
public SourceListItem(String text)
SourceListItem
with the given text.text
- the item text. Cannot be null.IllegalArgumentException
- if the text is null.public SourceListItem(String text, Icon icon)
SourceListItem
with the given text and icon.text
- the item text. Cannot be null.icon
- the item icon. Can be null.IllegalArgumentException
- if the text is null.public String getText()
getText
in interface TextProvider
public void setText(String text)
text
- the text to use for this item. Cannot be null.IllegalArgumentException
- if the text is null.public Icon getIcon()
getIcon
in interface IconProvider
public void setIcon(Icon icon)
icon
- the icon to use for this item. Can be null.public int getCounterValue()
getCounterValue
in interface SourceListBadgeContentProvider
public void setCounterValue(int counterValue)
counterValue
- the counter value to use for this item. Must be >= 0.IllegalArgumentException
- if the counter value is not >= 0.public boolean containsItem(SourceListItem item)
true
if the given SourceListItem
is contained by this item, to
include being a sub-element of another child SourceListItem
.item
- the SourceListItem
to determine whether or not is contained by this
item.true
if the given SourceListItem
is contained within this item
or within on of this items child SourceListItem
s.public List<SourceListItem> getChildItems()
SourceListItem
's child SourceListItem
s.SourceListItem
's child SourceListItem
s.public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
on this SourceListItem
.listener
- the listener to add.public void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeListener
from this SourceListItem
.listener
- the listener to remove.