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 Details

    • add

      default void add(ITEM_CONTENT item)
      Adds a new item to the end of the list. Duplicates are not allowed.
      Parameters:
      item - The item to insert.
    • add

      void add(int index, ITEM_CONTENT item)
      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

      ITEM_CONTENT remove(int index)
      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

      boolean remove(ITEM_CONTENT item)
      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

      ITEM_CONTENT get(int index)
      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 interface IContentProvider<ITEM extends IContentItem,ITEM_CONTENT extends IContentData<ITEM>>
      Returns:
      The array of items.
    • indexOf

      int indexOf(ITEM_CONTENT item)
      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

      String setSelection(int index)
      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

      String setSelection(int[] indicies)
      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

      void onSelectionChanged(ITEM_CONTENT item, boolean isSelected)
      Called from the items when they are selected or unselected from their setSelection(boolean) method.

      The method is NOT intended to be called.

      Parameters:
      item - The item who's selection changed.
      isSelected - The new selection state.