Class PairwiseFilteringRenderer
- All Implemented Interfaces:
Serializable,PairwiseSequenceRenderer,Changeable
PairwiseFilteringRenderer wraps a
PairwiseSequenceRenderer and filters the
PairwiseRenderContexts passed to it. The renderer
receives a new PairwiseRenderContext which has had
both of its FeatureHolders filtered with the
FeatureFilter.
Instances of this class cache up to 5 of the derived
PairwiseRenderContexts. Therefore cycling through up
to 5 different FeatureFilters will only be hitting the
cache rather than recalculating everthing. Should the
FeatureHolders themselves change, the cache will be
flushed. As only the features overlapping the context's range are
filtered, changing the range will also result in re-filtering.
- 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 TypeFieldDescriptionprotected FeatureFilterfilteris the filter applied to bothFeatureHolders.static final ChangeTypeConstantFILTERindicating a change to the renderer's filter.protected booleanrecurseindicates whether the filter should recurse through any subfeatures.static final ChangeTypeConstantRECURSEindicating a change to the renderer's filter recursion flag.static final ChangeTypeConstantRENDERERindicating a change to the renderer. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a newPairwiseFilteringRendererwhich uses a filter which accepts all features.PairwiseFilteringRenderer(PairwiseSequenceRenderer renderer, FeatureFilter filter, boolean recurse) Creates a newPairwiseFilteringRenderer. -
Method Summary
Modifier and TypeMethodDescriptionprotected ChangeSupportCalled to retrieve the ChangeSupport for this object.getFilterreturns the current filter.booleangetRecursereturns the recursion flag of the filter.getRendererreturn the current renderer.protected PairwiseRenderContextgetSubContext(PairwiseRenderContext context) getSubContextcreates a new context which hasFeatureHolders filtered using the current filter.voidpaint(Graphics2D g2, PairwiseRenderContext context) paints some or all of the information about the sequence pair.processMouseEvent(PairwiseRenderContext context, MouseEvent me, List path) processMouseEventproduces aSequenceViewerEventin response to a mouse gesture.voidsetFilter(FeatureFilter filter) setFiltersets the filter.voidsetRecurse(boolean recurse) setRecursesets the recursion flag on the filter.voidsetRenderer(PairwiseSequenceRenderer renderer) setRenderersets the renderer.Methods inherited from class org.biojava.utils.AbstractChangeable
addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener
-
Field Details
-
FILTER
ConstantFILTERindicating a change to the renderer's filter. -
RECURSE
ConstantRECURSEindicating a change to the renderer's filter recursion flag. -
RENDERER
ConstantRENDERERindicating a change to the renderer. -
filter
filteris the filter applied to bothFeatureHolders. -
recurse
recurseindicates whether the filter should recurse through any subfeatures.
-
-
Constructor Details
-
PairwiseFilteringRenderer
Creates a newPairwiseFilteringRendererwhich uses a filter which accepts all features.- Parameters:
renderer- aPairwiseSequenceRenderer.
-
PairwiseFilteringRenderer
public PairwiseFilteringRenderer(PairwiseSequenceRenderer renderer, FeatureFilter filter, boolean recurse) Creates a newPairwiseFilteringRenderer.- Parameters:
renderer- aPairwiseSequenceRenderer.filter- aFeatureFilter.recurse- aboolean.
-
-
Method Details
-
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
-
getRenderer
getRendererreturn the current renderer.- Returns:
- a
PairwiseSequenceRenderer.
-
setRenderer
setRenderersets the renderer.- Parameters:
renderer- aPairwiseSequenceRenderer.- Throws:
ChangeVetoException- if the change is vetoed.
-
getFilter
getFilterreturns the current filter.- Returns:
- a
FeatureFilter.
-
setFilter
setFiltersets the filter.- Parameters:
filter- aFeatureFilter.- Throws:
ChangeVetoException- if the change is vetoed.
-
getRecurse
getRecursereturns the recursion flag of the filter.- Returns:
- a
boolean.
-
setRecurse
setRecursesets the recursion flag on the filter.- Parameters:
recurse- aboolean.- Throws:
ChangeVetoException- if the change is vetoed.
-
paint
Description copied from interface:PairwiseSequenceRendererpaints some or all of the information about the sequence pair.- Specified by:
paintin interfacePairwiseSequenceRenderer- Parameters:
g2- aGraphics2D.context- aPairwiseRenderContextencapsulating the information to be displayed.
-
processMouseEvent
public SequenceViewerEvent processMouseEvent(PairwiseRenderContext context, MouseEvent me, List path) Description copied from interface:PairwiseSequenceRendererprocessMouseEventproduces aSequenceViewerEventin response to a mouse gesture.- Specified by:
processMouseEventin interfacePairwiseSequenceRenderer- Parameters:
context- aPairwiseRenderContext.me- aMouseEventthat caused the request.path- aListofPairwiseSequenceRendererinstances passed through so far.- Returns:
- a
SequenceViewerEventencapsulating the mouse gesture.
-
getSubContext
getSubContextcreates a new context which hasFeatureHolders filtered using the current filter.- Parameters:
context- aPairwiseRenderContext.- Returns:
- a
PairwiseRenderContext.
-