public class

DefaultItemStateManager

extends Object
implements ItemStateManager
java.lang.Object
   ↳ com.shinobicontrols.grids.supplement.DefaultItemStateManager

Class Overview

Convenience class to update the positions of hidden and selected items on the header and data GridRecyclerViews following the addition, removal or reordering of rows and columns.

This class implements the ItemStateManager interface and an instance is added to the ShinobiGridView by default. As column operations will invoke the ItemStateManager held by the ShinobiGridView automatically, out-of-the-box item state will be maintained when columns are added, removed and reordered. For row operations the DefaultItemStateManager must be invoked manually before and after the action is performed on the ShinobiGridView. The RowReorderDetector.OnRowReorderListener is useful for notifying you of the start and end of a row reorder event. However, if you are making use of the RowColumnReorderManager convenience class provided by the library, item state will be automatically maintained for row reordering events.

Summary

Public Constructors
DefaultItemStateManager()

Constructs a new DefaultItemStateManager.

Public Methods
void clearItemState()

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

void saveItemState(ShinobiGridView shinobiGridView)

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

void updateItemStateFollowingAddColumn(ShinobiGridView shinobiGridView)

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

void updateItemStateFollowingAddRow(int rowIndex, GridRecyclerView gridRecyclerView)

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

void updateItemStateFollowingRemoveColumn(int columnIndex, ShinobiGridView shinobiGridView)

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

void updateItemStateFollowingRemoveRow(int rowIndex, GridRecyclerView gridRecyclerView)

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

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.

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.

[Expand]
Inherited Methods
From class java.lang.Object
From interface com.shinobicontrols.grids.core.ItemStateManager

Public Constructors

public DefaultItemStateManager ()

Constructs a new DefaultItemStateManager.

Public Methods

public void clearItemState ()

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

public 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 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 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 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 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 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 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