Class SpreadSheet

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

class SpreadSheet
extends java.awt.Panel

This SpreadSheet class implements a dynamic spread sheet data structures. This includs underlying URL mappings, column and row headings etc. It has been extensively edited by the MAExplorer group to integrate it better with MAExplorer.

 This class creates a spread sheet with 2 fixed rows on top and on
 the Left.  The user data is modified using
 ShowSpreadSheetPopup.cvtTableToprepDataOrig(). 

 This new size is the size of prepDataOrig[0:rows][0:cols] w/ 2
 extra col & 2 extra rows.  The size is (tRows+2)*(tCols+2) but is
 addressed in [1:tRows+1][1:tCols+1].

 So if the user prepDataOrig is
     prepDataOrig[0:uRows-1][uCols], 
 then the virtual array is
     prepDataEdit[uRows+2][uCols+1]
 and rows 0 and column 0 are fixed.

 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)
 This means that when we scroll, the contents of these fixed
 cells are not changed. We only copy a subregion from 
 prepDataOrig[2:prepRows-1][2:prepCols-1] (???CHECK???)

 CLASSES
 =======
  #1 SpreadSheet    -  creates spreadsheet, title, and control buttons
  #2 SSspreadPanel  -  creates a panel of cells and scrollbars, create 
                       prepDataEdit[][].
  #3 SSstatusBar    -  panel w/ textfield displaying current grid value.
  #4 SStextCell     -  binary tree cells of TextFields with a String value 
  #5 SStextArray    -  array of SStextCell 
  #6 SSscrollHorizontal - a horizontal scrollbar for the SpreadSheet
  #7 SSscrollVertical - a vertical scrollbar for the SpreadSheet 

Version:
$Date: 2002/10/14 20:44:22 $ $Revision: $
Author:
Torsten Hothorn Originally written by Torsten Hothorn, 19.04.1998, Gnu General Licence

Heavily modified by the MAExplorer group.

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/.

, P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD

See Also:
MAExplorer Home, Report, ShowSpreadsheetPopup, 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, java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  java.awt.Font buttonFont
          ARG: cell label font
(package private) static int CELL_EXPR_PROFILE
          Spreadsheet Cell mode: Cell is an expression profile
(package private) static int CELL_NOP
          Spreadsheet Cell mode: Cell is just data
(package private) static int CELL_URL
          Spreadsheet Cell mode: Cell is a URL hypertext link
(package private)  java.awt.Font cellDataFont
          ARG: cell data font
(package private)  int[] cellFormat
          ARG: cell type [cols] fields is CELL_xxxx
(package private)  java.awt.Font cellUrlFont
          ARG: cell URL font
(package private)  java.lang.String[][] dataURL
          ARG: opt.
private  int fontSize
          font size number for cell entries
(package private)  MAExplorer mae
          link to global MAExplorer instance
private  int prepCols
          original # prep columns for prepDataOrig[0:prepRows-1][0:prepCols-1] sizes w/ 2 extra col & 2 extra rows.
(package private)  java.lang.String[][] prepDataOrig
          ARG:orig.
private  int prepRows
          original # prep rows for prepDataOrig[0:prepRows-1][0:prepCols-1] sizes w/ 2 extra col & 2 extra rows.
private  SSscrollHorizontal sh
          horizontal spreadsheet scroller instance
private  SSspreadPanel sp
          link to local SSspreadPanel instance
(package private)  ShowSpreadsheetPopup ssp
          link to global instance of SpreadsheetPopup
private  SSscrollVertical sv
          vertical spreadsheet scroller instance
(package private)  java.lang.String title
          ARG: user title
(package private)  java.awt.Panel titlePanel
          title panel for of spreadsheet
(package private)  boolean urlPopupFlag
          popup browser flag
private  int virCols
          virtual column sizes of prepDataEdit[0:rows-1][0:cols-1] This also inclues the field names in the top row and the row # in the left column
private  int virRows
          virtual row size of prepDataEdit[0:rows-1][0:cols-1] This also inclues the field names in the top row and the row # in the left column
 
Fields inherited from class java.awt.Panel
base, nameCounter, serialVersionUID
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, 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) SpreadSheet(ShowSpreadsheetPopup ssp, MAExplorer mae, int virRows, int virCols, java.lang.String[][] prepDataOrig, int prepRows, int prepCols, int fontSize, java.lang.String title, java.awt.Font cellUrlFont, java.awt.Font cellDataFont, java.awt.Font buttonFont, int[] cellFormat, java.lang.String[][] dataURL)
          Spreadsheet() - creates a new Panel with BoderLayout and adds a new SSspreadPanel (the grid itself) w/ horizontal and vertical scrollbars.
 
Method Summary
(package private)  void deleteColumn(int k)
          deleteColumn() - delete row at column k
private  void doSpreadSheet()
          doSpreadSheet() - create the spreadsheet panel, title, and control buttons
(package private)  java.lang.String getValue(int i, int j)
          getValue() - get the String from the cell at grid position (i,j)
(package private)  java.lang.String[][] getValues()
          getValues() - gets the whole grid as String[][] incl.
(package private)  void initValues(java.lang.String[][] data)
          initValues() - initialize data values for spreadsheet data structures
(package private)  void insertColumn(int k)
          insertColumn() - insert a column at column k
 
Methods inherited from class java.awt.Panel
, addNotify, constructComponentName, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paint, paintComponents, paintHeavyweightComponents, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, print, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusOwner, setFont, setLayout, transferFocus, update, validate, validateTree, writeObject
 
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, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkit, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, 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, resetGC, 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, registerNatives, wait, wait, wait
 

Field Detail

mae

MAExplorer mae
link to global MAExplorer instance

CELL_NOP

static final int CELL_NOP
Spreadsheet Cell mode: Cell is just data

CELL_URL

static final int CELL_URL
Spreadsheet Cell mode: Cell is a URL hypertext link

CELL_EXPR_PROFILE

static final int CELL_EXPR_PROFILE
Spreadsheet Cell mode: Cell is an expression profile

sp

private SSspreadPanel sp
link to local SSspreadPanel instance

sv

private SSscrollVertical sv
vertical spreadsheet scroller instance

sh

private SSscrollHorizontal sh
horizontal spreadsheet scroller instance

fontSize

private int fontSize
font size number for cell entries

prepRows

private int prepRows
original # prep rows for prepDataOrig[0:prepRows-1][0:prepCols-1] sizes w/ 2 extra col & 2 extra rows. Col 0 and Row 0 are NULLs. Col 1 rows [1:prepRows] is 1.2.3.4.5. prepRows.. Row 1 cols [1:prepCols] is F1, F2, F3,...

prepCols

private int prepCols
original # prep columns for prepDataOrig[0:prepRows-1][0:prepCols-1] sizes w/ 2 extra col & 2 extra rows. Col 0 and Row 0 are NULLs. Col 1 rows [1:prepRows] is 1.2.3.4.5. prepRows.. Row 1 cols [1:prepCols] is F1, F2, F3,...

virRows

private int virRows
virtual row size of prepDataEdit[0:rows-1][0:cols-1] This also inclues the field names in the top row and the row # in the left column

virCols

private int virCols
virtual column sizes of prepDataEdit[0:rows-1][0:cols-1] This also inclues the field names in the top row and the row # in the left column

prepDataOrig

java.lang.String[][] prepDataOrig
ARG:orig. prepDataOrig[0:prepRows-1][0:prepCols-1]

dataURL

java.lang.String[][] dataURL
ARG: opt. URL to use if not null then sizeof [prepRows][prepCols](??? CHECK???)

title

java.lang.String title
ARG: user title

cellUrlFont

java.awt.Font cellUrlFont
ARG: cell URL font

cellDataFont

java.awt.Font cellDataFont
ARG: cell data font

buttonFont

java.awt.Font buttonFont
ARG: cell label font

cellFormat

int[] cellFormat
ARG: cell type [cols] fields is CELL_xxxx

urlPopupFlag

boolean urlPopupFlag
popup browser flag

ssp

ShowSpreadsheetPopup ssp
link to global instance of SpreadsheetPopup

titlePanel

java.awt.Panel titlePanel
title panel for of spreadsheet
Constructor Detail

SpreadSheet

SpreadSheet(ShowSpreadsheetPopup ssp,
            MAExplorer mae,
            int virRows,
            int virCols,
            java.lang.String[][] prepDataOrig,
            int prepRows,
            int prepCols,
            int fontSize,
            java.lang.String title,
            java.awt.Font cellUrlFont,
            java.awt.Font cellDataFont,
            java.awt.Font buttonFont,
            int[] cellFormat,
            java.lang.String[][] dataURL)
Spreadsheet() - creates a new Panel with BoderLayout and adds a new SSspreadPanel (the grid itself) w/ horizontal and vertical scrollbars. Specify the fonts as well.
Parameters:
ssp - is instance of ShowSpreadsheetPopup
mae - is instance of MAExplorer
virRows - is # of virtual rows i.e. size of prepDataEdit[][]
virCols - is # of virtual columns i.e. size of prepDataEdit[][]
prepDataOrig - is user data[0:usrRawData][]
prepRows - is the size of prepDataOrig
prepCols - is the size of prepDataOrig
fontSize - is 8, 10, 12, 14
title -  
cellUrlFont - is the cell URL font
cellDataFont - is the cell data font
buttonFont - is the cell label font
cellFormat[] - is the cell type fields
dataURL[][] - is the data for URLs if not null
See Also:
SSspreadPanel.initValues(), doSpreadSheet()
Method Detail

doSpreadSheet

private void doSpreadSheet()
doSpreadSheet() - create the spreadsheet panel, title, and control buttons
See Also:
SSspreadPanel

initValues

void initValues(java.lang.String[][] data)
initValues() - initialize data values for spreadsheet data structures
Parameters:
data - is the initial data values
See Also:
SSspreadPanel.initValues()

getValue

java.lang.String getValue(int i,
                          int j)
getValue() - get the String from the cell at grid position (i,j)
Parameters:
i - is grid position i
j - is grid position j
Returns:
value at (i,j)
See Also:
SSspreadPanel.getValue(int, int)

getValues

java.lang.String[][] getValues()
getValues() - gets the whole grid as String[][] incl. labels
Returns:
entire grid
See Also:
SSspreadPanel.getValue(int, int)

insertColumn

void insertColumn(int k)
insertColumn() - insert a column at column k
Parameters:
k - number of new row to insert
See Also:
SSspreadPanel.insertColumn(int)

deleteColumn

void deleteColumn(int k)
deleteColumn() - delete row at column k
Parameters:
k - number of new row to delete
See Also:
SSspreadPanel.deleteColumn(int)