Class PopupHPChooser

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--PopupHPChooser
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.awt.event.WindowListener

class PopupHPChooser
extends java.awt.Frame
implements java.awt.event.ActionListener, java.awt.event.WindowListener

The class creates a GUI for selecting HP-X and HP-Y 'sets', HP-E 'list'. It lets users select subsets of samples from the set of all samples loaded in the database. Since HP-X and HP-Y sets are mutually exclusive, the data put into HP-X 'set' is not available to put into the HP-Y 'set'. The HP-E list' may be defined as an ordered list from a subset of the set of all samples.

The GUI uses 3 instances of the ChooserGUI tied together as described above and illustrated in the figure below. It makes copies of the HP sample lists in SampleSets hps.(msList, msListX, msListY, msListE) into

 The user selected results are saved in local arrays:
   msListXo[], msListYo[],  msListEo[], msListoXY[], msListoE[].
 Then generate the corresponding string arrays
   sListXo[], sListYo[],  sListEo[], sListoXY[], sListoE[].

 The SELECTED lists are sListXo[], sListYo[], sListEo[].
 The REMAINING lists are: sListoXY[] and sListoE[].
If the user finally presses "Done", the results are saveed back in SampleSets hps.(msListX, msListY, msListE).

  The following is the GUI Layout for HP chooser

   REMAINDERs     SELECTEDs
  
  |------|       |------|
  |  HP  |   ->  | HP-X | Up
  | rem  |   <-  |      | Down
  |------|       |------| 
                 
    use      ->  |------| 
    above    <-  | HP-Y | Up
                 |      | Down
                 |------| 
	  
  |------|       |------| 
  | HP   |   ->  | HP-E | Up
  | rem  |   <-  |      | Down
  |------|       |------| 
            
 --------------------------------
 |  info area for selected HP   |
 --------------------------------
  
   OK   CANCEL  RESET  (control buttons)
 

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.

Version:
$Date: 2002/10/30 00:00:49 $ $Revision: $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home, ChooserGUI, 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
(package private)  int cgIdx
          index of chooser instance in cgList[]
private  ChooserGUI[] cgList
          [0:nChooser-1] list of chooserGUIs
private  java.awt.Font dataFont
          font for data of popup chooser window
private  java.awt.Frame f
          frame to install choosers
(package private)  int frameHeight
          default frame size - must be here!
(package private)  int frameWidth
          default frame size - must be here!
private  int hpMenuItemListSize
          sorted list of HP menu size
private  SampleSets hps
          link to global SampleSets instance
(package private)  int id
          id # for this instance
private  java.awt.TextField infoTA1
          first line of info about selected HP
private  java.awt.TextField infoTA2
          second line of info about selected HP
private  java.awt.TextField infoTA3
          third line of info about selected HP
private  java.awt.Font labelFont
          font for labels of popup chooser window
private  MAExplorer mae
          link to global MAExplorer instance
private static int masterID
           
private  MaHybridSample[] msList
          List of ALL initial samples in DB
private  MaHybridSample[] msListEo
          initial HP-E sample list on starting chooser
private  MaHybridSample[] msListrE
          rem(E) = mxListo - msListEo
private  MaHybridSample[] msListrXY
          rem(X+Y) = mxListo - msListXo - msListYo
private  MaHybridSample[] msListXo
          initial HP-X sample list on starting chooser
private  MaHybridSample[] msListYo
          initial HP-Y sample list on starting chooser
(package private)  int nChooser
          number of ChooseGUI instances
private  int nHP
          # all probes in the database
private  int nHPEf
          # of final selected HP-E samples
private  int nHPEo
          # of original HP-E selected samples
private  int nHPrE
          # rem(E) = mxListo - msListEo
private  int nHPrXY
          # rem(X+Y) = mxListo - msListXo - msListYo
private  int nHPXf
          # of final selected HP-X samples
private  int nHPXo
          # of original HP-X selected samples
private  int nHPYf
          # of final selected HP-Y samples
private  int nHPYo
          # of original HP-Y selected samples
(package private) static int POPUP_HEIGHT
          Height of frame holding popup HP chooser.
(package private) static int POPUP_WIDTH
          Width of of frame holding popup HP chooser.
private  java.lang.String[] sList
          List of ALL initial samples in DB
private  java.lang.String[] sListEo
          initial HP-E list on starting chooser
private  java.lang.String[] sListrE
          rem(E) = msListo - msListEo
private  java.lang.String[] sListrXY
          rem(X+Y) = msListo - msListXo - msListYo
private  java.lang.String[] sListXo
          initial HP-X sample list on starting chooser
private  java.lang.String[] sListYo
          initial HP-Y sample list on starting chooser
(package private)  int taCols
          TextArea cols dimensions
(package private)  int taRows
          TextArea rows dimensions
private  java.lang.String title
          title of popup chooser window
private  java.awt.Font titleFont
          font for title of popup chooser window
 
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) PopupHPChooser(MAExplorer mae, java.awt.Font titleFont, java.awt.Font labelFont, java.awt.Font dataFont, int taRows, int taCols)
          PopupHPChooser() - Constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          actionPerformed() - handle action events buttons and text areas.
(package private)  void addObj(java.awt.Container cont, java.lang.Object arg, int x, int y, int w, int h, double weightX, double weightY)
          addObj() - add object to GridBagLayout.
(package private)  void buildDataStructures()
          buildDataStructures() - build the data structures used by the popup chooser.
(package private)  void buildHPchooserGUI(java.lang.String title)
          buildHPchooserGUI() - create GUI for PopupHPChooser.
(package private)  void close()
          close() - close the window.
 void keyPressed(java.awt.event.KeyEvent e)
          keyPressed() - get key Pressed event - look for ESCAPE key to set STOP flag
 void keyReleased(java.awt.event.KeyEvent e)
          keyReleased() - get key Released event
 void keyTyped(java.awt.event.KeyEvent e)
          keyTyped() - get key typed event - look for ESCAPE key to set STOP flag
(package private)  void printChooserState(java.lang.String msg)
          printChooserState() - print chooser state data.
private  void setMAEstateFromChooserData()
          setMAEstateFromChooserData() - restore MAE state from chooser data.
private  boolean setupHP_XYEchooserLists()
          setupHP_XYEchooserLists() - setup working HP-(X,Y,E) chooser lists.
(package private)  void updateInfo(ChooserGUI cGUI, int idx, java.lang.String sEntry)
          updateInfo() - update the info text fields for selected HP Note: this should be called from ChooseGUI when an entry is picked.
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
          windowClosing() - close 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

hps

private SampleSets hps
link to global SampleSets instance

masterID

private static int masterID

id

int id
id # for this instance

POPUP_HEIGHT

static final int POPUP_HEIGHT
Height of frame holding popup HP chooser. was 500

POPUP_WIDTH

static final int POPUP_WIDTH
Width of of frame holding popup HP chooser. Old 650 (30 cols), (old 550 before Up/Down).

f

private java.awt.Frame f
frame to install choosers

frameWidth

int frameWidth
default frame size - must be here!

frameHeight

int frameHeight
default frame size - must be here!

cgIdx

int cgIdx
index of chooser instance in cgList[]

taRows

int taRows
TextArea rows dimensions

taCols

int taCols
TextArea cols dimensions

nChooser

int nChooser
number of ChooseGUI instances

cgList

private ChooserGUI[] cgList
[0:nChooser-1] list of chooserGUIs

nHPXo

private int nHPXo
# of original HP-X selected samples

nHPYo

private int nHPYo
# of original HP-Y selected samples

nHPEo

private int nHPEo
# of original HP-E selected samples

nHP

private int nHP
# all probes in the database

nHPrXY

private int nHPrXY
# rem(X+Y) = mxListo - msListXo - msListYo

nHPrE

private int nHPrE
# rem(E) = mxListo - msListEo

nHPXf

private int nHPXf
# of final selected HP-X samples

nHPYf

private int nHPYf
# of final selected HP-Y samples

nHPEf

private int nHPEf
# of final selected HP-E samples

hpMenuItemListSize

private int hpMenuItemListSize
sorted list of HP menu size

msListXo

private MaHybridSample[] msListXo
initial HP-X sample list on starting chooser

msListYo

private MaHybridSample[] msListYo
initial HP-Y sample list on starting chooser

msListEo

private MaHybridSample[] msListEo
initial HP-E sample list on starting chooser

msList

private MaHybridSample[] msList
List of ALL initial samples in DB

msListrXY

private MaHybridSample[] msListrXY
rem(X+Y) = mxListo - msListXo - msListYo

msListrE

private MaHybridSample[] msListrE
rem(E) = mxListo - msListEo

sListXo

private java.lang.String[] sListXo
initial HP-X sample list on starting chooser

sListYo

private java.lang.String[] sListYo
initial HP-Y sample list on starting chooser

sListEo

private java.lang.String[] sListEo
initial HP-E list on starting chooser

sList

private java.lang.String[] sList
List of ALL initial samples in DB

sListrXY

private java.lang.String[] sListrXY
rem(X+Y) = msListo - msListXo - msListYo

sListrE

private java.lang.String[] sListrE
rem(E) = msListo - msListEo

title

private java.lang.String title
title of popup chooser window

titleFont

private java.awt.Font titleFont
font for title of popup chooser window

labelFont

private java.awt.Font labelFont
font for labels of popup chooser window

dataFont

private java.awt.Font dataFont
font for data of popup chooser window

infoTA1

private java.awt.TextField infoTA1
first line of info about selected HP

infoTA2

private java.awt.TextField infoTA2
second line of info about selected HP

infoTA3

private java.awt.TextField infoTA3
third line of info about selected HP
Constructor Detail

PopupHPChooser

PopupHPChooser(MAExplorer mae,
               java.awt.Font titleFont,
               java.awt.Font labelFont,
               java.awt.Font dataFont,
               int taRows,
               int taCols)
PopupHPChooser() - Constructor.
Parameters:
mae - is instance of MAExplorer
titleFont - is the font for the title
labelFont - is the font for the labels
dataFont - is the font for the data
taRows - is the TextArea rows dimension
taCols - is the TextArea cols dimension
See Also:
buildHPchooserGUI(java.lang.String)
Method Detail

buildHPchooserGUI

void buildHPchooserGUI(java.lang.String title)
buildHPchooserGUI() - create GUI for PopupHPChooser.
Parameters:
title - for the chooser
See Also:
addObj(java.awt.Container, java.lang.Object, int, int, int, int, double, double), buildDataStructures()

addObj

void addObj(java.awt.Container cont,
            java.lang.Object arg,
            int x,
            int y,
            int w,
            int h,
            double weightX,
            double weightY)
addObj() - add object to GridBagLayout. Uses x,y grid system. See GridBagConstriants in Patrick Chan's book on Java classes II, AWT classes, Revision 2, p.738.
Parameters:
cont - is panel, window, or scrollpane
arg - is the Label/Panel
x - is the x coord location
y - is the y coord location
w - is the cell width
h - is the cell height
weightX - is the row weight
weightY - is the col weight

buildDataStructures

void buildDataStructures()
buildDataStructures() - build the data structures used by the popup chooser. It uses data in the scroller windows from SampleSets.msListX|Y|E|*[0:nHPX|Y|E|* -1]
See Also:
ChooserGUI, ChooserGUI.buildChooserGUI(), ChooserGUI.setListData(int, int, int, int, java.lang.String[], java.lang.String[]), ChooserGUI.setTitles(java.lang.String, java.lang.String), printChooserState(java.lang.String), setupHP_XYEchooserLists()

setupHP_XYEchooserLists

private boolean setupHP_XYEchooserLists()
setupHP_XYEchooserLists() - setup working HP-(X,Y,E) chooser lists. Setup original ms lists. Save the results in: msListXo[], msListYo[], msListEo[], msListoXY[], msListoE[]. Then generate the corresponding string arrays sListXo[], sListYo[], sListEo[], sListoXY[], sListoE[]. NOTE: data is specified as [1:n] rather than [0:n-1].
Returns:
true if successful.

setMAEstateFromChooserData

private void setMAEstateFromChooserData()
setMAEstateFromChooserData() - restore MAE state from chooser data.
See Also:
Component.repaint()

printChooserState

void printChooserState(java.lang.String msg)
printChooserState() - print chooser state data.
Parameters:
msg - optional message

updateInfo

void updateInfo(ChooserGUI cGUI,
                int idx,
                java.lang.String sEntry)
updateInfo() - update the info text fields for selected HP Note: this should be called from ChooseGUI when an entry is picked.
Parameters:
cGUI - is instance of ChooserGUI to use
idx - is the field to select
sEntry - is the corresponding entry.
See Also:
Component.repaint()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed() - handle action events buttons and text areas.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - is action event for button press
See Also:
ChooserGUI.resetChooserGUI(), printChooserState(java.lang.String), setMAEstateFromChooserData()

windowClosing

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

close

void close()
close() - close the window.

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

windowOpened

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

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
keyPressed() - get key Pressed event - look for ESCAPE key to set STOP flag
Parameters:
e - is key pressed event

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
keyReleased() - get key Released event
Parameters:
e - is key released event

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
keyTyped() - get key typed event - look for ESCAPE key to set STOP flag
Parameters:
e - is key typed event