org.cruxframework.crux.widgets.client.grid
Class Grid

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by org.cruxframework.crux.widgets.client.grid.AbstractGrid<DataRow>
                  extended by org.cruxframework.crux.widgets.client.grid.Grid
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget, HasDataSource<PagedDataSource<?>>, HasBeforeCancelRowEditionHandler, HasBeforeRowEditHandlers, HasBeforeRowSelectHandlers, HasBeforeSaveRowEditionHandler, HasBeforeShowDetailsHandlers, HasCancelRowEditionHandler, HasLoadRowDetailsHandlers, HasRowClickHandlers, HasRowDoubleClickHandlers, HasRowEditHandlers, HasRowRenderHandlers, HasShowRowDetailsHandlers, Pageable

public class Grid
extends AbstractGrid<DataRow>
implements Pageable, HasDataSource<PagedDataSource<?>>, HasBeforeRowSelectHandlers

A Data grid component that allows pagination, edition, sort, frozen headers & columns and

Author:
Gesse S. F. Dafe

Nested Class Summary
protected static class Grid.ColumnHeader
           
static class Grid.SortingType
          Grid default sorting type
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class org.cruxframework.crux.widgets.client.grid.AbstractGrid
beforeCancelRowEditionHandlers, beforeSaveRowEditionHandlers
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType)
           
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType, boolean keepEditorOnClickDisabledRows)
           
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType, boolean keepEditorOnClickDisabledRows, boolean showEditorButtons)
           
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType, boolean keepEditorOnClickDisabledRows, boolean showEditorButtons, boolean freezeHeaders)
           
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType, boolean keepEditorOnClickDisabledRows, boolean showEditorButtons, String editButtonTooltip, String saveButtonTooltip, String cancelButtonTooltip)
           
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType, RowDetailWidgetCreator rowDetailsWidgetCreator, boolean showRowDetailsIcon, boolean freezeHeaders, boolean caseSensitive)
          Full constructor
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType, RowDetailWidgetCreator rowDetailsWidgetCreator, boolean showRowDetailsIcon, boolean freezeHeaders, boolean caseSensitive, boolean keepEditorOnClickDisabledRows)
           
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType, RowDetailWidgetCreator rowDetailsWidgetCreator, boolean showRowDetailsIcon, boolean freezeHeaders, boolean caseSensitive, boolean keepEditorOnClickDisabledRows, boolean showEditorButtons)
           
Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType, RowDetailWidgetCreator rowDetailsWidgetCreator, boolean showRowDetailsIcon, boolean freezeHeaders, boolean caseSensitive, boolean keepEditorOnClickDisabledRows, boolean showEditorButtons, String editButtonTooltip, String saveButtonTooltip, String cancelButtonTooltip)
           
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addBeforeRowSelectHandler(BeforeRowSelectHandler handler)
           
 void addColumnEditorValidator(String key, ColumnEditorValidator columnEditorValidator)
          Add a validator to a editable column
<T> void
addRow(T dataObject)
           
protected  Cell createColumnHeaderCell(ColumnDefinition columnDefinition)
          Creates a cell that will be used as the header for the given column
protected  DataRow createRow(int index, com.google.gwt.dom.client.Element element)
          Creates a row
protected  boolean fireBeforeCancelRowEditionEvent(DataRow row)
           
protected  void fireBeforeRowEditEvent(DataRow row)
          Fires a before row edit event
protected  boolean fireBeforeSaveRowEditionEvent(DataRow row)
          Fires a row saving event
protected  void fireCancelRowEditionEvent(DataRow row)
           
protected  void fireRowClickEvent(DataRow row)
          Fires a row click event
protected  void fireRowDoubleClickEvent(DataRow row)
          Fires a row double click event
protected  void fireRowEditEvent(DataRow row)
          Fires a row edit event
protected  void fireRowRenderEvent(DataRow row)
          Fires a row rendering event
 Object[] getCreatedDataObjects()
           
 List<DataRow> getCurrentPageRows()
          Gets all grid rows
 int getCurrentPageSize()
          Gets the current page row count
 PagedDataSource<?> getDataSource()
           
 Object[] getEditedDataObjects()
           
 int getPageCount()
          Return the total number of pages
 Object[] getRemovedDataObjects()
           
 DataRow getRow(com.google.gwt.user.client.ui.Widget w)
          Gets the row where the given widget is rendered
protected  int getRowsToBeRendered()
           
 Object[] getSelectedDataObjects()
          Gets all selected data objects contained by the grid.
 Object[] getSelectedDataRows()
          Deprecated. Use getSelectedDataObjects() instead
 List<DataRow> getSelectedRows()
          Gets the selected rows from the current visible page.
 void goToPage(int page)
          Moves the pageable's cursor to an arbitrary page
 boolean isDataLoaded()
          Checks if pageable data is already available
 boolean isEditable()
          Check if there is any editable column
 boolean isEditing()
           
 boolean isKeepEditorOnClickDisabledRows()
           
 boolean isLoaded()
           
 boolean isShowEditorButtons()
           
 void loadData()
           
 void makeEditable(DataRow row, Cell focusCell)
          Enables edit mode for given row
 void nextPage()
          Moves the pageable's cursor to the next page
protected  void onBeforeRender()
          Return true if the grid can be rendered
protected  void onBeforeRenderRows()
          Callback for before rendering the rows
protected  void onClear()
          Callback for grid clearing
protected  void onClearRendering()
          Callback for before clearing the rows contents
protected  boolean onSelectRow(boolean select, DataRow row, boolean fireEvents)
          Callback for row selection
protected  boolean onShowDetails(boolean show, Row row, boolean fireEvents)
          Executes the implementation-specific logic of showing the details of a row.
 void previousPage()
          Moves the pageable's cursor to the previous page
<T> void
removeRow(DataRow r)
           
 void removeSelectedRows()
           
<T> void
removeSelectedRows(boolean fromCurrentPageOnly)
           
protected  void renderRow(DataRow row)
          Renders the given row cells
protected  void renderRow(DataRow row, DataSourceRecord<?> record, boolean editMode, String focusCellKey)
           
 void rollbackRowEdition(DataRow row)
          Rollback the edition of the last column changed
 void setDataSource(PagedDataSource<?> dataSource)
          Sets the data source and re-renders the grid
 void setDataSource(PagedDataSource<?> dataSource, boolean autoLoadData)
           
 void setKeepEditorOnClickDisabledRows(boolean keepEditorOnClickDisabledRows)
           
 void setPager(Pager pager)
          Sets the pager for call back
 void setShowEditorButtons(boolean showEditorButtons)
           
 void setWidth(String width)
           
 void sort(String columnKey, boolean ascending, boolean caseSensitive)
          Sorts the grid's data by the given column
 
Methods inherited from class org.cruxframework.crux.widgets.client.grid.AbstractGrid
addBeforeCancelRowEditionHandler, addBeforeRowEditHandler, addBeforeSaveRowEditionHandler, addBeforeShowRowDetailsHandler, addCancelRowEditionHandler, addLoadRowDetailsHandler, addRowClickHandler, addRowDoubleClickHandler, addRowEditHandler, addRowRenderHandler, addScrollHandler, addShowRowDetailsHandler, clear, createBaseCell, createCell, createHeaderCell, ensureVisible, getColumnDefinition, getColumnDefinitions, getRowDetailWidgetCreator, getRowIterator, getRowSelectionModel, hasFrozenCells, hasFrozenColumns, hasFrozenHeaders, hasRowDetails, hasRowDetailsIconColumn, hasSelectionColumn, refresh, render, selectCurrentPageRows, setRowSelectionModel
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType)
Parameters:
columnDefinitions - the columns to be rendered
pageSize - the number of rows per page
rowSelection - the behavior of the grid about line selection
cellSpacing - the space between the cells
autoLoadData - if true, when a data source is set, its first page records are fetched and rendered.
stretchColumns - if true, the width of the columns are auto adjusted to fit the grid width. Prevents horizontal scrolling.
highlightRowOnMouseOver - if true, rows change their styles when mouse passed over them
emptyDataFilling - an alternative text to be shown when there is no data for some data cell
fixedCellSize - equivalent of setting CSS attribute table-layout to fixed
defaultSortingColumn - the column to be used to automatically sort the grid's data when it is rendered for the first time
defaultSortingType - tells the grid if defaultSortingColumn should be used ascending or descending

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType,
            boolean keepEditorOnClickDisabledRows)
Parameters:
columnDefinitions - the columns to be rendered
pageSize - the number of rows per page
rowSelection - the behavior of the grid about line selection
cellSpacing - the space between the cells
autoLoadData - if true, when a data source is set, its first page records are fetched and rendered.
stretchColumns - if true, the width of the columns are auto adjusted to fit the grid width. Prevents horizontal scrolling.
highlightRowOnMouseOver - if true, rows change their styles when mouse passed over them
emptyDataFilling - an alternative text to be shown when there is no data for some data cell
fixedCellSize - equivalent of setting CSS attribute table-layout to fixed
defaultSortingColumn - the column to be used to automatically sort the grid's data when it is rendered for the first time
defaultSortingType - tells the grid if defaultSortingColumn should be used ascending or descending
keepEditorOnClickDisabledRows - Keep row's editor opened even when clicking on a disabled datarow

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType,
            boolean keepEditorOnClickDisabledRows,
            boolean showEditorButtons)
Parameters:
columnDefinitions - the columns to be rendered
pageSize - the number of rows per page
rowSelection - the behavior of the grid about line selection
cellSpacing - the space between the cells
autoLoadData - if true, when a data source is set, its first page records are fetched and rendered.
stretchColumns - if true, the width of the columns are auto adjusted to fit the grid width. Prevents horizontal scrolling.
highlightRowOnMouseOver - if true, rows change their styles when mouse passed over them
emptyDataFilling - an alternative text to be shown when there is no data for some data cell
fixedCellSize - equivalent of setting CSS attribute table-layout to fixed
defaultSortingColumn - the column to be used to automatically sort the grid's data when it is rendered for the first time
defaultSortingType - tells the grid if defaultSortingColumn should be used ascending or descending
keepEditorOnClickDisabledRows - Keep row's editor opened even when clicking on a disabled datarow
showEditorButtons - Displays a column with three buttons: edit, save and cancel

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType,
            boolean keepEditorOnClickDisabledRows,
            boolean showEditorButtons,
            boolean freezeHeaders)

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType,
            boolean keepEditorOnClickDisabledRows,
            boolean showEditorButtons,
            String editButtonTooltip,
            String saveButtonTooltip,
            String cancelButtonTooltip)

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType,
            RowDetailWidgetCreator rowDetailsWidgetCreator,
            boolean showRowDetailsIcon,
            boolean freezeHeaders,
            boolean caseSensitive)
Full constructor

Parameters:
columnDefinitions - the columns to be rendered
pageSize - the number of rows per page
rowSelection - the behavior of the grid about line selection
cellSpacing - the space between the cells
autoLoadData - if true, when a data source is set, its first page records are fetched and rendered.
stretchColumns - if true, the width of the columns are auto adjusted to fit the grid width. Prevents horizontal scrolling.
highlightRowOnMouseOver - if true, rows change their styles when mouse passed over them
emptyDataFilling - an alternative text to be shown when there is no data for some data cell
fixedCellSize - equivalent of setting CSS attribute table-layout to fixed
defaultSortingColumn - the column to be used to automatically sort the grid's data when it is rendered for the first time
defaultSortingType - tells the grid if defaultSortingColumn should be used ascending or descending
rowDetailsWidgetCreator - used to create on-demand row details
showRowDetailsIcon - if true, the second column of the grid will contain icons for expanding or collapsing the row's details
caseSensitive - indicate if the columns sort are or not key sensitive

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType,
            RowDetailWidgetCreator rowDetailsWidgetCreator,
            boolean showRowDetailsIcon,
            boolean freezeHeaders,
            boolean caseSensitive,
            boolean keepEditorOnClickDisabledRows)
Parameters:
columnDefinitions -
pageSize -
rowSelection -
cellSpacing -
autoLoadData -
stretchColumns -
highlightRowOnMouseOver -
emptyDataFilling -
fixedCellSize -
defaultSortingColumn -
defaultSortingType -
rowDetailsWidgetCreator -
showRowDetailsIcon -
freezeHeaders -
caseSensitive -
keepEditorOnClickDisabledRows - Keep row's editor opened even when clicking on a disabled datarow

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType,
            RowDetailWidgetCreator rowDetailsWidgetCreator,
            boolean showRowDetailsIcon,
            boolean freezeHeaders,
            boolean caseSensitive,
            boolean keepEditorOnClickDisabledRows,
            boolean showEditorButtons)
Parameters:
columnDefinitions -
pageSize -
rowSelection -
cellSpacing -
autoLoadData -
stretchColumns -
highlightRowOnMouseOver -
emptyDataFilling -
fixedCellSize -
defaultSortingColumn -
defaultSortingType -
rowDetailsWidgetCreator -
showRowDetailsIcon -
freezeHeaders -
caseSensitive -
keepEditorOnClickDisabledRows -
showEditorButtons -

Grid

public Grid(ColumnDefinitions columnDefinitions,
            int pageSize,
            RowSelectionModel rowSelection,
            int cellSpacing,
            boolean autoLoadData,
            boolean stretchColumns,
            boolean highlightRowOnMouseOver,
            String emptyDataFilling,
            boolean fixedCellSize,
            String defaultSortingColumn,
            Grid.SortingType defaultSortingType,
            RowDetailWidgetCreator rowDetailsWidgetCreator,
            boolean showRowDetailsIcon,
            boolean freezeHeaders,
            boolean caseSensitive,
            boolean keepEditorOnClickDisabledRows,
            boolean showEditorButtons,
            String editButtonTooltip,
            String saveButtonTooltip,
            String cancelButtonTooltip)
Method Detail

setDataSource

public void setDataSource(PagedDataSource<?> dataSource)
Sets the data source and re-renders the grid

Parameters:
dataSource -

setDataSource

public void setDataSource(PagedDataSource<?> dataSource,
                          boolean autoLoadData)
Specified by:
setDataSource in interface HasDataSource<PagedDataSource<?>>

loadData

public void loadData()

createRow

protected DataRow createRow(int index,
                            com.google.gwt.dom.client.Element element)
Description copied from class: AbstractGrid
Creates a row

Specified by:
createRow in class AbstractGrid<DataRow>
Parameters:
index - the position of the row (zero based)
element - the row HTML element (TR)
Returns:

getRowsToBeRendered

protected int getRowsToBeRendered()
Specified by:
getRowsToBeRendered in class AbstractGrid<DataRow>
Returns:
the number of rows that will be rendered, less the header row

getCurrentPageSize

public int getCurrentPageSize()
Gets the current page row count

Returns:

onClear

protected void onClear()
Description copied from class: AbstractGrid
Callback for grid clearing

Specified by:
onClear in class AbstractGrid<DataRow>

onShowDetails

protected boolean onShowDetails(boolean show,
                                Row row,
                                boolean fireEvents)
Description copied from class: AbstractGrid
Executes the implementation-specific logic of showing the details of a row.

Specified by:
onShowDetails in class AbstractGrid<DataRow>
See Also:
br.com.sysmap.crux.widgets.client.grid.AbstractGrid#onShowDetails(boolean, br.com.sysmap.crux.widgets.client.grid.Row, boolean)

onSelectRow

protected boolean onSelectRow(boolean select,
                              DataRow row,
                              boolean fireEvents)
Description copied from class: AbstractGrid
Callback for row selection

Specified by:
onSelectRow in class AbstractGrid<DataRow>
Parameters:
select - true if the row was selected, false if deselected

renderRow

protected void renderRow(DataRow row)
Description copied from class: AbstractGrid
Renders the given row cells

Specified by:
renderRow in class AbstractGrid<DataRow>

renderRow

protected void renderRow(DataRow row,
                         DataSourceRecord<?> record,
                         boolean editMode,
                         String focusCellKey)

rollbackRowEdition

public void rollbackRowEdition(DataRow row)
Rollback the edition of the last column changed

Parameters:
row -

createColumnHeaderCell

protected Cell createColumnHeaderCell(ColumnDefinition columnDefinition)
Description copied from class: AbstractGrid
Creates a cell that will be used as the header for the given column

Overrides:
createColumnHeaderCell in class AbstractGrid<DataRow>
Returns:
the newly created cell

onBeforeRenderRows

protected void onBeforeRenderRows()
Description copied from class: AbstractGrid
Callback for before rendering the rows

Specified by:
onBeforeRenderRows in class AbstractGrid<DataRow>

getPageCount

public int getPageCount()
Description copied from interface: Pageable
Return the total number of pages

Specified by:
getPageCount in interface Pageable
Returns:
number of pages, -1 if unknown.

nextPage

public void nextPage()
Description copied from interface: Pageable
Moves the pageable's cursor to the next page

Specified by:
nextPage in interface Pageable

previousPage

public void previousPage()
Description copied from interface: Pageable
Moves the pageable's cursor to the previous page

Specified by:
previousPage in interface Pageable

setPager

public void setPager(Pager pager)
Description copied from interface: Pageable
Sets the pager for call back

Specified by:
setPager in interface Pageable
See Also:
Pageable.setPager(org.cruxframework.crux.widgets.client.paging.Pager)

onClearRendering

protected void onClearRendering()
Description copied from class: AbstractGrid
Callback for before clearing the rows contents

Specified by:
onClearRendering in class AbstractGrid<DataRow>

getDataSource

public PagedDataSource<?> getDataSource()
Specified by:
getDataSource in interface HasDataSource<PagedDataSource<?>>
Returns:
the dataSource

sort

public void sort(String columnKey,
                 boolean ascending,
                 boolean caseSensitive)
Sorts the grid's data by the given column

Parameters:
columnKey -

getSelectedRows

public List<DataRow> getSelectedRows()
Description copied from class: AbstractGrid
Gets the selected rows from the current visible page.

Specified by:
getSelectedRows in class AbstractGrid<DataRow>
Returns:
a List containing the selected rows

getCurrentPageRows

public List<DataRow> getCurrentPageRows()
Description copied from class: AbstractGrid
Gets all grid rows

Specified by:
getCurrentPageRows in class AbstractGrid<DataRow>
Returns:
a List containing the rows

getSelectedDataRows

@Deprecated
public Object[] getSelectedDataRows()
Deprecated. Use getSelectedDataObjects() instead

Gets all selected data objects contained by the grid.


getSelectedDataObjects

public Object[] getSelectedDataObjects()
Gets all selected data objects contained by the grid.

Returns:
an array of data objects

addBeforeRowSelectHandler

public com.google.gwt.event.shared.HandlerRegistration addBeforeRowSelectHandler(BeforeRowSelectHandler handler)
Specified by:
addBeforeRowSelectHandler in interface HasBeforeRowSelectHandlers
See Also:
HasBeforeRowSelectHandlers.addBeforeRowSelectHandler(org.cruxframework.crux.widgets.client.event.row.BeforeRowSelectHandler)

fireCancelRowEditionEvent

protected void fireCancelRowEditionEvent(DataRow row)
Specified by:
fireCancelRowEditionEvent in class AbstractGrid<DataRow>

fireBeforeSaveRowEditionEvent

protected boolean fireBeforeSaveRowEditionEvent(DataRow row)
Description copied from class: AbstractGrid
Fires a row saving event

Specified by:
fireBeforeSaveRowEditionEvent in class AbstractGrid<DataRow>

fireBeforeCancelRowEditionEvent

protected boolean fireBeforeCancelRowEditionEvent(DataRow row)
Specified by:
fireBeforeCancelRowEditionEvent in class AbstractGrid<DataRow>
Returns:

fireRowRenderEvent

protected void fireRowRenderEvent(DataRow row)
Description copied from class: AbstractGrid
Fires a row rendering event

Specified by:
fireRowRenderEvent in class AbstractGrid<DataRow>

fireRowClickEvent

protected void fireRowClickEvent(DataRow row)
Description copied from class: AbstractGrid
Fires a row click event

Specified by:
fireRowClickEvent in class AbstractGrid<DataRow>

fireRowEditEvent

protected void fireRowEditEvent(DataRow row)
Description copied from class: AbstractGrid
Fires a row edit event

Specified by:
fireRowEditEvent in class AbstractGrid<DataRow>

fireBeforeRowEditEvent

protected void fireBeforeRowEditEvent(DataRow row)
Description copied from class: AbstractGrid
Fires a before row edit event

Specified by:
fireBeforeRowEditEvent in class AbstractGrid<DataRow>

fireRowDoubleClickEvent

protected void fireRowDoubleClickEvent(DataRow row)
Description copied from class: AbstractGrid
Fires a row double click event

Specified by:
fireRowDoubleClickEvent in class AbstractGrid<DataRow>

isLoaded

public boolean isLoaded()

goToPage

public void goToPage(int page)
Description copied from interface: Pageable
Moves the pageable's cursor to an arbitrary page

Specified by:
goToPage in interface Pageable
Parameters:
page - page number
See Also:
Pageable.goToPage(int)

isDataLoaded

public boolean isDataLoaded()
Description copied from interface: Pageable
Checks if pageable data is already available

Specified by:
isDataLoaded in interface Pageable
See Also:
Pageable.isDataLoaded()

getRow

public DataRow getRow(com.google.gwt.user.client.ui.Widget w)
Description copied from class: AbstractGrid
Gets the row where the given widget is rendered

Overrides:
getRow in class AbstractGrid<DataRow>
Parameters:
w - a widget rendered inside a row
Returns:
a Row that contains the given widget. Null if no such row found.;

isEditable

public boolean isEditable()
Check if there is any editable column

Returns:

makeEditable

public void makeEditable(DataRow row,
                         Cell focusCell)
Enables edit mode for given row

Parameters:
row -
focusCell -

isEditing

public boolean isEditing()
Returns:
True if there is any row being edited

addRow

public <T> void addRow(T dataObject)

removeSelectedRows

public void removeSelectedRows()

removeSelectedRows

public <T> void removeSelectedRows(boolean fromCurrentPageOnly)

removeRow

public <T> void removeRow(DataRow r)

getRemovedDataObjects

public Object[] getRemovedDataObjects()

getCreatedDataObjects

public Object[] getCreatedDataObjects()

getEditedDataObjects

public Object[] getEditedDataObjects()

onBeforeRender

protected void onBeforeRender()
Description copied from class: AbstractGrid
Return true if the grid can be rendered

Specified by:
onBeforeRender in class AbstractGrid<DataRow>

addColumnEditorValidator

public void addColumnEditorValidator(String key,
                                     ColumnEditorValidator columnEditorValidator)
Add a validator to a editable column

Parameters:
key -
columnEditorValidator -

isShowEditorButtons

public boolean isShowEditorButtons()

isKeepEditorOnClickDisabledRows

public boolean isKeepEditorOnClickDisabledRows()

setKeepEditorOnClickDisabledRows

public void setKeepEditorOnClickDisabledRows(boolean keepEditorOnClickDisabledRows)

setShowEditorButtons

public void setShowEditorButtons(boolean showEditorButtons)

setWidth

public void setWidth(String width)
Overrides:
setWidth in class com.google.gwt.user.client.ui.UIObject


Copyright © 2014. All rights reserved.