Class PairwiseOverlayRenderer

  • All Implemented Interfaces:
    java.io.Serializable, PairwiseSequenceRenderer, Changeable

    public class PairwiseOverlayRenderer
    extends AbstractChangeable
    implements PairwiseSequenceRenderer, java.io.Serializable
    PairwiseOverlayRenderer allows a list of other PairwiseSequenceRenderers to superimpose their output. Operations on the child renderers (rendering, event handling) are carried out in the order in which they were added.
    Since:
    1.2
    Author:
    Keith James, Matthew Pocock
    See Also:
    Serialized Form
    • Field Detail

      • RENDERERS

        public static final ChangeType RENDERERS
        Constant RENDERERS indicating a change to the renderers handled by the overlay.
    • Constructor Detail

      • PairwiseOverlayRenderer

        public PairwiseOverlayRenderer()
        Creates a new, empty PairwiseOverlayRenderer.
    • Method Detail

      • paint

        public void paint​(java.awt.Graphics2D g2,
                          PairwiseRenderContext context)
        paint applies all renderers in the order in which they were added.
        Specified by:
        paint in interface PairwiseSequenceRenderer
        Parameters:
        g2 - a Graphics2D.
        context - a PairwiseRenderContext.
      • getChangeSupport

        protected ChangeSupport getChangeSupport​(ChangeType ct)
        Description copied from class: AbstractChangeable
        Called to retrieve the ChangeSupport for this object.

        Your implementation of this method should have the following structure:

         ChangeSupport cs = super.getChangeSupport(ct);
        
         if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) {
           someForwarder = new ChangeForwarder(...
        
           this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange);
         }
        
         return cs;
         
        It is usual for the forwarding listeners (someForwarder in this example) to be transient and lazily instantiated. Be sure to register & unregister the forwarder in the code that does the ChangeEvent handling in setter methods.
        Overrides:
        getChangeSupport in class AbstractChangeable
      • processMouseEvent

        public SequenceViewerEvent processMouseEvent​(PairwiseRenderContext context,
                                                     java.awt.event.MouseEvent me,
                                                     java.util.List path)
        processMouseEvent produces a SequenceViewerEvent in response to a mouse gesture. The list of renderers are probed in the order in which they were added and the first renderer to accept the event will return.
        Specified by:
        processMouseEvent in interface PairwiseSequenceRenderer
        Parameters:
        context - a PairwiseRenderContext.
        me - a MouseEvent that caused the request.
        path - a List of PairwiseSequenceRenderer instances passed through so far.
        Returns:
        a SequenceViewerEvent encapsulating the mouse gesture.