Class Annotatable.AnnotationForwarder

  • All Implemented Interfaces:
    EventListener, ChangeListener
    Enclosing interface:

    public static class Annotatable.AnnotationForwarder
    extends ChangeForwarder
    use new ChangeForwarder.Retyper(source, cs, Annotation.PROPERTY) instead

    A helper class so that you don't have to worry about forwarding events from the Annotation object to the Annotatable one.

    Once a listener is added to your Annotatable that is interested in ANNOTATION events, then instantiate one of these and add it as a listener to the annotation object. It will forward the events to your listeners and translate them accordingly.

    This will ease the pain of letting your Annotatable tell its listeners about changes in the Annotation.
    Matthew Pocock
    • Constructor Detail

      • AnnotationForwarder

        public AnnotationForwarder​(Object source,
                                   ChangeSupport cs)
        Create a new AnnotationForwarder that will forward events for a source using a change support.
        source - the Object to forward events on behalf of
        cs - the change support that manages listeners
    • Method Detail

      • generateEvent

        protected ChangeEvent generateEvent​(ChangeEvent ce)
        Description copied from class: ChangeForwarder

        Return the new event to represent the originating event ce.

        The returned ChangeEvent is the event that will be fired, and should be built from information in the original event. If it is null, then no event will be fired.

        The default implementation just constructs a ChangeEvent of the same type that chains back to ce.

        generateEvent in class ChangeForwarder
        ce - the originating ChangeEvent
        a new ChangeEvent to pass on, or null if no event should be sent