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

    java.lang.Object
      org.biojava.bio.gui.sequence.SubPairwiseRenderContext

All Implemented Interfaces:
  SwingConstants, PairwiseRenderContext, SequenceRenderContext

    public class SubPairwiseRenderContext

extends Object
implements PairwiseRenderContext

`SubPairwiseRenderContext` is a rendering context which wraps a delegate context and effectively hides some of the delegate's properties with its own. If any of the `SymbolList`, `FeatureHolder` or `RangeLocation` arguments are not null, their values are returned. Otherwise the delegate's method is called and its return value is returned instead.

Since:
  1.2
Author:
  Keith James, Matthew Pocock

Nested Class Summary

Nested classes/interfaces inherited from interface org.biojava.bio.gui.sequence.SequenceRenderContext
`SequenceRenderContext.Border`

Field Summary

Fields inherited from interface org.biojava.bio.gui.sequence.SequenceRenderContext
`LAYOUT, REPAINT`

Fields inherited from interface javax.swing.SwingConstants
`BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST`

Constructor Summary
`SubPairwiseRenderContext(PairwiseRenderContext context, SymbolList symbols, SymbolList secondarySymbols, FeatureHolder features, FeatureHolder secondaryFeatures, RangeLocation range, RangeLocation secondaryRange)` Creates a new `SubPairwiseRenderContext`.

Method Summary
`int` `getDirection()` Gets the direction in which this context expects sequences to be rendered - HORIZONTAL or VERTICAL.
`FeatureHolder` `getFeatures()` The features to render.
`Font` `getFont()` Gets the Font attribute of the SequenceRenderContext object
`SequenceRenderContext.Border` `getLeadingBorder()` Gets the LeadingBorder attribute of the SequenceRenderContext object.
`RangeLocation` `getRange()` The range of the SymbolList to render.
`double` `getScale()` Gets the scale as pixels per Symbol
`int` `getSecondaryDirection()` `getSecondaryDirection` returns the direction in which the secondary sequence is rendered.
`FeatureHolder` `getSecondaryFeatures()` `getSecondaryFeatures` returns the features on the secondary sequence.
`RangeLocation` `getSecondaryRange()` `getSecondaryRange` returns the range of the secondary sequence currently rendered.
`SymbolList` `getSecondarySymbols()` `getSecondarySymbols` returns the symbols of the secondary sequence.
`SymbolList` `getSymbols()` The SymbolList that is currently rendered by this SequenceRenderContext.
`SequenceRenderContext.Border` `getTrailingBorder()` Gets the TrailingBorder attribute of the SequenceRenderContext object.
`int` `graphicsToSecondarySequence(double graphicsPos)` `graphicsToSecondarySequence` converts a graphical position to a sequence coordinate on the secondary sequence.
`int` `graphicsToSecondarySequence(Point point)` `graphicsToSecondarySequence` converts a graphical position to a secondary sequence index.
`int` `graphicsToSequence(double graphicsPos)` Converts a graphical position into a sequence coordinate.
`int` `graphicsToSequence(Point2D point)` Converts a graphical position into a sequence coordinate.
`double` `secondarySequenceToGraphics(int sequencePos)` `secondarySequenceToGraphics` converts a sequence coordinate on the secondary sequence to a graphical position.
`double` `sequenceToGraphics(int sequencePos)` Converts a sequence index into a graphical coordinate.

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

Constructor Detail

### SubPairwiseRenderContext

    public SubPairwiseRenderContext(PairwiseRenderContext context,
                                    SymbolList symbols,
                                    SymbolList secondarySymbols,
                                    FeatureHolder features,
                                    FeatureHolder secondaryFeatures,
                                    RangeLocation range,
                                    RangeLocation secondaryRange)

  Creates a new `SubPairwiseRenderContext`.

  Parameters:
    `context` - a `PairwiseRenderContext` to wrap. This should not be null.
    `symbols` - a `SymbolList` to use instead of the delegate's. May be null.
    `secondarySymbols` - a `SymbolList` to use instead of the delegate's. May be null.
    `features` - a `FeatureHolder` to use instead of the delegate's. May be null.
    `secondaryFeatures` - a `FeatureHolder` to use instead of the delegate's. May be null.
    `range` - a `RangeLocation` to use instead of the delegate's. May be null.
    `secondaryRange` - a `RangeLocation` to use instead of the delegate's. May be null.

Method Detail

### getSymbols

    public SymbolList getSymbols()

  Description copied from interface: `SequenceRenderContext`
  The SymbolList that is currently rendered by this SequenceRenderContext.

  Specified by:
    `getSymbols` in interface `SequenceRenderContext`
  Returns:
    The Sequence value

### getSecondarySymbols

    public SymbolList getSecondarySymbols()

  Description copied from interface: `PairwiseRenderContext`
  `getSecondarySymbols` returns the symbols of the secondary sequence.

  Specified by:
    `getSecondarySymbols` in interface `PairwiseRenderContext`
  Returns:
    a `SymbolList`.

### getFeatures

    public FeatureHolder getFeatures()

  Description copied from interface: `SequenceRenderContext`
  The features to render.

  Specified by:
    `getFeatures` in interface `SequenceRenderContext`
  Returns:
    a FeatureHolder with the Features to render

### getSecondaryFeatures

    public FeatureHolder getSecondaryFeatures()

  Description copied from interface: `PairwiseRenderContext`
  `getSecondaryFeatures` returns the features on the secondary sequence.

  Specified by:
    `getSecondaryFeatures` in interface `PairwiseRenderContext`
  Returns:
    a `FeatureHolder`.

### getRange

    public RangeLocation getRange()

  Description copied from interface: `SequenceRenderContext`
  The range of the SymbolList to render.

  Specified by:
    `getRange` in interface `SequenceRenderContext`
  Returns:
    the RangeLocation specifying which indices (inclusive) to render

### getSecondaryRange

    public RangeLocation getSecondaryRange()

  Description copied from interface: `PairwiseRenderContext`
  `getSecondaryRange` returns the range of the secondary sequence currently rendered.

  Specified by:
    `getSecondaryRange` in interface `PairwiseRenderContext`
  Returns:
    a `RangeLocation`.

### getDirection

    public int getDirection()

  Description copied from interface: `SequenceRenderContext`
  Gets the direction in which this context expects sequences to be rendered - HORIZONTAL or VERTICAL.

  Specified by:
    `getDirection` in interface `SequenceRenderContext`
  Returns:
    The Direction value

### getSecondaryDirection

    public int getSecondaryDirection()

  Description copied from interface: `PairwiseRenderContext`
  `getSecondaryDirection` returns the direction in which the secondary sequence is rendered. This may be either HORIZONTAL or VERTICAL.

  Specified by:
    `getSecondaryDirection` in interface `PairwiseRenderContext`
  Returns:
    an `int`.

### getScale

    public double getScale()

  Description copied from interface: `SequenceRenderContext`
  Gets the scale as pixels per Symbol

  Specified by:
    `getScale` in interface `SequenceRenderContext`
  Returns:
    The scale value

### getLeadingBorder

    public SequenceRenderContext.Border getLeadingBorder()

  Description copied from interface: `SequenceRenderContext`
  Gets the LeadingBorder attribute of the SequenceRenderContext object. This represents the space between the beginning of the rendering area and the beginning of the sequence.

  Specified by:
    `getLeadingBorder` in interface `SequenceRenderContext`
  Returns:
    The LeadingBorder value

### getTrailingBorder

    public SequenceRenderContext.Border getTrailingBorder()

  Description copied from interface: `SequenceRenderContext`
  Gets the TrailingBorder attribute of the SequenceRenderContext object. This represents the space between the end of the sequence and the end of the rendering area.

  Specified by:
    `getTrailingBorder` in interface `SequenceRenderContext`
  Returns:
    The TrailingBorder value

### sequenceToGraphics

    public double sequenceToGraphics(int sequencePos)

  Description copied from interface: `SequenceRenderContext`
  Converts a sequence index into a graphical coordinate. You will need to use this in conjunction with getDirection to correctly lay graphics out.

  Specified by:
    `sequenceToGraphics` in interface `SequenceRenderContext`
  Parameters:
    `sequencePos` - Index within the sequence
  Returns:
    Equivalent graphical position in pixels

### secondarySequenceToGraphics

    public double secondarySequenceToGraphics(int sequencePos)

  Description copied from interface: `PairwiseRenderContext`
  `secondarySequenceToGraphics` converts a sequence coordinate on the secondary sequence to a graphical position.

  Specified by:
    `secondarySequenceToGraphics` in interface `PairwiseRenderContext`
  Parameters:
    `sequencePos` - an `int`.
  Returns:
    a `double`.

### graphicsToSequence

    public int graphicsToSequence(double graphicsPos)

  Description copied from interface: `SequenceRenderContext`
  Converts a graphical position into a sequence coordinate. You will need to have used getDirection to decide whether to use the x or y coordinate.

  Specified by:
    `graphicsToSequence` in interface `SequenceRenderContext`
  Parameters:
    `graphicsPos` - A pixel position
  Returns:
    The corresponding sequence index

### graphicsToSequence

    public int graphicsToSequence(Point2D point)

  Description copied from interface: `SequenceRenderContext`
  Converts a graphical position into a sequence coordinate. This will use getDirection to decide whether to use the x or y coordinate.

  Specified by:
    `graphicsToSequence` in interface `SequenceRenderContext`
  Parameters:
    `point` - a point representing the position
  Returns:
    the corresponding sequence index

### graphicsToSecondarySequence

    public int graphicsToSecondarySequence(double graphicsPos)

  Description copied from interface: `PairwiseRenderContext`
  `graphicsToSecondarySequence` converts a graphical position to a sequence coordinate on the secondary sequence.

  Specified by:
    `graphicsToSecondarySequence` in interface `PairwiseRenderContext`
  Parameters:
    `graphicsPos` - a `double`.
  Returns:
    an `int`.

### graphicsToSecondarySequence

    public int graphicsToSecondarySequence(Point point)

  Description copied from interface: `PairwiseRenderContext`
  `graphicsToSecondarySequence` converts a graphical position to a secondary sequence index.

  Specified by:
    `graphicsToSecondarySequence` in interface `PairwiseRenderContext`
  Parameters:
    `point` - a `Point`.
  Returns:
    an `int`.

### getFont

    public Font getFont()

  Description copied from interface: `SequenceRenderContext`
  Gets the Font attribute of the SequenceRenderContext object

  Specified by:
    `getFont` in interface `SequenceRenderContext`
  Returns:
    The Font value