Class EMFFormsContextTracker
- java.lang.Object
-
- org.eclipse.emfforms.spi.core.services.view.EMFFormsContextTracker
-
public class EMFFormsContextTracker extends java.lang.Object
A tracker of the comings and goings of contexts in a hierarchy ofEMFFormsViewContext
s. This supplements theEMFFormsContextListener
andRootDomainModelChangeListener
APIs with specificity in the call-backs of which context in a hierarchy the call-back pertains to.- Since:
- 1.22
-
-
Constructor Summary
Constructors Constructor Description EMFFormsContextTracker(EMFFormsViewContext context)
Initializes me with the root context to track.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Stop tracking contexts.boolean
isRoot(EMFFormsViewContext context)
Query whether acontext
is the root of this tracker.EMFFormsContextTracker
onChildContextAdded(TriConsumer<? super EMFFormsViewContext,? super VElement,? super EMFFormsViewContext> handler)
Add a call-back to handle the addition of a new child context to a parent context.EMFFormsContextTracker
onChildContextRemoved(TriConsumer<? super EMFFormsViewContext,? super VElement,? super EMFFormsViewContext> handler)
Add a call-back to handle the removal of a child context from a parent context.EMFFormsContextTracker
onContextDisposed(java.util.function.Consumer<? super EMFFormsViewContext> handler)
Add a call-back to handle the disposal of a context, including the root context.EMFFormsContextTracker
onContextInitialized(java.util.function.Consumer<? super EMFFormsViewContext> handler)
Add a call-back to handle the initialization of a new context, including the root context.EMFFormsContextTracker
onDomainModelChanged(java.util.function.Consumer<? super EMFFormsViewContext> handler)
Add a call-back to handle the replacement of a context's domain model, including the root context.void
open()
Start tracking my root context.
-
-
-
Constructor Detail
-
EMFFormsContextTracker
public EMFFormsContextTracker(EMFFormsViewContext context)
Initializes me with the root context to track.- Parameters:
context
- the root context
-
-
Method Detail
-
isRoot
public boolean isRoot(EMFFormsViewContext context)
Query whether acontext
is the root of this tracker.- Parameters:
context
- a context- Returns:
- whether it is the root of the context tree being tracked
-
onContextInitialized
public EMFFormsContextTracker onContextInitialized(java.util.function.Consumer<? super EMFFormsViewContext> handler)
Add a call-back to handle the initialization of a new context, including the root context.- Parameters:
handler
- the call-back. It is invoked with the context that was initialized- Returns:
- myself, for convenience of call chaining
-
onContextDisposed
public EMFFormsContextTracker onContextDisposed(java.util.function.Consumer<? super EMFFormsViewContext> handler)
Add a call-back to handle the disposal of a context, including the root context.- Parameters:
handler
- the call-back. It is invoked with the context that was disposed- Returns:
- myself, for convenience of call chaining
-
onDomainModelChanged
public EMFFormsContextTracker onDomainModelChanged(java.util.function.Consumer<? super EMFFormsViewContext> handler)
Add a call-back to handle the replacement of a context's domain model, including the root context.- Parameters:
handler
- the call-back. It is invoked with the context that had its domain-model replaced- Returns:
- myself, for convenience of call chaining
-
onChildContextAdded
public EMFFormsContextTracker onChildContextAdded(TriConsumer<? super EMFFormsViewContext,? super VElement,? super EMFFormsViewContext> handler)
Add a call-back to handle the addition of a new child context to a parent context.- Parameters:
handler
- the call-back. It is invoked with the parent context, the parent element, and the child context that was added- Returns:
- myself, for convenience of call chaining
-
onChildContextRemoved
public EMFFormsContextTracker onChildContextRemoved(TriConsumer<? super EMFFormsViewContext,? super VElement,? super EMFFormsViewContext> handler)
Add a call-back to handle the removal of a child context from a parent context.- Parameters:
handler
- the call-back. It is invoked with the parent context, the parent element with which the child context was associated, and the child context that was removed- Returns:
- myself, for convenience of call chaining
-
open
public void open()
Start tracking my root context.
-
close
public void close()
Stop tracking contexts.
-
-