Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.sourceforge.jsxe
Class EditBus

    java.lang.Object
      net.sourceforge.jsxe.EditBus

public class EditBus
extends Object

jsXe's global event notification mechanism.

Plugins register with the EditBus to receive messages reflecting changes in the application's state, including changes in buffers, views and edit panes, changes in the set of properties maintained by the application, and the closing of the application.

The EditBus maintains a list of objects that have requested to receive messages. When a message is sent using this class, all registered components receive it in turn. Classes for objects that subscribe to the EditBus must implement the `EBListener` interface, which defines the single method `EBListener.handleMessage(EBMessage)`.

Any plugin core class whose name ends with `Plugin` (for identification purposes) will automatically be added to the EditBus during jsXe's startup routine. Any other class - for example, a dockable window that needs to receive notification of buffer changes - must perform its own registration by calling `addToBus(EBListener)` during its initialization. A convenient place to register in a class derived from `JComponent` would be in an implementation of the `JComponent` method`addNotify()`.

Message types sent by jsXe can be found in the `net.sourceforge.jsxe.msg` package.

Plugins can also send their own messages - any object can send a message to the EditBus by calling the static method `send(EBMessage)`. Most plugins, however, only concern themselves with receiving, not sending, messages.

Since:
  jsXe 0.5 pre1
Version:
  $Id$
Author:
  Ian Lewis (IanLewis@member.fsf.org), Slava Pestov, John Gellene (API documentation)
See Also:
  `EBListener`, `EBMessage`

Method Summary
`static void` | `addToBus(EBListener comp)` Adds a component to the bus.
`static EBListener[]` | `getComponents()` Returns an array of all components connected to the bus.
`static void` | `removeFromBus(EBListener comp)` Removes a component from the bus.
`static void` | `send(EBMessage message)` Sends a message to all components on the bus in turn.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### addToBus

    public static void addToBus(EBListener comp)

  Adds a component to the bus. It will receive all messages sent on the bus.

  Parameters:
    `comp` - The component to add

### removeFromBus

    public static void removeFromBus(EBListener comp)

  Removes a component from the bus.

  Parameters:
    `comp` - The component to remove

### getComponents

    public static EBListener[] getComponents()

  Returns an array of all components connected to the bus.

### send

    public static void send(EBMessage message)

  Sends a message to all components on the bus in turn.

  Parameters:
    `message` - The message

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD