Class PopupRegistry

java.lang.Object
  |
  +--PopupRegistry

class PopupRegistry
extends java.lang.Object

The PopupRegistry class implements a call-back mechanism for active popup windows It is also usable for any other objects that impelement MaeEventListeners that are dynamicaly created and need to be notified of state changes. Examples of the latter are MAEPlugin instances.

It registers popup windows (plots, spreadsheets, string text areas, expr. profiles, MAEPlugin Instance Objects etc.) So they can be checked for user event handling. When an event gets registered, it supplies a list of events it wants to be notified of which include: CurGene changed, data Filter changed, threshold Sliders changed, sample labels or other lables changed, and timeout (not implemented yet). Also, when a window registers it supplies a popup key (i.e. popup name) and this may be required to be UNIQUE or not. If unique, then only one instance of that window may exist and the old windows must be removed (by the caller) prior to to creating the new window.

 There are 6 types of popups that are able to be registered here.
  Class                 variable prefix   
  ShowPlotPopup           sppXXX[0:nSPP-1] active Plot popups   
  ShowSpreadsheetPopup    ssspXXX[0:nSSSP-1] active ShowSpreadsheetPopup popups 
  ShowStringPopup         sspXXX[0:nSSP-1] active String popups 
  ShowExprProfilesPopup   seppXXX[0:nSEPP-1] active ExprProfile's popups 
  MAEPluginUpdateListener maepXXX[0:nMAEP-1] active MAEPlugin Instance Object's Object popups [TODO]

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.12 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home

Field Summary
private  Config cfg
          link to global Config instance
(package private) static int CUR_GENE
          Property bit type: Notify bit if CurGene changed
(package private) static int FILTER
          Property bit type: Notify bit if Filter changed
private  int idxMAEP
          MAEPlugin Object current index
private  int idxSEPP
          ShowExprProfilesPopup current index
private  int idxSPP
          ShowPlotPopup popups currrent index
private  int idxSSP
          ShowStringPopup popups current index
private  int idxSSSP
          ShowSpreadsheetPopup popups current index
(package private) static int LABEL
          Property bit type: Notify bit if Labels changed
private  MAExplorer mae
          link to global MAExplorer instance
private  java.lang.String[] maepKey
          [0:nMAEP-1] MAEPlugin Object key names
private  MAEUpdateListener[] maepList
          [0:nMAEP-1] list of active MAEPlugin Objects
private  int[] maepPropBits
          [0:nMAEP-1] bits requesting notification of MAEPlugin Object list of changes
private  Maps map
          link to global Maps instance
(package private) static int MAX_POPUPS
          maximum # of popups for each type of popup
private  MenuBarFrame mbf
          link to global MenuBarFrame instance
private  int nMAEP
          MAEPlugin Instance Object counter
private  int nSEPP
          ShowExprProfilesPopup counter
private  int nSPP
          Plot popups counter
private  int nSSP
          String popups counter
private  int nSSSP
          ShowSpreadsheetPopup popups counter
private  int oldWorkingCLlength
          last value of fc.workingCL.length to see if update clusters - if filter changed.
(package private)  int prevObjMID
          previous MID object used to see if switched current gene object
private  java.lang.String[] seppKey
          [0:nSEPP-1] ExprProfilePopup key names
private  ShowExprProfilesPopup[] seppList
          [0:nSEPP-1] list of active Expr Profile popups
private  int[] seppPropBits
          [0:nSEPP-1] bits requesting notification of ExprProfilePopup list of changes
(package private) static int SLIDER
          Property bit type: Notify bit if Slider changed
private  java.lang.String[] sppKey
          [0:nSPP-1] ShowPlotPopup key names
private  ShowPlotPopup[] sppList
          [0:nSPP-1] list of active Plot popups
private  int[] sppPropBits
          [0:nSPP-1] bits requesting notification of ShowPlotPopup of change
private  java.lang.String[] sspKey
          [0:nSSP-1] ShowStringPopup key names
private  ShowStringPopup[] sspList
          [0:nSSP-1] list of active String popups
private  int[] sspPropBits
          [0:nSSP-1] bits requesting notification of ShowStringPopup of changes
private  int[] sspTime
          [0:nSPP-1] String Popup timeout seconds
private  java.lang.String[] ssspKey
          [0:nSSSP-1] ShowSpreadsheetPopup key names
private  ShowSpreadsheetPopup[] ssspList
          [0:nSSSP-1] list of active spreadsheet popup popups
private  int[] ssspPropBits
          [0:nSSSP-1] bits requesting notification of ShowSpreadsheetPopup of change
(package private) static int TIMEOUT
          Property bit type: set if timeout and kill itself after TIMEOUT_DELAY milliseconds
(package private) static int TIMEOUT_DELAY
          # msec.
(package private) static int UNIQUE
          Property bit type: set if this is a unique popup
 
Constructor Summary
(package private) PopupRegistry(MAExplorer mae)
          PopupRegistry() - constructor to popup registry
 
Method Summary
(package private)  int addPopupWindowToReg(MAEUpdateListener maep, java.lang.String key, int propBits)
          addPopupWindowToReg() - register MAEPlugin Instance Object window in maepList[]
(package private)  int addPopupWindowToReg(ShowExprProfilesPopup sepp, java.lang.String key, int propBits)
          addPopupWindowToReg() - register ShowExprProfilesPopup window in seppList[]
(package private)  int addPopupWindowToReg(ShowPlotPopup spp, java.lang.String key, int propBits)
          addPopupWindowToReg() - register ShowPlotPopup window in sppList[]
(package private)  int addPopupWindowToReg(ShowSpreadsheetPopup sssp, java.lang.String key, int propBits)
          addPopupWindowToReg() - register ShowSpreadsheetPopup window in ssspList[]
(package private)  int addPopupWindowToReg(ShowStringPopup ssp, java.lang.String key, int propBits)
          addPopupWindowToReg() - register ShowStringPopup window in sspList[]
(package private)  void checkStringPopupTimeouts(int runLoopDelayMsec)
          checkPopupTimeouts() - check timeouts for all active popups and kill any that exceed the time.
(package private)  boolean chkOtherCurGeneEffects(int midA, int mouseKeyMods)
          chkOtherCurGeneEffects() - check other gene effects when change current gene in ms.objXXX.
(package private)  boolean doesPopupExist(java.lang.String testKey)
          doesPopupExist() - check to see if popup exists for this key.
(package private)  boolean doesUniquePopupExist(java.lang.String testKey)
          doesUniquePopupExist() - check to see if popup exists for this key
(package private)  java.lang.Object lookupMAEPluginInstanceObjectInstance(java.lang.String testKey)
          lookupMAEPluginInstanceObjectInstance() - lookup MAEPlugin Object for unique key instance
(package private)  ShowExprProfilesPopup lookupShowExprProfilesPopupInstance(java.lang.String testKey)
          lookupShowExprProfilesPopupInstance() - lookup ShowExprProfilesPopup for unique key instance
(package private)  ShowPlotPopup lookupShowPlotPopupInstance(java.lang.String testKey)
          lookupShowPlotPopupInstance() - lookup ShowPlotPopup for unique key instance
(package private)  ShowSpreadsheetPopup lookupShowSpreadsheetPopupInstance(java.lang.String testKey)
          lookupShowSpreadsheetPopupInstance() - lookup ShowSpreadsheetPopup for unique key instance
(package private)  ShowStringPopup lookupShowStringPopupInstance(java.lang.String testKey)
          lookupShowStringPopupInstance() - lookup ShowStringPopup for unique key instance
(package private)  boolean removePopupByKey(java.lang.String testKey)
          removePopupByKey() - remove popup by unique key if existing instance
(package private)  int rmvPopupFromReg(java.lang.Object maep, int BOGUS)
          rmvPopupFromReg() - remove popup from maepList[].
(package private)  int rmvPopupFromReg(ShowExprProfilesPopup seep)
          rmvPopupFromReg() - remove popup from ShowExprProfilesPopup seppList[].
(package private)  int rmvPopupFromReg(ShowPlotPopup spp)
          rmvPopupFromReg() - remove popup instance from ShowPlotPopup sppList[].
(package private)  int rmvPopupFromReg(ShowSpreadsheetPopup sssp)
          rmvPopupFromReg() - remove popup from ShowSpreadsheetPopup ssspList[].
(package private)  int rmvPopupFromReg(ShowStringPopup ssp)
          rmvPopupFromReg() - remove popup from ShowStringPopup ssptList[].
(package private)  void setWaitCursor(boolean waitCursorFlag)
          setWaitCursor() - if true set wait cursor, else set default cursor.
(package private)  boolean updateCurGene(int mid, int mouseKeyMods, java.lang.Object sObj)
          updateCurGene() - update (plot,report,string,MAEPlugin) popups with the current gene.
(package private)  boolean updateCurGeneInImageAndReg(java.lang.String nameOrId)
          updateCurGeneInImageAndReg() - update current gene in pseudoarray image and notify the PopupRegistry.
(package private)  boolean updateFilter(GeneList ml)
          updateFilter() - update popups using Filter workingCL changes for (plot,report,string,MAEPlugin) popups.
(package private)  boolean updateLabels()
          updateLabels() - update popups using Label changes for (plot,report,string,MAEPlugin) popups.
(package private)  boolean updateSlider()
          updateSlider() - update popups using Slider changes for (plot,report,string,MAEPlugin) popups.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mae

private MAExplorer mae
link to global MAExplorer instance

mbf

private MenuBarFrame mbf
link to global MenuBarFrame instance

map

private Maps map
link to global Maps instance

cfg

private Config cfg
link to global Config instance

CUR_GENE

static final int CUR_GENE
Property bit type: Notify bit if CurGene changed

FILTER

static final int FILTER
Property bit type: Notify bit if Filter changed

SLIDER

static final int SLIDER
Property bit type: Notify bit if Slider changed

LABEL

static final int LABEL
Property bit type: Notify bit if Labels changed

UNIQUE

static final int UNIQUE
Property bit type: set if this is a unique popup

TIMEOUT

static final int TIMEOUT
Property bit type: set if timeout and kill itself after TIMEOUT_DELAY milliseconds

TIMEOUT_DELAY

static final int TIMEOUT_DELAY
# msec. to wait before kill popup

MAX_POPUPS

static final int MAX_POPUPS
maximum # of popups for each type of popup

sppList

private ShowPlotPopup[] sppList
[0:nSPP-1] list of active Plot popups

ssspList

private ShowSpreadsheetPopup[] ssspList
[0:nSSSP-1] list of active spreadsheet popup popups

sspList

private ShowStringPopup[] sspList
[0:nSSP-1] list of active String popups

seppList

private ShowExprProfilesPopup[] seppList
[0:nSEPP-1] list of active Expr Profile popups

maepList

private MAEUpdateListener[] maepList
[0:nMAEP-1] list of active MAEPlugin Objects

sppKey

private java.lang.String[] sppKey
[0:nSPP-1] ShowPlotPopup key names

ssspKey

private java.lang.String[] ssspKey
[0:nSSSP-1] ShowSpreadsheetPopup key names

sspKey

private java.lang.String[] sspKey
[0:nSSP-1] ShowStringPopup key names

seppKey

private java.lang.String[] seppKey
[0:nSEPP-1] ExprProfilePopup key names

maepKey

private java.lang.String[] maepKey
[0:nMAEP-1] MAEPlugin Object key names

sppPropBits

private int[] sppPropBits
[0:nSPP-1] bits requesting notification of ShowPlotPopup of change

ssspPropBits

private int[] ssspPropBits
[0:nSSSP-1] bits requesting notification of ShowSpreadsheetPopup of change

sspPropBits

private int[] sspPropBits
[0:nSSP-1] bits requesting notification of ShowStringPopup of changes

seppPropBits

private int[] seppPropBits
[0:nSEPP-1] bits requesting notification of ExprProfilePopup list of changes

maepPropBits

private int[] maepPropBits
[0:nMAEP-1] bits requesting notification of MAEPlugin Object list of changes

sspTime

private int[] sspTime
[0:nSPP-1] String Popup timeout seconds

nSPP

private int nSPP
Plot popups counter

nSSSP

private int nSSSP
ShowSpreadsheetPopup popups counter

nSSP

private int nSSP
String popups counter

nSEPP

private int nSEPP
ShowExprProfilesPopup counter

nMAEP

private int nMAEP
MAEPlugin Instance Object counter

idxSPP

private int idxSPP
ShowPlotPopup popups currrent index

idxSSSP

private int idxSSSP
ShowSpreadsheetPopup popups current index

idxSSP

private int idxSSP
ShowStringPopup popups current index

idxSEPP

private int idxSEPP
ShowExprProfilesPopup current index

idxMAEP

private int idxMAEP
MAEPlugin Object current index

prevObjMID

int prevObjMID
previous MID object used to see if switched current gene object

oldWorkingCLlength

private int oldWorkingCLlength
last value of fc.workingCL.length to see if update clusters - if filter changed.
Constructor Detail

PopupRegistry

PopupRegistry(MAExplorer mae)
PopupRegistry() - constructor to popup registry
Parameters:
mae - is instance of MAExplorer
Method Detail

addPopupWindowToReg

int addPopupWindowToReg(ShowPlotPopup spp,
                        java.lang.String key,
                        int propBits)
addPopupWindowToReg() - register ShowPlotPopup window in sppList[]
Parameters:
ssp - instance of window to register
key - is popup name for this window
propBits - specify which updates are to be invoked for this window
Returns:
the new count for this window type.

addPopupWindowToReg

int addPopupWindowToReg(ShowSpreadsheetPopup sssp,
                        java.lang.String key,
                        int propBits)
addPopupWindowToReg() - register ShowSpreadsheetPopup window in ssspList[]
Parameters:
sssp - instance of window to register
key - is popup name for this window
propBits - specify which updates are to be invoked for this window
Returns:
the new count for this window type.

addPopupWindowToReg

int addPopupWindowToReg(ShowStringPopup ssp,
                        java.lang.String key,
                        int propBits)
addPopupWindowToReg() - register ShowStringPopup window in sspList[]
Parameters:
ssp - instance of window to register
key - is popup name for this window
propBits - specify which updates are to be invoked for this window
Returns:
the new count for this window type.

addPopupWindowToReg

int addPopupWindowToReg(ShowExprProfilesPopup sepp,
                        java.lang.String key,
                        int propBits)
addPopupWindowToReg() - register ShowExprProfilesPopup window in seppList[]
Parameters:
sepp - instance of window to register
key - is popup name for this window
propBits - specify which updates are to be invoked for this window
Returns:
the new count for this window type.

addPopupWindowToReg

int addPopupWindowToReg(MAEUpdateListener maep,
                        java.lang.String key,
                        int propBits)
addPopupWindowToReg() - register MAEPlugin Instance Object window in maepList[]
Parameters:
maep - instance of window to register
key - is popup name for this window
propBits - specify which updates are to be invoked for this window
Returns:
the new count for this window type.

rmvPopupFromReg

int rmvPopupFromReg(ShowPlotPopup spp)
rmvPopupFromReg() - remove popup instance from ShowPlotPopup sppList[].
Parameters:
spp - is instance of previously registered window to be removed
Returns:
-1 if not found or no objects in the list else the new count.

rmvPopupFromReg

int rmvPopupFromReg(ShowSpreadsheetPopup sssp)
rmvPopupFromReg() - remove popup from ShowSpreadsheetPopup ssspList[].
Parameters:
sssp - is instance of previously registered window to be removed
Returns:
-1 if not found or no objects in the list else the new count.

rmvPopupFromReg

int rmvPopupFromReg(ShowStringPopup ssp)
rmvPopupFromReg() - remove popup from ShowStringPopup ssptList[]. Note that only the String popup has a potential timeout.
Parameters:
spp - is instance of previously registered window to be removed
Returns:
-1 if not found or no objects in the list else the new count.

rmvPopupFromReg

int rmvPopupFromReg(ShowExprProfilesPopup seep)
rmvPopupFromReg() - remove popup from ShowExprProfilesPopup seppList[].
Parameters:
seep - is instance of previously registered window to be removed
Returns:
-1 if not found or no objects in the list else the new count.

rmvPopupFromReg

int rmvPopupFromReg(java.lang.Object maep,
                    int BOGUS)
rmvPopupFromReg() - remove popup from maepList[].
Parameters:
maep - is instance of previously registered window to be removed
Returns:
-1 if not found or no objects in the list else the new count.

chkOtherCurGeneEffects

boolean chkOtherCurGeneEffects(int midA,
                               int mouseKeyMods)
chkOtherCurGeneEffects() - check other gene effects when change current gene in ms.objXXX. Note: Put things here to do when change the gene which are side effects. If the current gene is defined (i.e. mae.ms.isValidObjFlag), then check and update the following if they are enabled:
    1. modifying the 'editable gene list',
    2. poping up a web browser on external GenBank etc. data,
    3. changing the gene used in the 'single' expression profile plot,
    4. update cluster algorithms and redraw overlays in pseudoarray image.
If mouseKeyMods==ClusterGenes.UPDATE, compute it again even if midA==cdb.objMID.
Parameters:
midA - specifying the gene MID
mouseKeyMods - modifieers (i.e.CONTROL or SHIFT)
Returns:
true if successful
See Also:
ClusterGenes.copyCurClusterToEditedGeneList(), ClusterGenes.findClustersOfGene(MAExplorer, Gene, float, boolean), ClusterGenes.updateGeneClustersOfCurrentGeneReport(), Gene.lookupIDbyName(java.lang.String), EditedGeneList.processEditCommand(int), EventMenu.setClusterDisplayState(java.awt.CheckboxMenuItem, boolean), ExprProfilePopup.updateData(int, java.lang.String, boolean), Component.repaint(), ShowStringPopup.changeGeneButton(java.lang.String, java.lang.String, int), StateScrollers.regenerateScrollers(boolean), Util.popupViewer(java.net.URL, java.lang.String, java.lang.String), Util.rmvIMAGEstr(java.lang.String), Util.saveCmdHistory(java.lang.String)

updateCurGene

boolean updateCurGene(int mid,
                      int mouseKeyMods,
                      java.lang.Object sObj)
updateCurGene() - update (plot,report,string,MAEPlugin) popups with the current gene. The popup objects will do whatever else is needed and also handle side-effects.
Parameters:
mid - specifying the gene MID
mouseKeyMods - modifieers (i.e.CONTROL or SHIFT)
sObj - object invoking the change if not null, don't refresh 'self' object which called update.
Returns:
true if successful
See Also:
updateCurGene(int, int, java.lang.Object), chkOtherCurGeneEffects(int, int)

updateFilter

boolean updateFilter(GeneList ml)
updateFilter() - update popups using Filter workingCL changes for (plot,report,string,MAEPlugin) popups. The popup objects will do whatever else is needed.
Parameters:
ml - is GeneList to be used when running the data Filter
Returns:
true if successful
See Also:
updateFilter(GeneList), Component.repaint()

updateSlider

boolean updateSlider()
updateSlider() - update popups using Slider changes for (plot,report,string,MAEPlugin) popups. The popup objects will do whatever else is needed.
Returns:
true if successful
See Also:
updateSlider()

updateLabels

boolean updateLabels()
updateLabels() - update popups using Label changes for (plot,report,string,MAEPlugin) popups. The popup objects will do whatever else is needed.
Returns:
true if successful
See Also:
updateLabels()

doesPopupExist

boolean doesPopupExist(java.lang.String testKey)
doesPopupExist() - check to see if popup exists for this key.
Returns:
true if the popup exists, else false if key is null or it fails

doesUniquePopupExist

boolean doesUniquePopupExist(java.lang.String testKey)
doesUniquePopupExist() - check to see if popup exists for this key
Parameters:
key - is the popup name of the window to test for
Returns:
true if key found, else false if key is null or it fails
See Also:
lookupMAEPluginInstanceObjectInstance(java.lang.String), lookupShowExprProfilesPopupInstance(java.lang.String), lookupShowPlotPopupInstance(java.lang.String), lookupShowSpreadsheetPopupInstance(java.lang.String), lookupShowStringPopupInstance(java.lang.String)

lookupShowPlotPopupInstance

ShowPlotPopup lookupShowPlotPopupInstance(java.lang.String testKey)
lookupShowPlotPopupInstance() - lookup ShowPlotPopup for unique key instance
Parameters:
key - is the popup name of the window to test for
Returns:
the instance if found, else null. Set idxSPP to index else -1.

lookupShowSpreadsheetPopupInstance

ShowSpreadsheetPopup lookupShowSpreadsheetPopupInstance(java.lang.String testKey)
lookupShowSpreadsheetPopupInstance() - lookup ShowSpreadsheetPopup for unique key instance
Parameters:
key - is the popup name of the window to test for
Returns:
the instance if found, else null. Set idxSSSP to index else -1.

lookupShowStringPopupInstance

ShowStringPopup lookupShowStringPopupInstance(java.lang.String testKey)
lookupShowStringPopupInstance() - lookup ShowStringPopup for unique key instance
Parameters:
key - is the popup name of the window to test for
Returns:
the instance if found, else null. Set idxSSP to index else -1.

lookupShowExprProfilesPopupInstance

ShowExprProfilesPopup lookupShowExprProfilesPopupInstance(java.lang.String testKey)
lookupShowExprProfilesPopupInstance() - lookup ShowExprProfilesPopup for unique key instance
Parameters:
key - is the popup name of the window to test for
Returns:
the instance if found, else null. Set idxSEPP to index else -1.

lookupMAEPluginInstanceObjectInstance

java.lang.Object lookupMAEPluginInstanceObjectInstance(java.lang.String testKey)
lookupMAEPluginInstanceObjectInstance() - lookup MAEPlugin Object for unique key instance
Parameters:
key - is the popup name of the window to test for
Returns:
the instance if found, else null. Set idxMAEP to index else -1.

removePopupByKey

boolean removePopupByKey(java.lang.String testKey)
removePopupByKey() - remove popup by unique key if existing instance
Parameters:
key - is the popup name of the window
Returns:
the instance if found and return true, else No-OP if not found and return false.
See Also:
lookupMAEPluginInstanceObjectInstance(java.lang.String), lookupShowExprProfilesPopupInstance(java.lang.String), lookupShowPlotPopupInstance(java.lang.String), lookupShowSpreadsheetPopupInstance(java.lang.String), lookupShowStringPopupInstance(java.lang.String), rmvPopupFromReg(ShowPlotPopup)

checkStringPopupTimeouts

void checkStringPopupTimeouts(int runLoopDelayMsec)
checkPopupTimeouts() - check timeouts for all active popups and kill any that exceed the time. We increment the times here. This method is called from the run() infinite loop once each time around. [TODO] Debug...
Parameters:
runLoopDelayMsec - is the timeout to test for
See Also:
rmvPopupFromReg(ShowPlotPopup)

setWaitCursor

void setWaitCursor(boolean waitCursorFlag)
setWaitCursor() - if true set wait cursor, else set default cursor. [TODO] may want to save old cursor if using more than DEFAULT.
Parameters:
waitCursorFlag - is the new cursor state

updateCurGeneInImageAndReg

boolean updateCurGeneInImageAndReg(java.lang.String nameOrId)
updateCurGeneInImageAndReg() - update current gene in pseudoarray image and notify the PopupRegistry.
Parameters:
nameOrId - to set as the new current gene
Returns:
true if succeed
See Also:
Component.repaint(), Component.repaint(), SpotFeatures.getXYG(java.awt.Point, MaHybridSample), SpotFeatures.getSpotFeatures(java.awt.Point, MaHybridSample), SpotFeatures.getSpotGenomicData(java.awt.Point, MaHybridSample), Util.showMsg(java.lang.String), Util.showFeatures(java.lang.String, java.lang.String), updateCurGene(int, int, java.lang.Object)