EventPublisher (Griffon 0.9.5-rc2)
Date: 2012-03-09

Overview | Package | Class | Deprecated | Index | Help
| Griffon 0.9.5-rc2
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD

## griffon.core
[Java] Interface EventPublisher

    public interface EventPublisher

Base contract for classes that can publish events using their own event bus.

Authors:
  Andres Almiray

Since:
  0.9.3

Method Summary
`void` | `addEventListener(Object listener)` Adds an event listener.
`void` | `addEventListener(String eventName, Closure listener)` Adds a closure as an event listener.
`void` | `addEventListener(String eventName, RunnableWithArgs listener)` Adds a runnable as an event listener.
`boolean` | `isEventPublishingEnabled()` Returns whether events will be published by the event bus or not.
`void` | `publishEvent(String eventName)` Publishes an event.
`void` | `publishEvent(String eventName, List args)` Publishes an event.
`void` | `publishEventAsync(String eventName)` Publishes an event.
`void` | `publishEventAsync(String eventName, List args)` Publishes an event.
`void` | `publishEventOutside(String eventName)` Publishes an event.
`void` | `publishEventOutside(String eventName, List args)` Publishes an event.
`void` | `publishEventOutsideUI(String eventName)` Publishes an event.
`void` | `publishEventOutsideUI(String eventName, List args)` Publishes an event.
`void` | `removeEventListener(Object listener)` Removes an event listener.
`void` | `removeEventListener(String eventName, Closure listener)` Removes a closure as an event listener.
`void` | `removeEventListener(String eventName, RunnableWithArgs listener)` Removes a runnable as an event listener.
`void` | `setEventPublishingEnabled(boolean enabled)` Sets the enabled state for event publishing.

Method Detail

### addEventListener

    public void addEventListener(Object listener)

  Adds an event listener.

  Accepted types are: Script, Map and Object.

  Parameters:
    `listener` - an event listener

### addEventListener

    public void addEventListener(String eventName, Closure listener)

  Adds a closure as an event listener.

  Parameters:
    `eventName` - the name of the event
    `listener` - an event listener

### addEventListener

    public void addEventListener(String eventName, RunnableWithArgs listener)

  Adds a runnable as an event listener.

  Parameters:
    `eventName` - the name of the event
    `listener` - an event listener

### isEventPublishingEnabled

    public boolean isEventPublishingEnabled()

  Returns whether events will be published by the event bus or not.
  Returns:
    true if event publishing is enabled; false otherwise.

### publishEvent

    public void publishEvent(String eventName)

  Publishes an event.

  Listeners will be notified in the same thread as the publisher.

  Parameters:
    `eventName` - the name of the event

### publishEvent

    public void publishEvent(String eventName, List args)

  Publishes an event.

  Listeners will be notified in the same thread as the publisher.

  Parameters:
    `eventName` - the name of the event
    `args` - event arguments sent to listeners

### publishEventAsync

    public void publishEventAsync(String eventName)

  Publishes an event.

  Listeners will be notified in a different thread.

  Parameters:
    `eventName` - the name of the event

### publishEventAsync

    public void publishEventAsync(String eventName, List args)

  Publishes an event.

  Listeners will be notified in a different thread.

  Parameters:
    `eventName` - the name of the event
    `args` - event arguments sent to listeners

### publishEventOutside

    @Deprecated
    public void publishEventOutside(String eventName)

  Publishes an event.

  Listeners will be notified outside of the UI thread.

  deprecated:
    use #publishEventOutsideUI() instead
  Parameters:
    `eventName` - the name of the event

### publishEventOutside

    @Deprecated
    public void publishEventOutside(String eventName, List args)

  Publishes an event.

  Listeners will be notified outside of the UI thread.

  deprecated:
    use #publishEventOutsideUI() instead
  Parameters:
    `eventName` - the name of the event
    `args` - event arguments sent to listeners

### publishEventOutsideUI

    public void publishEventOutsideUI(String eventName)

  Publishes an event.

  Listeners will be notified outside of the UI thread.

  Parameters:
    `eventName` - the name of the event

### publishEventOutsideUI

    public void publishEventOutsideUI(String eventName, List args)

  Publishes an event.

  Listeners will be notified outside of the UI thread.

  Parameters:
    `eventName` - the name of the event
    `args` - event arguments sent to listeners

### removeEventListener

    public void removeEventListener(Object listener)

  Removes an event listener.

  Accepted types are: Script, Map and Object.

  Parameters:
    `listener` - an event listener

### removeEventListener

    public void removeEventListener(String eventName, Closure listener)

  Removes a closure as an event listener.

  Parameters:
    `eventName` - the name of the event
    `listener` - an event listener

### removeEventListener

    public void removeEventListener(String eventName, RunnableWithArgs listener)

  Removes a runnable as an event listener.

  Parameters:
    `eventName` - the name of the event
    `listener` - an event listener

### setEventPublishingEnabled

    public void setEventPublishingEnabled(boolean enabled)

  Sets the enabled state for event publishing. Events will be automatically discarded when the enabled state is set to false.
  Parameters:
    `enabled` - the value fot the enabled state.

Groovy Documentation