BioLegato 0.7.0 GDE Canvas plugin

org.biolegato.gdesupport.canvas.colourmap
Class ColourMap

java.lang.Object
  extended by org.biolegato.gdesupport.canvas.colourmap.ColourMap
Direct Known Subclasses:
MonochromeColourMap, PositionColourMap

public abstract class ColourMap
extends java.lang.Object

The superclass of all colour maps. Colour maps are used to provide different colour schemas to canvases. To implement a new schema, create a subclass that implements all of the methods you wish to override of the default schema.

Author:
Graham Alvare, Brian Fristensky

Field Summary
protected  java.awt.Color background
          The current default background colour of normal unselected text
protected  java.awt.Color backgroundSelect
          The current default background colour of normal selected text
protected  java.awt.Color foreground
          The current default foreground colour of normal unselected text
protected  java.awt.Color foregroundSelect
          The current default foreground colour of normal selected text
 
Constructor Summary
ColourMap()
          The abstract constructor for colour maps.
 
Method Summary
protected  void drawChars(BLTextArea ta, java.awt.Graphics gfx, int xstart, int ystart, char[] array, int index, int length, java.awt.Color foreground, java.awt.Color background)
          This is a function to help ensure proper spacing.
 java.awt.Color getBackground()
          Returns the current default background colour for painting portions of the canvas without text.
 java.awt.Color getForeground()
          Returns the current default foreground colour for painting portions of the canvas without text.
 java.lang.String getName()
          Returns the name of the colour map.
abstract  void regularDrawString(BLTextArea ta, java.awt.Graphics gfx, int xstart, int ystart, org.biolegato.core.data.sequence.Sequence seq, int pstart, int pend)
          Draws an unselected sequence while mapping the appropriate colours to each character rendered.
 java.lang.String safesubstring(org.biolegato.core.data.sequence.Sequence seq, int pstart, int pend)
          Ensures all substrings do not excees the start or end of the sequence
 void selectDrawString(BLTextArea ta, java.awt.Graphics gfx, int xstart, int ystart, org.biolegato.core.data.sequence.Sequence seq, int pstart, int pend)
          Draws a selected sequence while mapping the appropriate colours to each character rendered.
 void setBackground(java.awt.Color c)
          Changes the current default background colour for painting portions of the canvas without text.
 void setForeground(java.awt.Color c)
          Changes the current default foreground colour for painting portions of the canvas without text.
 void setName(java.lang.String string)
          Changes the name of the colour map.
 java.lang.String toString()
          Returns the name of the colour map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

foreground

protected java.awt.Color foreground
The current default foreground colour of normal unselected text


background

protected java.awt.Color background
The current default background colour of normal unselected text


foregroundSelect

protected java.awt.Color foregroundSelect
The current default foreground colour of normal selected text


backgroundSelect

protected java.awt.Color backgroundSelect
The current default background colour of normal selected text

Constructor Detail

ColourMap

public ColourMap()
The abstract constructor for colour maps.

Method Detail

regularDrawString

public abstract void regularDrawString(BLTextArea ta,
                                       java.awt.Graphics gfx,
                                       int xstart,
                                       int ystart,
                                       org.biolegato.core.data.sequence.Sequence seq,
                                       int pstart,
                                       int pend)
Draws an unselected sequence while mapping the appropriate colours to each character rendered. The sequence passed to this function need not be modified, as all of the math and string manipulation required for handling selected text is done in the drawString function.

Parameters:
ta - the textarea to use for obtaining metrics from.
gfx - the graphics object to draw the string to.
xstart - the x co-ordinate to start drawing from.
ystart - the y co-ordinate to start drawing from.
seq - the sequence to draw.

selectDrawString

public void selectDrawString(BLTextArea ta,
                             java.awt.Graphics gfx,
                             int xstart,
                             int ystart,
                             org.biolegato.core.data.sequence.Sequence seq,
                             int pstart,
                             int pend)
Draws a selected sequence while mapping the appropriate colours to each character rendered. The sequence passed to this function need not be modified, as all of the math and string manipulation required for handling selected text is done in the drawString function.

Parameters:
ta - the textarea to use for obtaining metrics from.
gfx - the graphics object to draw the string to.
xstart - the x co-ordinate to start drawing from.
ystart - the y co-ordinate to start drawing from.
seq - the sequence to draw.

drawChars

protected void drawChars(BLTextArea ta,
                         java.awt.Graphics gfx,
                         int xstart,
                         int ystart,
                         char[] array,
                         int index,
                         int length,
                         java.awt.Color foreground,
                         java.awt.Color background)
This is a function to help ensure proper spacing. All of the drawing should be done through this function.

Parameters:
ta - the textarea to use for obtaining metrics from.
gfx - the graphics object to draw the string to.
xstart - the x co-ordinate to start drawing from.
ystart - the y co-ordinate to start drawing from.
array - the character to draw.
index - the index to draw the characters in the array.
length - the length of characters to draw in the array.
foreground - the foreground colour of the string.
background - the background colour of the string.

safesubstring

public java.lang.String safesubstring(org.biolegato.core.data.sequence.Sequence seq,
                                      int pstart,
                                      int pend)
Ensures all substrings do not excees the start or end of the sequence

Parameters:
pstart - the start position of the substring
pend - the end position of the substring

getForeground

public java.awt.Color getForeground()
Returns the current default foreground colour for painting portions of the canvas without text.

Returns:
the background colour.

setForeground

public void setForeground(java.awt.Color c)
Changes the current default foreground colour for painting portions of the canvas without text.

Parameters:
c - the new background colour.

getBackground

public java.awt.Color getBackground()
Returns the current default background colour for painting portions of the canvas without text.

Returns:
the background colour.

setBackground

public void setBackground(java.awt.Color c)
Changes the current default background colour for painting portions of the canvas without text.

Parameters:
c - the new background colour.

getName

public java.lang.String getName()
Returns the name of the colour map.

Returns:
the name of the colour map.

setName

public void setName(java.lang.String string)
Changes the name of the colour map.

Parameters:
string - the new name for the colour map.

toString

public java.lang.String toString()
Returns the name of the colour map.

Overrides:
toString in class java.lang.Object
Returns:
the name of the colour map.

BioLegato 0.7.0 GDE Canvas plugin

Copyright © 2008-2010 University of Manitoba.