Package 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
SubPairwiseRenderContextis a rendering context which wraps a delegate context and effectively hides some of the delegate's properties with its own. If any of theSymbolList,FeatureHolderorRangeLocationarguments 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
Constructors Constructor Description SubPairwiseRenderContext(PairwiseRenderContext context, SymbolList symbols, SymbolList secondarySymbols, FeatureHolder features, FeatureHolder secondaryFeatures, RangeLocation range, RangeLocation secondaryRange)Creates a newSubPairwiseRenderContext.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDirection()Gets the direction in which this context expects sequences to be rendered - HORIZONTAL or VERTICAL.FeatureHoldergetFeatures()The features to render.FontgetFont()Gets the Font attribute of the SequenceRenderContext objectSequenceRenderContext.BordergetLeadingBorder()Gets the LeadingBorder attribute of the SequenceRenderContext object.RangeLocationgetRange()The range of the SymbolList to render.doublegetScale()Gets the scale as pixels per SymbolintgetSecondaryDirection()getSecondaryDirectionreturns the direction in which the secondary sequence is rendered.FeatureHoldergetSecondaryFeatures()getSecondaryFeaturesreturns the features on the secondary sequence.RangeLocationgetSecondaryRange()getSecondaryRangereturns the range of the secondary sequence currently rendered.SymbolListgetSecondarySymbols()getSecondarySymbolsreturns the symbols of the secondary sequence.SymbolListgetSymbols()The SymbolList that is currently rendered by this SequenceRenderContext.SequenceRenderContext.BordergetTrailingBorder()Gets the TrailingBorder attribute of the SequenceRenderContext object.intgraphicsToSecondarySequence(double graphicsPos)graphicsToSecondarySequenceconverts a graphical position to a sequence coordinate on the secondary sequence.intgraphicsToSecondarySequence(Point point)graphicsToSecondarySequenceconverts a graphical position to a secondary sequence index.intgraphicsToSequence(double graphicsPos)Converts a graphical position into a sequence coordinate.intgraphicsToSequence(Point2D point)Converts a graphical position into a sequence coordinate.doublesecondarySequenceToGraphics(int sequencePos)secondarySequenceToGraphicsconverts a sequence coordinate on the secondary sequence to a graphical position.doublesequenceToGraphics(int sequencePos)Converts a sequence index into a graphical coordinate.
-
-
-
Constructor Detail
-
SubPairwiseRenderContext
public SubPairwiseRenderContext(PairwiseRenderContext context, SymbolList symbols, SymbolList secondarySymbols, FeatureHolder features, FeatureHolder secondaryFeatures, RangeLocation range, RangeLocation secondaryRange)
Creates a newSubPairwiseRenderContext.- Parameters:
context- aPairwiseRenderContextto wrap. This should not be null.symbols- aSymbolListto use instead of the delegate's. May be null.secondarySymbols- aSymbolListto use instead of the delegate's. May be null.features- aFeatureHolderto use instead of the delegate's. May be null.secondaryFeatures- aFeatureHolderto use instead of the delegate's. May be null.range- aRangeLocationto use instead of the delegate's. May be null.secondaryRange- aRangeLocationto use instead of the delegate's. May be null.
-
-
Method Detail
-
getSymbols
public SymbolList getSymbols()
Description copied from interface:SequenceRenderContextThe SymbolList that is currently rendered by this SequenceRenderContext.- Specified by:
getSymbolsin interfaceSequenceRenderContext- Returns:
- The Sequence value
-
getSecondarySymbols
public SymbolList getSecondarySymbols()
Description copied from interface:PairwiseRenderContextgetSecondarySymbolsreturns the symbols of the secondary sequence.- Specified by:
getSecondarySymbolsin interfacePairwiseRenderContext- Returns:
- a
SymbolList.
-
getFeatures
public FeatureHolder getFeatures()
Description copied from interface:SequenceRenderContextThe features to render.- Specified by:
getFeaturesin interfaceSequenceRenderContext- Returns:
- a FeatureHolder with the Features to render
-
getSecondaryFeatures
public FeatureHolder getSecondaryFeatures()
Description copied from interface:PairwiseRenderContextgetSecondaryFeaturesreturns the features on the secondary sequence.- Specified by:
getSecondaryFeaturesin interfacePairwiseRenderContext- Returns:
- a
FeatureHolder.
-
getRange
public RangeLocation getRange()
Description copied from interface:SequenceRenderContextThe range of the SymbolList to render.- Specified by:
getRangein interfaceSequenceRenderContext- Returns:
- the RangeLocation specifying which indices (inclusive) to render
-
getSecondaryRange
public RangeLocation getSecondaryRange()
Description copied from interface:PairwiseRenderContextgetSecondaryRangereturns the range of the secondary sequence currently rendered.- Specified by:
getSecondaryRangein interfacePairwiseRenderContext- Returns:
- a
RangeLocation.
-
getDirection
public int getDirection()
Description copied from interface:SequenceRenderContextGets the direction in which this context expects sequences to be rendered - HORIZONTAL or VERTICAL.- Specified by:
getDirectionin interfaceSequenceRenderContext- Returns:
- The Direction value
-
getSecondaryDirection
public int getSecondaryDirection()
Description copied from interface:PairwiseRenderContextgetSecondaryDirectionreturns the direction in which the secondary sequence is rendered. This may be either HORIZONTAL or VERTICAL.- Specified by:
getSecondaryDirectionin interfacePairwiseRenderContext- Returns:
- an
int.
-
getScale
public double getScale()
Description copied from interface:SequenceRenderContextGets the scale as pixels per Symbol- Specified by:
getScalein interfaceSequenceRenderContext- Returns:
- The scale value
-
getLeadingBorder
public SequenceRenderContext.Border getLeadingBorder()
Description copied from interface:SequenceRenderContextGets 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:
getLeadingBorderin interfaceSequenceRenderContext- Returns:
- The LeadingBorder value
-
getTrailingBorder
public SequenceRenderContext.Border getTrailingBorder()
Description copied from interface:SequenceRenderContextGets 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:
getTrailingBorderin interfaceSequenceRenderContext- Returns:
- The TrailingBorder value
-
sequenceToGraphics
public double sequenceToGraphics(int sequencePos)
Description copied from interface:SequenceRenderContextConverts a sequence index into a graphical coordinate. You will need to use this in conjunction with getDirection to correctly lay graphics out.- Specified by:
sequenceToGraphicsin interfaceSequenceRenderContext- Parameters:
sequencePos- Index within the sequence- Returns:
- Equivalent graphical position in pixels
-
secondarySequenceToGraphics
public double secondarySequenceToGraphics(int sequencePos)
Description copied from interface:PairwiseRenderContextsecondarySequenceToGraphicsconverts a sequence coordinate on the secondary sequence to a graphical position.- Specified by:
secondarySequenceToGraphicsin interfacePairwiseRenderContext- Parameters:
sequencePos- anint.- Returns:
- a
double.
-
graphicsToSequence
public int graphicsToSequence(double graphicsPos)
Description copied from interface:SequenceRenderContextConverts 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:
graphicsToSequencein interfaceSequenceRenderContext- Parameters:
graphicsPos- A pixel position- Returns:
- The corresponding sequence index
-
graphicsToSequence
public int graphicsToSequence(Point2D point)
Description copied from interface:SequenceRenderContextConverts a graphical position into a sequence coordinate. This will use getDirection to decide whether to use the x or y coordinate.- Specified by:
graphicsToSequencein interfaceSequenceRenderContext- Parameters:
point- a point representing the position- Returns:
- the corresponding sequence index
-
graphicsToSecondarySequence
public int graphicsToSecondarySequence(double graphicsPos)
Description copied from interface:PairwiseRenderContextgraphicsToSecondarySequenceconverts a graphical position to a sequence coordinate on the secondary sequence.- Specified by:
graphicsToSecondarySequencein interfacePairwiseRenderContext- Parameters:
graphicsPos- adouble.- Returns:
- an
int.
-
graphicsToSecondarySequence
public int graphicsToSecondarySequence(Point point)
Description copied from interface:PairwiseRenderContextgraphicsToSecondarySequenceconverts a graphical position to a secondary sequence index.- Specified by:
graphicsToSecondarySequencein interfacePairwiseRenderContext- Parameters:
point- aPoint.- Returns:
- an
int.
-
getFont
public Font getFont()
Description copied from interface:SequenceRenderContextGets the Font attribute of the SequenceRenderContext object- Specified by:
getFontin interfaceSequenceRenderContext- Returns:
- The Font value
-
-