com.google.gwt.user.cellview.client

## Class Column<T,C>

- java.lang.Object
- - com.google.gwt.user.cellview.client.Column<T,C>

- Type Parameters:
    `T` - the row type
    `C` - the column type
  All Implemented Interfaces:
    HasCell<T,C>, HasAlignment, HasHorizontalAlignment, HasVerticalAlignment
  Direct Known Subclasses:
    IdentityColumn, TextColumn

      public abstract class Column<T,C>
      extends java.lang.Object
      implements HasCell<T,C>, HasAlignment

  A representation of a column in a table.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment

      `HasHorizontalAlignment.AutoHorizontalAlignmentConstant, HasHorizontalAlignment.HorizontalAlignmentConstant`

    - ### Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment

      `HasVerticalAlignment.VerticalAlignmentConstant`

  - ### Field Summary

    - ### Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment

      `ALIGN_CENTER, ALIGN_DEFAULT, ALIGN_JUSTIFY, ALIGN_LEFT, ALIGN_LOCALE_END, ALIGN_LOCALE_START, ALIGN_RIGHT`

    - ### Fields inherited from interface com.google.gwt.user.client.ui.HasVerticalAlignment

      `ALIGN_BOTTOM, ALIGN_MIDDLE, ALIGN_TOP`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Column(Cell<C> cell)` Construct a new Column with a given `Cell`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Cell<C>` | `getCell()` Returns the `Cell` responsible for rendering items in the column.
    `java.lang.String` | `getCellStyleNames(Cell.Context context, T object)` Get extra style names that should be applied to a cell in this column.
    `java.lang.String` | `getDataStoreName()`
    `FieldUpdater<T,C>` | `getFieldUpdater()` Returns the `FieldUpdater` used for updating values in the column.
    `HasHorizontalAlignment.HorizontalAlignmentConstant` | `getHorizontalAlignment()` Gets the horizontal alignment.
    `abstract C` | `getValue(T object)` Returns the column value from within the underlying data object.
    `HasVerticalAlignment.VerticalAlignmentConstant` | `getVerticalAlignment()` Gets the vertical alignment.
    `boolean` | `isDefaultSortAscending()` Check if the default sort order of the column is ascending or descending.
    `boolean` | `isSortable()` Check if the column is sortable.
    `void` | `onBrowserEvent(Cell.Context context, Element elem, T object, NativeEvent event)` Handle a browser event that took place within the column.
    `void` | `render(Cell.Context context, T object, SafeHtmlBuilder sb)` Render the object into the cell.
    `void` | `setCellStyleNames(java.lang.String styleNames)` Set extra style names that should be applied to every cell.
    `void` | `setDataStoreName(java.lang.String name)` Sets a string that identifies this column in a data query.
    `void` | `setDefaultSortAscending(boolean isAscending)` Set whether or not the default sort order is ascending.
    `void` | `setFieldUpdater(FieldUpdater<T,C> fieldUpdater)` Set the `FieldUpdater` used for updating values in the column.
    `void` | `setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)` Sets the horizontal alignment.
    `void` | `setSortable(boolean sortable)` Set whether or not the column can be sorted.
    `void` | `setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)` Sets the vertical alignment.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Column

          public Column(Cell<C> cell)

      Construct a new Column with a given `Cell`.
      Parameters:
        `cell` - the Cell used by this Column

  - ### Method Detail

    - #### getCell

          public Cell<C> getCell()

      Returns the `Cell` responsible for rendering items in the column.
      Specified by:
        `getCell` in interface `HasCell<T,C>`
      Returns:
        a Cell

    - #### getCellStyleNames

          public java.lang.String getCellStyleNames(Cell.Context context,
                                           T object)

      Get extra style names that should be applied to a cell in this column.
      Parameters:
        `context` - the cell context
        `object` - the base object to be updated, or null if the row is empty
      Returns:
        the extra styles of the given row in a space-separated list, or `null` if there are no extra styles for the cells in this column

    - #### getDataStoreName

          public java.lang.String getDataStoreName()

      Returns:
        the database name of the column, or null if it's never been set

    - #### getFieldUpdater

          public FieldUpdater<T,C> getFieldUpdater()

      Returns the `FieldUpdater` used for updating values in the column.
      Specified by:
        `getFieldUpdater` in interface `HasCell<T,C>`
      Returns:
        an instance of FieldUpdater
      See Also:
        `setFieldUpdater(FieldUpdater)`

    - #### getHorizontalAlignment

          public HasHorizontalAlignment.HorizontalAlignmentConstant getHorizontalAlignment()

      Description copied from interface: `HasHorizontalAlignment`
      Gets the horizontal alignment.
      Specified by:
        `getHorizontalAlignment` in interface `HasHorizontalAlignment`
      Returns:
        the current horizontal alignment ( `HasHorizontalAlignment.ALIGN_LEFT`, `HasHorizontalAlignment.ALIGN_CENTER`, `HasHorizontalAlignment.ALIGN_RIGHT`, `HasHorizontalAlignment.ALIGN_JUSTIFY`, or null).

    - #### getValue

          public abstract C getValue(T object)

      Returns the column value from within the underlying data object.
      Specified by:
        `getValue` in interface `HasCell<T,C>`
      Parameters:
        `object` - a record of type T
      Returns:
        a value of type C suitable for passing to the cell

    - #### getVerticalAlignment

          public HasVerticalAlignment.VerticalAlignmentConstant getVerticalAlignment()

      Description copied from interface: `HasVerticalAlignment`
      Gets the vertical alignment.
      Specified by:
        `getVerticalAlignment` in interface `HasVerticalAlignment`
      Returns:
        the current vertical alignment.

    - #### isDefaultSortAscending

          public boolean isDefaultSortAscending()

      Check if the default sort order of the column is ascending or descending.
      Returns:
        true if default sort is ascending, false if not

    - #### isSortable

          public boolean isSortable()

      Check if the column is sortable.
      Returns:
        true if sortable, false if not

    - #### onBrowserEvent

          public void onBrowserEvent(Cell.Context context,
                            Element elem,
                            T object,
                            NativeEvent event)

      Handle a browser event that took place within the column.
      Parameters:
        `context` - the cell context
        `elem` - the parent Element
        `object` - the base object to be updated
        `event` - the native browser event

    - #### render

          public void render(Cell.Context context,
                    T object,
                    SafeHtmlBuilder sb)

      Render the object into the cell.
      Parameters:
        `context` - the cell context
        `object` - the object to render
        `sb` - the buffer to render into

    - #### setCellStyleNames

          public void setCellStyleNames(java.lang.String styleNames)

      Set extra style names that should be applied to every cell.

      If you want to apply style names based on the row or cell value, override `#getCellStyleNames(Context, Object)` directly.

      Parameters:
        `styleNames` - the extra style names to apply in a space-separated list, or `null` if there are no extra styles for this cell

    - #### setDataStoreName

          public void setDataStoreName(java.lang.String name)

      Sets a string that identifies this column in a data query.
      Parameters:
        `name` - name of the column from the data store's perspective

    - #### setDefaultSortAscending

          public void setDefaultSortAscending(boolean isAscending)

      Set whether or not the default sort order is ascending.
      Parameters:
        `isAscending` - true to set the default order to ascending, false for descending

    - #### setFieldUpdater

          public void setFieldUpdater(FieldUpdater<T,C> fieldUpdater)

      Set the `FieldUpdater` used for updating values in the column.
      Parameters:
        `fieldUpdater` - the field updater
      See Also:
        `getFieldUpdater()`

    - #### setHorizontalAlignment

          public void setHorizontalAlignment(HasHorizontalAlignment.HorizontalAlignmentConstant align)

      Sets the horizontal alignment.

      Use `null` to clear horizontal alignment, allowing it to be determined by the standard HTML mechanisms such as inheritance and CSS rules.

      The new horizontal alignment will apply the next time the table is rendered.

      Specified by:
        `setHorizontalAlignment` in interface `HasHorizontalAlignment`
      Parameters:
        `align` - the horizontal alignment ( `HasHorizontalAlignment.ALIGN_LEFT`, `HasHorizontalAlignment.ALIGN_CENTER`, `HasHorizontalAlignment.ALIGN_RIGHT`, `HasHorizontalAlignment.ALIGN_JUSTIFY`, `HasHorizontalAlignment.ALIGN_LOCALE_START`, or `HasHorizontalAlignment.ALIGN_LOCALE_END`).

    - #### setSortable

          public void setSortable(boolean sortable)

      Set whether or not the column can be sorted. The change will take effect the next time the table is redrawn.
      Parameters:
        `sortable` - true to make sortable, false to make unsortable

    - #### setVerticalAlignment

          public void setVerticalAlignment(HasVerticalAlignment.VerticalAlignmentConstant align)

      Sets the vertical alignment.

      The new vertical alignment will apply the next time the table is rendered.

      Specified by:
        `setVerticalAlignment` in interface `HasVerticalAlignment`
      Parameters:
        `align` - the vertical alignment ( `HasVerticalAlignment.ALIGN_TOP`, `HasVerticalAlignment.ALIGN_MIDDLE`, or `HasVerticalAlignment.ALIGN_BOTTOM`).