org.emboss.jemboss.editor
Class GraphicSequenceCollection

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byorg.emboss.jemboss.editor.GraphicSequenceCollection
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, javax.swing.Scrollable, java.io.Serializable
Direct Known Subclasses:
GroutGraphicSequenceCollection

public class GraphicSequenceCollection
extends javax.swing.JPanel
implements java.awt.print.Printable, javax.swing.Scrollable

This class can be used to get a grapical representation of a collection of sequences.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.util.Hashtable colorScheme
          Colour scheme to use
protected  boolean drawBlackBox
          draw black square around residues
protected  boolean drawColorBox
          colour residues
protected  boolean drawNumber
          draw sequence position number
protected  boolean drawSequence
          draw the sequence
protected  java.util.Vector graphicName
          Vector containing graphical names of sequences
protected  java.util.Vector graphicSequence
          Vector containing graphical sequences
private  int hgt
           
protected  javax.swing.JScrollPane jspSequence
          sequence scrollpane
private  int len
           
private  Matrix mat
          scoring matrix
protected  int MAXSEQLENGTH
          longest sequence length
protected  SequenceJPanel numberDraw
          panel for sequence numbers
private  int numResiduePerLine
          number of residues on each line for print
private  PlotConsensus pc
          Consensus plot
private  javax.swing.Box plotconsSeqBox
          container for consensus plot
private  int plotConStrut
          gap between sequences and consensus plot
private  boolean prettPlot
          draw as per prettplot
private  PrettyPlotJFrame prettyPlot
          pretty plot values
private  java.util.Vector removedSeqs
          Vector of sequences removed from panel
protected  javax.swing.Box seqBox
          container for sequences
protected  javax.swing.Box seqNameBox
          container for sequence names
private  javax.swing.JPanel seqNamePanel
          sequence name panel
protected  java.util.Vector seqs
          Vector containing Sequence objects
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GraphicSequenceCollection(java.util.Vector seqs, java.util.Hashtable colorScheme, javax.swing.JScrollPane jspSequence, boolean drawSequence, boolean drawBlackBox, boolean drawColorBox, boolean drawNumber, javax.swing.JTextField statusField)
           
GraphicSequenceCollection(java.util.Vector seqs, javax.swing.JScrollPane jspSequence, boolean drawSequence, boolean drawBlackBox, boolean drawColorBox, boolean drawNumber, javax.swing.JTextField statusField)
           
 
Method Summary
protected  void addAnnotationSequence(Sequence s)
           
protected  void addSequence(Sequence seq, boolean addToSequences, int ypad, int fontSize)
          Add a sequence to the sequence collection display and to the collection of sequences (seqs) with a specified y-padding.
protected  void addSequence(Sequence seq, boolean addToSequences, int ypad, int fontSize, int index)
          Add a sequence at a particular index to the sequence collection display and to the collection of sequences (seqs) with a specified y-padding.
protected  void deleteConsensusPlot()
          Remove the consensus plot from the sequence editor
protected  void deleteSequence(java.lang.String name)
          Delete a sequence from the sequence collection display and resize the sequence panel display
protected  void drawNumber()
           
 void drawSequences(java.awt.Graphics2D g2d, java.awt.print.PageFormat format, int pageIndex)
          Draws the sequences for printing
 void drawSequences(java.awt.Graphics2D g2d, java.awt.print.PageFormat format, int pageIndex, int numResPerLine)
          Draws the sequences for printing
private  int findMiddle(int newResPos, int viewWidth, java.lang.String pat)
          Locate the center of a vieport view that contains the defined position to display
 int findPattern(java.lang.String pat, int oldResPosition, boolean wrapAround)
          Search sequences for a pattern and highlight matches.
protected  java.awt.Color getColor(java.lang.String s, int pos, java.lang.String seqName)
          Determine the colour of a residue at a given position.
protected  Sequence getConsensusSequence()
          Get the consensus sequence
 int getFontSize()
          Get the font size used to display the sequences in the editor return font size
 java.util.Vector getGraphicSequence()
          Get the vector containing the SequenceJPanel objects
 java.awt.Dimension getImageableSize(int numResPerLine)
          Get the imageable size.
 int getMaxSeqLength()
          Get the longest sequence length
 java.lang.String getName(int i)
           
 int getNameHeight()
          Get the sequence name panel height
 java.awt.Dimension getNameViewSize()
          Get the sequence name view size
 int getNameWidth()
          Get the sequence name panel width
 int getNumberPages(java.awt.print.PageFormat format)
          Get the number of pages to print the alignment in a given format
 int getNumberPages(java.awt.print.PageFormat format, int numResPerLine)
          Get the number of pages to print the alignment in a given format and with a given number of residues per line
protected  int getNumberSequences()
          Get the number of sequences
 int getPanelHeight()
          Get the sequence panel height
 java.awt.Dimension getPanelSize()
          Get the sequence view size
 int getPanelWidth()
          Get the sequence panel width
 java.awt.Dimension getPreferredScrollableViewportSize()
          Override for scrollable interface
protected  java.awt.Color getPrettyBackground(java.awt.Color textColour)
          Determine the colour of a residue background
 int getResiduesPerLine(java.awt.print.PageFormat format)
          Get the number residues per line
 int getResiduesPerPage(java.awt.print.PageFormat format, int numResPerLine)
          Get the number residues per page
 int getScrollableBlockIncrement(java.awt.Rectangle r, int orientation, int direction)
          Override for scrollable interface
 boolean getScrollableTracksViewportHeight()
          Override for scrollable interface
 boolean getScrollableTracksViewportWidth()
          Override for scrollable interface
 int getScrollableUnitIncrement(java.awt.Rectangle r, int orientation, int direction)
          Override for scrollable interface
protected  java.util.Vector getSequenceCollection()
          Get the vector of Sequences
protected  java.awt.Point getViewPosition()
          Get the position of the sequence JViewPort
protected  java.awt.Rectangle getViewRect()
          Get the Rectangle being displayed by the sequence JViewPort
 java.awt.Dimension getViewSize()
          Get the sequence view size
protected  void idSort()
          Sorts the sequences and displays them by their id's
protected  boolean isPrettyBox()
          Determine if the identities are to be boxed
static void main(java.lang.String[] args)
           
protected  void moveSequence(java.lang.String name, int i)
          Move a sequence to a new position
 int print(java.awt.Graphics g, java.awt.print.PageFormat format, int pageIndex)
          Used to print the sequence alignment
private  Sequence removeSequence(java.lang.String name)
          Remove a sequence from the editor display
private  int searchSequences(int startSearch, java.lang.String pat)
          Search the sequences for the position in that matches the given pattern to search for.
 void setColorScheme(java.util.Hashtable colourTable)
          Set the colour scheme to use
 void setDrawBoxes(boolean drawBlackBox)
          Draw the boxes around the residues of each sequence
 void setDrawColor(boolean drawColorBox)
          Draw the residue colours in each sequence
 void setFontSizeForCollection(int fs)
          Set the font size of the sequences in the editor
 void setJScrollPaneViewportView()
          Force display in the viewport
protected  void setMatrix(Matrix mat)
           
protected  void setMaxSeqLength()
          Calculate the longest sequence length
protected  void setMaxSequenceLength(int max)
          Set the longest sequence length
 void setNamePanelWidth(int x)
          Set the sequence name panel width
protected  void setNumberOfResiduesPerLine(int numResiduePerLine)
          Set the number of residues per line to user setting
protected  void setNumberSize()
          Set the size of the sequence number panel
 void setPrettyPlot(boolean bpretty, PrettyPlotJFrame prettyPlot)
          Display the sequences as per emboss prettyplot colours
protected  void setSequenceLock(boolean llock)
          Lock/group the sequences
protected  void showConsensusPlot(java.io.File matrix, int wsize)
          Calculate and display the consensus plot
protected  void showConsensusPlot(Matrix mat, int wsize)
          Calculate and display the consensus plot
protected  int testUpAndDown(int pos, Sequence seq)
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

removedSeqs

private java.util.Vector removedSeqs
Vector of sequences removed from panel


seqs

protected java.util.Vector seqs
Vector containing Sequence objects


graphicSequence

protected java.util.Vector graphicSequence
Vector containing graphical sequences


graphicName

protected java.util.Vector graphicName
Vector containing graphical names of sequences


colorScheme

protected java.util.Hashtable colorScheme
Colour scheme to use


pc

private PlotConsensus pc
Consensus plot


hgt

private int hgt

len

private int len

MAXSEQLENGTH

protected int MAXSEQLENGTH
longest sequence length


numResiduePerLine

private int numResiduePerLine
number of residues on each line for print


numberDraw

protected SequenceJPanel numberDraw
panel for sequence numbers


jspSequence

protected javax.swing.JScrollPane jspSequence
sequence scrollpane


seqNamePanel

private javax.swing.JPanel seqNamePanel
sequence name panel


seqBox

protected javax.swing.Box seqBox
container for sequences


seqNameBox

protected javax.swing.Box seqNameBox
container for sequence names


plotconsSeqBox

private javax.swing.Box plotconsSeqBox
container for consensus plot


drawSequence

protected boolean drawSequence
draw the sequence


drawBlackBox

protected boolean drawBlackBox
draw black square around residues


drawColorBox

protected boolean drawColorBox
colour residues


drawNumber

protected boolean drawNumber
draw sequence position number


prettPlot

private boolean prettPlot
draw as per prettplot


plotConStrut

private int plotConStrut
gap between sequences and consensus plot


prettyPlot

private PrettyPlotJFrame prettyPlot
pretty plot values


mat

private Matrix mat
scoring matrix

Constructor Detail

GraphicSequenceCollection

public GraphicSequenceCollection(java.util.Vector seqs,
                                 java.util.Hashtable colorScheme,
                                 javax.swing.JScrollPane jspSequence,
                                 boolean drawSequence,
                                 boolean drawBlackBox,
                                 boolean drawColorBox,
                                 boolean drawNumber,
                                 javax.swing.JTextField statusField)
Parameters:
seqs - vector of sequences
colorScheme - sequence colour scheme
jspSequence - sequence scrollpane
drawSequence - true to draw the sequence
drawBlackBox - true to draw black square around residues
drawColorBox - true to colour residues
drawNumber - true to draw sequence position number
statusField - status field in the editor

GraphicSequenceCollection

public GraphicSequenceCollection(java.util.Vector seqs,
                                 javax.swing.JScrollPane jspSequence,
                                 boolean drawSequence,
                                 boolean drawBlackBox,
                                 boolean drawColorBox,
                                 boolean drawNumber,
                                 javax.swing.JTextField statusField)
Parameters:
seqs - vector of sequences
jspSequence - sequence scrollpane
drawSequence - true to draw the sequence
drawBlackBox - true to draw black square around residues
drawColorBox - true to colour residues
drawNumber - true to draw sequence position number
statusField - status field in the editor
Method Detail

getSequenceCollection

protected java.util.Vector getSequenceCollection()
Get the vector of Sequences

Returns:
vector of Sequences

getConsensusSequence

protected Sequence getConsensusSequence()
Get the consensus sequence

Returns:
consensus sequence

getNumberSequences

protected int getNumberSequences()
Get the number of sequences

Returns:
vector of Sequences

getViewPosition

protected java.awt.Point getViewPosition()
Get the position of the sequence JViewPort

Returns:
position of the sequence JViewPort

getViewRect

protected java.awt.Rectangle getViewRect()
Get the Rectangle being displayed by the sequence JViewPort

Returns:
rectangle being displayed by the sequence JViewPort

showConsensusPlot

protected void showConsensusPlot(java.io.File matrix,
                                 int wsize)
Calculate and display the consensus plot


showConsensusPlot

protected void showConsensusPlot(Matrix mat,
                                 int wsize)
Calculate and display the consensus plot


deleteConsensusPlot

protected void deleteConsensusPlot()
Remove the consensus plot from the sequence editor


setMaxSequenceLength

protected void setMaxSequenceLength(int max)
Set the longest sequence length

Parameters:
max - longest sequence length

setMaxSeqLength

protected void setMaxSeqLength()
Calculate the longest sequence length


getMaxSeqLength

public int getMaxSeqLength()
Get the longest sequence length

Returns:
longest sequence length

setSequenceLock

protected void setSequenceLock(boolean llock)
Lock/group the sequences


setNumberSize

protected void setNumberSize()
Set the size of the sequence number panel


setMatrix

protected void setMatrix(Matrix mat)

getColor

protected java.awt.Color getColor(java.lang.String s,
                                  int pos,
                                  java.lang.String seqName)
Determine the colour of a residue at a given position. If the residues at that position in all the sequences are identical then return red otherwise return black.

Parameters:
s - residue at position pos
pos - residue position
seqName - sequence name
Returns:
red if all identical otherwise return black

getPrettyBackground

protected java.awt.Color getPrettyBackground(java.awt.Color textColour)
Determine the colour of a residue background


isPrettyBox

protected boolean isPrettyBox()
Determine if the identities are to be boxed

Returns:
true if to draw boxes

testUpAndDown

protected int testUpAndDown(int pos,
                            Sequence seq)

removeSequence

private Sequence removeSequence(java.lang.String name)
Remove a sequence from the editor display

Parameters:
name - name of sequence to remove

deleteSequence

protected void deleteSequence(java.lang.String name)
Delete a sequence from the sequence collection display and resize the sequence panel display

Parameters:
name - name of sequence to remove

moveSequence

protected void moveSequence(java.lang.String name,
                            int i)
Move a sequence to a new position

Parameters:
name - name of sequence to remove
i - new position in the sequence editor

idSort

protected void idSort()
Sorts the sequences and displays them by their id's


addSequence

protected void addSequence(Sequence seq,
                           boolean addToSequences,
                           int ypad,
                           int fontSize,
                           int index)
Add a sequence at a particular index to the sequence collection display and to the collection of sequences (seqs) with a specified y-padding.

Parameters:
seq - sequence to add to the editor display
addToSequences - true to add seq to the vector of sequences
ypad - sequence panel height padding
fontSize - font size
index - sequence index

addSequence

protected void addSequence(Sequence seq,
                           boolean addToSequences,
                           int ypad,
                           int fontSize)
Add a sequence to the sequence collection display and to the collection of sequences (seqs) with a specified y-padding.

Parameters:
seq - sequence to add to the editor display
addToSequences - true to add seq to the vector of sequences
ypad - sequence panel height padding
fontSize - font size

getViewSize

public java.awt.Dimension getViewSize()
Get the sequence view size

Returns:
sequence view dimension

getName

public java.lang.String getName(int i)

getNameViewSize

public java.awt.Dimension getNameViewSize()
Get the sequence name view size

Returns:
sequence name dimension

getPanelSize

public java.awt.Dimension getPanelSize()
Get the sequence view size

Returns:
sequence view dimension

getNameHeight

public int getNameHeight()
Get the sequence name panel height

Returns:
sequence name panel height

getNameWidth

public int getNameWidth()
Get the sequence name panel width

Returns:
sequence name panel width

setNamePanelWidth

public void setNamePanelWidth(int x)
Set the sequence name panel width

Parameters:
x - sequence name panel width

getPanelHeight

public int getPanelHeight()
Get the sequence panel height

Returns:
sequence panel height

getPanelWidth

public int getPanelWidth()
Get the sequence panel width

Returns:
sequence panel width

getGraphicSequence

public java.util.Vector getGraphicSequence()
Get the vector containing the SequenceJPanel objects

Returns:
vector containing the SequenceJPanel objects

setDrawBoxes

public void setDrawBoxes(boolean drawBlackBox)
Draw the boxes around the residues of each sequence


setDrawColor

public void setDrawColor(boolean drawColorBox)
Draw the residue colours in each sequence


setFontSizeForCollection

public void setFontSizeForCollection(int fs)
Set the font size of the sequences in the editor


getFontSize

public int getFontSize()
Get the font size used to display the sequences in the editor return font size


findPattern

public int findPattern(java.lang.String pat,
                       int oldResPosition,
                       boolean wrapAround)
Search sequences for a pattern and highlight matches. Set the viewport to that position.

Returns:
int the matching position found (or -1 if none found)

searchSequences

private int searchSequences(int startSearch,
                            java.lang.String pat)
Search the sequences for the position in that matches the given pattern to search for.

Returns:
int position in a sequence that next matches the pattern (or -1 if none found)

findMiddle

private int findMiddle(int newResPos,
                       int viewWidth,
                       java.lang.String pat)
Locate the center of a vieport view that contains the defined position to display

Returns:
int position to set the viewport to so that the pattern is displayed in the middle of it

setColorScheme

public void setColorScheme(java.util.Hashtable colourTable)
Set the colour scheme to use

Parameters:
colourTable - colour scheme as a hashtable

setPrettyPlot

public void setPrettyPlot(boolean bpretty,
                          PrettyPlotJFrame prettyPlot)
Display the sequences as per emboss prettyplot colours

Parameters:
bpretty - true if displaying as prettyplot

setJScrollPaneViewportView

public void setJScrollPaneViewportView()
Force display in the viewport


getNumberPages

public int getNumberPages(java.awt.print.PageFormat format)
Get the number of pages to print the alignment in a given format

Parameters:
format - format for printing
Returns:
number of pages

getNumberPages

public int getNumberPages(java.awt.print.PageFormat format,
                          int numResPerLine)
Get the number of pages to print the alignment in a given format and with a given number of residues per line

Parameters:
format - format for printing
numResPerLine - number of residues per line
Returns:
number of pages

getImageableSize

public java.awt.Dimension getImageableSize(int numResPerLine)
Get the imageable size. This is for fitting the image to one page.

Returns:
image size

getResiduesPerLine

public int getResiduesPerLine(java.awt.print.PageFormat format)
Get the number residues per line

Parameters:
format - format for printing
Returns:
number residues per line

getResiduesPerPage

public int getResiduesPerPage(java.awt.print.PageFormat format,
                              int numResPerLine)
Get the number residues per page

Parameters:
format - format for printing
numResPerLine - number residues per line
Returns:
number residues per page

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat format,
                 int pageIndex)
          throws java.awt.print.PrinterException
Used to print the sequence alignment

Specified by:
print in interface java.awt.print.Printable
Parameters:
g - graphics
format - page format
pageIndex - page number to print
Throws:
java.awt.print.PrinterException

setNumberOfResiduesPerLine

protected void setNumberOfResiduesPerLine(int numResiduePerLine)
Set the number of residues per line to user setting

Parameters:
numResiduePerLine - number of residues per line

drawSequences

public void drawSequences(java.awt.Graphics2D g2d,
                          java.awt.print.PageFormat format,
                          int pageIndex)
Draws the sequences for printing

Parameters:
g2d - graphics
format - page format
pageIndex - page number to print

drawSequences

public void drawSequences(java.awt.Graphics2D g2d,
                          java.awt.print.PageFormat format,
                          int pageIndex,
                          int numResPerLine)
Draws the sequences for printing

Parameters:
g2d - graphics
format - page format
pageIndex - page number to print
numResPerLine - number of residues per line

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Override for scrollable interface

Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Override for scrollable interface

Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Override for scrollable interface

Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle r,
                                       int orientation,
                                       int direction)
Override for scrollable interface

Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle r,
                                      int orientation,
                                      int direction)
Override for scrollable interface

Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable

main

public static void main(java.lang.String[] args)

drawNumber

protected void drawNumber()

addAnnotationSequence

protected void addAnnotationSequence(Sequence s)