@JsModule(value="./component-observer.js") @Tag(value="component-observer") public class ComponentObserver extends com.vaadin.flow.component.Component implements WithIdMixin<ComponentObserver>
| Constructor and Description |
|---|
ComponentObserver(com.vaadin.flow.component.Component viewportRoot,
String rootMargin,
double... visibilityRanges)
Creates the observer using provided document as viewport root and provided root margins.
|
ComponentObserver(double... visibilityRanges)
Creates the observer using entire document as viewport.
|
| Modifier and Type | Method and Description |
|---|---|
com.vaadin.flow.shared.Registration |
addComponentObservationListener(ComponentObservationListener listener)
Adds a listener that will be informed about changes in observed components.
|
protected void |
fireComponentObservationEvent(ComponentObservationEvent event)
Broadcasts the event using
Component.getEventBus(). |
double[] |
getVisibilityRanges()
Returns an array with visibility ranges registered for this component.
|
protected void |
initClient() |
boolean |
isObserving(com.vaadin.flow.component.Component component)
Checks whether or not given
Component is being observed by this object. |
void |
observe(com.vaadin.flow.component.Component... components)
Starts observation of given components.
|
protected void |
observe(String indexString,
com.vaadin.flow.component.Component component)
Observes the given component with given index.
|
protected void |
onAttach(com.vaadin.flow.component.AttachEvent attachEvent) |
protected void |
onDetach(com.vaadin.flow.component.DetachEvent detachEvent) |
void |
unobserve(com.vaadin.flow.component.Component... components)
Stops observation of given components.
|
addListener, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onEnabledStateChanged, set, setElement, setId, setVisibleclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwithIdpublic ComponentObserver(double... visibilityRanges)
visibilityRanges - Ranges at which to trigger visibility change events. If not specified, [0.0, 1.0] will be used.public ComponentObserver(com.vaadin.flow.component.Component viewportRoot,
String rootMargin,
double... visibilityRanges)
viewportRoot - Component to use as viewport root.rootMargin - Root margin (CSS-like expression).visibilityRanges - Ranges at which to trigger visibility change events. If not specified, [0.0, 1.0] will be used.protected void initClient()
protected void onDetach(com.vaadin.flow.component.DetachEvent detachEvent)
onDetach in class com.vaadin.flow.component.Componentprotected void onAttach(com.vaadin.flow.component.AttachEvent attachEvent)
onAttach in class com.vaadin.flow.component.Componentprotected void fireComponentObservationEvent(ComponentObservationEvent event)
Component.getEventBus().event - Event with relevant information about what happened.protected void observe(String indexString, com.vaadin.flow.component.Component component)
indexString - Index string to register the component with.component - Component to observe.public void observe(com.vaadin.flow.component.Component... components)
unobserve(Component...) method is called.components - Components to observe.public void unobserve(com.vaadin.flow.component.Component... components)
observe(Component...), nothing will happen.components - Components to stop observing.public com.vaadin.flow.shared.Registration addComponentObservationListener(ComponentObservationListener listener)
listener - Listener to add.public boolean isObserving(com.vaadin.flow.component.Component component)
Component is being observed by this object.component - A Component.true when the component has been added through observe(Component...) and not removed with unobserve(Component...).public double[] getVisibilityRanges()
Copyright © 2023 Miki. All rights reserved.