Class JmixGridLayout<T>
- Type Parameters:
T- the type of the items displayed in this layout
- All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.HasComponents,com.vaadin.flow.component.HasElement,com.vaadin.flow.component.HasEnabled,com.vaadin.flow.component.HasSize,com.vaadin.flow.component.HasStyle,com.vaadin.flow.data.binder.HasItemComponents<T>,com.vaadin.flow.data.provider.HasDataView<T,,Void, GridLayoutDataView<T>> com.vaadin.flow.data.provider.HasListDataView<T,,GridLayoutListDataView<T>> Serializable
- Direct Known Subclasses:
GridLayout
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.vaadin.flow.data.binder.HasItemComponents
com.vaadin.flow.data.binder.HasItemComponents.ItemComponent<T extends Object> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected final AtomicReference<com.vaadin.flow.data.provider.DataProvider<T,?>> protected com.vaadin.flow.shared.Registrationprotected com.vaadin.flow.component.ItemLabelGenerator<T>protected com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,T> protected static final Stringprotected intprotected intprotected com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.UI> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected GridLayoutItem<T>createItemComponent(T item) protected voidgetAlignSelf(com.vaadin.flow.component.HasElement component) Returns the individual alignment of a given component inside a cell along the block (column) axis.Returns the minimum width of the columns in theJmixGridLayout.com.vaadin.flow.data.provider.DataProvider<T,?> Gets the data provider used by thisJmixGridLayout.getGap()Returns the gap of the grid layout in theJmixGridLayout.Gets the generic data view for theJmixGridLayout.protected List<GridLayoutItem<T>>protected Objectcom.vaadin.flow.component.ItemLabelGenerator<T>Gets the item label generator used to produce the strings shown in theJmixGridLayoutfor each item.com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,T> Returns the item component renderer.getJustifySelf(com.vaadin.flow.component.HasElement component) Returns the individual alignment of a given component inside a cell along the inline (row) axis.Gets the list data view for theJmixGridLayout.protected voidhandleDataChange(com.vaadin.flow.data.provider.DataChangeEvent<T> event) protected voidonAttach(com.vaadin.flow.component.AttachEvent attachEvent) protected voidonDetach(com.vaadin.flow.component.DetachEvent detachEvent) protected voidrebuild()protected voidprotected voidrefreshContent(GridLayoutItem<T> gridLayoutItem) protected voidrunBeforeClientResponse(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.UI> command) voidsetAlignSelf(Alignment alignment, com.vaadin.flow.component.HasElement... components) Sets an alignment for individual components inside their cells along the block (column) axis.voidsetColumnMinWidth(String columnMinWidth) Sets the minimum width for the grid columns in theJmixGridLayout.voidsetDataProvider(com.vaadin.flow.data.provider.DataProvider<T, ?> dataProvider) Sets a generic data provider for theJmixGridLayoutto use.voidSets the gap of the grid layout in theJmixGridLayout.voidsetItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) Sets a generic data provider for theJmixGridLayoutto use and returns the baseGridLayoutDataViewthat provides API to get information on the items.Sets an in-memory data provider for theJmixGridLayoutto use.Sets aListDataProviderfor theJmixGridLayoutto use and returns aListDataViewthat provides information and allows operation on the items.voidsetJustifySelf(Alignment alignment, com.vaadin.flow.component.HasElement... components) Sets an alignment for individual components inside their cells along the inline (row) axis.voidsetRenderer(com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component, T> itemRenderer) Sets the item renderer for thisJmixGridLayout.protected voidsetupDataProviderListener(com.vaadin.flow.data.provider.DataProvider<T, ?> dataProvider) Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasComponents
add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAllMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled, setEnabledMethods inherited from interface com.vaadin.flow.data.binder.HasItemComponents
addComponents, getItemPosition, prependComponentsMethods inherited from interface com.vaadin.flow.data.provider.HasListDataView
setItems, setItemsMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
ALIGN_SELF_CSS_PROPERTY
- See Also:
-
JUSTIFY_SELF_CSS_PROPERTY
- See Also:
-
dataProvider
-
items
-
dataProviderListenerRegistration
protected com.vaadin.flow.shared.Registration dataProviderListenerRegistration -
itemLabelGenerator
-
itemRenderer
protected com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,T> itemRenderer -
lastNotifiedDataSize
protected int lastNotifiedDataSize -
lastFetchedDataSize
protected volatile int lastFetchedDataSize -
sizeRequest
protected com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.UI> sizeRequest
-
-
Constructor Details
-
JmixGridLayout
public JmixGridLayout()
-
-
Method Details
-
getGap
Returns the gap of the grid layout in theJmixGridLayout. Default value isvar(--lumo-space-s).- Returns:
- the gap of the grid layout
-
setGap
Sets the gap of the grid layout in theJmixGridLayout.- Parameters:
gridGap- the gap to be set for the grid layout, represented as a CSS length value (e.g.,"10px","1rem")
-
getColumnMinWidth
Returns the minimum width of the columns in theJmixGridLayout. Default value is19rem- Returns:
- the minimum width for the columns as a CSS length value (e.g.,
"19rem")
-
setColumnMinWidth
Sets the minimum width for the grid columns in theJmixGridLayout.- Parameters:
columnMinWidth- the minimum width to be set for the grid columns, represented as a CSS length value (e.g.,"50px","10rem")
-
getAlignSelf
Returns the individual alignment of a given component inside a cell along the block (column) axis.The default alignment for individual components is
Alignment.AUTO.- Parameters:
component- the component which individual layout should be read- Returns:
- the alignment of the component
-
setAlignSelf
public void setAlignSelf(@Nullable Alignment alignment, com.vaadin.flow.component.HasElement... components) Sets an alignment for individual components inside their cells along the block (column) axis.It effectively sets the
"alignSelf"style value.- Parameters:
alignment- the individual alignment for the children components. Settingnullwill reset the alignment to its defaultcomponents- the components to which the individual alignment should be set
-
getJustifySelf
Returns the individual alignment of a given component inside a cell along the inline (row) axis.The default alignment for individual components is
Alignment.AUTO.- Parameters:
component- the component which individual layout should be read- Returns:
- the alignment of the component
-
setJustifySelf
public void setJustifySelf(@Nullable Alignment alignment, com.vaadin.flow.component.HasElement... components) Sets an alignment for individual components inside their cells along the inline (row) axis.It effectively sets the
"justifySelf"style value.- Parameters:
alignment- the individual alignment for the children components. Settingnullwill reset the alignment to its defaultcomponents- the components to which the individual alignment should be set
-
getDataProvider
Gets the data provider used by thisJmixGridLayout.To get information and control over the items in the
JmixGridLayout, use eithergetListDataView()orgetGenericDataView()instead.- Returns:
- the data provider used by this
JmixGridLayout
-
setDataProvider
Sets a generic data provider for theJmixGridLayoutto use.Use this method when none of the
setItemsmethods are applicable, e.g., when having a data provider with a filter that cannot be transformed toDataProvider<T, Void>.- Parameters:
dataProvider- DataProvider instance to use, notnull
-
setupDataProviderListener
protected void setupDataProviderListener(com.vaadin.flow.data.provider.DataProvider<T, ?> dataProvider) -
handleDataChange
-
onAttach
protected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent) - Overrides:
onAttachin classcom.vaadin.flow.component.Component
-
onDetach
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent) - Overrides:
onDetachin classcom.vaadin.flow.component.Component
-
getItemRenderer
public com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component,T> getItemRenderer()Returns the item component renderer.- Returns:
- the item renderer
- See Also:
-
setRenderer
public void setRenderer(com.vaadin.flow.data.renderer.ComponentRenderer<? extends com.vaadin.flow.component.Component, T> itemRenderer) Sets the item renderer for thisJmixGridLayout. The renderer is applied to each item to create a component which represents the item.- Parameters:
itemRenderer- the item renderer, notnull
-
getItemLabelGenerator
Gets the item label generator used to produce the strings shown in theJmixGridLayoutfor each item.- Returns:
- the item label provider to use, not
null
-
setItemLabelGenerator
public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) -
rebuild
protected void rebuild() -
createItemComponent
-
refresh
-
refreshContent
-
getItemComponents
-
setItems
public GridLayoutDataView<T> setItems(com.vaadin.flow.data.provider.DataProvider<T, Void> dataProvider) Sets a generic data provider for theJmixGridLayoutto use and returns the baseGridLayoutDataViewthat provides API to get information on the items.This method should be used only when the data provider type is not either
ListDataProviderorBackEndDataProvider.- Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, GridLayoutDataView<T>> - Parameters:
dataProvider- DataProvider instance to use, notnull- Returns:
GridLayoutDataViewproviding information on the data
-
setItems
public GridLayoutDataView<T> setItems(com.vaadin.flow.data.provider.InMemoryDataProvider<T> inMemoryDataProvider) Sets an in-memory data provider for theJmixGridLayoutto use.Note! Using a
ListDataProviderinstead of aInMemoryDataProvideris recommended to get access toGridLayoutListDataViewAPI by usingHasListDataView.setItems(ListDataProvider).- Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, GridLayoutDataView<T>> - Parameters:
inMemoryDataProvider- data provider to use, notnull- Returns:
GridLayoutDataViewproviding information on the data
-
setItems
public GridLayoutListDataView<T> setItems(com.vaadin.flow.data.provider.ListDataProvider<T> listDataProvider) Sets aListDataProviderfor theJmixGridLayoutto use and returns aListDataViewthat provides information and allows operation on the items.- Specified by:
setItemsin interfacecom.vaadin.flow.data.provider.HasListDataView<T,GridLayoutListDataView<T>> - Parameters:
listDataProvider- ListDataProvider providing items to theJmixGridLayout.- Returns:
GridLayoutListDataViewproviding access to the items
-
getListDataView
Gets the list data view for theJmixGridLayout. This data view should only be used when the items are in-memory and set with:HasListDataView.setItems(Collection)HasListDataView.setItems(Object[])setItems(ListDataProvider)
- Specified by:
getListDataViewin interfacecom.vaadin.flow.data.provider.HasListDataView<T,GridLayoutListDataView<T>> - Returns:
- the list data view that provides access to the data bound to the
JmixGridLayout
-
getGenericDataView
Gets the generic data view for theJmixGridLayout. This data view should only be used whengetListDataView()is not applicable for the underlying data provider.- Specified by:
getGenericDataViewin interfacecom.vaadin.flow.data.provider.HasDataView<T,Void, GridLayoutDataView<T>> - Returns:
- the generic DataView instance implementing
GridLayoutDataView
-
getItemId
-
fireSizeEvent
protected void fireSizeEvent() -
runBeforeClientResponse
protected void runBeforeClientResponse(com.vaadin.flow.function.SerializableConsumer<com.vaadin.flow.component.UI> command)
-