Interface IEasyGridComposite<T>
- Type Parameters:
T- the grid bean type
Grid methods that
EasyGridComposite re-exposes by delegating to the wrapped grid instance. Used as the
type argument for Lombok @Delegate on the EasyGridComposite.IEasyGridDelegate inner class.-
Method Summary
Modifier and TypeMethodDescription<V extends Component>
Grid.Column<T>addComponentColumn(ValueProvider<T, V> componentProvider) Adds a new column that shows components.addDataGenerator(DataGenerator<T> generator) Adds the given data generator.addItemClickListener(ComponentEventListener<ItemClickEvent<T>> listener) Adds an item click listener to this component.addSelectionListener(SelectionListener<Grid<T>, T> listener) Adds a selection listener to the current selection model.Gets the generic data view for the grid.Gets the lazy data view for the grid.Gets the list data view for the grid.This method is a shorthand that delegates to the currently set selection model.setItems(BackEndDataProvider<T, Void> dataProvider) Supply items with aBackEndDataProviderthat lazy loads items from a backend.setItems(DataProvider<T, Void> dataProvider) Set a generic data provider for the component to use and returns the baseDataViewthat provides API to get information on the items.setItems(InMemoryDataProvider<T> dataProvider) Sets an in-memory data provider for the component to use.setItems(ListDataProvider<T> dataProvider) Sets aListDataProviderfor the component to use and returns aListDataViewthat provides information and allows operations on the items.setSelectionMode(Grid.SelectionMode selectionMode) Sets the grid's selection mode.voidsetSortableColumns(String... propertyNames) Sets the defined columns as sortable, based on the given property names.
-
Method Details
-
addDataGenerator
Adds the given data generator. If the generator was already added, does nothing.- Parameters:
generator- the data generator to add- Returns:
- a registration that can be used to remove the data generator
-
addItemClickListener
Adds an item click listener to this component.- Parameters:
listener- the listener to add, notnull- Returns:
- a handle that can be used for removing the listener
-
addSelectionListener
Adds a selection listener to the current selection model.This is a shorthand for
grid.getSelectionModel().addSelectionListener(). To get more detailed selection events, usegetSelectionModel()and eitherGridSingleSelectionModel#addSingleSelectionListener(SingleSelectionListener)orGridMultiSelectionModel#addMultiSelectionListener(MultiSelectionListener)depending on the used selection mode.- Parameters:
listener- the listener to add- Returns:
- a registration handle to remove the listener
- Throws:
UnsupportedOperationException- if selection has been disabled withGrid.SelectionMode.NONE
-
addComponentColumn
Adds a new column that shows components.This is a shorthand for
addColumn(Renderer)with aComponentRenderer.NOTE: Using
ComponentRendereris not as efficient as the built in renderers or usingLitRenderer.Every added column sends data to the client side regardless of its visibility state. Don't add a new column at all or use
Grid#removeColumn(Column)to avoid sending extra data.- Type Parameters:
V- the component type- Parameters:
componentProvider- a value provider that will return a component for the given item- Returns:
- the new column
-
getGenericDataView
GridDataView<T> getGenericDataView()Gets the generic data view for the grid. This data view should only be used whengetListDataView()orgetLazyDataView()is not applicable for the underlying data provider.- Returns:
- the generic
DataViewimplementation for grid - See Also:
-
getLazyDataView
GridLazyDataView<T> getLazyDataView()Gets the lazy data view for the grid. This data view should only be used when the items are provided lazily from the backend with:setItems(CallbackDataProvider.FetchCallback)setItems(CallbackDataProvider.FetchCallback, CallbackDataProvider.CountCallback)setItems(BackEndDataProvider)
getListDataView()instead.- Returns:
- the lazy data view that provides access to the data bound to the grid
-
getListDataView
GridListDataView<T> getListDataView()Gets the list data view for the grid. This data view should only be used when the items are in-memory set with:setItems(Collection)setItems(Object[])setItems(ListDataProvider)
getLazyDataView()instead.- Returns:
- the list data view that provides access to the items in the grid
-
getSelectedItems
This method is a shorthand that delegates to the currently set selection model.- Returns:
- a set with the selected items, never
null - See Also:
-
setItems
Supply items with aBackEndDataProviderthat lazy loads items from a backend. Note that component will query the data provider for the item count. In case that is not desired for performance reasons, usesetItems(CallbackDataProvider.FetchCallback)instead.The returned data view object can be used for further configuration, or later on fetched with
getLazyDataView(). For using in-memory data, likeCollection, useHasListDataView#setItems(Collection)instead.- Parameters:
dataProvider-BackEndDataProviderinstance- Returns:
LazyDataViewinstance for further configuration
-
setItems
Set a generic data provider for the component to use and returns the baseDataViewthat provides API to get information on the items.This method should be used only when the data provider type is not either
ListDataProviderorBackEndDataProvider.- Parameters:
dataProvider-DataProviderinstance to use, notnull- Returns:
DataViewproviding information on the data
-
setItems
Sets aListDataProviderfor the component to use and returns aListDataViewthat provides information and allows operations on the items.- Parameters:
dataProvider-ListDataProviderproviding items to the component- Returns:
ListDataViewproviding access to the items
-
setItems
Sets an in-memory data provider for the component to use.Note! Using a
ListDataProviderinstead of anInMemoryDataProvideris recommended to get access toListDataViewAPI by usingsetItems(ListDataProvider).- Parameters:
dataProvider-InMemoryDataProviderto use, notnull- Returns:
DataViewproviding information on the data
-
setSelectionMode
Sets the grid's selection mode.To use your custom selection model, you can use
setSelectionModel(GridSelectionModel, SelectionMode), see existing selection model implementations for example.- Parameters:
selectionMode- the selection mode to switch to, notnull- Returns:
- the used selection model
- See Also:
-
setSortableColumns
Sets the defined columns as sortable, based on the given property names.This is a shortcut for setting all columns not sortable and then calling
Column#setSortable(boolean)for each of the columns defined by the given propertyNames.You can set sortable columns for nested properties with dot notation, eg.
"property.nestedProperty"Note: This method can only be used for a
Gridcreated from a bean type withGrid(Class).- Parameters:
propertyNames- the property names used to reference the columns- Throws:
IllegalArgumentException- if any of the propertyNames refers to a non-existing column
-