PairwiseFilteringRenderer (BioJava-1.5-beta API)
Keywords: org.biojava.bio.gui.sequence.PairwiseFilteringRenderer class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.gui.sequence
Class PairwiseFilteringRenderer

    java.lang.Object
      org.biojava.utils.AbstractChangeable
          org.biojava.bio.gui.sequence.PairwiseFilteringRenderer

All Implemented Interfaces:
  Serializable, PairwiseSequenceRenderer, Changeable

    public class PairwiseFilteringRenderer

extends AbstractChangeable
implements PairwiseSequenceRenderer, Serializable

`PairwiseFilteringRenderer` wraps a `PairwiseSequenceRenderer` and filters the `PairwiseRenderContext`s passed to it. The renderer receives a new `PairwiseRenderContext` which has had both of its `FeatureHolder`s filtered with the `FeatureFilter`.

Instances of this class cache up to 5 of the derived `PairwiseRenderContext`s. Therefore cycling through up to 5 different `FeatureFilter`s will only be hitting the cache rather than recalculating everthing. Should the `FeatureHolder`s 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:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface org.biojava.bio.gui.sequence.PairwiseSequenceRenderer
`PairwiseSequenceRenderer.PairwiseRendererForwarder`

Field Summary
`protected FeatureFilter` | `filter` `filter` is the filter applied to both `FeatureHolder`s.
`static ChangeType` | `FILTER` Constant `FILTER` indicating a change to the renderer's filter.
`protected boolean` | `recurse` `recurse` indicates whether the filter should recurse through any subfeatures.
`static ChangeType` | `RECURSE` Constant `RECURSE` indicating a change to the renderer's filter recursion flag.
`static ChangeType` | `RENDERER` Constant `RENDERER` indicating a change to the renderer.

Constructor Summary
`PairwiseFilteringRenderer(PairwiseSequenceRenderer renderer)` Creates a new `PairwiseFilteringRenderer` which uses a filter which accepts all features.
`PairwiseFilteringRenderer(PairwiseSequenceRenderer renderer, FeatureFilter filter, boolean recurse)` Creates a new `PairwiseFilteringRenderer`.

Method Summary
`protected ChangeSupport` | `getChangeSupport(ChangeType ct)` Called to retrieve the ChangeSupport for this object.
`FeatureFilter` | `getFilter()` `getFilter` returns the current filter.
`boolean` | `getRecurse()` `getRecurse` returns the recursion flag of the filter.
`PairwiseSequenceRenderer` | `getRenderer()` `getRenderer` return the current renderer.
`protected PairwiseRenderContext` | `getSubContext(PairwiseRenderContext context)` `getSubContext` creates a new context which has `FeatureHolder`s filtered using the current filter.
`void` | `paint(Graphics2D g2, PairwiseRenderContext context)` `paint`s some or all of the information about the sequence pair.
`SequenceViewerEvent` | `processMouseEvent(PairwiseRenderContext context, MouseEvent me, List path)` `processMouseEvent` produces a `SequenceViewerEvent` in response to a mouse gesture.
`void` | `setFilter(FeatureFilter filter)` `setFilter` sets the filter.
`void` | `setRecurse(boolean recurse)` `setRecurse` sets the recursion flag on the filter.
`void` | `setRenderer(PairwiseSequenceRenderer renderer)` `setRenderer` sets the renderer.

Methods inherited from class org.biojava.utils.AbstractChangeable
`addChangeListener, addChangeListener, generateChangeSupport, hasListeners, hasListeners, isUnchanging, removeChangeListener, removeChangeListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### FILTER

    public static final ChangeType FILTER

  Constant `FILTER` indicating a change to the renderer's filter.

### RECURSE

    public static final ChangeType RECURSE

  Constant `RECURSE` indicating a change to the renderer's filter recursion flag.

### RENDERER

    public static final ChangeType RENDERER

  Constant `RENDERER` indicating a change to the renderer.

### filter

    protected FeatureFilter filter

  `filter` is the filter applied to both `FeatureHolder`s.

### recurse

    protected boolean recurse

  `recurse` indicates whether the filter should recurse through any subfeatures.

Constructor Detail

### PairwiseFilteringRenderer

    public PairwiseFilteringRenderer(PairwiseSequenceRenderer renderer)

  Creates a new `PairwiseFilteringRenderer` which uses a filter which accepts all features.

  Parameters:
    `renderer` - a `PairwiseSequenceRenderer`.

### PairwiseFilteringRenderer

    public PairwiseFilteringRenderer(PairwiseSequenceRenderer renderer,
                                     FeatureFilter filter,
                                     boolean recurse)

  Creates a new `PairwiseFilteringRenderer`.

  Parameters:
    `renderer` - a `PairwiseSequenceRenderer`.
    `filter` - a `FeatureFilter`.
    `recurse` - a `boolean`.

Method Detail

### 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`

### getRenderer

    public PairwiseSequenceRenderer getRenderer()

  `getRenderer` return the current renderer.

  Returns:
    a `PairwiseSequenceRenderer`.

### setRenderer

    public void setRenderer(PairwiseSequenceRenderer renderer)
                     throws ChangeVetoException

  `setRenderer` sets the renderer.

  Parameters:
    `renderer` - a `PairwiseSequenceRenderer`.
  Throws:
    `ChangeVetoException` - if the change is vetoed.

### getFilter

    public FeatureFilter getFilter()

  `getFilter` returns the current filter.

  Returns:
    a `FeatureFilter`.

### setFilter

    public void setFilter(FeatureFilter filter)
                   throws ChangeVetoException

  `setFilter` sets the filter.

  Parameters:
    `filter` - a `FeatureFilter`.
  Throws:
    `ChangeVetoException` - if the change is vetoed.

### getRecurse

    public boolean getRecurse()

  `getRecurse` returns the recursion flag of the filter.

  Returns:
    a `boolean`.

### setRecurse

    public void setRecurse(boolean recurse)
                    throws ChangeVetoException

  `setRecurse` sets the recursion flag on the filter.

  Parameters:
    `recurse` - a `boolean`.
  Throws:
    `ChangeVetoException` - if the change is vetoed.

### paint

    public void paint(Graphics2D g2,
                      PairwiseRenderContext context)

  Description copied from interface: `PairwiseSequenceRenderer`
  `paint`s some or all of the information about the sequence pair.

  Specified by:
    `paint` in interface `PairwiseSequenceRenderer`
  Parameters:
    `g2` - a `Graphics2D`.
    `context` - a `PairwiseRenderContext` encapsulating the information to be displayed.

### processMouseEvent

    public SequenceViewerEvent processMouseEvent(PairwiseRenderContext context,
                                                 MouseEvent me,
                                                 List path)

  Description copied from interface: `PairwiseSequenceRenderer`
  `processMouseEvent` produces a `SequenceViewerEvent` in response to a mouse gesture.

  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.

### getSubContext

    protected PairwiseRenderContext getSubContext(PairwiseRenderContext context)

  `getSubContext` creates a new context which has `FeatureHolder`s filtered using the current filter.

  Parameters:
    `context` - a `PairwiseRenderContext`.
  Returns:
    a `PairwiseRenderContext`.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD