public class Grid extends AbstractGrid<DataRow> implements Pageable, HasDataSource<PagedDataSource<?>>, HasBeforeRowSelectHandlers
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Grid.ColumnHeader |
static class |
Grid.SortingType
Grid default sorting type
|
| Constructor and Description |
|---|
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,
RowDetailWidgetCreator rowDetailsWidgetCreator,
boolean showRowDetailsIcon,
boolean freezeHeaders,
boolean caseSensitive)
Full constructor
|
| Modifier and Type | Method and Description |
|---|---|
com.google.gwt.event.shared.HandlerRegistration |
addBeforeRowSelectHandler(BeforeRowSelectHandler handler) |
<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 void |
fireRowClickEvent(DataRow row)
Fires a row click event
|
protected void |
fireRowDoubleClickEvent(DataRow row)
Fires a row double click 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() |
boolean |
isLoaded() |
void |
loadData() |
void |
makeEditable(DataRow row,
Cell focusCell) |
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
|
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 |
setDataSource(PagedDataSource<?> dataSource)
Sets the data source and re-renders the grid
|
void |
setDataSource(PagedDataSource<?> dataSource,
boolean autoLoadData) |
void |
setPager(Pager pager)
Sets the pager for call back
|
void |
sort(String columnKey,
boolean ascending,
boolean caseSensitive)
Sorts the grid's data by the given column
|
addBeforeRowEditHandler, addBeforeShowRowDetailsHandler, addLoadRowDetailsHandler, addRowClickHandler, addRowDoubleClickHandler, addRowEditHandler, addRowRenderHandler, addShowRowDetailsHandler, clear, createBaseCell, createCell, createHeaderCell, ensureVisible, getColumnDefinition, getColumnDefinitions, getRowDetailWidgetCreator, getRowIterator, getRowSelectionModel, hasFrozenCells, hasFrozenColumns, hasFrozenHeaders, hasRowDetails, hasRowDetailsIconColumn, hasSelectionColumn, refresh, render, selectCurrentPageRows, setRowSelectionModelclaimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, 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, setWidth, sinkBitlessEvent, toString, unsinkEventspublic Grid(ColumnDefinitions columnDefinitions, int pageSize, RowSelectionModel rowSelection, int cellSpacing, boolean autoLoadData, boolean stretchColumns, boolean highlightRowOnMouseOver, String emptyDataFilling, boolean fixedCellSize, String defaultSortingColumn, Grid.SortingType defaultSortingType)
columnDefinitions - the columns to be renderedpageSize - the number of rows per pagerowSelection - the behavior of the grid about line selectioncellSpacing - the space between the cellsautoLoadData - 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 thememptyDataFilling - an alternative text to be shown when there is no data for some data cellfixedCellSize - equivalent of setting CSS attribute table-layout to fixeddefaultSortingColumn - the column to be used to automatically sort the grid's data when it is rendered for the first timedefaultSortingType - tells the grid if defaultSortingColumn should be used ascending or descendingpublic 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)
columnDefinitions - the columns to be renderedpageSize - the number of rows per pagerowSelection - the behavior of the grid about line selectioncellSpacing - the space between the cellsautoLoadData - 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 thememptyDataFilling - an alternative text to be shown when there is no data for some data cellfixedCellSize - equivalent of setting CSS attribute table-layout to fixeddefaultSortingColumn - the column to be used to automatically sort the grid's data when it is rendered for the first timedefaultSortingType - tells the grid if defaultSortingColumn should be used ascending or descendingrowDetailsWidgetCreator - used to create on-demand row detailsshowRowDetailsIcon - if true, the second column of the grid will contain icons for expanding or collapsing the row's detailscaseSensitive - indicate if the columns sort are or not key sensitivepublic void setDataSource(PagedDataSource<?> dataSource)
dataSource - public void setDataSource(PagedDataSource<?> dataSource, boolean autoLoadData)
setDataSource in interface HasDataSource<PagedDataSource<?>>public void loadData()
protected DataRow createRow(int index, com.google.gwt.dom.client.Element element)
AbstractGridcreateRow in class AbstractGrid<DataRow>index - the position of the row (zero based)element - the row HTML element (TR)protected int getRowsToBeRendered()
getRowsToBeRendered in class AbstractGrid<DataRow>public int getCurrentPageSize()
protected void onClear()
AbstractGridonClear in class AbstractGrid<DataRow>protected boolean onShowDetails(boolean show,
Row row,
boolean fireEvents)
AbstractGridonShowDetails in class AbstractGrid<DataRow>br.com.sysmap.crux.widgets.client.grid.AbstractGrid#onShowDetails(boolean, br.com.sysmap.crux.widgets.client.grid.Row, boolean)protected boolean onSelectRow(boolean select,
DataRow row,
boolean fireEvents)
AbstractGridonSelectRow in class AbstractGrid<DataRow>select - true if the row was selected, false if deselectedprotected void renderRow(DataRow row)
AbstractGridrenderRow in class AbstractGrid<DataRow>protected void renderRow(DataRow row, DataSourceRecord<?> record, boolean editMode, String focusCellKey)
protected Cell createColumnHeaderCell(ColumnDefinition columnDefinition)
AbstractGridcreateColumnHeaderCell in class AbstractGrid<DataRow>protected void onBeforeRenderRows()
AbstractGridonBeforeRenderRows in class AbstractGrid<DataRow>public int getPageCount()
PageablegetPageCount in interface Pageablepublic void nextPage()
Pageablepublic void previousPage()
PageablepreviousPage in interface Pageablepublic void setPager(Pager pager)
PageablesetPager in interface PageablePageable.setPager(org.cruxframework.crux.widgets.client.paging.Pager)protected void onClearRendering()
AbstractGridonClearRendering in class AbstractGrid<DataRow>public PagedDataSource<?> getDataSource()
getDataSource in interface HasDataSource<PagedDataSource<?>>public void sort(String columnKey, boolean ascending, boolean caseSensitive)
columnKey - public List<DataRow> getSelectedRows()
AbstractGridgetSelectedRows in class AbstractGrid<DataRow>List containing the selected rowspublic List<DataRow> getCurrentPageRows()
AbstractGridgetCurrentPageRows in class AbstractGrid<DataRow>List containing the rows@Deprecated public Object[] getSelectedDataRows()
getSelectedDataObjects() insteadpublic Object[] getSelectedDataObjects()
public com.google.gwt.event.shared.HandlerRegistration addBeforeRowSelectHandler(BeforeRowSelectHandler handler)
protected void fireRowRenderEvent(DataRow row)
AbstractGridfireRowRenderEvent in class AbstractGrid<DataRow>protected void fireRowClickEvent(DataRow row)
AbstractGridfireRowClickEvent in class AbstractGrid<DataRow>protected void fireRowDoubleClickEvent(DataRow row)
AbstractGridfireRowDoubleClickEvent in class AbstractGrid<DataRow>public boolean isLoaded()
public void goToPage(int page)
PageablegoToPage in interface Pageablepage - page numberPageable.goToPage(int)public boolean isDataLoaded()
PageableisDataLoaded in interface PageablePageable.isDataLoaded()public DataRow getRow(com.google.gwt.user.client.ui.Widget w)
AbstractGridgetRow in class AbstractGrid<DataRow>w - a widget rendered inside a rowRow that contains the given widget. Null if no such row found.;public boolean isEditable()
public <T> void addRow(T dataObject)
public void removeSelectedRows()
public <T> void removeSelectedRows(boolean fromCurrentPageOnly)
public Object[] getRemovedDataObjects()
public Object[] getCreatedDataObjects()
public Object[] getEditedDataObjects()
protected void onBeforeRender()
AbstractGridonBeforeRender in class AbstractGrid<DataRow>Copyright © 2014. All rights reserved.