public abstract class Computation extends Object implements ReactiveValueChangeListener
doRecompute() whenever any reactive value used
by it changes. The recompute method is invoked by the next invocation of
Reactive.flush(), unless it has been invoked manually before the
global flush. A computation is also scheduled to for an initial
"recomputation" when it is created.| Constructor and Description |
|---|
Computation()
Creates a new computation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDependency(ReactiveValue dependency)
Adds a dependency to a reactive value.
|
protected abstract void |
doRecompute()
Does the actual recomputation.
|
boolean |
isInvalidated()
Checks whether this computation is invalidated.
|
void |
onNextInvalidate(InvalidateListener listener)
Adds an invalidate listener that will be invoked the next time this
computation is invalidated.
|
void |
onValueChange(ReactiveValueChangeEvent changeEvent)
Invoked when a reactive value has changed.
|
void |
recompute()
Recomputes this computation.
|
void |
stop()
Stops this computation, so that it will no longer be recomputed.
|
public void addDependency(ReactiveValue dependency)
This method is automatically called when a reactive value is used for recomputing this computation. The developer is not expected to call this method himself.
dependency - the reactive value to depend onpublic void onValueChange(ReactiveValueChangeEvent changeEvent)
ReactiveValueChangeListeneronValueChange in interface ReactiveValueChangeListenerchangeEvent - the change eventpublic void stop()
public boolean isInvalidated()
recompute() or
Reactive.flush() is invoked.true if this computation is invalidated; otherwise
falsepublic void recompute()
protected abstract void doRecompute()
public void onNextInvalidate(InvalidateListener listener)
listener - the listener to run on the next invalidationCopyright © 2000–2022 Vaadin Ltd. All rights reserved.