Cytoscape 3.0.1 API

org.cytoscape.event
Interface CyEventHelper


public interface CyEventHelper

The basic event handling interface for Cytoscape. All Cytoscape events should be fired using these methods. All listeners should be registered as CyListener services.


Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.

Field Summary
static int DEFAULT_PAYLOAD_INTERVAL_MILLIS
          The default number of milliseconds to wait before the next time that we will check for payload events to fire.
 
Method Summary
<S,P,E extends CyPayloadEvent<S,P>>
void
addEventPayload(S source, P payload, Class<E> eventType)
          Adds a payload object to be accumulated in a CyPayloadEvent.
<E extends CyEvent<?>>
void
fireEvent(E event)
          Calls each listener found in the Service Registry identified by the listenerClass interface by the supplied CyEvent.
 void flushPayloadEvents()
          Forces accumulated payload events to be fired.
 void silenceEventSource(Object eventSource)
          This method will prevent any events fired from the specified source object from being propagated to listeners.
 void unsilenceEventSource(Object eventSource)
          This method will allow events fired from the specified source object to be propagated to listeners.
 

Field Detail

DEFAULT_PAYLOAD_INTERVAL_MILLIS

static final int DEFAULT_PAYLOAD_INTERVAL_MILLIS
The default number of milliseconds to wait before the next time that we will check for payload events to fire.

See Also:
Constant Field Values
Method Detail

fireEvent

<E extends CyEvent<?>> void fireEvent(E event)
Calls each listener found in the Service Registry identified by the listenerClass interface by the supplied CyEvent.

Type Parameters:
E - The type of event fired.
Parameters:
event - The event to be fired.

addEventPayload

<S,P,E extends CyPayloadEvent<S,P>> void addEventPayload(S source,
                                                         P payload,
                                                         Class<E> eventType)
Adds a payload object to be accumulated in a CyPayloadEvent. The event is guaranteed to be fired after a certain duration where the single event contains all payload objects added to the event within that window of time. Payload objects added after an event has fired simply trigger a new event to fire at the next time point. All accumulated CyPayloadEvents are guaranteed to be fired before any normal CyEvents are fired.

Type Parameters:
S - the generic type of the object firing the event.
P - the generic type of the data payload to be added to the event.
E - the generic type of the event that the payload will be added to.
Parameters:
source - The object firing the event.
payload - The data payload to be added to the event that will eventually be fired.
eventType - The type of the event that the payload will be added to.

flushPayloadEvents

void flushPayloadEvents()
Forces accumulated payload events to be fired. This is a useful method that flushes all accumulated payload events, which are normally fired asynchronously to be fired synchronously at a precise time. While this method can be safely called at any time, it probably shouldn't be called as a force of habit.


silenceEventSource

void silenceEventSource(Object eventSource)
This method will prevent any events fired from the specified source object from being propagated to listeners. This applies to both normal events and accumulating event payloads.

Parameters:
eventSource - The object that should have its events blocked from being sent.

unsilenceEventSource

void unsilenceEventSource(Object eventSource)
This method will allow events fired from the specified source object to be propagated to listeners. This applies to both normal events and accumulating event payloads. This method only needs to be called if the silenceEventSource(eventSource) method has been called. Otherwise, all events are by default propagated normally.

Parameters:
eventSource - The object that should have its events sent to listeners.

Cytoscape 3.0.1 API

Copyright 2011 Cytoscape Consortium. All rights reserved.