public class SingleColorTokenPainter extends AbstractTokenPainter implements TokenPainter
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_HEIGHT |
static double |
DEFAULT_WIDTH |
static float |
FONT_SIZE_FACTOR |
static int |
MIN_FONT_SIZE |
Constructor and Description |
---|
SingleColorTokenPainter() |
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
backgroundColorByRepresentation(java.lang.String tokenRepresentation,
java.awt.Color selectionColor)
Returns the same color as
getColor(String) but blends it with a selection color, if one is specified. |
protected java.awt.Font |
calculateFont(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D area,
java.lang.String text) |
void |
calculatePreferredWidth(TokenSet<?> tokenSet) |
protected void |
doPaintToken(AlignmentArea alignmentArea,
java.lang.String sequenceID,
int columnIndex,
java.lang.Object token,
java.lang.String tokenRepresentation,
java.awt.Graphics2D g,
java.awt.geom.Rectangle2D area,
java.awt.Color selectionColor)
Method to be implemented by inherited classes performing the actual paint operation.
|
boolean |
equals(java.lang.Object obj) |
java.util.Map<java.lang.String,java.awt.Color> |
getBackgroundColorMap() |
java.awt.Color |
getColor(java.lang.String tokenRepresentation)
Returns the background color associated with the specified token as stored in
getBackgroundColorMap() . |
java.awt.Color |
getDefaultBackgroundColor() |
java.awt.Color |
getFontColor() |
java.lang.String |
getFontName() |
int |
getFontStyle() |
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).
|
int |
hashCode() |
protected void |
paintText(java.awt.Graphics2D g,
java.awt.geom.Rectangle2D area,
java.lang.String text,
java.awt.Color selectionColor) |
void |
setDefaultBackgroundColor(java.awt.Color defaultBackgroundColor) |
void |
setFontColor(java.awt.Color fontColor) |
void |
setFontName(java.lang.String fontName) |
void |
setFontStyle(int fontStyle) |
paintToken
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
paintToken
public static final double DEFAULT_WIDTH
public static final double DEFAULT_HEIGHT
public static final float FONT_SIZE_FACTOR
public static final int MIN_FONT_SIZE
public SingleColorTokenPainter()
public java.awt.Color getDefaultBackgroundColor()
public void setDefaultBackgroundColor(java.awt.Color defaultBackgroundColor)
public java.awt.Color getFontColor()
public void setFontColor(java.awt.Color fontColor)
public java.lang.String getFontName()
public void setFontName(java.lang.String fontName)
public int getFontStyle()
public void setFontStyle(int fontStyle)
public java.util.Map<java.lang.String,java.awt.Color> getBackgroundColorMap()
public java.awt.Color getColor(java.lang.String tokenRepresentation)
getBackgroundColorMap()
.getColor
in interface TokenPainter
getColor
in class AbstractTokenPainter
tokenRepresentation
- the string representation of the tokengetDefaultBackgroundColor()
if no such color is definedTokenPainter.getColor(java.lang.String)
public java.awt.Color backgroundColorByRepresentation(java.lang.String tokenRepresentation, java.awt.Color selectionColor)
getColor(String)
but blends it with a selection color, if one is specified.tokenRepresentation
- the string representation of the tokenselectionColor
- the color of the selection in the associated alignment area (may be null
)protected java.awt.Font calculateFont(java.awt.Graphics2D g, java.awt.geom.Rectangle2D area, java.lang.String text)
protected void paintText(java.awt.Graphics2D g, java.awt.geom.Rectangle2D area, java.lang.String text, java.awt.Color selectionColor)
protected void doPaintToken(AlignmentArea alignmentArea, java.lang.String sequenceID, int columnIndex, java.lang.Object token, java.lang.String tokenRepresentation, java.awt.Graphics2D g, java.awt.geom.Rectangle2D area, java.awt.Color selectionColor)
AbstractTokenPainter
TokenPainter
by an additional parameter providing the string representation of
the token.
- * @param alignmentArea the alignment area displaying the token to be painteddoPaintToken
in class AbstractTokenPainter
sequenceID
- the ID of the sequence containing the token to be paintedcolumnIndex
- the index of the alignment column containing the token to be paintedtoken
- the token to be paintedtokenRepresentation
- the string representation of token
determined from the token set of
alignmentModel
g
- the graphics context to paint toarea
- 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
public void calculatePreferredWidth(TokenSet<?> tokenSet)
public double getPreferredWidth()
TokenPainter
getPreferredWidth
in interface TokenPainter
public double getPreferredHeight()
TokenPainter
getPreferredHeight
in interface TokenPainter
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object