Package com.explodingpixels.macwidgets
Class SourceListModel
java.lang.Object
com.explodingpixels.macwidgets.SourceListModel
The backing model to be used with a
SourceList
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCategory
(SourceListCategory category) Adds the given category to the model and fires an event such thatSourceListModelListener
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 thatSourceListModelListener
s will be notified.void
addItemToCategory
(SourceListItem item, SourceListCategory category) Adds the given item to the givenSourceListCategory
.void
addItemToCategory
(SourceListItem item, SourceListCategory category, int index) Adds the given item to the givenSourceListCategory
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
Adds the givenSourceListModelListener
to the list of listeners.Gets theSourceListCategory
s associated with this model.void
removeCategory
(SourceListCategory category) Removes the given category from the model and fires an event such thatSourceListModelListener
s will be notified.void
removeCategoryAt
(int index) Removes the category at the given index from the model and fires an event such thatSourceListModelListener
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
Removes the givenSourceListModelListener
from the list of listeners.void
Checks if the givenSourceListItem
is in this model.
-
Constructor Details
-
SourceListModel
public SourceListModel()
-
-
Method Details
-
getCategories
Gets theSourceListCategory
s associated with this model.- Returns:
- the
SourceListCategory
s associated with this model.
-
addCategory
Adds the given category to the model and fires an event such thatSourceListModelListener
s will be notified.- Parameters:
category
- theSourceListCategory
to add.
-
addCategory
Adds the given category to the model at the given index and fires an event such thatSourceListModelListener
s will be notified.- Parameters:
category
- theSourceListCategory
to add.index
- the index to add the category at.
-
removeCategory
Removes the given category from the model and fires an event such thatSourceListModelListener
s will be notified.- Parameters:
category
- theSourceListCategory
to remove.- Throws:
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 thatSourceListModelListener
s will be notified.- Parameters:
index
- the index of theSourceListCategory
to remove.- Throws:
IllegalArgumentException
- if there is no category at the given index.
-
addItemToCategory
Adds the given item to the givenSourceListCategory
.- Parameters:
item
- the item to add.category
- the category to add the item to.- Throws:
IllegalStateException
- if the given category is not in the model.
-
addItemToCategory
Adds the given item to the givenSourceListCategory
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:
IllegalStateException
- if the given category is not in the model.
-
addItemToItem
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:
IllegalStateException
- if the given parent item is not in the model.
-
addItemToItem
Adds the given "child" item to the given "parent" item at the given index. The parentSourceListItem
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:
IllegalStateException
- if the given child or parent item is not in the model.
-
removeItemFromCategory
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:
IllegalStateException
- if the given category is not in the model.
-
removeItemFromCategoryAtIndex
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:
IllegalStateException
- if the given category is not in the model.
-
removeItemFromItem
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:
IllegalStateException
- if the given child or parent item is not in the model.
-
removeItemFromItem
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:
IllegalStateException
- if the given child or parent item is not in the model.
-
validateItemIsInModel
Checks if the givenSourceListItem
is in this model.- Parameters:
item
- the item to check if is in this model.- Throws:
IllegalArgumentException
- if the given item is not part of this model.
-
addSourceListModelListener
Adds the givenSourceListModelListener
to the list of listeners.- Parameters:
listener
- the listener to add.
-
removeSourceListModelListener
Removes the givenSourceListModelListener
from the list of listeners.- Parameters:
listener
- the listener to remove.
-