Class ExprProfileCanvas

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--ExprProfileCanvas
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

class ExprProfileCanvas
extends java.awt.Canvas

The ExprProfileCanvas is used to draw the expression profile. It also tracks locations of points drawn so they can be used with the event handler when the user clicks on a point or bar, etc.

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/07/07 21:40:41 $ $Revision: 1.9 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home, Serialized Form

Inner classes inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  boolean didDataSetupFlag
          set by setupData() if successful
(package private)  boolean doMeanPlotsFlag
          mean else individual plots
(package private)  boolean drawAdditionalDataFlag
          draw title & additional data if larger format.
(package private)  boolean drawIntoImageFlag
          set if draw plot to GIF file
(package private)  boolean drawLabelsFlag
          ARG: draw labels for larger version
(package private)  ExprProfile ep
          expression profile for mid
private static java.awt.Font font
           
private  int fontHeight
          height font size of current font
private  int fontLeading
          leading font size of current font
(package private)  MAExplorer mae
          instance of MAExplorer so we can clear flags indicating the user did a manual quit()
(package private) static int MIN_CANVAS_HEIGHT
          default canvas height size
(package private) static int MIN_CANVAS_WIDTH
          default canvas width size
(package private) static int MODE_CIRCLE
          draw circles for each entry
(package private) static int MODE_CURVE
          draw continuous curve
(package private) static int MODE_LINE
          draw vertical bars
(package private)  java.lang.String oGifFileName
          full Gif file path name
(package private)  int plotStyleMode
          plot mode style: 0=line, 1=circle, 2=curve
 int preferredHeight
          preferred canvas height size
 int preferredWidth
          preferred canvas width size
(package private)  boolean showErrBarsFlag
          draw error bars for each line
(package private)  boolean showKmeansDataFlag
          report K-means data else just CloneID & name
(package private) static int TARGET_SIZE
          target Size for selecting a line
private  java.lang.String title
          ARG: opt.
private static java.awt.Font titleFont
           
(package private)  int xCursor
          event handler mouse X cursor coordinates
(package private)  int yCursor
          event handler mouse Y cursor coordinates
(package private)  int zoomBarsMag
          zoom magnification: by 1X, 2X, 5X, 10X, 20X mod
 
Fields inherited from class java.awt.Canvas
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dbg, dropTarget, enabled, eventMask, focusListener, focusListenerK, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
(package private) ExprProfileCanvas(MAExplorer mae, int mid, java.lang.String title, java.awt.Font font, int preferredWidth, int preferredHeight, boolean showKmeansDataFlag, boolean drawLabelsFlag)
          ExprProfileCanvas() - Constructor to display an expression profile in a canvas.
 
Method Summary
(package private)  boolean drawGifFile(java.lang.String oGifFileName)
          drawGifFile() - draw expression plot into Gif image file if in standalone mode.
 java.awt.Dimension getMinimumSize()
          getMinimumSize() - get the minimum preferred size
 java.awt.Dimension getPreferredSize()
          getPreferredSize() - get the preferred size
 void paint(java.awt.Graphics g)
          paint() - draw the expression profile in the canvas if a legal gene MID.
(package private)  void setPlotEPmeansData(int mid, int hpDataNbr, float maxHPdataMn, float[] hpDataMn, float[] hpDataSD, boolean doMeanPlotsFlag)
          setPlotEPmeansData() - set expression profile data so plot mean EP data.
(package private)  boolean updateData(int mid, java.lang.String title, boolean drawLabelsFlag)
          updateData() - update expression profile plot with new gene data.
 
Methods inherited from class java.awt.Canvas
, addNotify, constructComponentName, getAccessibleContext, postsOldMouseEvents
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkGD, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createChildHierarchyEvents, createHierarchyEvents, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, eventEnabled, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getMaximumSize, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, layout, lightweightPaint, lightweightPrint, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, numListening, paintAll, paintHeavyweightComponents, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, printHeavyweightComponents, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, resetGC, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate, writeObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

mae

MAExplorer mae
instance of MAExplorer so we can clear flags indicating the user did a manual quit()

ep

ExprProfile ep
expression profile for mid

MODE_LINE

static final int MODE_LINE
draw vertical bars

MODE_CIRCLE

static final int MODE_CIRCLE
draw circles for each entry

MODE_CURVE

static final int MODE_CURVE
draw continuous curve

MIN_CANVAS_WIDTH

static final int MIN_CANVAS_WIDTH
default canvas width size

MIN_CANVAS_HEIGHT

static final int MIN_CANVAS_HEIGHT
default canvas height size

TARGET_SIZE

static final int TARGET_SIZE
target Size for selecting a line

preferredHeight

public int preferredHeight
preferred canvas height size

preferredWidth

public int preferredWidth
preferred canvas width size

font

private static java.awt.Font font

titleFont

private static java.awt.Font titleFont

xCursor

int xCursor
event handler mouse X cursor coordinates

yCursor

int yCursor
event handler mouse Y cursor coordinates

fontHeight

private int fontHeight
height font size of current font

fontLeading

private int fontLeading
leading font size of current font

title

private java.lang.String title
ARG: opt. from user. If drawLabel

plotStyleMode

int plotStyleMode
plot mode style: 0=line, 1=circle, 2=curve

zoomBarsMag

int zoomBarsMag
zoom magnification: by 1X, 2X, 5X, 10X, 20X mod

showKmeansDataFlag

boolean showKmeansDataFlag
report K-means data else just CloneID & name

showErrBarsFlag

boolean showErrBarsFlag
draw error bars for each line

doMeanPlotsFlag

boolean doMeanPlotsFlag
mean else individual plots

didDataSetupFlag

boolean didDataSetupFlag
set by setupData() if successful

drawLabelsFlag

boolean drawLabelsFlag
ARG: draw labels for larger version

drawAdditionalDataFlag

boolean drawAdditionalDataFlag
draw title & additional data if larger format.

drawIntoImageFlag

boolean drawIntoImageFlag
set if draw plot to GIF file

oGifFileName

java.lang.String oGifFileName
full Gif file path name
Constructor Detail

ExprProfileCanvas

ExprProfileCanvas(MAExplorer mae,
                  int mid,
                  java.lang.String title,
                  java.awt.Font font,
                  int preferredWidth,
                  int preferredHeight,
                  boolean showKmeansDataFlag,
                  boolean drawLabelsFlag)
ExprProfileCanvas() - Constructor to display an expression profile in a canvas.
 If mid >=0, then display gene info
 If mid==-1, then display "request to click on a gene"
 If mid==-2, then don't draw anything.
Parameters:
mae - is the MAExplorer instance
mid - is the Master Gene Index if not -1
title - is the title for canvas label
font - is the overide labels font if not null
preferredWidth - is the canvas size, 0 to use defaults
preferredHeight -  
showKmeansDataFlag - to draw K-means else gene data
drawLabelsFlag - if true
See Also:
ExprProfile.setupData(int)
Method Detail

drawGifFile

boolean drawGifFile(java.lang.String oGifFileName)
drawGifFile() - draw expression plot into Gif image file if in standalone mode. This sets it up and lets paint() to the heavy lifting...
Parameters:
oGifFileName - is the full path GIF output file
Returns:
false if unable to generate the image file.
See Also:
Component.repaint()

getPreferredSize

public java.awt.Dimension getPreferredSize()
getPreferredSize() - get the preferred size
Overrides:
getPreferredSize in class java.awt.Component
Returns:
window size

getMinimumSize

public java.awt.Dimension getMinimumSize()
getMinimumSize() - get the minimum preferred size
Overrides:
getMinimumSize in class java.awt.Component
Returns:
window size

updateData

boolean updateData(int mid,
                   java.lang.String title,
                   boolean drawLabelsFlag)
updateData() - update expression profile plot with new gene data. Only repaint if a legal gene MID.
Parameters:
mid - is the Master Gene Index if not -1
title - is the title for canvas label
drawLabelsFlag - if true
See Also:
ExprProfile.setupData(int), Component.repaint()

setPlotEPmeansData

void setPlotEPmeansData(int mid,
                        int hpDataNbr,
                        float maxHPdataMn,
                        float[] hpDataMn,
                        float[] hpDataSD,
                        boolean doMeanPlotsFlag)
setPlotEPmeansData() - set expression profile data so plot mean EP data.
Parameters:
mid - is the Master Gene Index if not -1
hpDataNbr - is the # HP-E members
maxHPdataMn - is the max value in vector
hpDataMn - is the Mean HP member quant data
hpDataSD - is the S.D. HP member quant data
doMeanPlotsFlag - if true
See Also:
ExprProfile.updateData(int), Component.repaint()

paint

public void paint(java.awt.Graphics g)
paint() - draw the expression profile in the canvas if a legal gene MID.
Overrides:
paint in class java.awt.Canvas
Parameters:
g - is graphics context
See Also:
CompositeDatabase.setObjCoordFromMID(int, java.lang.Object), PopupRegistry.chkOtherCurGeneEffects(int, int), SpotFeatures.showValidSpotInfo(java.awt.Point, MaHybridSample), Util.cvf2s(float, int), WriteGifEncoder, WriteGifEncoder.writeFile(java.lang.String), Component.repaint()