Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Instance parameters support the following pre-defined variables: ${username}, ${viewName} and ${instanceName}

Events

Events are an important component of the views framework. Events allow the view to interact with the framework on lifecycle changes (i.e. "framework eventsFramework Events") . such as deploy, create and destroy. As well, once a user has collection of views available, eventing allows the views to communicate with other views (i.e. "view eventsView Events").

Framework Events

To register to receive framework events, in the view.xml, specify a <view-class>this.is.my.view-clazz</view-class> which is a class that implements the View interface.

Image Added

EventDescription
onDeploy()Called when a view is deployed.
onCreate()Called when a view instance is created.
onDestroy()Called when a view instance is destroy.

To register to receive framework events, in the view.xml, specify a <view-class>this.is.my.view-clazz</view-class> which is a class that implements the View interface.

View Events
Views Events

Views can pass events between views. Obtain From the view context, you can obtain the ViewController object that allows you to register listeners for view events and to fire events for other listeners.

Code Block
ViewController viewContext.getViewController();
Registering Listeners

A view can register an event Listener from (via the ViewController) for other views by view name, or by view name + version. When an Event is fired from the source view, all registered listeners will receive the event.

Info

Typically, a view implementation will register event listeners during the onDeploy() framework event (via a <view-class>).

Firing and Receiving Events

Image Added

  1. Obtain the view controller and register a listener.
    viewContext.getViewController().registerListener(...);
  2. Create an event.
  3. Fire the event.
    viewContext.getViewController().fireEvent(event...);

  4. The framework will notify all registered listeners. The listener implementation can process the event as appropriate.
    listener.notify(event)...)