org.emboss.jemboss.editor
Class GraphicSequenceCollection

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.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

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

Field Summary
private  java.util.Hashtable colorScheme
          Colour scheme to use
private  boolean drawBlackBox
          draw black square around residues
private  boolean drawColorBox
          colour residues
private  boolean drawNumber
          draw sequence position number
private  boolean drawSequence
          draw the sequence
private  java.util.Vector graphicName
          Vector containing graphical names of sequences
private  java.util.Vector graphicSequence
          Vector containing graphical sequences
private  int hgt
           
private  int hgtName
           
private  javax.swing.JScrollPane jspSequence
          sequence scrollpane
private  int len
           
private  int lenName
           
private  int MAXSEQLENGTH
           
private  SequenceJPanel numberDraw
           
private  int numResiduePerLine
          number of residues on each line for print
private  PlotConsensus pc
          Consensus plot
private  javax.swing.Box plotconsSeqBox
           
private  int plotConStrut
           
private  boolean prettPlot
           
private  java.util.Vector removedSeqs
          Vector of sequences removed from panel
private  javax.swing.Box seqBox
           
private  javax.swing.Box seqNameBox
           
private  javax.swing.JPanel seqNamePanel
           
private  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 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()
           
protected  void deleteSequence(java.lang.String name)
          Delete a sequence from the sequence collection display and resize the sequence panel display
 void drawSequences(java.awt.Graphics2D g2d, java.awt.print.PageFormat format, int pageIndex)
           
 void drawSequences(java.awt.Graphics2D g2d, java.awt.print.PageFormat format, int pageIndex, int numResPerLine)
           
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)
           
 int getFontSize()
           
 java.util.Vector getGraphicSequence()
           
 int getMaxSeqLength()
           
 int getNameHeight()
           
 java.awt.Dimension getNameViewSize()
          Get the sequence name view size
 int getNameWidth()
           
 int getNumberPages(java.awt.print.PageFormat format)
           
 int getNumberPages(java.awt.print.PageFormat format, int numResPerLine)
           
 int getPanelHeight()
           
 java.awt.Dimension getPanelSize()
           
 int getPanelWidth()
           
 java.awt.Dimension getPreferredScrollableViewportSize()
           
 int getResiduesPerLine(java.awt.print.PageFormat format)
           
 int getResiduesPerPage(java.awt.print.PageFormat format, int numResPerLine)
           
 int getScrollableBlockIncrement(java.awt.Rectangle r, int orientation, int direction)
           
 boolean getScrollableTracksViewportHeight()
           
 boolean getScrollableTracksViewportWidth()
           
 int getScrollableUnitIncrement(java.awt.Rectangle r, int orientation, int direction)
           
protected  java.util.Vector getSequenceCollection()
           
protected  java.awt.Point getViewPosition()
           
protected  java.awt.Rectangle getViewRect()
           
 java.awt.Dimension getViewSize()
          Get the sequence view size
protected  void idSort()
           
static void main(java.lang.String[] args)
           
protected  void moveSequence(java.lang.String name, int i)
           
 int print(java.awt.Graphics g, java.awt.print.PageFormat format, int pageIndex)
           
private  Sequence removeSequence(java.lang.String name)
           
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)
           
 void setDrawBoxes(boolean drawBlackBox)
           
 void setDrawColor(boolean drawColorBox)
           
 void setFontSizeForCollection(int fs)
           
 void setJScrollPaneViewportView()
           
private  void setMaxSeqLength()
           
protected  void setMaxSequenceLength(int max)
           
 void setNamePanelWidth(int x)
           
protected  void setNumberOfResiduesPerLine(int numResiduePerLine)
           
private  void setNumberSize()
           
 void setPrettyPlot(boolean bpretty)
           
protected  void setSequenceSelection(boolean b)
           
protected  void showConsensusPlot(java.io.File matrix, int wsize)
           
protected  void showConsensusPlot(Matrix mat, int wsize)
           
 
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

private java.util.Vector seqs
Vector containing Sequence objects


graphicSequence

private java.util.Vector graphicSequence
Vector containing graphical sequences


graphicName

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


colorScheme

private java.util.Hashtable colorScheme
Colour scheme to use


pc

private PlotConsensus pc
Consensus plot


lenName

private int lenName

hgtName

private int hgtName

hgt

private int hgt

len

private int len

MAXSEQLENGTH

private int MAXSEQLENGTH

numResiduePerLine

private int numResiduePerLine
number of residues on each line for print


numberDraw

private SequenceJPanel numberDraw

jspSequence

private javax.swing.JScrollPane jspSequence
sequence scrollpane


seqNamePanel

private javax.swing.JPanel seqNamePanel

seqBox

private javax.swing.Box seqBox

seqNameBox

private javax.swing.Box seqNameBox

plotconsSeqBox

private javax.swing.Box plotconsSeqBox

drawSequence

private boolean drawSequence
draw the sequence


drawBlackBox

private boolean drawBlackBox
draw black square around residues


drawColorBox

private boolean drawColorBox
colour residues


drawNumber

private boolean drawNumber
draw sequence position number


prettPlot

private boolean prettPlot

plotConStrut

private int plotConStrut
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)
Method Detail

getSequenceCollection

protected java.util.Vector getSequenceCollection()

getViewPosition

protected java.awt.Point getViewPosition()

getViewRect

protected java.awt.Rectangle getViewRect()

showConsensusPlot

protected void showConsensusPlot(java.io.File matrix,
                                 int wsize)

showConsensusPlot

protected void showConsensusPlot(Matrix mat,
                                 int wsize)

deleteConsensusPlot

protected void deleteConsensusPlot()

setMaxSequenceLength

protected void setMaxSequenceLength(int max)

setMaxSeqLength

private void setMaxSeqLength()

getMaxSeqLength

public int getMaxSeqLength()

setSequenceSelection

protected void setSequenceSelection(boolean b)

setNumberSize

private void setNumberSize()

getColor

protected java.awt.Color getColor(java.lang.String s,
                                  int pos,
                                  java.lang.String seqName)

removeSequence

private Sequence removeSequence(java.lang.String name)

deleteSequence

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


moveSequence

protected void moveSequence(java.lang.String name,
                            int i)

idSort

protected void idSort()

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.


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.


getViewSize

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


getNameViewSize

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


getPanelSize

public java.awt.Dimension getPanelSize()

getNameHeight

public int getNameHeight()

getNameWidth

public int getNameWidth()

setNamePanelWidth

public void setNamePanelWidth(int x)

getPanelHeight

public int getPanelHeight()

getPanelWidth

public int getPanelWidth()

getGraphicSequence

public java.util.Vector getGraphicSequence()

setDrawBoxes

public void setDrawBoxes(boolean drawBlackBox)

setDrawColor

public void setDrawColor(boolean drawColorBox)

setFontSizeForCollection

public void setFontSizeForCollection(int fs)

getFontSize

public int getFontSize()

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)

setPrettyPlot

public void setPrettyPlot(boolean bpretty)

setJScrollPaneViewportView

public void setJScrollPaneViewportView()

getNumberPages

public int getNumberPages(java.awt.print.PageFormat format)

getNumberPages

public int getNumberPages(java.awt.print.PageFormat format,
                          int numResPerLine)

getResiduesPerLine

public int getResiduesPerLine(java.awt.print.PageFormat format)

getResiduesPerPage

public int getResiduesPerPage(java.awt.print.PageFormat format,
                              int numResPerLine)

print

public int print(java.awt.Graphics g,
                 java.awt.print.PageFormat format,
                 int pageIndex)
          throws java.awt.print.PrinterException
Specified by:
print in interface java.awt.print.Printable
java.awt.print.PrinterException

setNumberOfResiduesPerLine

protected void setNumberOfResiduesPerLine(int numResiduePerLine)

drawSequences

public void drawSequences(java.awt.Graphics2D g2d,
                          java.awt.print.PageFormat format,
                          int pageIndex)

drawSequences

public void drawSequences(java.awt.Graphics2D g2d,
                          java.awt.print.PageFormat format,
                          int pageIndex,
                          int numResPerLine)

getPreferredScrollableViewportSize

public java.awt.Dimension getPreferredScrollableViewportSize()
Specified by:
getPreferredScrollableViewportSize in interface javax.swing.Scrollable

getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()
Specified by:
getScrollableTracksViewportHeight in interface javax.swing.Scrollable

getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()
Specified by:
getScrollableTracksViewportWidth in interface javax.swing.Scrollable

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle r,
                                       int orientation,
                                       int direction)
Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle r,
                                      int orientation,
                                      int direction)
Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable

main

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