public interface TokenPainter
AlignmentModel
in an AlignmentArea
.
Note that implementing classes should always consider if a token is selected and if any overlay colors are
set. (See also AlignmentArea.getSelection()
and AlignmentArea.getOverlays()
.) The preferred
way to implement a new token painter would be to inherit it from AbstractTokenPainter
which already
provides respective functionality by providing an overlayColor
parameter in its
AbstractTokenPainter.doPaintToken(AlignmentArea, String, int, Object, String, Graphics2D, Rectangle2D, Color)
method. All token painters provided with LibrAlign have respective functionality.
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getColor(java.lang.String tokenRepresentation)
Returns the color associated with the specified token.
|
double |
getPreferredHeight()
Returns the optimal height this painter would need to paint a supported token in original size (100 % zoom).
|
double |
getPreferredWidth()
Returns the optimal width this painter would need to paint a supported token in original size (100 % zoom).
|
void |
paintToken(AlignmentArea alignmentArea,
java.lang.String sequenceID,
int columnIndex,
java.awt.Graphics2D g,
java.awt.geom.Rectangle2D paintArea,
java.awt.Color selectionColor)
Paints a representation of the specified token filling up the specified area.
|
void paintToken(AlignmentArea alignmentArea, java.lang.String sequenceID, int columnIndex, java.awt.Graphics2D g, java.awt.geom.Rectangle2D paintArea, java.awt.Color selectionColor)
area
may be different from the preferred width and height specified by this instance, if necessary.
Tokens are identified by the alignment area they are contained in, the sequence ID of their sequence and their column index instead of a direct reference, to allow implementing classes to consider information e.g. on neighboring tokens. - * @param alignmentArea the alignment area displaying the token to be painted
sequenceID
- the ID of the sequence containing the token to be paintedcolumnIndex
- the index of the alignment column containing the token to be paintedg
- the graphics context to paint topaintArea
- the rectangle to be filled with the representation of the tokenselectionColor
- this color must be mixed by half with the painted output if it is not null
double getPreferredWidth()
double getPreferredHeight()
java.awt.Color getColor(java.lang.String tokenRepresentation)
This is an optional method. Classes not implementing this feature should always return null
here.
tokenRepresentation
- the string representation of the tokennull
of no associated color is known.