org.apache.beehive.controls.api.events
Annotation Type EventSet


@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface EventSet

The EventSet annotation type is used to mark an interface that defines a group of events associated with a Java Control. By convention, event interfaces are defined as inner classes on the Java Control public interface. Each method defined within a event interface indicates an event that can be delivered by the control.

Here is a simple example:

 public interface MyControl extends org.apache.beehive.controls.api.Control
 {
     @EventSet
     public interface MyEvents
     {
         public void anEvent();
     }

     ...
 }
 
This will declare an event interface named MyEvents that declares a single event: anEvent The declaration of an EventSet for a control also means that the associated Control JavaBean will have listener registration/deregistration APIs. The name of these APIs will be add/removeListener, and the argument will be an listener instance that implements the EventSet interface.

The above example would result in the following APIs on MyControlBean

 public class MyControlBean implements MyControl
 {
     ...
     public void addMyEventsListener(MyEvents listener) { ... }
     public void removeMyEventsListener(MyEvents listener) { ... }
 


Optional Element Summary
 boolean unicast
          Defines whether the events defined by the interface are unicast events.
 

unicast

public abstract boolean unicast
Defines whether the events defined by the interface are unicast events. A unicast event set may have only a single listener registered to receive events for any given bean instance. Any attempt to register additional listeners will result in a java.util.TooManyListenersException being thrown by the event listener registration method.

If an event set provides multicast support (the default), then it may only declare event methods that have a void return type. Unicast event sets may support event return values, that will be provided by the (single) registered listener.

Default:
false