Class SelectionEventSource<N extends NodeWrapper>
java.lang.Object
org.knime.gateway.impl.service.events.EventSource<N,SelectionEvent>
org.knime.gateway.impl.service.events.SelectionEventSource<N>
- Type Parameters:
N-
public final class SelectionEventSource<N extends NodeWrapper>
extends EventSource<N,SelectionEvent>
An event source that emits selection events (i.e. hiliting events) to the given event consumer.
- Since:
- 4.5
- Author:
- Martin Horn, KNIME GmbH, Konstanz, Germany, Marc Bux, KNIME GmbH, Berlin, Germany
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe mode of selection event.static final record -
Constructor Summary
ConstructorsConstructorDescriptionSelectionEventSource(BiConsumer<String, Object> eventConsumer, TableViewManager<N> tableViewManager) -
Method Summary
Modifier and TypeMethodDescriptionRegisters 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()intThe total number of event listener registered for the event source.static voidprocessSelectionEvent(org.knime.core.node.property.hilite.HiLiteHandler hiLiteHandler, org.knime.core.node.workflow.NodeID nodeId, SelectionEventSource.SelectionEventMode selectionEventMode, boolean async, Set<org.knime.core.data.RowKey> rowKeys) Forwards selection events to the given hilite-handler.voidRemoves all event listeners registered with the event source.voidremoveEventListener(N nw) 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
-
SelectionEventSource
public SelectionEventSource(BiConsumer<String, Object> eventConsumer, TableViewManager<N> tableViewManager) - Parameters:
eventConsumer- selection events will be forwarded to this consumertableViewManager-
-
-
Method Details
-
getName
- Specified by:
getNamein classEventSource<N extends NodeWrapper,SelectionEvent> - Returns:
- a name unique to the event source
-
addEventListenerAndGetInitialEventFor
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:
addEventListenerAndGetInitialEventForin classEventSource<N extends NodeWrapper,SelectionEvent> - 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)
-
removeAllEventListeners
public void removeAllEventListeners()Removes all event listeners registered with the event source. After this method, no events will be emitted anymore.- Specified by:
removeAllEventListenersin classEventSource<N extends NodeWrapper,SelectionEvent>
-
removeEventListener
Removes an event listener for a particular event type instance.- Specified by:
removeEventListenerin classEventSource<N extends NodeWrapper,SelectionEvent>
-
getNumEventListeners
public int getNumEventListeners()The total number of event listener registered for the event source. Mainly for testing purposes.- Returns:
- the total number of event listeners registered
-
processSelectionEvent
public static void processSelectionEvent(org.knime.core.node.property.hilite.HiLiteHandler hiLiteHandler, org.knime.core.node.workflow.NodeID nodeId, SelectionEventSource.SelectionEventMode selectionEventMode, boolean async, Set<org.knime.core.data.RowKey> rowKeys) Forwards selection events to the given hilite-handler.- Parameters:
hiLiteHandler- hilite-handler to usenodeId- the id of the node the hilite-handler is associated withselectionEventMode- the selection event modeasync- iftrue, it will return immediately; iffalseit will return once the selection has been processed completely (i.e. once all associated nodes have received the selection change, too).rowKeys- the keys to be (un-)selected
-