Class AbstractContentProvider<ITEM extends IContentItem,ITEM_CONTENT extends IContentData<ITEM>> 
- All Implemented Interfaces:
- IContentProvider<ITEM,,- ITEM_CONTENT> - IContentProviderAPI<ITEM,- ITEM_CONTENT> 
- Direct Known Subclasses:
- MapMarkerContentProvider,- MLContentProvider
- Author:
- Christopher Mindus
- Field SummaryFieldsModifier and TypeFieldDescription- protected AbstractContentUIContainer<ITEM,- ITEM_CONTENT> The container.
- Constructor SummaryConstructorsConstructorDescription- AbstractContentProvider- (int selectionType, Class<ITEM_CONTENT> itemContentClass) Constructor.
- Method SummaryModifier and TypeMethodDescription- void- add- (int index, ITEM_CONTENT item) Inserts a new item before the specified index.- voidBegins a mass change operation of the content by means of the API.- booleanReturns if API is enabled for this content provider or not.Clear the selection.- voidCommits a mass change operation of the content by means of the API.- protected abstract ITEM_CONTENT- createContentItem- (VSRow row) Creates a new content item for a VS row.- void- dispose()Called when the content provider is no longer required by the container.- get- (int index) Gets an item at the specified index.- getAll()Gets the content items.- int[]Gets the connected table columns indicies.- intGets the first selected index.- intGets the item count.Returns the items container.- int[]Gets the selected indicies.- getTable()Gets the VSTable connected.- int- indexOf- (ITEM_CONTENT item) Returns the index of an item.- voidCalled to initialize the content provider for the container instance.- protected booleanReturns if the enabled state is synchronized with the table.- protected booleanReturns if the read-only state is synchronized with the table.- protected booleanReturns if the visible state is synchronized with the table.- booleanCalled when a VSRow is added in the connected table.- booleanCalled when a VSRow is removed in the connected table.- void- onSelectionChanged- (ITEM_CONTENT item, boolean isSelected) Called from the items when they are selected or unselected from their- setSelection(boolean)method.- void- onSelectionTypeChanged- (int selectionType) Called when the content provider changes selection type.- protected voidRefreshes the contents with the container.- protected void- refreshContentItemFromVS- (ITEM_CONTENT itemData, int[] columns) Refresh the content item after a potential change in the VirtualSpace with an existing item.- voidThis method is called when the content provider needs re-initialization due to e.g.- remove- (int index) Removes an item at the specified index.- boolean- remove- (ITEM_CONTENT item) Removes an item.- booleanRemoves 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.- voidUpdates all the items to match the current contents.- protected void- updateContentsFromVS- (int[] columns) Called to update the items from the VirtualSpace only if such a connection exists.- protected boolean- useVSConnection- (int[] columnIndicies) Called during initialization to determine if content items will need to use the VS row connection or not.- Methods inherited from class java.lang.Object- clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait- Methods inherited from interface com.iizix.prop.content.IContentProviderAPI- add
- Field Details- cnrprotected AbstractContentUIContainer<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> cnrThe container.
 
- Constructor Details- AbstractContentProviderConstructor.- Parameters:
- selectionType- The selection type: 0=none, 1=single, 2=multiple.
- itemContentClass- The class for item content.
 
 
- Method Details- onSelectionTypeChangedpublic void onSelectionTypeChanged- (int selectionType) Called when the content provider changes selection type.- Specified by:
- onSelectionTypeChangedin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- selectionType- The selection type: 0=none, 1=single, 2=multiple.
 
- initializeCalled to initialize the content provider for the container instance.- The default content provides saves the - cnrreference and calls- reinitialize()- Specified by:
- initializein interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- cnr- The container.
 
- getItemsContainerReturns the items container.- Specified by:
- getItemsContainerin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Returns:
- The container that stores the item properties. This method will return null if not yet initialized.
 
- reinitializepublic void reinitialize()This method is called when the content provider needs re-initialization due to e.g. a change of its properties, e.g. the VSTable or one of the columns.- The default content retrieves the VS table and columns and saves them for future reference. - Specified by:
- reinitializein interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
 
- disposepublic void dispose()Called when the content provider is no longer required by the container.- Specified by:
- disposein interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
 
- canModifyWithAPIpublic boolean canModifyWithAPI()Returns if API is enabled for this content provider or not. If the content provider is connected to VirtualSpace, this method will return false.- Specified by:
- canModifyWithAPIin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Returns:
- true if the API methods for modification can be used, false otherwise.
 
- getTableGets the VSTable connected.- Returns:
- The table, or null for none.
 
- getColumnspublic int[] getColumns()Gets the connected table columns indicies.- Returns:
- The array of connected table column indicies, null if not VS-connected. A column index in the array may be -1 if it is not referenced or used.
 
- beginChangespublic void beginChanges()Begins a mass change operation of the content by means of the API. Call this method to avoid updates being fired to the client before all changes are committed.- A call to this method must be followed by a call to - commitChanges()- Specified by:
- beginChangesin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
 
- commitChangespublic void commitChanges()Commits a mass change operation of the content by means of the API. This method will fire the updates to the client.- Each call to - beginChanges()- Specified by:
- commitChangesin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
 
- refreshContentprotected void refreshContent()Refreshes the contents with the container. If one or more mass change operations are taking place, this method flags changes to be performed when all mass change operations are committed.
- addInserts a new item before the specified index. Duplicates are not allowed.- Specified by:
- addin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- index- The insertion point index, -1 for last.
- item- The item to insert.
- Throws:
- IllegalArgumentException- If the index is not valid.
 
- removeRemoves an item at the specified index.- Specified by:
- removein interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- index- The item to remove.
- Returns:
- The removed item.
- Throws:
- IllegalArgumentException- If the index is not valid.
 
- removeRemoves an item.- Specified by:
- removein interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- item- The item to remove.
- Returns:
- true for success, false if not found.
 
- removeAllpublic boolean removeAll()Removes all items.- Specified by:
- removeAllin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Returns:
- true for changed, false when no items were present.
 
- getGets an item at the specified index.- Specified by:
- getin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- index- The index of the item.
- Returns:
- The item.
- Throws:
- IllegalArgumentException- If the index is not valid.
 
- indexOfReturns the index of an item.- Specified by:
- indexOfin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- item- The item to look-up.
- Returns:
- The index of the item, or -1 if not found.
 
- getFirstSelectedIndexpublic int getFirstSelectedIndex()Gets the first selected index.- Specified by:
- getFirstSelectedIndexin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Returns:
- The first index in the current selection, or -1 for none.
 
- getSelectedIndiciespublic int[] getSelectedIndicies()Gets the selected indicies.- Specified by:
- getSelectedIndiciesin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- 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.
 
- setSelectionSets the selection as a single selected item at specified index.- Specified by:
- setSelectionin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- 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.
 
- setSelectionSets the selection to the specified indicies.- Specified by:
- setSelectionin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- indicies- The indicies.
- Returns:
- null for success, otherwise the error message with the reason why it failed.
 
- clearSelectionClear the selection.- Specified by:
- clearSelectionin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Returns:
- null for success, otherwise the error message with the reason why it failed.
 
- onSelectionChangedCalled from the items when they are selected or unselected from their- setSelection(boolean)method.- The method is NOT intended to be called. - Specified by:
- onSelectionChangedin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- item- The item who's selection changed.
- isSelected- The new selection state.
 
- getItemCountpublic int getItemCount()Gets the item count.- Specified by:
- getItemCountin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Returns:
- The count of items that will be provided.
 
- getAllGets the content items.- Specified by:
- getAllin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Specified by:
- getAllin interface- IContentProviderAPI<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Returns:
- The array of content items.
 
- updateContentspublic void updateContents()Updates all the items to match the current contents.- This method is not intended to be called, it is used by the framework -- DO NOT CALL THE METHOD! - Override this method to perform specialized processing. - Note: this method is always called from the content updater thread, i.e. the client worker thread. - Specified by:
- updateContentsin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
 
- updateContentsFromVSprotected void updateContentsFromVS- (int[] columns) Called to update the items from the VirtualSpace only if such a connection exists.- Parameters:
- columns- The connected table columns.
 
- onAddedCalled when a VSRow is added in the connected table.- Specified by:
- onAddedin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- row- The row added.
- index- The row index added (-1 or table size for last).
- Returns:
- true for success, false to cause a refresh of the containers content.
 
- onRemovedCalled when a VSRow is removed in the connected table.- Specified by:
- onRemovedin interface- IContentProvider<ITEM extends IContentItem,- ITEM_CONTENT extends IContentData<ITEM>> 
- Parameters:
- row- The row removed.
- index- The row index removed.
- Returns:
- true for success, false to cause a refresh of the containers content.
 
- useVSConnectionprotected boolean useVSConnection- (int[] columnIndicies) Called during initialization to determine if content items will need to use the VS row connection or not. By default, VS connection is used only when at least one column is connected to a row.- A custom content provider can override this method to return - true.- The default implementation is to return true if at least one column index is larger than -1. - Parameters:
- columnIndicies- The column indicies, null for none.
- Returns:
- true to use a VS connection, false not to use a VS connection.
 
- createContentItemCreates a new content item for a VS row.- Parameters:
- row- The row.
- Returns:
- The new content item associated with the row.
 
- refreshContentItemFromVSRefresh the content item after a potential change in the VirtualSpace with an existing item.- A custom content provider can override this method to provide an alternate refresh method for it's items. - By default, the item's method - refreshFromVS(int [] columns)is called.- Parameters:
- itemData- The item previously created.
- columns- The connected table columns indicies, -1 for none.
 
- isVisibleStateSynchronizedprotected boolean isVisibleStateSynchronized()Returns if the visible state is synchronized with the table.- Returns:
- true by default, override for other functionality.
 
- isEnabledStateSynchronizedprotected boolean isEnabledStateSynchronized()Returns if the enabled state is synchronized with the table.- Returns:
- true by default, override for other functionality.
 
- isReadOnlyStateSynchronizedprotected boolean isReadOnlyStateSynchronized()Returns if the read-only state is synchronized with the table.- Returns:
- true by default, override for other functionality.