org.peace_tools.views.overlap
Class OverlapView

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.peace_tools.views.overlap.OverlapView
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener, ClusterColorMapper

public class OverlapView
extends javax.swing.JPanel
implements javax.swing.event.ChangeListener, ClusterColorMapper

A pre-alignment overlap view of fragments organized based on clusters. This is a graphical summary view of various fragments organized based on the clusters in which they have been placed. This view uses the pre-alignment model to obtain the information to be displayed in a convenient form. In addition, this view embellishes the data with the following information:

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
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
private  javax.swing.JSlider[] axisScale
          The row and column size scale controllers.
private  java.util.HashMap<java.lang.Integer,java.awt.Color> clusterColorMap
          A hash map to quickly look-up color for a given cluster ID.
private  ClusterList clusterList
          The list that displays the list of clusters currently present in the memory model and permits the user to change colors.
private  Ruler horizontalRuler
          The horizontal ruler that is displayed at the top of the overview panel.
private  MainFrame mainFrame
          Convenient reference to the main frame class that logically owns this component.
private  double MIN_COL_SCALE_FACTOR
          Factor to determine minimum column scale value.
private  OverlapModel pam
          The PreAlignmentModel that provides the necessary information for rendering the core information required for this view.
private  OverlapPanel panel
          The overlap panel that actual renders the fragments for us.
private static long serialVersionUID
          Generated serialization UID (merely to keep the compiler happy)
private  javax.swing.JToolBar toolbar
          The tool bar that contains some commonly used tools with the overlap view and for modifying the scale used to draw the overlap view.
private  Ruler verticalRuler
          The vertical ruler that is displayed to the left of the overview panel.
 
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
OverlapView(MainFrame frame, OverlapModel pam, ClusterFile clusterFile)
          The default constructor.
 
Method Summary
 java.awt.Color getColor(java.lang.Integer clusterID)
          Return the Color associated with a given cluster ID.
 void setColor(java.lang.Integer clusterID, java.awt.Color color)
          Set a color to be used for rendering fragments in the given cluster.
private  void setupToolBar()
          Helper method to configure and setup various tools in the tool bar.
 void stateChanged(javax.swing.event.ChangeEvent e)
          Helper method to compute and update scale for the actual display.
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, 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
 
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
 

Field Detail

axisScale

private javax.swing.JSlider[] axisScale
The row and column size scale controllers. The following array holds two sliders that can be used to control the scale of the row and column in the graph. The sliders are created in the setupToolBar() method. The sliders are set such that the scale for the row cannot be decreased below 1 pixel and the column size cannot drop below 1/4 pixel (four nucleotides per pixel).


toolbar

private final javax.swing.JToolBar toolbar
The tool bar that contains some commonly used tools with the overlap view and for modifying the scale used to draw the overlap view.


clusterList

private final ClusterList clusterList
The list that displays the list of clusters currently present in the memory model and permits the user to change colors. This object is created in the constructor and is added to the tool bar as the first component.


pam

private final OverlapModel pam
The PreAlignmentModel that provides the necessary information for rendering the core information required for this view. This instance variable is initialized by the constructor and it is never changed during the life time of this object.


panel

private final OverlapPanel panel
The overlap panel that actual renders the fragments for us. This instance variable holds an immutable reference to the overlap panel that actually renders the fragments.


mainFrame

private final MainFrame mainFrame
Convenient reference to the main frame class that logically owns this component. This value is set in the constructor and is never changed.


horizontalRuler

private final Ruler horizontalRuler
The horizontal ruler that is displayed at the top of the overview panel. This ruler is added to the scroll pane that contains the panel. The horizontal ruler displays a ruler with column numbers indicating the relative position of each nucleotide.


verticalRuler

private final Ruler verticalRuler
The vertical ruler that is displayed to the left of the overview panel. This ruler is added to the scroll pane that contains the panel. The vertical ruler displays a ruler with row numbers indicating the relative row number where a given fragment was accomodated.


MIN_COL_SCALE_FACTOR

private final double MIN_COL_SCALE_FACTOR
Factor to determine minimum column scale value. This constant provides a convenient mechanism to quickly change the minimum scaling factor for columns in the fragment display panel. The minimum scaling factor is computed as: 1.0 / MIN_COL_SCALE_FACTOR. This value is used in various spots in the code to configure and work with sliders that requires integral values to operate (it cannot deal with fractional values like 0.25)

See Also:
Constant Field Values

clusterColorMap

private final java.util.HashMap<java.lang.Integer,java.awt.Color> clusterColorMap
A hash map to quickly look-up color for a given cluster ID. This hash map is used when rendering fragments. The hash map is used to look up the colors set for a given cluster, given its cluster ID. This hash map is used to implement methods in the ClusterColorMapper interface.


serialVersionUID

private static final long serialVersionUID
Generated serialization UID (merely to keep the compiler happy)

See Also:
Constant Field Values
Constructor Detail

OverlapView

public OverlapView(MainFrame frame,
                   OverlapModel pam,
                   ClusterFile clusterFile)
The default constructor. The default constructor creates the various controls (that are part of this view) that can be used to customize this view.

Parameters:
frame - The main frame that logically owns this view. This reference is used to launch the classifier dialog.
pam - The pre-alignment in-memory model that contains the clusters and organized ESTs. This model is used by this view to render the information appropriately.
clusterFile - The cluster file from where the clusters are being displayed. This data is used to merely populate the summary view in this class.
Method Detail

setupToolBar

private void setupToolBar()
Helper method to configure and setup various tools in the tool bar. This method was introduced to streamline the code better and cut down the code clutter in the constructor.


getColor

public java.awt.Color getColor(java.lang.Integer clusterID)
Description copied from interface: ClusterColorMapper
Return the Color associated with a given cluster ID. This method provides the currently used Color for a given cluster.

Specified by:
getColor in interface ClusterColorMapper
Parameters:
clusterID - The ID of the cluster whose current color is to be returned.
Returns:
If the cluster ID is valid then this method returns a valid Color object. Otherwise it returns null.

setColor

public void setColor(java.lang.Integer clusterID,
                     java.awt.Color color)
Description copied from interface: ClusterColorMapper
Set a color to be used for rendering fragments in the given cluster. This method must be used to set the color to be used for rendering the fragments in this cluster. Note that this method merely sets the color but does not trigger a refresh or an update.

Specified by:
setColor in interface ClusterColorMapper
Parameters:
clusterID - The cluster ID whose color is to be set.
color - The color to be set for the given cluster ID.

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Helper method to compute and update scale for the actual display. This method is is part of the ChangeListener interface. This method is invoked whenever the user modifies the sliders for "Width" and "Height" in this panel. This method computes a new scaling factor for rows and columns and updates the scaling factor in the actual fragment display panel.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
e - The change event associated with this method. This method is currently not used.