AFLPgui
Class GraphView

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

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

Displays a graph of a bin. This class manages the size of the graph and draws the axis and axis labels. It also provides a slider to manipulate the cutoffs in the bin. The actually drawing of the graph is done by objects of the type Graph. Normally, the display is double-buffered, but this is disabled if the class is drawing to a printer page. When it first displays, it will adjust the cutoffs so that only one will appear in the bin, (the cutoff with the largest starting position). The size of the display and the graph can be manipulated by external classes.

See Also:
Graph, 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
 
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
GraphView(DataList lanes, DataList bins, java.awt.Frame parentWindow)
          Create a new GraphView with the specified parameters.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles the buttons in the button bar.
 Bin getBin()
          Gives the bin that was used to produce the graph.
 ButtonBar getButtonBar()
          Gives the ButtonBar associated with the graph.
 int getGraphWidth()
          Gets the width of the graph, which does not include borders.
 int getHeight()
          Gives the height of the graph display area, including borders.
 Bar getInfoBar()
          Returns a bar that displays information about the graph.
 int getWidth()
          Gives the width of the graph display area, including borders.
protected  void handleScoreError(ScoringFailure error)
          Shows an options dialog if an error occurs when scoring a bin.
 void init(Bin bin, DataList lanes, DataList bins)
          Initialize the graph view.
 void itemStateChanged(java.awt.event.ItemEvent e)
          Changes the graph to the one selected in the choice box.
 void mouseClicked(java.awt.event.MouseEvent e)
          Unused
 void mouseDragged(java.awt.event.MouseEvent e)
          Called when the mouse is dragged.
 void mouseEntered(java.awt.event.MouseEvent e)
          Unused
 void mouseExited(java.awt.event.MouseEvent e)
          Unused
 void mouseMoved(java.awt.event.MouseEvent e)
          Unused
 void mousePressed(java.awt.event.MouseEvent e)
          Unused
 void mouseReleased(java.awt.event.MouseEvent e)
          Called when the mouse is released.
 void paint(java.awt.Graphics g)
          Draws the graph.
 void refresh()
          Updates the display so that it matches the data.
 void setGraphWidth(int width)
          Sets the width of the actual graph, which does not include the border.
 void setHeight(int height)
          Sets the height of the graph display area, including borders, to the specified value.
 void setWidth(int width)
          Sets the width of the graph display area, including borders, to the specified value.
 void update(java.awt.Graphics g)
          Called to update the screen 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, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, 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
 

Constructor Detail

GraphView

public GraphView(DataList lanes,
                 DataList bins,
                 java.awt.Frame parentWindow)
Create a new GraphView with the specified parameters.
Parameters:
lanes - the lanes to include in the graph.
bins - a list of bins in the gel.
parentWindow - an owner for dialog boxes.
Method Detail

init

public void init(Bin bin,
                 DataList lanes,
                 DataList bins)
Initialize the graph view. This will do things like check to see that only a single cutoff applies to the specified bin in the lanes. It will also set the scale for the graph and score any bins that need scoring.
Parameters:
bin - the bin to show a graph for
lanes - the lanes to include in the graph
bins - a list of bins in the gel, used so the graph could switch to another bin.

getHeight

public int getHeight()
Gives the height of the graph display area, including borders.
Overrides:
getHeight in class java.awt.Component
Returns:
the height

setHeight

public void setHeight(int height)
Sets the height of the graph display area, including borders, to the specified value.
Parameters:
height - the new height for the view

getWidth

public int getWidth()
Gives the width of the graph display area, including borders.
Overrides:
getWidth in class java.awt.Component
Returns:
the width

setWidth

public void setWidth(int width)
Sets the width of the graph display area, including borders, to the specified value.
Parameters:
width - the new width

getGraphWidth

public int getGraphWidth()
Gets the width of the graph, which does not include borders. This is the value that will be passed to the graph drawing object.
Returns:
the width
See Also:
Graph

setGraphWidth

public void setGraphWidth(int width)
Sets the width of the actual graph, which does not include the border. This is the value that will be passed to the graph drawing object.
Parameters:
width - the new width for the graph
See Also:
Graph

getBin

public Bin getBin()
Gives the bin that was used to produce the graph.
Returns:
the bin currently displayed as a graph

paint

public void paint(java.awt.Graphics g)
Draws the graph. It will actually draw the axis and the tick marks, as well as the cutoffs, but the actual graph is drawn by the Graph object selected. The display is normally double buffered, but double-buffering is disabled if the method is drawing to a printed page.
Overrides:
paint in class java.awt.Container

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Changes the graph to the one selected in the choice box.
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

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

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Called when the mouse is released. It will rescore a bin if the mouse is released on the slider.
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Called when the mouse is dragged. It will refresh the display if the event originated with the cutoff slider.
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

update

public void update(java.awt.Graphics g)
Called to update the screen by Java. It simply calls paint.
Overrides:
update in class java.awt.Container

getButtonBar

public ButtonBar getButtonBar()
Gives the ButtonBar associated with the graph.
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 graph. This object should be displayed somewhere by the container of this object.
Returns:
the bar as described above

refresh

public void refresh()
Updates the display so that it matches the data.

mouseClicked

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

mousePressed

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

mouseMoved

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

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