view
Class SequencePainter

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by view.SequencePainter
All Implemented Interfaces:
Observable, Observer, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class SequencePainter
extends javax.swing.JComponent
implements Observable, Observer

This class does all the sequence painting, implements Observable, as the structure frame listens to the mouse events on the alignment panel.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
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.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SequencePainter(AlignViewProps viewProps, AlignPanel alignPanel, S3DetObject s3detobj)
          Constructor of the SeqRenderer.
SequencePainter(AlignViewProps viewProps, S3DetObject s3detobj)
          Constructor of the SequencePainter without observers.
 
Method Summary
 void closeRegisteredWindows(java.lang.String type)
          Close all registered windows
 void colorColumn(java.awt.Color currentColor, int xPos, int yPos)
          This method colors the columns
 void deregister(Observer obs)
          Deregisters the observer.
 void drawBackground(int start, int end, int yPos)
          This methods draws the background.
 void drawHorizontal(SequenceImpl seq, int xStart, int xEnd, int yPos, java.awt.Color linecolor)
          This methods draws an horizontal line (used for the group boxes).
 void drawPanel(java.awt.Graphics g1, int startRes, int endRes, int startSeq, int endSeq, int offset)
          This methods draws the panel.
 void drawSelectionSeq(SequenceImpl seq, int start, int end, int yPos)
          This methods actually draws the sequence.
 void drawSeq(SequenceImpl seq, int start, int end, int yPos)
          This methods actually draws the sequence.
 void drawVertical(SequenceImpl seq, int xPos, int yStart, int yEnd, java.awt.Color linecolor)
          This methods draws an vertical line (used for the group boxes).
 int getAAPosition(java.awt.event.MouseEvent evt)
          Returns the position of a amino acid for a mouse event.
 AlignPanel getAlignPanel()
          Returns the alignment panel.
 int getCurrentPosition()
          Returns the current position.
 SequenceImpl getSelectedSequence()
          Returns the selected sequence.
 int getSequence(java.awt.event.MouseEvent evt)
          Returns the sequence for a mouse event.
 int getSumScrollX()
           
 AlignViewProps getViewProps()
           
 void init(java.awt.Graphics g)
          Initializes the graphics object.
 void notifyObservers()
          Notify the observer.
 void notifyOnMouseClick(java.awt.event.MouseEvent ev)
          Notifies the observers on a mouse click.
 void notifyUpperPanels()
           
protected  void paintComponent(java.awt.Graphics g)
           
 void register(Observer obs)
          Registers the observer.
 void scrollPainting(int xValue, int yValue)
          This method does the scroll painting.
 void setExport(boolean isExport)
           
 void setJmolPanel(view.Structure3DFrame.JmolPanel jmolPanel)
          Sets the jMolPanel and registers the seqPainter.
 void setSumScrollX(int sumScrollX)
           
 void setViewProps(AlignViewProps viewProps)
           
 void toggleResidue(java.awt.event.MouseEvent ev)
           
 void unsetJmolPanel()
          Unsets the seqPainter.
 void update(Observable object)
          Updates the data from the observable object.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SequencePainter

public SequencePainter(AlignViewProps viewProps,
                       AlignPanel alignPanel,
                       S3DetObject s3detobj)
Constructor of the SeqRenderer. In an optional case it uses the s3detobject to order the sequences and color

Parameters:
viewProps -
alignPanel -
s3detobj -

SequencePainter

public SequencePainter(AlignViewProps viewProps,
                       S3DetObject s3detobj)
Constructor of the SequencePainter without observers. Use it for paint the selected sequences

Parameters:
viewProps -
alignPanel -
s3detobj -
Method Detail

paintComponent

protected void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

drawPanel

public void drawPanel(java.awt.Graphics g1,
                      int startRes,
                      int endRes,
                      int startSeq,
                      int endSeq,
                      int offset)
This methods draws the panel.

Parameters:
g1 -
startRes -
endRes -
startSeq -
endSeq -
offset -

init

public void init(java.awt.Graphics g)
Initializes the graphics object.

Parameters:
g -

colorColumn

public void colorColumn(java.awt.Color currentColor,
                        int xPos,
                        int yPos)
This method colors the columns

Parameters:
currentColor -
xPos -
yPos -

drawBackground

public void drawBackground(int start,
                           int end,
                           int yPos)
This methods draws the background.

Parameters:
start -
end -
yPos -

drawHorizontal

public void drawHorizontal(SequenceImpl seq,
                           int xStart,
                           int xEnd,
                           int yPos,
                           java.awt.Color linecolor)
This methods draws an horizontal line (used for the group boxes).

Parameters:
xStart -
xEnd -
yPos -

drawVertical

public void drawVertical(SequenceImpl seq,
                         int xPos,
                         int yStart,
                         int yEnd,
                         java.awt.Color linecolor)
This methods draws an vertical line (used for the group boxes).

Parameters:
seq -
xPos -
yStart -
yEnd -
linecolor -

drawSeq

public void drawSeq(SequenceImpl seq,
                    int start,
                    int end,
                    int yPos)
This methods actually draws the sequence.

Parameters:
seq -
start -
end -
yPos -

drawSelectionSeq

public void drawSelectionSeq(SequenceImpl seq,
                             int start,
                             int end,
                             int yPos)
This methods actually draws the sequence.

Parameters:
seq -
start -
end -
yPos -

scrollPainting

public void scrollPainting(int xValue,
                           int yValue)
This method does the scroll painting.

Parameters:
xValue -
yValue -

notifyOnMouseClick

public void notifyOnMouseClick(java.awt.event.MouseEvent ev)
Notifies the observers on a mouse click.


toggleResidue

public void toggleResidue(java.awt.event.MouseEvent ev)

getAAPosition

public int getAAPosition(java.awt.event.MouseEvent evt)
Returns the position of a amino acid for a mouse event.

Parameters:
evt -
Returns:
pos Integer

getSequence

public int getSequence(java.awt.event.MouseEvent evt)
Returns the sequence for a mouse event.

Parameters:
evt -
Returns:
seq Integer

getAlignPanel

public AlignPanel getAlignPanel()
Returns the alignment panel.

Returns:
alignPanel AlignPanel

notifyObservers

public void notifyObservers()
Notify the observer.

Specified by:
notifyObservers in interface Observable

notifyUpperPanels

public void notifyUpperPanels()

register

public void register(Observer obs)
Registers the observer.

Specified by:
register in interface Observable

deregister

public void deregister(Observer obs)
Deregisters the observer.

Specified by:
deregister in interface Observable

getCurrentPosition

public int getCurrentPosition()
Returns the current position.

Returns:
currentPosition int

getSelectedSequence

public SequenceImpl getSelectedSequence()
Returns the selected sequence.

Returns:
selectedSequence SequenceImpl

update

public void update(Observable object)
Updates the data from the observable object.

Specified by:
update in interface Observer

setJmolPanel

public void setJmolPanel(view.Structure3DFrame.JmolPanel jmolPanel)
Sets the jMolPanel and registers the seqPainter.

Parameters:
jmolPanel -

unsetJmolPanel

public void unsetJmolPanel()
Unsets the seqPainter.


setExport

public void setExport(boolean isExport)

setSumScrollX

public void setSumScrollX(int sumScrollX)

getSumScrollX

public int getSumScrollX()

closeRegisteredWindows

public void closeRegisteredWindows(java.lang.String type)
Close all registered windows


getViewProps

public AlignViewProps getViewProps()
Returns:
the viewProps

setViewProps

public void setViewProps(AlignViewProps viewProps)
Parameters:
viewProps - the viewProps to set