Class NodeViewStateEventSource
java.lang.Object
org.knime.gateway.impl.service.events.EventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent>
org.knime.gateway.impl.service.events.NodeViewStateEventSource
public class NodeViewStateEventSource
extends EventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent>
Emits
NodeViewStateEvents which signal a node view to update itself (depending on the
underlying node state).
Implementation only covers 'single node views' so far and should eventually be extended to composite views, too (see
UIEXT-143).- Author:
- Martin Horn, KNIME GmbH, Konstanz, Germany
-
Constructor Summary
ConstructorsConstructorDescriptionNodeViewStateEventSource(BiConsumer<String, Object> eventConsumer, Runnable preEventCreationCallback, Supplier<List<String>> initialSelectionSupplier) -
Method Summary
Modifier and TypeMethodDescriptionaddEventListenerAndGetInitialEventFor(org.knime.core.node.workflow.NativeNodeContainer nnc) Registers a listener with the event source for the specified type of event and optionally returns the very first event to 'catch up' (instead of passing it to the associated event consumer).protected StringgetName()voidRemoves all event listeners registered with the event source.voidremoveEventListener(org.knime.core.node.workflow.NativeNodeContainer nnc) Removes an event listener for a particular event type instance.Methods inherited from class org.knime.gateway.impl.service.events.EventSource
addEventListenerFor, addEventListenerFor, preEventCreation, sendEvent, sendEvent, setPreEventCreationCallback
-
Constructor Details
-
NodeViewStateEventSource
public NodeViewStateEventSource(BiConsumer<String, Object> eventConsumer, Runnable preEventCreationCallback, Supplier<List<String>> initialSelectionSupplier) - Parameters:
eventConsumer- all emitted events are passed to this consumerpreEventCreationCallback- called right before a new event is created (and passed to the consumer)initialSelectionSupplier- supplier for the initial selection required to create aNodeViewEnt-instance
-
-
Method Details
-
addEventListenerAndGetInitialEventFor
public Optional<NodeViewStateEvent> addEventListenerAndGetInitialEventFor(org.knime.core.node.workflow.NativeNodeContainer nnc) Description copied from class:EventSourceRegisters a listener with the event source for the specified type of event and optionally returns the very first event to 'catch up' (instead of passing it to the associated event consumer).- Specified by:
addEventListenerAndGetInitialEventForin classEventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent> - Returns:
- the very first event or an empty optional if there isn't any (method must not wait for events to arrive - only returns if there is an event at event listener registration time)
-
removeEventListener
public void removeEventListener(org.knime.core.node.workflow.NativeNodeContainer nnc) Description copied from class:EventSourceRemoves an event listener for a particular event type instance.- Specified by:
removeEventListenerin classEventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent>
-
removeAllEventListeners
public void removeAllEventListeners()Description copied from class:EventSourceRemoves all event listeners registered with the event source. After this method, no events will be emitted anymore.- Specified by:
removeAllEventListenersin classEventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent>
-
getName
- Specified by:
getNamein classEventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent> - Returns:
- a name unique to the event source
-