|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectResizeComposite
com.vaadin.client.ui.grid.Grid<T>
T - The row type of the grid. The row type is the POJO type from where
the data is retrieved into the column cells.public class Grid<T>
A data grid view that supports columns and lazy loading of data rows from a data source.
The GridColumn class defines the renderer used to render a cell in
the grid. Implement Grid.AbstractGridColumn.getValue(Object) to retrieve the cell
value from the row object and return the cell renderer to render that cell.
GridColumns contain other properties like the width of the column and
the visiblity of the column. If you want to change a column's properties
after it has been added to the grid you can get a column object for a
specific column index using getColumn(int).
TODO Explain about headers/footers once the multiple header/footer api has been implemented
TODO Explain about what a data source is and how it should be implemented.
| Nested Class Summary | |
|---|---|
static class |
Grid.AbstractGridKeyEvent<HANDLER extends AbstractGridKeyEventHandler>
|
protected class |
Grid.BodyUpdater
|
class |
Grid.SelectionColumn
|
static class |
Grid.SelectionMode
Enumeration for easy setting of selection mode. |
protected class |
Grid.StaticSectionUpdater
|
| Field Summary | |
|---|---|
protected com.vaadin.client.ui.grid.Grid.ActiveCellHandler |
activeCellHandler
|
| Constructor Summary | |
|---|---|
Grid()
Creates a new instance. |
|
| Method Summary | ||
|---|---|---|
com.google.gwt.event.shared.HandlerRegistration |
addBodyKeyDownHandler(BodyKeyDownHandler handler)
Register a BodyKeyDownHandler to this Grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addBodyKeyPressHandler(BodyKeyPressHandler handler)
Register a BodyKeyPressHandler to this Grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addBodyKeyUpHandler(BodyKeyUpHandler handler)
Register a BodyKeyUpHandler to this Grid. |
|
void |
addColumn(GridColumn<?,T> column)
Adds a column as the last column in the grid. |
|
void |
addColumn(GridColumn<?,T> column,
int index)
Inserts a column into a specific position in the grid. |
|
void |
addColumns(GridColumn<?,T>... columns)
Adds columns as the last columns in the grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addDataAvailableHandler(DataAvailableHandler handler)
Register a GWT event handler for a data available event. |
|
com.google.gwt.event.shared.HandlerRegistration |
addFooterKeyDownHandler(FooterKeyDownHandler handler)
Register a FooterKeyDownHandler to this Grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addFooterKeyPressHandler(FooterKeyPressHandler handler)
Register a FooterKeyPressHandler to this Grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addFooterKeyUpHandler(FooterKeyUpHandler handler)
Register a FooterKeyUpHandler to this Grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addHeaderKeyDownHandler(HeaderKeyDownHandler handler)
Register a HeaderKeyDownHandler to this Grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addHeaderKeyPressHandler(HeaderKeyPressHandler handler)
Register a HeaderKeyPressHandler to this Grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addHeaderKeyUpHandler(HeaderKeyUpHandler handler)
Register a HeaderKeyUpHandler to this Grid. |
|
com.google.gwt.event.shared.HandlerRegistration |
addRowVisibilityChangeHandler(RowVisibilityChangeHandler handler)
|
|
com.google.gwt.event.shared.HandlerRegistration |
addScrollHandler(ScrollHandler handler)
Adds a scroll handler to this grid |
|
com.google.gwt.event.shared.HandlerRegistration |
addSelectionChangeHandler(SelectionChangeHandler<T> handler)
|
|
com.google.gwt.event.shared.HandlerRegistration |
addSortHandler(SortEventHandler<T> handler)
Register a GWT event handler for a sorting event. |
|
protected EscalatorUpdater |
createBodyUpdater()
Creates the escalator updater used to update the body rows in this grid. |
|
protected EscalatorUpdater |
createFooterUpdater()
Creates the escalator updater used to update the footer rows in this grid. |
|
protected EscalatorUpdater |
createHeaderUpdater()
Creates the escalator updater used to update the header rows in this grid. |
|
boolean |
deselect(T row)
Deselect a row using the current selection model. |
|
protected int |
findVisibleColumnIndex(GridColumn<?,T> column)
|
|
GridColumn<?,T> |
getColumn(int index)
Returns a column by its index in the grid. |
|
int |
getColumnCount()
Returns the amount of columns in the grid. |
|
protected GridColumn<?,T> |
getColumnFromVisibleIndex(int index)
|
|
java.util.List<GridColumn<?,T>> |
getColumns()
Returns a list of columns in the grid. |
|
DataSource<T> |
getDataSource()
Gets the for this Grid. |
|
EditorRow<T> |
getEditorRow()
|
|
protected Escalator |
getEscalator()
|
|
GridFooter |
getFooter()
Returns the footer section of this grid. |
|
GridHeader |
getHeader()
Returns the header section of this grid. |
|
double |
getHeightByRows()
Gets the amount of rows in Grid's body that are shown, while getHeightMode() is HeightMode.ROW. |
|
com.vaadin.shared.ui.grid.HeightMode |
getHeightMode()
Returns the current HeightMode the Grid is in. |
|
GridColumn<?,T> |
getLastFrozenColumn()
Gets the rightmost frozen column in the grid. |
|
double |
getScrollLeft()
Gets the horizontal scroll offset |
|
double |
getScrollTop()
Gets the vertical scroll offset |
|
T |
getSelectedRow()
Gets last selected row from the current SelectionModel. |
|
java.util.Collection<T> |
getSelectedRows()
Gets currently selected rows from the current selection model. |
|
SelectionModel<T> |
getSelectionModel()
Gets a reference to the current selection model. |
|
java.util.List<SortOrder> |
getSortOrder()
Get a copy of the current sort order array. |
|
com.google.gwt.user.client.Element |
getSubPartElement(java.lang.String subPart)
Locates an element inside a component using the identifier provided in subPart. |
|
java.lang.String |
getSubPartName(com.google.gwt.user.client.Element subElement)
Provides an identifier that identifies the element within the component. |
|
protected java.util.List<GridColumn<?,T>> |
getVisibleColumns()
Returns a list of columns that are currently visible. |
|
boolean |
isSelected(T row)
Test if a row is selected. |
|
boolean |
isWorkPending()
Checks whether there are operations pending for this widget that must be executed before reaching a steady state. |
|
void |
onBrowserEvent(Event event)
|
|
void |
removeColumn(GridColumn<?,T> column)
Removes a column from the grid. |
|
void |
scrollToEnd()
Scrolls to the end of the very last row. |
|
void |
scrollToRow(int rowIndex)
Scrolls to a certain row, using ScrollDestination.ANY. |
|
void |
scrollToRow(int rowIndex,
com.vaadin.shared.ui.grid.ScrollDestination destination)
Scrolls to a certain row, using user-specified scroll destination. |
|
void |
scrollToStart()
Scrolls to the beginning of the very first row. |
|
boolean |
select(T row)
Select a row using the current selection model. |
|
void |
setColumnOrder(GridColumn<?,T>... orderedColumns)
Sets a new column order for the grid. |
|
void |
setDataSource(DataSource<T> dataSource)
Sets the data source used by this grid. |
|
void |
setHeight(java.lang.String height)
|
|
void |
setHeightByRows(double rows)
Sets the number of rows that should be visible in Grid's body, while getHeightMode() is HeightMode.ROW. |
|
void |
setHeightMode(com.vaadin.shared.ui.grid.HeightMode heightMode)
Defines the mode in which the Grid widget's height is calculated. |
|
void |
setLastFrozenColumn(GridColumn<?,T> lastFrozenColumn)
Sets the rightmost frozen column in the grid. |
|
void |
setScrollTop(double px)
Sets the vertical scroll offset. |
|
void |
setSelectionMode(Grid.SelectionMode mode)
Sets current selection mode. |
|
void |
setSelectionModel(SelectionModel<T> selectionModel)
Sets the current selection model. |
|
void |
setSortOrder(java.util.List<SortOrder> order)
Sets the sort order to use. |
|
void |
setStylePrimaryName(java.lang.String style)
|
|
void |
setWidth(java.lang.String width)
|
|
|
sort(GridColumn<C,T> column)
Sorts the Grid data in ascending order along one column. |
|
|
sort(GridColumn<C,T> column,
com.vaadin.shared.ui.grid.SortDirection direction)
Sorts the Grid data along one column. |
|
void |
sort(Sort s)
Sets the current sort order using the fluid Sort API. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.vaadin.client.ui.grid.selection.HasSelectionChangeHandlers |
|---|
addSelectionChangeHandler |
| Field Detail |
|---|
protected final com.vaadin.client.ui.grid.Grid.ActiveCellHandler activeCellHandler
| Constructor Detail |
|---|
public Grid()
| Method Detail |
|---|
public void setStylePrimaryName(java.lang.String style)
protected EscalatorUpdater createHeaderUpdater()
GridHeader,
getHeader()protected EscalatorUpdater createBodyUpdater()
protected EscalatorUpdater createFooterUpdater()
GridFooter,
getFooter()public void addColumns(GridColumn<?,T>... columns)
columns - the columns to addpublic void addColumn(GridColumn<?,T> column)
column - the column to add
public void addColumn(GridColumn<?,T> column,
int index)
index - the index where the column should be inserted intocolumn - the column to add
java.lang.IllegalStateException - if Grid's current selection model renders a selection column,
and index is 0.protected int findVisibleColumnIndex(GridColumn<?,T> column)
protected GridColumn<?,T> getColumnFromVisibleIndex(int index)
public void removeColumn(GridColumn<?,T> column)
column - the column to removepublic int getColumnCount()
public java.util.List<GridColumn<?,T>> getColumns()
public GridColumn<?,T> getColumn(int index)
throws java.lang.IllegalArgumentException
index - the index of the column
java.lang.IllegalArgumentException - if the column index does not exist in the gridprotected java.util.List<GridColumn<?,T>> getVisibleColumns()
public GridHeader getHeader()
public GridFooter getFooter()
public EditorRow<T> getEditorRow()
protected Escalator getEscalator()
public void setHeight(java.lang.String height)
Note: This method will change the widget's size in the browser
only if getHeightMode() returns HeightMode.CSS.
setHeightMode(HeightMode)public void setWidth(java.lang.String width)
public void setDataSource(DataSource<T> dataSource)
throws java.lang.IllegalArgumentException
dataSource - the data source to use, not null
java.lang.IllegalArgumentException - if dataSource is nullpublic DataSource<T> getDataSource()
public void setLastFrozenColumn(GridColumn<?,T> lastFrozenColumn)
All columns up to and including the given column will be frozen in place when the grid is scrolled sideways.
lastFrozenColumn - the rightmost column to freeze, or null to not
have any columns frozen
java.lang.IllegalArgumentException - if lastFrozenColumn is not a column from this gridpublic GridColumn<?,T> getLastFrozenColumn()
Note: Most usually, this method returns the very value set with
setLastFrozenColumn(GridColumn). This value, however, can be
reset to null if the column is removed from this grid.
null if
no columns are frozen.public com.google.gwt.event.shared.HandlerRegistration addRowVisibilityChangeHandler(RowVisibilityChangeHandler handler)
public void scrollToRow(int rowIndex)
throws java.lang.IllegalArgumentException
ScrollDestination.ANY.
rowIndex - zero-based index of the row to scroll to.
java.lang.IllegalArgumentException - if rowIndex is below zero, or above the maximum value
supported by the data source.
public void scrollToRow(int rowIndex,
com.vaadin.shared.ui.grid.ScrollDestination destination)
throws java.lang.IllegalArgumentException
rowIndex - zero-based index of the row to scroll to.destination - desired destination placement of scrolled-to-row. See
ScrollDestination for more information.
java.lang.IllegalArgumentException - if rowIndex is below zero, or above the maximum value
supported by the data source.public void scrollToStart()
public void scrollToEnd()
public void setScrollTop(double px)
px - the number of pixels this grid should be scrolled downpublic double getScrollTop()
public double getScrollLeft()
public void setHeightByRows(double rows)
throws java.lang.IllegalArgumentException
getHeightMode() is HeightMode.ROW.
If Grid is currently not in HeightMode.ROW, the given value is
remembered, and applied once the mode is applied.
rows - The height in terms of number of rows displayed in Grid's
body. If Grid doesn't contain enough rows, white space is
displayed instead.
java.lang.IllegalArgumentException - if rows is zero or less
java.lang.IllegalArgumentException - if rows is infinite
java.lang.IllegalArgumentException - if rows is NaNsetHeightMode(HeightMode)public double getHeightByRows()
getHeightMode() is HeightMode.ROW.
By default, it is .
HeightMode.ROW.setHeightByRows(double)public void setHeightMode(com.vaadin.shared.ui.grid.HeightMode heightMode)
If HeightMode.CSS is given, Grid will respect the values given
via setHeight(String), and behave as a traditional Widget.
If HeightMode.ROW is given, Grid will make sure that the body
will display as many rows as getHeightByRows() defines.
Note: If headers/footers are inserted or removed, the widget
will resize itself to still display the required amount of rows in its
body. It also takes the horizontal scrollbar into account.
heightMode - the mode in to which Grid should be setpublic com.vaadin.shared.ui.grid.HeightMode getHeightMode()
HeightMode the Grid is in.
Defaults to HeightMode.CSS.
public void onBrowserEvent(Event event)
public com.google.gwt.user.client.Element getSubPartElement(java.lang.String subPart)
SubPartAwaresubPart. The subPart identifier is component specific and
may be any string of characters, numbers, space characters and brackets.
getSubPartElement in interface SubPartAwaresubPart - The identifier for the element inside the component
public java.lang.String getSubPartName(com.google.gwt.user.client.Element subElement)
SubPartAwaresubElement is a part of the component and must never be null.
Note!
getSubPartElement(getSubPartName(element)) == element is not
always true. A component can choose to provide a more generic
identifier for any given element if the results of all interactions with
subElement are the same as interactions with the element
identified by the return value. For example a button can return an
identifier for the root element even though a DIV inside the button was
passed as subElement because interactions with the DIV and the
root button element produce the same result.
getSubPartName in interface SubPartAwaresubElement - The element the identifier string should uniquely identify
subElement or null
if no identifier could be provided.public void setSelectionModel(SelectionModel<T> selectionModel)
This function will call SelectionModel.setGrid(Grid).
selectionModel - a selection model implementation.
java.lang.IllegalArgumentException - if selection model argument is nullpublic SelectionModel<T> getSelectionModel()
public void setSelectionMode(Grid.SelectionMode mode)
This is a shorthand method for setSelectionModel(com.vaadin.client.ui.grid.selection.SelectionModel.
mode - a selection mode valueSelectionMode}.public boolean isSelected(T row)
row - a row object
public boolean select(T row)
Only selection models implementing SelectionModel.Single and
SelectionModel.Multi are supported; for anything else, an
exception will be thrown.
row - a row object
true iff the current selection changed
java.lang.IllegalStateException - if the current selection model is not an instance of
SelectionModel.Single or SelectionModel.Multipublic boolean deselect(T row)
Only selection models implementing SelectionModel.Single and
SelectionModel.Multi are supported; for anything else, an
exception will be thrown.
row - a row object
true iff the current selection changed
java.lang.IllegalStateException - if the current selection model is not an instance of
SelectionModel.Single or SelectionModel.Multipublic T getSelectedRow()
Only selection models implementing SelectionModel.Single are
valid for this method; for anything else, use the
getSelectedRows() method.
java.lang.IllegalStateException - if the current selection model is not an instance of
SelectionModel.Singlepublic java.util.Collection<T> getSelectedRows()
public com.google.gwt.event.shared.HandlerRegistration addSelectionChangeHandler(SelectionChangeHandler<T> handler)
public void sort(Sort s)
Sort for more information.
s - a sort instancepublic <C> void sort(GridColumn<C,T> column)
column - a grid column reference
public <C> void sort(GridColumn<C,T> column,
com.vaadin.shared.ui.grid.SortDirection direction)
column - a grid column referencedirection - a sort direction valuepublic void setSortOrder(java.util.List<SortOrder> order)
order - a sort order list. If set to null, the sort order is cleared.public java.util.List<SortOrder> getSortOrder()
public com.google.gwt.event.shared.HandlerRegistration addSortHandler(SortEventHandler<T> handler)
handler - a sort event handler
public com.google.gwt.event.shared.HandlerRegistration addDataAvailableHandler(DataAvailableHandler handler)
DataSource for this Grid has new data
available.
This handle will be fired with the current available data after registration is done.
handler - a data available event handler
public com.google.gwt.event.shared.HandlerRegistration addBodyKeyDownHandler(BodyKeyDownHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addBodyKeyUpHandler(BodyKeyUpHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addBodyKeyPressHandler(BodyKeyPressHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addHeaderKeyDownHandler(HeaderKeyDownHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addHeaderKeyUpHandler(HeaderKeyUpHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addHeaderKeyPressHandler(HeaderKeyPressHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addFooterKeyDownHandler(FooterKeyDownHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addFooterKeyUpHandler(FooterKeyUpHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addFooterKeyPressHandler(FooterKeyPressHandler handler)
handler - the key handler to register
public com.google.gwt.event.shared.HandlerRegistration addScrollHandler(ScrollHandler handler)
handler - the scroll handler to add
public boolean isWorkPending()
DeferredWorker
isWorkPending in interface DeferredWorkerpublic void setColumnOrder(GridColumn<?,T>... orderedColumns)
orderedColumns - array of columns in wanted order
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||