Class AbstractAlignmentStyler
- java.lang.Object
-
- org.biojava.bio.program.blast2html.AbstractAlignmentStyler
-
- Direct Known Subclasses:
SimpleAlignmentStyler
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 thegetStyle
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.
- Version:
- 1.0
- Author:
- Cambridge Antibody Technology Group plc, Greg Cox
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description AbstractAlignmentStyler()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
oColourSet
protected HashSet oColourSet
Store the unique colours for markup.
-
oColourClassMap
protected HashMap oColourClassMap
Stores mapping from a Colour to a FONT Class.
For example:
Key Value --- ----- #000000 C1-S
-
iNumberOfColours
protected int iNumberOfColours
The number of unique colours.
-
oColourMap
protected HashMap oColourMap
Map between Char and the Colour class.
Eg.
Key Value --- ----- A C1-S
-
-
Constructor Detail
-
AbstractAlignmentStyler
public AbstractAlignmentStyler()
-
-
Method Detail
-
getAlignmentStyles
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}
- Returns:
- String - the HTML
-
getStyle
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.
- Parameters:
poFirst
- - the first char in the alignmentpoSecond
- - the second char in the alignmentpoStyleHolder
- - an array to hold the styles, [0] = first etc
-
addStyle
public void addStyle(String poChar, String poColour)
Add a colour style to this Styler.- Parameters:
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 )
-
getColourClass
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.
- Parameters:
poColour
- - a colour, eg 'C8FFC8'- Returns:
- String - the colour class, eg 'C1-S'
-
-