AFLPgui
Class Thumbnail

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--AFLPgui.Thumbnail
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable

public class Thumbnail
extends java.awt.Panel
implements java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener

This class displays thumbnails for a bin. A thumbnail is a trace of a lane, but the trace is not the full trace. Instead, it is only the portion of the lane that is included in the bin. Each thumbnail shows the lane number and the scoring label as well as the trace. The thumbnails have a set width. The width of the display area is set not to exceed the the size avaiable. If all of the thumbnails do not fit on one row, another row will be made. There is no limit on the number of rows. A CutoffSlider is provided to adjust the cutoff levels. Buttons allow the user to move to the next or previous bin, as well as add a cutoff level and show a dialog to manipulate the cutoffs. A button also changes the scoring to the opposite of it's current setting. This is useful if one has two parents, and wants to keep the scoring consistant. The class can be drawn to a printer page by setting the width with setViewWidth and paint. The paint method will recognize the print request and behave appropriately. Normally the display is double-buffered, but this is disabled when drawing to a printed page (PrinteGraphics). The scoring can also be adjusted manually by clicking on the trace.

See Also:
CutoffSlider, Serialized Form

Inner classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static int BLANK
           
static int TRACE
           
 
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
Thumbnail(DataList lanes, DataList bins, java.awt.Frame parentWindow)
          Creates thumbnails with the specified parameters.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles the buttons in the button bar.
 void drawTrace(java.awt.Graphics g, Lane lane, int x, int y)
          Draws the trace portion of the thumbnail.
 int findPositionInfo(int x, int y)
          Gives the size and intensity for the given point.
 Bin getBin()
          Gives the bin displayed.
 ButtonBar getButtonBar()
          Gives the ButtonBar associated with the thumbnails.
 Bar getInfoBar()
          Returns a bar that displays information about the thumbnails.
 DataList getLanes()
          Gives the lanes that are being displayed.
 java.awt.Dimension getThumbnailSize()
          Gives the size of an individual thumbnail, including the border around it.
protected  void handleScoreError(ScoringFailure error)
          Shows an options dialog if an error occurs when scoring a bin.
 void init()
          Performs calculations neccessary to display the thumbnails.
 void mouseClicked(java.awt.event.MouseEvent e)
          Adjusts the scoring for a lane if the mouse is over the trace.
 void mouseDragged(java.awt.event.MouseEvent e)
          Refreshes the display if the mouse is on the slider.
 void mouseEntered(java.awt.event.MouseEvent e)
          Unused
 void mouseExited(java.awt.event.MouseEvent e)
          Unused
 void mouseMoved(java.awt.event.MouseEvent e)
          Determines what the mouse is over and displays info in the info bar.
 void mousePressed(java.awt.event.MouseEvent e)
          Unused
 void mouseReleased(java.awt.event.MouseEvent e)
          Rescores the bin if the mouse was on the slider.
 void paint(java.awt.Graphics g)
          Draws the thumbnails.
 void refresh()
          Updates the display so that it matches the data, which may have changed.
 void setBin(Bin b)
          Sets the bin for the thumbnails to the specified one.
 void setBinList(DataList bins)
          Sets the bins for the thumbnail.
 void setLanes(DataList lanes)
          Sets the lanes for which to display thumbnails to the specified value.
 void setViewWidth(int width)
          Sets the width of the display area.
 void update(java.awt.Graphics g)
          Updates the display and is called by java.
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BLANK

public static final int BLANK

TRACE

public static final int TRACE
Constructor Detail

Thumbnail

public Thumbnail(DataList lanes,
                 DataList bins,
                 java.awt.Frame parentWindow)
Creates thumbnails with the specified parameters.
Parameters:
lanes - the lanes to produce thumbnails for
bins - the bins defined in the gel.
parentWindow - a windows used as the owner of various dialog boxes.
Method Detail

init

public void init()
Performs calculations neccessary to display the thumbnails. It finds the horizontal and vertical scales used to convert between pixels and base pairs, initializes the slider control with the correct values, scores the bin if neccessary, and ensures that only one cutoff appears in the bin. This is accomplished by applying the cutoff with the start position closest to the top of the bin to the entire bin. (The top has a larger size in bp.)

paint

public void paint(java.awt.Graphics g)
Draws the thumbnails. It will automatically adjust it's width to the correct size if a PrintGraphics is supplied. Normally the display is double-buffered, but not when drawing to a printer page.
Overrides:
paint in class java.awt.Container

drawTrace

public void drawTrace(java.awt.Graphics g,
                      Lane lane,
                      int x,
                      int y)
Draws the trace portion of the thumbnail. It uses the scales set by inti. The trace will be drawn in the same color as the signal for the lane. It also draws the border box and adds the lane number and score label for the lane to the top of the box, as well as the cutoff for the lane. If the cutoff is a line (type LinearCutoff then a straight line is drawn. Otherwise, the CutoffFunction is drawn by playing connect the dots.
Parameters:
g - the graphics to draw on
lane - the lane to display in the thumbnail
x - the top-left position of the thumbnail.
y - the top left position of the thumbnail.

update

public void update(java.awt.Graphics g)
Updates the display and is called by java. It simply calls paint.
Overrides:
update in class java.awt.Container

getButtonBar

public ButtonBar getButtonBar()
Gives the ButtonBar associated with the thumbnails.
Returns:
the button bar.

handleScoreError

protected void handleScoreError(ScoringFailure error)
Shows an options dialog if an error occurs when scoring a bin. The most likely reason is that the number of cutoffs do not match the number expected by the scoring function. The options are used to adjust the scoring function.
Parameters:
error - the orignal failure

getInfoBar

public Bar getInfoBar()
Returns a bar that displays information about the thumbnails. This object should be displayed somewhere by the container of this object.
Returns:
the bar as described above

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handles the buttons in the button bar.
Specified by:
actionPerformed in interface java.awt.event.ActionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Adjusts the scoring for a lane if the mouse is over the trace.
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Rescores the bin if the mouse was on the slider.
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Refreshes the display if the mouse is on the slider. Since the cutoffs are changing, the display needs to be updated.
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Determines what the mouse is over and displays info in the info bar.
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

setLanes

public void setLanes(DataList lanes)
Sets the lanes for which to display thumbnails to the specified value.
Parameters:
lanes - a list of lanes to display.

getLanes

public DataList getLanes()
Gives the lanes that are being displayed.
Returns:
the lanes
See Also:
setLanes(AFLPcore.DataList)

setViewWidth

public void setViewWidth(int width)
Sets the width of the display area. This will only be used when the thumbnails are printed, otherwise this class will look up the size of the screen, which can change and use that as the view width.
Parameters:
width - the width of the page.

setBin

public void setBin(Bin b)
Sets the bin for the thumbnails to the specified one. The bin is required for the thumbnails to display. This method sets the range of the thumbnails to that of the bin
Parameters:
b - the bin whose thumbnails to dislay.

getBin

public Bin getBin()
Gives the bin displayed. This can be changed from the one initially set when the thumbnail moves to the next or previous bin.
Returns:
the bin.

getThumbnailSize

public java.awt.Dimension getThumbnailSize()
Gives the size of an individual thumbnail, including the border around it.
Returns:
an container for both the widht and height

setBinList

public void setBinList(DataList bins)
Sets the bins for the thumbnail. These are provided so that the thumbnail can move to the next or previous bin.
Parameters:
bins - the bins in the gel

findPositionInfo

public int findPositionInfo(int x,
                            int y)
Gives the size and intensity for the given point. It will also determine if the point is on a trace or on a blank. If it is one a trace, it will determine the corresponding size in bp and intensity of that point.
Parameters:
x - the x-coordinate of the point.
y - the y-coordinate of the point.
Returns:
the type the point is in either BLANK or TRACE, which are constants declared in this class.

refresh

public void refresh()
Updates the display so that it matches the data, which may have changed.

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Unused
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Unused
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Unused
Specified by:
mouseExited in interface java.awt.event.MouseListener