com.explodingpixels.macwidgets

## Class SourceListItem

- java.lang.Object
- - com.explodingpixels.macwidgets.SourceListItem

All Implemented Interfaces:
  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
`static String` `COUNTER_VALUE`
`static String` `ICON`
`static String` `TEXT`

### Constructor Summary

Constructors
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.

### Method Summary

Methods
`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`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### TEXT

    public static final String TEXT

See Also:
  Constant Field Values

#### ICON

    public static final String ICON

See Also:
  Constant Field Values

#### COUNTER_VALUE

    public static final String COUNTER_VALUE

See Also:
  Constant Field Values

### Constructor Detail

#### SourceListItem

    public SourceListItem(String text)

Creates a `SourceListItem` with the given text.

Parameters:
  `text` - the item text. Cannot be null.
Throws:
  `IllegalArgumentException` - if the text is null.

#### SourceListItem

    public SourceListItem(String text,
                  Icon icon)

Creates a `SourceListItem` with 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 Detail

#### getText

    public String getText()

Gets the text to use for this item.

Specified by:
  `getText` in interface `TextProvider`
Returns:
  the text to use for this item.

#### setText

    public void setText(String text)

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

    public Icon getIcon()

Gets the icon to use for this item.

Specified by:
  `getIcon` in interface `IconProvider`
Returns:
  the icon to use for this item.

#### setIcon

    public void setIcon(Icon icon)

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:
  `getCounterValue` in interface `SourceListBadgeContentProvider`
Returns:
  the counter value to use for this item.

#### 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

    public 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`.

Parameters:
  `item` - the `SourceListItem` to determine whether or not is contained by this item.
Returns:
  `true` if the given `SourceListItem` is contained within this item or within on of this items child `SourceListItem`s.

#### toString

    public String toString()

Returns a `String` representation of this `SourceListItem`.

Overrides:
  `toString` in class `Object`
Returns:
  a `String` representation of this `SourceListItem`.

#### getChildItems

    public List<SourceListItem> getChildItems()

Gets a list of this `SourceListItem`'s child `SourceListItem`s.

Returns:
  a list of this `SourceListItem`'s child `SourceListItem`s.

#### addPropertyChangeListener

    public void addPropertyChangeListener(PropertyChangeListener listener)

Adds a `PropertyChangeListener` on this `SourceListItem`.

Parameters:
  `listener` - the listener to add.

#### removePropertyChangeListener

    public void removePropertyChangeListener(PropertyChangeListener listener)

Removes a `PropertyChangeListener` from this `SourceListItem`.

Parameters:
  `listener` - the listener to remove.