Package com.explodingpixels.macwidgets

## Class SourceListModel

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

    public final class SourceListModel
    extends java.lang.Object

The backing model to be used with a `SourceList`.

### Constructor Summary

Constructors
`SourceListModel()`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addCategory​(SourceListCategory category)` Adds the given category to the model and fires an event such that `SourceListModelListener`s will be notified.
`void` `addCategory​(SourceListCategory category, int index)` Adds the given category to the model at the given index and fires an event such that `SourceListModelListener`s will be notified.
`void` `addItemToCategory​(SourceListItem item, SourceListCategory category)` Adds the given item to the given `SourceListCategory`.
`void` `addItemToCategory​(SourceListItem item, SourceListCategory category, int index)` Adds the given item to the given `SourceListCategory` at the given index within that category.
`void` `addItemToItem​(SourceListItem childItem, SourceListItem parentItem)` Adds the given "child" item to the given "parent" item.
`void` `addItemToItem​(SourceListItem childItem, SourceListItem parentItem, int index)` Adds the given "child" item to the given "parent" item at the given index.
`void` `addSourceListModelListener​(SourceListModelListener listener)` Adds the given `SourceListModelListener` to the list of listeners.
`java.util.List<SourceListCategory>` `getCategories()` Gets the `SourceListCategory`s associated with this model.
`void` `removeCategory​(SourceListCategory category)` Removes the given category from the model and fires an event such that `SourceListModelListener`s will be notified.
`void` `removeCategoryAt​(int index)` Removes the category at the given index from the model and fires an event such that `SourceListModelListener`s will be notified.
`void` `removeItemFromCategory​(SourceListItem item, SourceListCategory category)` Removes the given item from the given category.
`void` `removeItemFromCategoryAtIndex​(SourceListCategory category, int index)` Removes the item at the given index from the given category.
`void` `removeItemFromItem​(SourceListItem parentItem, int index)` Removes the given child item at from the given parent item.
`void` `removeItemFromItem​(SourceListItem childItem, SourceListItem parentItem)` Removes the given child item at from the given parent item.
`void` `removeSourceListModelListener​(SourceListModelListener listener)` Removes the given `SourceListModelListener` from the list of listeners.
`void` `validateItemIsInModel​(SourceListItem item)` Checks if the given `SourceListItem` is in this model.

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

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

### Constructor Detail

#### SourceListModel

    public SourceListModel()

### Method Detail

#### getCategories

    public java.util.List<SourceListCategory> getCategories()

Gets the `SourceListCategory`s associated with this model.

Returns:
  the `SourceListCategory`s associated with this model.

#### addCategory

    public void addCategory​(SourceListCategory category)

Adds the given category to the model and fires an event such that `SourceListModelListener`s will be notified.

Parameters:
  `category` - the `SourceListCategory` to add.

#### addCategory

    public void addCategory​(SourceListCategory category,
                            int index)

Adds the given category to the model at the given index and fires an event such that `SourceListModelListener`s will be notified.

Parameters:
  `category` - the `SourceListCategory` to add.
  `index` - the index to add the category at.

#### removeCategory

    public void removeCategory​(SourceListCategory category)

Removes the given category from the model and fires an event such that `SourceListModelListener`s will be notified.

Parameters:
  `category` - the `SourceListCategory` to remove.
Throws:
  `java.lang.IllegalArgumentException` - if the given category is not part of this model.

#### removeCategoryAt

    public void removeCategoryAt​(int index)

Removes the category at the given index from the model and fires an event such that `SourceListModelListener`s will be notified.

Parameters:
  `index` - the index of the `SourceListCategory` to remove.
Throws:
  `java.lang.IllegalArgumentException` - if there is no category at the given index.

#### addItemToCategory

    public void addItemToCategory​(SourceListItem item,
                                  SourceListCategory category)

Adds the given item to the given `SourceListCategory`.

Parameters:
  `item` - the item to add.
  `category` - the category to add the item to.
Throws:
  `java.lang.IllegalStateException` - if the given category is not in the model.

#### addItemToCategory

    public void addItemToCategory​(SourceListItem item,
                                  SourceListCategory category,
                                  int index)

Adds the given item to the given `SourceListCategory` at the given index within that category.

Parameters:
  `item` - the item to add.
  `category` - the category to add the item to.
  `index` - the index in the category to add the item.
Throws:
  `java.lang.IllegalStateException` - if the given category is not in the model.

#### addItemToItem

    public void addItemToItem​(SourceListItem childItem,
                              SourceListItem parentItem)

Adds the given "child" item to the given "parent" item.

Parameters:
  `childItem` - the item to add to the given parent item.
  `parentItem` - the item to add the child item to.
Throws:
  `java.lang.IllegalStateException` - if the given parent item is not in the model.

#### addItemToItem

    public void addItemToItem​(SourceListItem childItem,
                              SourceListItem parentItem,
                              int index)

Adds the given "child" item to the given "parent" item at the given index. The parent `SourceListItem` will be expanded if it was not a parent but becomes a parent as a result of this call.

Parameters:
  `childItem` - the item to add to the given parent item.
  `parentItem` - the item to add the child item to.
  `index` - the index of the parent item at which to add the child item.
Throws:
  `java.lang.IllegalStateException` - if the given child or parent item is not in the model.

#### removeItemFromCategory

    public void removeItemFromCategory​(SourceListItem item,
                                       SourceListCategory category)

Removes the given item from the given category.

Parameters:
  `item` - the item to remove from the given category.
  `category` - the category form which to remove the given item.
Throws:
  `java.lang.IllegalStateException` - if the given category is not in the model.

#### removeItemFromCategoryAtIndex

    public void removeItemFromCategoryAtIndex​(SourceListCategory category,
                                              int index)

Removes the item at the given index from the given category.

Parameters:
  `category` - the category from which to remove the item.
  `index` - the index of the item to remove.
Throws:
  `java.lang.IllegalStateException` - if the given category is not in the model.

#### removeItemFromItem

    public void removeItemFromItem​(SourceListItem childItem,
                                   SourceListItem parentItem)

Removes the given child item at from the given parent item.

Parameters:
  `childItem` - the item to remove.
  `parentItem` - the item from which to remove the given child item.
Throws:
  `java.lang.IllegalStateException` - if the given child or parent item is not in the model.

#### removeItemFromItem

    public void removeItemFromItem​(SourceListItem parentItem,
                                   int index)

Removes the given child item at from the given parent item.

Parameters:
  `parentItem` - the item from which to remove the given child item.
  `index` - the index of the item to remove.
Throws:
  `java.lang.IllegalStateException` - if the given child or parent item is not in the model.

#### validateItemIsInModel

    public void validateItemIsInModel​(SourceListItem item)

Checks if the given `SourceListItem` is in this model.

Parameters:
  `item` - the item to check if is in this model.
Throws:
  `java.lang.IllegalArgumentException` - if the given item is not part of this model.

#### addSourceListModelListener

    public void addSourceListModelListener​(SourceListModelListener listener)

Adds the given `SourceListModelListener` to the list of listeners.

Parameters:
  `listener` - the listener to add.

#### removeSourceListModelListener

    public void removeSourceListModelListener​(SourceListModelListener listener)

Removes the given `SourceListModelListener` from the list of listeners.

Parameters:
  `listener` - the listener to remove.