public abstract class AbstractAlignmentStyler extends Object
Abstract implementation of AlignmentStyler
, contains
utility methods for generating a set of HTML styles from a list of
RGB colours.
Thus getAlignmentStyles()
is implemented and all that
remains to be implemented is the getStyle
method.
Primary author - Colin Hardman (CAT) Other authors - Tim Dilks (CAT) Simon Brocklehurst (CAT) Stuart Johnston (CAT) Lawerence Bower (CAT) Derek Crockford (CAT) Neil Benn (CAT) Copyright 2001 Cambridge Antibody Technology Group plc.
This code released to the biojava project, May 2001 under the LGPL license.
Modifier and Type | Field and Description |
---|---|
protected int |
iNumberOfColours
The number of unique colours.
|
protected HashMap |
oColourClassMap
Stores mapping from a Colour to a FONT Class.
|
protected HashMap |
oColourMap
Map between Char and the Colour class.
|
protected HashSet |
oColourSet
Store the unique colours for markup.
|
Constructor and Description |
---|
AbstractAlignmentStyler() |
Modifier and Type | Method and Description |
---|---|
void |
addStyle(String poChar,
String poColour)
Add a colour style to this Styler.
|
String |
getAlignmentStyles()
Returns a fragment of HTML that defines the FONT
styles to be used in the alignment markup.
|
protected String |
getColourClass(String poColour)
Returns the colour class for the specified colour (in hex).
|
abstract void |
getStyle(String poFirst,
String poSecond,
String[] poStyleHolder)
Return the styles for the two aligned characters.
|
protected HashSet oColourSet
protected HashMap oColourClassMap
Stores mapping from a Colour to a FONT Class.
For example:
Key Value --- ----- #000000 C1-S
protected int iNumberOfColours
protected HashMap oColourMap
Map between Char and the Colour class.
Eg.
Key Value --- ----- A C1-S
public AbstractAlignmentStyler()
public String getAlignmentStyles()
Returns a fragment of HTML that defines the FONT styles to be used in the alignment markup.
For example:
FONT.C2-S{background-color:#FFFC50;color:#000000} FONT.C4-S{background-color:#FC50FF;color:#000000} FONT.C3-S{background-color:#FF7272;color:#000000} FONT.C0-S{background-color:#50FF78;color:#000000} FONT.C1-S{background-color:#FFCA50;color:#000000} FONT.C5-S{background-color:#A5A5FF;color:#000000}
public abstract void getStyle(String poFirst, String poSecond, String[] poStyleHolder)
Return the styles for the two aligned characters. (in the form of predefined font classes).
Null is acceptable value for no style.
poFirst
- - the first char in the alignmentpoSecond
- - the second char in the alignmentpoStyleHolder
- - an array to hold the styles, [0] = first etcpublic void addStyle(String poChar, String poColour)
poChar
- the char for which this colour applies.poColour
- the color in hex eg 'FFA2A2' for a nice red
( R = FF, G = A2 and B = A2 )protected String getColourClass(String poColour)
Returns the colour class for the specified colour (in hex). If one is not already defined for that colour then a new class is created and returned.
Colour specification is R G B in hex ie FF00FF is r = 255, g = 0, b = 255.
poColour
- - a colour, eg 'C8FFC8'Copyright © 2014 BioJava. All rights reserved.