Class ShowSpreadsheetPopup

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--ShowSpreadsheetPopup
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.io.Serializable, java.awt.event.WindowListener

class ShowSpreadsheetPopup
extends java.awt.Frame
implements java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.event.ItemListener

The ShowSpreadsheetPopup class pops up a scrollable dynamic spreadsheet. For columns that should contain hypertext links, this displays table data in formated/clickable spreadsheet and handles hyperlink dispatching events.

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/04/24 20:16:17 $ $Revision: 1.6 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home, Report, SpreadSheet, Serialized Form

Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock
 
Field Summary
private  java.lang.String[] altFieldNames
          ARG: [maxCols] if ! null - same for all cells
private  java.awt.Font buttonFont
          cell label font
(package private)  java.awt.Checkbox cb
          Checkbox
(package private)  java.awt.Color cellClicked
          clicked color for cell color in spreadsheet
private  java.awt.Font cellDataFont
          cell data font
private  int[] cellFormat
          ARG: cell type [0:maxCols] fields which are urls is Spreadsheet.CELL_NOP, .CELL_URL, or .CELL_EXPR_PROFILE
(package private)  java.awt.Color cellReg
          normal color for cell color in spreadsheet
private  java.awt.Font cellUrlFont
          cell URL font
(package private)  int clickedCellCol
          keep track of last clicked cell
(package private)  int clickedCellRow
          keep track of last clicked cell
private  int cols
          cols
private  java.lang.String[][] dataURL
          ARG: if url [0:maxRows-1][0:maxCols-1] from and not null, use this for URL
(package private) static int DEF_COLS_TO_SHOW
          # of cols to show in dynamic spreadsheet
(package private)  int fontSize
          integer value of fontSizeStr
(package private)  java.lang.String fontSizeStr
          ARG: font size
private  java.awt.Frame frame
          frame which holds popup spreadsheet
(package private)  java.awt.Color headerClicked
          color for header when click on cell
(package private)  java.lang.String headerName
          header name for col clicked on in virData
(package private)  int lastRow
          ARG: end of table data to use, counts from 0?
private  MAExplorer mae
          link to global MAExplorer instance
(package private) static int MAX_ROWS_TO_SHOW
          # of rows to show in dynamic spreadsheet
(package private)  int oldTagCol
          old tag col for clicked cell color (before)
(package private)  int oldTagRow
           
(package private) static int POPUP_HEIGHT
          size (height) of popup report window
(package private) static int POPUP_WIDTH
          size (width) of popup report window
(package private)  java.lang.String popupName
          ARG: for PopupRegistry
(package private)  int popupPropertyBits
          ARG: for PopupRegistry
(package private)  int prepCols
          # cols in prepData table
private  java.lang.String[][] prepData
          displayed data [0:prepRows-1][0:prepCols-1]
(package private)  int prepHdrPos
          location of col clicked in prepData
(package private)  int prepRows
          # rows in prepData table
private  Report report
          Report instance to show
private  int rows
          rows
(package private)  SpreadSheet ss
          SpreadSheet objecyt
(package private)  int startRow
          ARG: start of table data to use, counts from 0 ?
(package private)  int tagCol
          tag col for current clicked cell color
(package private)  int tagRow
          tag row for current clicked cell color
(package private)  int tCols
          ARG: # cols in Table data
private  java.lang.String[][] tData
          ARG: user Table data [0:maxRows-1][0:maxCols-1]
private  java.lang.String[] tFields
          ARG: [maxCols] Table field names from user
(package private)  java.lang.String title
          ARG: title of spreadsheet
(package private)  int tRows
          ARG: # rows in Table data
(package private)  boolean urlPopupFlag
          popup browser flag
(package private)  boolean urlViewerFlag
          button for browser control
(package private)  int virtualHdrPos
          location of col clicked in virData
 
Fields inherited from class java.awt.Frame
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis
 
Fields inherited from class java.awt.Window
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, showWithParent, warningString, windowListener, windowSerializedDataVersion
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads
 
Fields inherited from class java.awt.Component
accessibleContext, actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, 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) ShowSpreadsheetPopup(MAExplorer mae, Report report, java.lang.String[] tFields, java.lang.String[][] tData, int lastRow, int startRow, int tRows, int tCols, java.lang.String fontSizeStr, java.lang.String title, java.lang.String[] altFieldNames, int[] cellFormat, java.lang.String[][] dataURL, java.lang.String popupName, int popupPropertyBits, boolean urlViewerFlag)
          ShowSpreadsheetPopup() - constructor to create a spreadsheet from raw data with URL spec.
(package private) ShowSpreadsheetPopup(MAExplorer mae, Report report, Table t, java.lang.String fontSizeStr, java.lang.String title, java.lang.String popupName, int popupPropertyBits, boolean urlViewerFlag)
          ShowSpreadsheetPopup() - constructor to create a spreadsheet from table without URL spec.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          actionPerformed() - Handle Control panel button clicks
(package private)  void close()
          close() - close this popup and reset flags if needed
private  boolean createSpreadSheet()
          createSpreadSheet() - create the the popup spreadsheet
private  java.lang.String[][] cvtTableToPrepData(java.lang.String[][] tData, java.lang.String[] tFields, int tRows, int tCols)
          cvtTableToPrepData() - cvt tFields & tData into one prepData[][] string[].
 void itemStateChanged(java.awt.event.ItemEvent e)
           
(package private)  void updateCurGene(int mid)
          updateCurGene() - update plot if current gene changed and this type of report requires it.
(package private)  void updateFilter(GeneList ml)
          updateFilter() - update plot if Filter changed and this type of report requires it.
(package private)  void updateLabels()
          updateLabels() - update string report if labels changed and this type of report requires it.
(package private)  void updateSlider()
          updateSlider() - update plot if Slider changed and this type of report requires it.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
          windowClosing() - close down the window.
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
 
Methods inherited from class java.awt.Frame
, addNotify, addToFrameList, constructComponentName, finalize, getAccessibleContext, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, initIDs, isResizable, paramString, postProcessKeyEvent, readObject, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle, writeObject
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, processWindowEvent, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFont, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

mae

private MAExplorer mae
link to global MAExplorer instance

DEF_COLS_TO_SHOW

static final int DEF_COLS_TO_SHOW
# of cols to show in dynamic spreadsheet

MAX_ROWS_TO_SHOW

static final int MAX_ROWS_TO_SHOW
# of rows to show in dynamic spreadsheet

POPUP_WIDTH

static final int POPUP_WIDTH
size (width) of popup report window

POPUP_HEIGHT

static final int POPUP_HEIGHT
size (height) of popup report window

report

private Report report
Report instance to show

tFields

private java.lang.String[] tFields
ARG: [maxCols] Table field names from user

tData

private java.lang.String[][] tData
ARG: user Table data [0:maxRows-1][0:maxCols-1]

dataURL

private java.lang.String[][] dataURL
ARG: if url [0:maxRows-1][0:maxCols-1] from and not null, use this for URL

altFieldNames

private java.lang.String[] altFieldNames
ARG: [maxCols] if ! null - same for all cells

prepData

private java.lang.String[][] prepData
displayed data [0:prepRows-1][0:prepCols-1]

cellFormat

private int[] cellFormat
ARG: cell type [0:maxCols] fields which are urls is Spreadsheet.CELL_NOP, .CELL_URL, or .CELL_EXPR_PROFILE

prepHdrPos

int prepHdrPos
location of col clicked in prepData

virtualHdrPos

int virtualHdrPos
location of col clicked in virData

clickedCellRow

int clickedCellRow
keep track of last clicked cell

clickedCellCol

int clickedCellCol
keep track of last clicked cell

oldTagRow

int oldTagRow

oldTagCol

int oldTagCol
old tag col for clicked cell color (before)

tagRow

int tagRow
tag row for current clicked cell color

tagCol

int tagCol
tag col for current clicked cell color

prepRows

int prepRows
# rows in prepData table

prepCols

int prepCols
# cols in prepData table

lastRow

int lastRow
ARG: end of table data to use, counts from 0?

startRow

int startRow
ARG: start of table data to use, counts from 0 ?

tRows

int tRows
ARG: # rows in Table data

tCols

int tCols
ARG: # cols in Table data

fontSize

int fontSize
integer value of fontSizeStr

title

java.lang.String title
ARG: title of spreadsheet

headerName

java.lang.String headerName
header name for col clicked on in virData

fontSizeStr

java.lang.String fontSizeStr
ARG: font size

popupName

java.lang.String popupName
ARG: for PopupRegistry

popupPropertyBits

int popupPropertyBits
ARG: for PopupRegistry

rows

private int rows
rows

cols

private int cols
cols

cellUrlFont

private java.awt.Font cellUrlFont
cell URL font

cellDataFont

private java.awt.Font cellDataFont
cell data font

buttonFont

private java.awt.Font buttonFont
cell label font

frame

private java.awt.Frame frame
frame which holds popup spreadsheet

ss

SpreadSheet ss
SpreadSheet objecyt

cb

java.awt.Checkbox cb
Checkbox

urlViewerFlag

boolean urlViewerFlag
button for browser control

urlPopupFlag

boolean urlPopupFlag
popup browser flag

headerClicked

java.awt.Color headerClicked
color for header when click on cell

cellClicked

java.awt.Color cellClicked
clicked color for cell color in spreadsheet

cellReg

java.awt.Color cellReg
normal color for cell color in spreadsheet
Constructor Detail

ShowSpreadsheetPopup

ShowSpreadsheetPopup(MAExplorer mae,
                     Report report,
                     java.lang.String[] tFields,
                     java.lang.String[][] tData,
                     int lastRow,
                     int startRow,
                     int tRows,
                     int tCols,
                     java.lang.String fontSizeStr,
                     java.lang.String title,
                     java.lang.String[] altFieldNames,
                     int[] cellFormat,
                     java.lang.String[][] dataURL,
                     java.lang.String popupName,
                     int popupPropertyBits,
                     boolean urlViewerFlag)
ShowSpreadsheetPopup() - constructor to create a spreadsheet from raw data with URL spec. use DIFFERENT name for URL as in the cell.
Parameters:
mae - is the MAExplorer instance
report - is the Report instance to display
tFields - is the Table fields
tData - is the Table data
lastRow - is the end of the region
startRow - is the start of the region
tRows - is the # rows of tData
tCols - is the # cols of tData
fontSizeStr - is the cell font size "12pt", "10pt", "8pt"
title - of spreadsheet
altFieldNames - if not null (name to display since data is URL type data)
cellFormat - is the cell type fields that may highlight some cells
dataURL - is associated URL data
popupName - is the name for PopupRegistry
popupPropertyBits - is property bits for PopupRegistry
urlViewerFlag - if browser popup is enabled
See Also:
createSpreadSheet()

ShowSpreadsheetPopup

ShowSpreadsheetPopup(MAExplorer mae,
                     Report report,
                     Table t,
                     java.lang.String fontSizeStr,
                     java.lang.String title,
                     java.lang.String popupName,
                     int popupPropertyBits,
                     boolean urlViewerFlag)
ShowSpreadsheetPopup() - constructor to create a spreadsheet from table without URL spec.
Parameters:
mae - is the MAExplorer instance
report - is the Report instance to display
t - the Table instance
fontSizeStr - is the cell font size "12pt", "10pt", "8pt"
title - of spreadsheet
popupName - is the name for PopupRegistry
popupPropertyBits - is property bits for PopupRegistry
urlViewerFlag - if browser popup is enabled
See Also:
createSpreadSheet()
Method Detail

createSpreadSheet

private boolean createSpreadSheet()
createSpreadSheet() - create the the popup spreadsheet
Returns:
false if there is problem.
See Also:
PopupRegistry.addPopupWindowToReg(ShowPlotPopup, java.lang.String, int), PopupRegistry.removePopupByKey(java.lang.String), Util.cvFontS2I(java.lang.String), cvtTableToPrepData(java.lang.String[][], java.lang.String[], int, int)

cvtTableToPrepData

private java.lang.String[][] cvtTableToPrepData(java.lang.String[][] tData,
                                                java.lang.String[] tFields,
                                                int tRows,
                                                int tCols)
cvtTableToPrepData() - cvt tFields & tData into one prepData[][] string[]. There is also a null row vector at the top and null col vector on the left. w/ 2 extra col & 2 extra rows. The size is (tRows+2)*(tCols+2) but is addressed in [1:tRows+1][1:tCols+1]. Col 0 vector and Row 0 vector are NULLs. Col 1 vector is a fixed list of quoted numbers "1", "2", "3" ... Row 1 vector is a fixed list of field names F1, F2, F3,... and rows 0 and column 0 are fixed. row\col 0 1 2 3 5 6 tCols+1 (index) 0 null null null null null null ... 1 null "" F1(A) F2(B) F3(C) F4(D) ... F[tCols-1] 2 null "1" * * * * . . 3 null "2" * * * * . . . ... 4 null "3" * * * * . . . . . . tRows+1 null "tRows" . . . (index)
Parameters:
tFields - is the Table fields
tData - is the Table data
tRows - is the # rows of tData
tCols - is the # cols of tData
Returns:
null if there is a problem.

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed() - Handle Control panel button clicks
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - is ActionEvent for Buttons
See Also:
close()

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
windowClosing() - close down the window.
Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
e - is window closing event
See Also:
close()

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

updateCurGene

void updateCurGene(int mid)
updateCurGene() - update plot if current gene changed and this type of report requires it.
Parameters:
mid - is the new Master Gene ID of the current gene

updateFilter

void updateFilter(GeneList ml)
updateFilter() - update plot if Filter changed and this type of report requires it.
Parameters:
ml - is the gene list to update now that filter has changed.

updateSlider

void updateSlider()
updateSlider() - update plot if Slider changed and this type of report requires it.

updateLabels

void updateLabels()
updateLabels() - update string report if labels changed and this type of report requires it.
See Also:
Component.repaint()

close

void close()
close() - close this popup and reset flags if needed
See Also:
PopupRegistry.removePopupByKey(java.lang.String)