C - Type of component that is lazy-loaded.public class LazyLoad<C extends com.vaadin.flow.component.Component> extends com.vaadin.flow.component.Composite<LazyLoad.LazyLoadElement> implements WithIdMixin<LazyLoad<C>>, com.vaadin.flow.component.HasStyle
| Modifier and Type | Class and Description |
|---|---|
static class |
LazyLoad.LazyLoadElement
This class exists so that
LazyLoad can have a custom tag name. |
| Modifier and Type | Field and Description |
|---|---|
static String |
EMPTY_CLASS_NAME
Style name when this component is empty (not showing anything).
|
static String |
LOADED_CLASS_NAME
Style name when this component has content.
|
| Constructor and Description |
|---|
LazyLoad(C contents)
Creates lazy load wrapper for given contents.
|
LazyLoad(C contents,
boolean removeOnHide)
Creates lazy load wrapper for given contents.
|
LazyLoad(com.vaadin.flow.function.SerializableSupplier<C> supplier)
Creates lazy load wrapper for given component supplier.
|
LazyLoad(com.vaadin.flow.function.SerializableSupplier<C> supplier,
boolean removeOnHide)
Creates lazy load wrapper for given component supplier.
|
| Modifier and Type | Method and Description |
|---|---|
Optional<C> |
getLoadedContent()
Gets the content if it was already loaded (
isOnlyLoadedOnce() ()} is true) or if it is currently showing. |
boolean |
isLoaded()
Checks if the content has been already loaded (
isOnlyLoadedOnce() ()} is true) or is currently loaded. |
boolean |
isOnlyLoadedOnce()
Returns if the lazy loading happens only on the first showing.
|
protected void |
onNowHidden() |
protected void |
onNowVisible() |
getChildren, getContent, getElement, initContentaddListener, fireEvent, from, get, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwithIdpublic static final String EMPTY_CLASS_NAME
public static final String LOADED_CLASS_NAME
public LazyLoad(C contents)
contents - Contents to wrap for lazy loading.public LazyLoad(com.vaadin.flow.function.SerializableSupplier<C> supplier)
supplier - Supplier that will be called when the component gets into view.public LazyLoad(C contents, boolean removeOnHide)
contents - Contents to wrap for lazy loading.removeOnHide - Whether to remove the component when this object gets hidden.public LazyLoad(com.vaadin.flow.function.SerializableSupplier<C> supplier, boolean removeOnHide)
supplier - Supplier that will be called when the component gets into view.removeOnHide - Whether to remove the component when this object gets hidden.protected void onNowHidden()
protected void onNowVisible()
public boolean isOnlyLoadedOnce()
true when the target component will be loaded only once, the first time this component is shown; otherwise false.public Optional<C> getLoadedContent()
isOnlyLoadedOnce() ()} is true) or if it is currently showing.Optional.empty().isLoaded(),
isOnlyLoadedOnce()public boolean isLoaded()
isOnlyLoadedOnce() ()} is true) or is currently loaded.getLoadedContent(),
isOnlyLoadedOnce()Copyright © 2023 Miki. All rights reserved.