Package org.biojava.bio.gui.sequence
Class PairwiseOverlayRenderer
java.lang.Object
org.biojava.utils.AbstractChangeable
org.biojava.bio.gui.sequence.PairwiseOverlayRenderer
- All Implemented Interfaces:
Serializable,PairwiseSequenceRenderer,Changeable
public class PairwiseOverlayRenderer
extends AbstractChangeable
implements PairwiseSequenceRenderer, 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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojava.bio.gui.sequence.PairwiseSequenceRenderer
PairwiseSequenceRenderer.PairwiseRendererForwarder -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ChangeTypeConstantRENDERERSindicating a change to the renderers handled by the overlay. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void_addRenderer(PairwiseSequenceRenderer renderer) protected void_removeRenderer(PairwiseSequenceRenderer renderer) voidaddRenderer(PairwiseSequenceRenderer renderer) addRendereradds a renderer.voidclearRenderersremoves all the renderers.protected ChangeSupportCalled to retrieve the ChangeSupport for this object.voidpaint(Graphics2D g2, PairwiseRenderContext context) paintapplies all renderers in the order in which they were added.processMouseEvent(PairwiseRenderContext context, MouseEvent me, List path) processMouseEventproduces aSequenceViewerEventin response to a mouse gesture.voidremoveRenderer(PairwiseSequenceRenderer renderer) removeRendererremoves a renderer.Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Field Details
-
RENDERERS
ConstantRENDERERSindicating a change to the renderers handled by the overlay.
-
-
Constructor Details
-
PairwiseOverlayRenderer
public PairwiseOverlayRenderer()Creates a new, emptyPairwiseOverlayRenderer.
-
-
Method Details
-
addRenderer
addRendereradds a renderer.- Parameters:
renderer- aPairwiseSequenceRenderer.- Throws:
ChangeVetoException- if an error occurs.
-
removeRenderer
removeRendererremoves a renderer.- Parameters:
renderer- aPairwiseSequenceRenderer.- Throws:
ChangeVetoException- if an error occurs.
-
clearRenderers
clearRenderersremoves all the renderers.- Throws:
ChangeVetoException- if an error occurs.
-
paint
paintapplies all renderers in the order in which they were added.- Specified by:
paintin interfacePairwiseSequenceRenderer- Parameters:
g2- aGraphics2D.context- aPairwiseRenderContext.
-
getChangeSupport
Description copied from class:AbstractChangeableCalled to retrieve the ChangeSupport for this object.Your implementation of this method should have the following structure:
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.ChangeSupport cs = super.getChangeSupport(ct); if(someForwarder == null && ct.isMatching(SomeInterface.SomeChangeType)) { someForwarder = new ChangeForwarder(... this.stateVariable.addChangeListener(someForwarder, VariableInterface.AChange); } return cs;- Overrides:
getChangeSupportin classAbstractChangeable
-
processMouseEvent
public SequenceViewerEvent processMouseEvent(PairwiseRenderContext context, MouseEvent me, List path) processMouseEventproduces aSequenceViewerEventin 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:
processMouseEventin interfacePairwiseSequenceRenderer- Parameters:
context- aPairwiseRenderContext.me- aMouseEventthat caused the request.path- aListofPairwiseSequenceRendererinstances passed through so far.- Returns:
- a
SequenceViewerEventencapsulating the mouse gesture.
-
_addRenderer
-
_removeRenderer
-