public interface

ColumnSpec

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

Class Overview

Defines certain properties and behavior of a Column. A number of ready-made ColumnSpecs are provided with the library, such as the TextColumnSpec. Custom ColumnSpecs can also be created and given to the create(ColumnSpec) method.

ColumnSpecs should not be shared across different Columns.

Summary

Public Methods
abstract int getHeaderItemViewType()

Returns the item view type for the header of the Column this ColumnSpec describes.

abstract int getItemViewType(int rowIndex)

Returns the item view type for the given rowIndex in the grid.

abstract boolean hasHeader()

Returns whether the Column this ColumnSpec describes has a header or not.

abstract void initialize(Column.Callback callback)

Called when the Column is created, this method gives this ColumnSpec an opportunity to hold a reference to a callback object that provides controlled access to the Column via a number of useful methods.

abstract void onBindHeaderViewHolder(RecyclerView.ViewHolder holder)

Updates the contents of the item view for the header of the Column this ColumnSpec describes.

abstract void onBindViewHolder(RecyclerView.ViewHolder holder, int rowIndex)

Updates the contents of the item view to reflect the given rowIndex.

abstract void onColumnAdded(Context context)

Notifies this ColumnSpec that the Column it belongs to has been added to a ShinobiGridView.

Public Methods

public abstract int getHeaderItemViewType ()

Returns the item view type for the header of the Column this ColumnSpec describes. If hasHeader() returns false this method will not be called.

Returns
  • the item view type for the header of the Column this ColumnSpec describes

public abstract int getItemViewType (int rowIndex)

Returns the item view type for the given rowIndex in the grid.

Parameters
rowIndex the zero-based index of the row in the grid that the item being bound to the given holder is on
Returns
  • the item view type for the item at the given rowIndex in the grid

public abstract boolean hasHeader ()

Returns whether the Column this ColumnSpec describes has a header or not. If at least one Column in a ShinobiGridView has a header then a header row will be displayed.

Returns
  • whether the Column this ColumnSpec describes has a header or not

public abstract void initialize (Column.Callback callback)

Called when the Column is created, this method gives this ColumnSpec an opportunity to hold a reference to a callback object that provides controlled access to the Column via a number of useful methods.

Parameters
callback the Callback into the Column which contains a number of useful methods

public abstract void onBindHeaderViewHolder (RecyclerView.ViewHolder holder)

Updates the contents of the item view for the header of the Column this ColumnSpec describes. The provided ViewHolder can be cast to the more specific ViewHolder subclass that is being used for the Column's header, allowing its contents to be updated. If hasHeader() returns false this method will not be called.

Parameters
holder the ViewHolder containing the item view for the Column's header

public abstract void onBindViewHolder (RecyclerView.ViewHolder holder, int rowIndex)

Updates the contents of the item view to reflect the given rowIndex. The provided android.support.v7.widget.RecyclerView.ViewHolder will be suitable for the given rowIndex and therefore can be cast to a more specific ViewHolder subclass to allow the updating of the item view inside the holder.

Parameters
holder the ViewHolder containing an item view that is suitable for the given position
rowIndex the zero-based index of the row in the grid that the item being bound to the given holder is on

public abstract void onColumnAdded (Context context)

Notifies this ColumnSpec that the Column it belongs to has been added to a ShinobiGridView. The current Context is passed in allowing the retrieval of attributes in the theme that has been applied to the grid.

Parameters
context the current context of the grid the Column has been added to providing access to attributes in the current theme