public final class

Column

extends Object
java.lang.Object
   ↳ com.shinobicontrols.grids.core.Column

Class Overview

Represents a column in a ShinobiGridView. Columns are added to a grid in order to display data.

A new Column can be created with the create(ColumnSpec) method. A ColumnSpec, which defines certain properties and behaviors of the Column, must be passed into this method. You can create your own ColumnSpec implementations or you can use the ones provided by the library, such as the TextColumnSpec.

ColumnSpecs should not be shared across different Columns.

Summary

Nested Classes
interface Column.Callback

Implementations of this callback interface provide controlled access to the Column through a number of useful methods. 

Public Methods
static Column create(ColumnSpec columnSpec)

Creates a new Column based on the supplied .ColumnSpec.

final ColumnSpec getColumnSpec()

Returns the ColumnSpec for this Column.

final int getHeaderItemViewType()

Returns the item view type for the header of this Column, as defined by this Column's ColumnSpec or, if the header item has had its visibility set to false, a view type of sg_hidden_item_view.

final int getIndex()

Returns the index in the list of columns in the ShinobiGridView for this Column.

final int getItemViewType(int rowIndex)

Returns the view type for the item at the given rowIndex, as defined by this Column's ColumnSpec or, if the item has had its visibility set to false, a view type of sg_hidden_item_view.

final boolean hasHeader()

Returns whether this Column has a header or not, as defined by this Column's ColumnSpec.

final void onBindHeaderViewHolder(RecyclerView.ViewHolder holder)

Updates the contents of the item view for the header of this Column, as defined by this Column's ColumnSpec.

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

Updates the contents of the item view to reflect the given rowIndex, as defined by this Column's ColumnSpec.

[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static Column create (ColumnSpec columnSpec)

Creates a new Column based on the supplied .ColumnSpec.

Parameters
columnSpec the ColumnSpec that defines certain properties and behavior of the Column being created
Returns
  • a newly created Column based on the given ColumnSpec

public final ColumnSpec getColumnSpec ()

Returns the ColumnSpec for this Column.

Returns

public final int getHeaderItemViewType ()

Returns the item view type for the header of this Column, as defined by this Column's ColumnSpec or, if the header item has had its visibility set to false, a view type of sg_hidden_item_view. This identifies the view type which will be placed in the grid to represent blank or empty items. By default this is a transparent View but it is possible to register a different View to be used for hidden items (see registerItemViewHolderCreator(ItemViewHolderCreator) and setItemVisible(int, boolean)).

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

public final int getIndex ()

Returns the index in the list of columns in the ShinobiGridView for this Column. If this Column has not been added to a grid then a value of -1 will be returned.

Returns
  • the index of this Column in the ShinobiGridView

public final int getItemViewType (int rowIndex)

Returns the view type for the item at the given rowIndex, as defined by this Column's ColumnSpec or, if the item has had its visibility set to false, a view type of sg_hidden_item_view. This identifies the view type which will be placed in the grid to represent blank or empty items. By default this is a transparent View but it is possible to register a different View to be used for hidden items (see registerItemViewHolderCreator(ItemViewHolderCreator) and setItemVisible(int, boolean)).

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 view type for the item at the given rowIndex

public final boolean hasHeader ()

Returns whether this Column has a header or not, as defined by this Column's ColumnSpec.

Returns
  • whether this Column has a header or not

public final void onBindHeaderViewHolder (RecyclerView.ViewHolder holder)

Updates the contents of the item view for the header of this Column, as defined by this Column's ColumnSpec. The provided ViewHolder cab be cast to the more specific ViewHolder subclass that is being used for this Column's header, allowing its contents to be updated.

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

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

Updates the contents of the item view to reflect the given rowIndex, as defined by this Column's ColumnSpec. 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 rowIndex
rowIndex the zero-based index of the row in the grid that the item being bound to the given holder is on