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 Details

    • NodeViewStateEventSource

      public NodeViewStateEventSource(BiConsumer<String,Object> eventConsumer, Runnable preEventCreationCallback, Supplier<List<String>> initialSelectionSupplier)
      Parameters:
      eventConsumer - all emitted events are passed to this consumer
      preEventCreationCallback - called right before a new event is created (and passed to the consumer)
      initialSelectionSupplier - supplier for the initial selection required to create a NodeViewEnt-instance
  • Method Details

    • addEventListenerAndGetInitialEventFor

      public Optional<NodeViewStateEvent> addEventListenerAndGetInitialEventFor(org.knime.core.node.workflow.NativeNodeContainer nnc)
      Description copied from class: EventSource
      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).
      Specified by:
      addEventListenerAndGetInitialEventFor in class EventSource<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: EventSource
      Removes an event listener for a particular event type instance.
      Specified by:
      removeEventListener in class EventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent>
    • removeAllEventListeners

      public void removeAllEventListeners()
      Description copied from class: EventSource
      Removes all event listeners registered with the event source. After this method, no events will be emitted anymore.
      Specified by:
      removeAllEventListeners in class EventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent>
    • getName

      protected String getName()
      Specified by:
      getName in class EventSource<org.knime.core.node.workflow.NativeNodeContainer,NodeViewStateEvent>
      Returns:
      a name unique to the event source