Interface IContentProviderAPI<ITEM extends IContentItem,​ITEM_CONTENT extends IContentData<ITEM>>

    • Method Detail

      • 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:
        java.lang.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:
        java.lang.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:
        java.lang.IndexOutOfBoundsException - If the index is not valid.
      • 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

        java.lang.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

        java.lang.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

        java.lang.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.