public interface

ItemStateManager

com.shinobicontrols.grids.core.ItemStateManager
Known Indirect Subclasses

Class Overview

This interface defines methods which will be invoked at various points during add, remove and reorder events of rows and columns within the grid.

Typically implementations of this interface will perform actions to update the positions of hidden and selected items following add, remove and reorder events of rows and columns within the grid.

Methods relating to column actions are given a ShinobiGridView as these actions affect both the header and data GridRecyclerView. Methods relating to row actions, however, only affect the header or the data GridRecyclerView but not both. As such these methods are given the GridRecyclerView they relate to. As you cannot directly add or remove rows to the header GridRecyclerView in the vast majority of cases the data GridRecyclerView will be passed in to these methods.

The general pattern of usage is to call the saveItemState(ShinobiGridView) method prior to performing an action on the ShinobiGridView in order to save the current state of its items. Then, after performing the desired action such as reordering a row, the appropriate update method is called to modify the state of the items to reflect the action that has just been performed.

As the ShinobiGridView maintains the collection of Column objects itself, the ItemStateManager held by the ShinobiGridView can be automatically invoked when column operations are performed. For row operations item state cannot be maintained automatically as it is the user who defines what adding and removing a row means. Therefore, it is simply a case of manually calling the relevant methods on the ItemStateManager before and after performing an action on the ShinobiGridView.

Summary

Public Methods
abstract void clearItemState()

Clears any state previously saved with the saveItemState(ShinobiGridView) method.

abstract void saveItemState(ShinobiGridView shinobiGridView)

The method to be invoked when item state is to be captured for later use.

abstract void updateItemStateFollowingAddColumn(ShinobiGridView shinobiGridView)

The method to be invoked when a column has been added to the grid.

abstract void updateItemStateFollowingAddRow(int rowIndex, GridRecyclerView gridRecyclerView)

The method to be invoked when a row has been added to the grid.

abstract void updateItemStateFollowingRemoveColumn(int columnIndex, ShinobiGridView shinobiGridView)

The method to be invoked when a column has been removed from the grid.

abstract void updateItemStateFollowingRemoveRow(int rowIndex, GridRecyclerView gridRecyclerView)

The method to be invoked when a row has been removed from the grid.

abstract void updateItemStateFollowingReorderColumn(int columnIndex, int endColumnIndex, ShinobiGridView shinobiGridView)

The method to be invoked when a reorder event that is performed on a column in the grid has ended.

abstract void updateItemStateFollowingReorderRow(int rowIndex, int endRowIndex, GridRecyclerView gridRecyclerView)

The method to be invoked when a reorder event that is performed on a row in the grid has ended.

Public Methods

public abstract void clearItemState ()

Clears any state previously saved with the saveItemState(ShinobiGridView) method.

public abstract void saveItemState (ShinobiGridView shinobiGridView)

The method to be invoked when item state is to be captured for later use.

Specifically this method is likely to be useful prior to an event such as a column removal, which will necessitate the updating of selected and hidden item positions.

Parameters
shinobiGridView the ShinobiGridView whose state is to be saved

public abstract void updateItemStateFollowingAddColumn (ShinobiGridView shinobiGridView)

The method to be invoked when a column has been added to the grid.

Parameters
shinobiGridView the ShinobiGridView whose column has been added

public abstract void updateItemStateFollowingAddRow (int rowIndex, GridRecyclerView gridRecyclerView)

The method to be invoked when a row has been added to the grid.

Parameters
rowIndex the index of the row that has been added
gridRecyclerView the GridRecyclerView whose row has been added

public abstract void updateItemStateFollowingRemoveColumn (int columnIndex, ShinobiGridView shinobiGridView)

The method to be invoked when a column has been removed from the grid.

Parameters
columnIndex the index of the column that has been removed
shinobiGridView the ShinobiGridView whose column has been removed

public abstract void updateItemStateFollowingRemoveRow (int rowIndex, GridRecyclerView gridRecyclerView)

The method to be invoked when a row has been removed from the grid.

Parameters
rowIndex the index of the row that has been removed
gridRecyclerView the GridRecyclerView from which the row have been removed

public abstract void updateItemStateFollowingReorderColumn (int columnIndex, int endColumnIndex, ShinobiGridView shinobiGridView)

The method to be invoked when a reorder event that is performed on a column in the grid has ended.

Parameters
columnIndex the index of the column that is being reordered
endColumnIndex the index that the column being reordered has moved to at the end of the reorder event
shinobiGridView the ShinobiGridView on which the reordering event was initiated

public abstract void updateItemStateFollowingReorderRow (int rowIndex, int endRowIndex, GridRecyclerView gridRecyclerView)

The method to be invoked when a reorder event that is performed on a row in the grid has ended.

Parameters
rowIndex the index of the row that is being reordered
endRowIndex the index that the row being reordered has moved to at the end of the reorder event
gridRecyclerView the GridRecyclerView on which the reordering event was initiated