Package com.iizix.prop.content
Interface IContentProviderAPI<ITEM extends IContentItem,ITEM_CONTENT extends IContentData<ITEM>>
- All Superinterfaces:
IContentProvider<ITEM,
ITEM_CONTENT>
- All Known Subinterfaces:
IMListContentProviderAPI
- All Known Implementing Classes:
AbstractContentProvider
,MapMarkerContentProvider
,MLContentProvider
public interface IContentProviderAPI<ITEM extends IContentItem,ITEM_CONTENT extends IContentData<ITEM>> extends IContentProvider<ITEM,ITEM_CONTENT>
Extends the generic interface of content providing with an API to add/remove items by means of API. The method to change the items will throw exceptions if not enabled for API, e.g. when a connection to VirtualSpace is present.
- Author:
- Christopher Mindus
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(int index, ITEM_CONTENT item) Inserts a new item before the specified index.default void
add
(ITEM_CONTENT item) Adds a new item to the end of the list.Clear the selection.get
(int index) Gets an item at the specified index.getAll()
Gets all items.int
Gets the first selected index.int[]
Gets the selected indicies.int
indexOf
(ITEM_CONTENT item) Returns the index of an item.void
onSelectionChanged
(ITEM_CONTENT item, boolean isSelected) Called from the items when they are selected or unselected from theirsetSelection(boolean)
method.remove
(int index) Removes an item at the specified index.boolean
remove
(ITEM_CONTENT item) Removes an item.boolean
Removes all items.setSelection
(int index) Sets the selection as a single selected item at specified index.setSelection
(int[] indicies) Sets the selection to the specified indicies.Methods inherited from interface com.iizix.prop.content.IContentProvider
beginChanges, canModifyWithAPI, commitChanges, dispose, getItemCount, getItemsContainer, initialize, onAdded, onRemoved, onSelectionTypeChanged, reinitialize, updateContents
Method Details
add
Adds a new item to the end of the list. Duplicates are not allowed.- Parameters:
item
- The item to insert.
add
Inserts a new item before the specified index. Duplicates are not allowed.- Parameters:
index
- The insertion point index, -1 for last.item
- The item to insert.- Throws:
IndexOutOfBoundsException
- If the index is not valid.
remove
Removes an item at the specified index.- Parameters:
index
- The item to remove.- Returns:
- The removed item.
- Throws:
IndexOutOfBoundsException
- If the index is not valid.
remove
Removes an item.- Parameters:
item
- The item to remove.- Returns:
- true for success, false if not found.
removeAll
boolean removeAll()Removes all items.- Returns:
- true for changed, false when no items were present.
get
Gets an item at the specified index.- Parameters:
index
- The index of the item.- Returns:
- The item.
- Throws:
IndexOutOfBoundsException
- If the index is not valid.
getAll
ITEM_CONTENT[] getAll()Gets all items.- Specified by:
getAll
in interfaceIContentProvider<ITEM extends IContentItem,
ITEM_CONTENT extends IContentData<ITEM>> - Returns:
- The array of items.
indexOf
Returns the index of an item.- Parameters:
item
- The item to look-up.- Returns:
- The index of the item, or -1 if not found.
getFirstSelectedIndex
int getFirstSelectedIndex()Gets the first selected index.- Returns:
- The first index in the current selection, or -1 for none.
getSelectedIndicies
int[] getSelectedIndicies()Gets the selected indicies.- Returns:
- A new array of the selected indices (that may be modified to your liking), or a static zero in length array for no selection.
setSelection
Sets the selection as a single selected item at specified index.- Parameters:
index
- The single item to select at index, -1 to clear the selection.- Returns:
- null for success, otherwise an error message why the selection failed.
setSelection
Sets the selection to the specified indicies.- Parameters:
indicies
- The indicies.- Returns:
- null for success, otherwise the error message with the reason why it failed.
clearSelection
String clearSelection()Clear the selection.onSelectionChanged
Called from the items when they are selected or unselected from theirsetSelection(boolean)
method.The method is NOT intended to be called.
- Parameters:
item
- The item who's selection changed.isSelected
- The new selection state.