M - the model typepublic class Grid<M> extends Component implements ViewReadyEvent.HasViewReadyHandlers, SortChangeEvent.HasSortChangeHandlers, RowClickEvent.HasRowClickHandlers, RowDoubleClickEvent.HasRowDoubleClickHandlers, RowMouseDownEvent.HasRowMouseDownHandlers, CellClickEvent.HasCellClickHandlers, CellDoubleClickEvent.HasCellDoubleClickHandlers, CellMouseDownEvent.HasCellMouseDownHandlers, HeaderClickEvent.HasHeaderClickHandlers, HeaderDoubleClickEvent.HasHeaderDoubleClickHandlers, HeaderContextMenuEvent.HasHeaderContextMenuHandlers, RefreshEvent.HasRefreshHandlers, ReconfigureEvent.HasReconfigureHandlers, BodyScrollEvent.HasBodyScrollHandlers
ListStore and ColumnModel when
constructed. Each model in the store will be rendered as a row in the grid.
Any updates to the store are automatically pushed to the grid. This includes
inserting, removing, sorting and filter.
Grid support several ways to manage column widths.
GridView.setAutoExpandColumn(ColumnConfig).GridView.setAutoFill(boolean) to
enable this feature. With auto fill, the calculations are only run once.
After the grid is rendered, the columns widths will not be adjusted when
available width changes. You can use @link
GridView.setForceFit(boolean) to always run the width calculations on
any changes to available width or column sizes. Columns can be "fixed" which
prevents their columns widths to be adjusted by the grid "weight"
calculations. See @link ColumnConfig.setFixed(boolean).| Modifier and Type | Class and Description |
|---|---|
static interface |
Grid.Callback
Provides a mechanism by which other components can report whether a cell is
selectable.
|
static interface |
Grid.GridAppearance
Define the appearance of a Grid.
|
static class |
Grid.GridCell
A reference to a cell in the grid that can be used for a variety of
purposes, including, for example, whether it is active or selected.
|
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledDEBUG_ID_PREFIX| Constructor and Description |
|---|
Grid(ListStore<M> store,
ColumnModel<M> cm)
Creates a new grid with the given data store and column model.
|
Grid(ListStore<M> store,
ColumnModel<M> cm,
Grid.GridAppearance appearance)
Creates a new grid with the given data store, column model and appearance
|
| Modifier and Type | Method and Description |
|---|---|
HandlerRegistration |
addBodyScrollHandler(BodyScrollEvent.BodyScrollHandler handler) |
HandlerRegistration |
addCellClickHandler(CellClickEvent.CellClickHandler handler) |
HandlerRegistration |
addCellDoubleClickHandler(CellDoubleClickEvent.CellDoubleClickHandler handler) |
HandlerRegistration |
addCellMouseDownHandler(CellMouseDownEvent.CellMouseDownHandler handler) |
HandlerRegistration |
addHeaderClickHandler(HeaderClickEvent.HeaderClickHandler handler) |
HandlerRegistration |
addHeaderContextMenuHandler(HeaderContextMenuEvent.HeaderContextMenuHandler handler) |
HandlerRegistration |
addHeaderDoubleClickHandler(HeaderDoubleClickEvent.HeaderDoubleClickHandler handler) |
HandlerRegistration |
addReconfigureHandler(ReconfigureEvent.ReconfigureHandler handler) |
HandlerRegistration |
addRefreshHandler(RefreshEvent.RefreshHandler handler)
Adds a
RefreshEvent.RefreshHandler handler for
RefreshEvent events. |
HandlerRegistration |
addRowClickHandler(RowClickEvent.RowClickHandler handler) |
HandlerRegistration |
addRowDoubleClickHandler(RowDoubleClickEvent.RowDoubleClickHandler handler) |
HandlerRegistration |
addRowMouseDownHandler(RowMouseDownEvent.RowMouseDownHandler handler) |
HandlerRegistration |
addSortChangeHandler(SortChangeEvent.SortChangeHandler handler) |
HandlerRegistration |
addViewReadyHandler(ViewReadyEvent.ViewReadyHandler handler) |
Grid.GridAppearance |
getAppearance()
Returns the grid appearance.
|
ColumnModel<M> |
getColumnModel()
Returns the column model.
|
int |
getLazyRowRender()
Returns the time in ms after the rows get rendered.
|
ListLoader<?,?> |
getLoader()
Returns the loader.
|
int |
getMinColumnWidth()
Returns the minimum column width.
|
GridSelectionModel<M> |
getSelectionModel()
Returns the grid's selection model.
|
ListStore<M> |
getStore()
Returns the grid's store.
|
GridView<M> |
getView()
Returns the grid's view.
|
boolean |
isColumnLines()
Returns true if column lines are enabled.
|
boolean |
isColumnReordering()
Returns true if column reordering is enabled.
|
boolean |
isColumnResize()
Returns true if column resizing is enabled.
|
boolean |
isHideHeaders()
Returns true if the header is hidden.
|
boolean |
isLoadMask()
Returns true if the load mask in enabled.
|
boolean |
isStripeRows()
Returns true if row striping is enabled.
|
boolean |
isTrackMouseOver()
Returns true if rows are highlighted on mouse over.
|
boolean |
isViewReady()
Returns true if the view is ready.
|
void |
onBrowserEvent(Event ce) |
void |
reconfigure(ListStore<M> store,
ColumnModel<M> cm)
Reconfigures the grid to use a different Store and Column Model.
|
void |
setAllowTextSelection(boolean enable)
Enables and disables text selection for the widget.
|
void |
setColumnLines(boolean columnLines)
True to enable column separation lines (defaults to false).
|
void |
setColumnReordering(boolean enableColumnReorder)
True to enable column reordering via drag and drop (defaults to false).
|
void |
setColumnResize(boolean enableColumnResize)
Sets whether columns may be resized (defaults to true).
|
void |
setHideHeaders(boolean hideHeaders)
Sets whether the header should be hidden (defaults to false).
|
void |
setLazyRowRender(int lazyRowRender)
Sets the time in ms after the row gets rendered (defaults to 10).
|
void |
setLoader(ListLoader<?,?> loader)
Sets the loader.
|
void |
setLoadMask(boolean loadMask)
Sets whether a load mask should be displayed during load operations
(defaults to false).
|
void |
setMinColumnWidth(int minColumnWidth)
The minimum width a column can be resized to (defaults to 25).
|
void |
setSelectionModel(GridSelectionModel<M> sm)
Sets the grid selection model.
|
void |
setStripeRows(boolean stripeRows)
True to stripe the rows (defaults to false).
|
void |
setTrackMouseOver(boolean trackMouseOver)
True to highlight rows when the mouse is over (defaults to true).
|
void |
setView(GridView<M> view)
Sets the view's grid (pre-render).
|
Grid.GridCell |
walkCells(int row,
int col,
int step,
Grid.Callback callback)
Navigate in the requested direction to the next selectable cell, given the
row, column and step.
|
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disable, disableEvents, enable, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeHandler, removeToolTip, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmaskaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEventsequals, getClass, hashCode, notify, notifyAll, wait, wait, waitfireEventpublic Grid(ListStore<M> store, ColumnModel<M> cm)
store - the data storecm - the column modelpublic Grid(ListStore<M> store, ColumnModel<M> cm, Grid.GridAppearance appearance)
store - the data storecm - the column modelappearance - the appearancepublic HandlerRegistration addBodyScrollHandler(BodyScrollEvent.BodyScrollHandler handler)
addBodyScrollHandler in interface BodyScrollEvent.HasBodyScrollHandlerspublic HandlerRegistration addCellClickHandler(CellClickEvent.CellClickHandler handler)
addCellClickHandler in interface CellClickEvent.HasCellClickHandlerspublic HandlerRegistration addCellDoubleClickHandler(CellDoubleClickEvent.CellDoubleClickHandler handler)
addCellDoubleClickHandler in interface CellDoubleClickEvent.HasCellDoubleClickHandlerspublic HandlerRegistration addCellMouseDownHandler(CellMouseDownEvent.CellMouseDownHandler handler)
addCellMouseDownHandler in interface CellMouseDownEvent.HasCellMouseDownHandlerspublic HandlerRegistration addHeaderClickHandler(HeaderClickEvent.HeaderClickHandler handler)
addHeaderClickHandler in interface HeaderClickEvent.HasHeaderClickHandlerspublic HandlerRegistration addHeaderContextMenuHandler(HeaderContextMenuEvent.HeaderContextMenuHandler handler)
addHeaderContextMenuHandler in interface HeaderContextMenuEvent.HasHeaderContextMenuHandlerspublic HandlerRegistration addHeaderDoubleClickHandler(HeaderDoubleClickEvent.HeaderDoubleClickHandler handler)
addHeaderDoubleClickHandler in interface HeaderDoubleClickEvent.HasHeaderDoubleClickHandlerspublic HandlerRegistration addReconfigureHandler(ReconfigureEvent.ReconfigureHandler handler)
addReconfigureHandler in interface ReconfigureEvent.HasReconfigureHandlerspublic HandlerRegistration addRefreshHandler(RefreshEvent.RefreshHandler handler)
RefreshEvent.HasRefreshHandlersRefreshEvent.RefreshHandler handler for
RefreshEvent events.addRefreshHandler in interface RefreshEvent.HasRefreshHandlershandler - the handlerpublic HandlerRegistration addRowClickHandler(RowClickEvent.RowClickHandler handler)
addRowClickHandler in interface RowClickEvent.HasRowClickHandlerspublic HandlerRegistration addRowDoubleClickHandler(RowDoubleClickEvent.RowDoubleClickHandler handler)
addRowDoubleClickHandler in interface RowDoubleClickEvent.HasRowDoubleClickHandlerspublic HandlerRegistration addRowMouseDownHandler(RowMouseDownEvent.RowMouseDownHandler handler)
addRowMouseDownHandler in interface RowMouseDownEvent.HasRowMouseDownHandlerspublic HandlerRegistration addSortChangeHandler(SortChangeEvent.SortChangeHandler handler)
addSortChangeHandler in interface SortChangeEvent.HasSortChangeHandlerspublic HandlerRegistration addViewReadyHandler(ViewReadyEvent.ViewReadyHandler handler)
addViewReadyHandler in interface ViewReadyEvent.HasViewReadyHandlerspublic Grid.GridAppearance getAppearance()
public ColumnModel<M> getColumnModel()
public int getLazyRowRender()
public ListLoader<?,?> getLoader()
public int getMinColumnWidth()
public GridSelectionModel<M> getSelectionModel()
public boolean isColumnLines()
public boolean isColumnReordering()
public boolean isColumnResize()
public boolean isHideHeaders()
public boolean isLoadMask()
public boolean isStripeRows()
public boolean isTrackMouseOver()
public boolean isViewReady()
public void onBrowserEvent(Event ce)
onBrowserEvent in interface EventListeneronBrowserEvent in class Componentpublic void reconfigure(ListStore<M> store, ColumnModel<M> cm)
store - the new storecm - the new column modelpublic void setAllowTextSelection(boolean enable)
ComponentsetAllowTextSelection in class Componentenable - true to enable, false to disablepublic void setColumnLines(boolean columnLines)
columnLines - true to enable column separation linespublic void setColumnReordering(boolean enableColumnReorder)
enableColumnReorder - true to enablepublic void setColumnResize(boolean enableColumnResize)
enableColumnResize - true to allow column resizingpublic void setHideHeaders(boolean hideHeaders)
hideHeaders - true to hide the headerpublic void setLazyRowRender(int lazyRowRender)
lazyRowRender - the time in ms after the rows get rendered.public void setLoader(ListLoader<?,?> loader)
loader - the loaderpublic void setLoadMask(boolean loadMask)
loadMask - true to show a maskpublic void setMinColumnWidth(int minColumnWidth)
minColumnWidth - the min column widthpublic void setSelectionModel(GridSelectionModel<M> sm)
sm - the selection modelpublic void setStripeRows(boolean stripeRows)
stripeRows - true to strip rowspublic void setTrackMouseOver(boolean trackMouseOver)
trackMouseOver - true to highlight rows on mouse overpublic void setView(GridView<M> view)
view - the viewpublic Grid.GridCell walkCells(int row, int col, int step, Grid.Callback callback)
row - the starting row indexcol - the starting column indexstep - the step size and directioncallback - a callback that determines whether the given cell is
selectablenull if no cell matches the criteriaCopyright © 2012. All Rights Reserved.