edu.wisc.ssec.mcidasv
Class ViewManagerManager

java.lang.Object
  extended by ucar.unidata.ui.WindowHolder
      extended by ucar.unidata.idv.IdvManager
          extended by ucar.unidata.idv.VMManager
              extended by edu.wisc.ssec.mcidasv.ViewManagerManager
All Implemented Interfaces:
ActionListener, EventListener, IdvConstants

public class ViewManagerManager
extends VMManager

McIDAS-V needs to manage ViewManagers in a slightly different way than the IDV. The key differences between the two are the way previously active ViewManagers are ordered and a (hopefully) more consistent way of handling active ViewManagers.

The IDV only keeps track of the ViewManager used immediately before the current one. McV keeps track of the previously active ViewManagers in a stack. This mimics window z-ordering and always returns the user to the most recently active ViewManager upon removal of the active ViewManager.

Newly created ViewManagers and their first layer now become the active ViewManager and layer. If there is only one ViewManager, it is now displayed as active instead of just implying it. When the active ViewManager is removed, the last active ViewManager and its first layer become active.

A note to the future: McV/IDV supports two notions of active and selected ViewManagers. Say you have NxN ViewManagers in a ComponentHolder, and you want to share views among some of these ViewManagers. When one of these shared ViewManagers is activated, should all of them become the active ViewManager? We're going to have to work out how to convey which ViewManagers are shared and active, and maybe more? Good luck!


Field Summary
private  boolean DEBUG
          Whether or not to display debug messages.
private static org.slf4j.Logger logger
           
private  Stack<ViewManager> previousVMs
          The stack that stores the order of previously active ViewManagers.
private  UIManager uiManager
          Convenient reference back to the UIManager.
 
Fields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, window
 
Fields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, ARG_B64ISL, ARG_BUNDLE, ARG_CATALOG, ARG_CHOOSER, ARG_CLEARDEFAULT, ARG_CODE, ARG_CONNECT, ARG_CURRENTTIME, ARG_DATA, ARG_DEBUG, ARG_DEFAULT, ARG_DISPLAY, ARG_DXML, ARG_FIXEDTIME, ARG_HELP, ARG_IMAGE, ARG_IMAGESERVER, ARG_INSTALLPLUGIN, ARG_ISLFILE, ARG_ISLINTERACTIVE, ARG_LISTRESOURCES, ARG_MAINCLASS, ARG_MOVIE, ARG_MSG_DEBUG, ARG_MSG_RECORD, ARG_NODEFAULT, ARG_NOERRORSINGUI, ARG_NOGUI, ARG_NOONEINSTANCE, ARG_NOPLUGINS, ARG_NOPREF, ARG_ONEINSTANCEPORT, ARG_PLUGIN, ARG_PORT, ARG_PRINTJNLP, ARG_PROPERTIES, ARG_SCRIPT, ARG_SERVER, ARG_SETFILES, ARG_SITEPATH, ARG_TEMPLATE, ARG_TEST, ARG_TESTEVAL, ARG_TRACE, ARG_TRACEONLY, ARG_USERPATH, DEFAULT_DATE_FORMAT, DEFAULT_DOCPATH, DEFAULT_MAX_PERMGENSIZE, DEFAULT_TIMEZONE, FILTER_CPT, FILTER_ISL, FILTER_JNLP, FILTER_XIDV, FILTER_XIDVZIDV, FILTER_XML, FILTER_ZIDV, ID_COMMANDSTORUN, ID_DATASOURCES, ID_DISPLAYCONTROLS, ID_IDV, ID_JYTHON, ID_MESSAGE, ID_MISCHASHTABLE, ID_NCIDV_VERSION, ID_VERSION, ID_VIEWMANAGERS, ID_WINDOWS, INITIAL_PROBE_EARTHLOCATION, NULL_DATA_SELECTION, NULL_STRING, PREF_ARCHIVEDIR, PREF_ARCHIVENAME, PREF_AUTODISPLAYS_ENABLE, PREF_AUTODISPLAYS_SHOWGUI, PREF_AUTOSELECTDATA, PREF_CACHESIZE, PREF_CONTROLSINTABS, PREF_DATAPREFIX, PREF_DATE_FORMAT, PREF_DISTANCEUNIT, PREF_DOCACHE, PREF_EMBEDDATACHOOSERINDASHBOARD, PREF_EMBEDFIELDSELECTORINDASHBOARD, PREF_EMBEDLEGENDINDASHBOARD, PREF_EMBEDQUICKLINKSINDASHBOARD, PREF_EVENT_KEYBOARDMAP, PREF_EVENT_MOUSEMAP, PREF_EVENT_WHEELMAP, PREF_FAST_RENDER, PREF_FIELD_CACHETHRESHOLD, PREF_FILEREADDIR, PREF_FILEWRITEDIR, PREF_GEOMETRY_BY_REF, PREF_HISTORY, PREF_IMAGE_BY_REF, PREF_LARGE_REMOTE_DATA_WARN, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LEGEND_SHOWICONS, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAX_PERMGENSIZE, PREF_MAXIMAGESIZE, PREF_MEMORY, PREF_NPOT_IMAGE, PREF_OPEN_ASK, PREF_OPEN_MERGE, PREF_OPEN_REMOVE, PREF_PROJ_LIST, PREF_SAMPLINGMODE, PREF_SHOWCONTROLWINDOW, PREF_SHOWDASHBOARD, PREF_SHOWDECODEDIALOG, PREF_SHOWHIDDENFILES, PREF_SHOWQUITCONFIRM, PREF_SITEPATH, PREF_THREADS_DATA, PREF_THREADS_RENDER, PREF_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, PREF_WINDOW_SHOWTOOLBAR, PREF_ZIDV_ASK, PREF_ZIDV_DIRECTORY, PREF_ZIDV_SAVETOTMP, PROP_3DMODE, PROP_ABOUTTEXT, PROP_APPRESOURCEPATH, PROP_CHOOSERS, PROP_CHOOSERS_ALL, PROP_CONTROLDESCRIPTORS, PROP_CONTROLDESCRIPTORS_ALL, PROP_DATAHOLDERBOUNDS, PROP_DEFAULTLOCATIONS, PROP_DISPLAYLIST_GROUP, PROP_FIXFILELOCKUP, PROP_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_MAP_GLOBE_LEVEL, PROP_MAP_MAP_LEVEL, PROP_MINIMUMFRAMECYCLETIME, PROP_MONITORPORT, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWCLOCK, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, PROP_USE_TIMEDRIVER, PROP_VERSIONFILE, PROP_WINDOW_SCREENSIZEOFFSET, PROP_WINDOW_SIZEHEIGHT, PROP_WINDOW_SIZEWIDTH, PROP_WINDOW_USESCREENSIZE, SUFFIX_BAT, SUFFIX_CPT, SUFFIX_ISL, SUFFIX_JNLP, SUFFIX_RBI, SUFFIX_SH, SUFFIX_XIDV, SUFFIX_XML, SUFFIX_ZIDV
 
Constructor Summary
ViewManagerManager(IntegratedDataViewer idv)
          Yet another constructor.
 
Method Summary
 void addViewManager(ViewManager newViewManager)
          Add the new view manager into the list if we don't have one with the ViewDescriptor of the new view manager already.
protected  void disableAllLayerVizAnimations()
          Turns off layer visibility animation for all ViewManagers.
private  void focusLayerControlsOn(ViewManager vm, boolean doShow)
          Sets the active tab of the dashboard to the layer controls and makes the first layer (TODO: fix that!)
 int getComponentGroupCount()
           
 int getComponentHolderCount()
           
 int getViewManagerCount()
           
 Stack<ViewManager> getViewManagerOrder()
           
 boolean haveMoreThanOneMainViewManager()
          Overridden so that McV can set the active ViewManager even if there is only one ViewManager.
private  void inspectStack(String msg)
          Helper method that'll display the ordering of the stack and a helpful debug message!
 void removeViewManager(ViewManager viewManager)
          Handles the removal of a ViewManager.
 void setLastActiveViewManager(ViewManager vm)
          This method is a bit strange.
 void setViewManagerOrder(Stack<ViewManager> newOrder)
          Overwrite the stack containing the ordering of previously active ViewManagers.
 
Methods inherited from class ucar.unidata.idv.VMManager
addViewManagers, applyPreferences, captureAll, center, center, center, center, center, center, center, center, createViewManager, findOrCreateViewManager, findTransectDrawingControls, findViewManager, findViewManagerInList, getLastActiveViewManager, getViewManagers, getViewManagers, getVMState, removeAllViewManagers, removeAllViewManagers, saveViewManagerState, setDisplayMastersActive, setDisplayMastersInactive, setTransect, showProjectionManager, transectViewsChanged, unpersistViewManagers, updateAllLegends, writeVMState
 
Methods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getInstallManager, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone, waitUntilDisplaysAreDone
 
Methods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, getWindowTitle, isShowing, removeAll, setMenuBar, setWindowTitle, shouldMakeDialog, show, show, showModal, toFront, windowIsClosing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.slf4j.Logger logger

DEBUG

private final boolean DEBUG
Whether or not to display debug messages.

See Also:
Constant Field Values

previousVMs

private final Stack<ViewManager> previousVMs
The stack that stores the order of previously active ViewManagers.


uiManager

private UIManager uiManager
Convenient reference back to the UIManager.

Constructor Detail

ViewManagerManager

public ViewManagerManager(IntegratedDataViewer idv)
Yet another constructor.

Method Detail

getViewManagerCount

public int getViewManagerCount()

addViewManager

public void addViewManager(ViewManager newViewManager)
Add the new view manager into the list if we don't have one with the ViewDescriptor of the new view manager already.

Overrides:
addViewManager in class VMManager
Parameters:
newViewManager - The new view manager

getViewManagerOrder

public Stack<ViewManager> getViewManagerOrder()
Returns:
Reference to the stack of previously active ViewManagers.

haveMoreThanOneMainViewManager

public boolean haveMoreThanOneMainViewManager()
Overridden so that McV can set the active ViewManager even if there is only one ViewManager. This is just a UI nicety; it'll allow the McV UI to show the active ViewManager no matter what.

Overrides:
haveMoreThanOneMainViewManager in class VMManager
Returns:
Always returns true.

removeViewManager

public void removeViewManager(ViewManager viewManager)
Handles the removal of a ViewManager. McV needs to override this so that the stack of previously active ViewManagers is ordered properly. McV uses this method to make the ViewPanel respond immediately to the change.

Overrides:
removeViewManager in class VMManager
Parameters:
viewManager - The ViewManager being removed.

setLastActiveViewManager

public void setLastActiveViewManager(ViewManager vm)

This method is a bit strange. If the given ViewManager is null, then the IDV has removed the active ViewManager. McV will use the stack of last active ViewManagers to make the last active ViewManager active once again.

If the given ViewManager is not null, but cannot be found in the stack of previously active ViewManagers, the IDV has created a new ViewManager and McV must push it on the stack.

If the given ViewManager is not null and has been found in the stack, then the user has selected an inactive ViewManager. McV must remove the ViewManager from the stack and then push it back on top.

These steps allow McV to make the behavior of closing tabs a bit more user-friendly. The user is always returned to whichever ViewManager was last active.

Overrides:
setLastActiveViewManager in class VMManager
Parameters:
vm - See above. :(

setViewManagerOrder

public void setViewManagerOrder(Stack<ViewManager> newOrder)

Overwrite the stack containing the ordering of previously active ViewManagers.

Use this if you want to mess with the user's mind a little bit.

Parameters:
newOrder - The stack containing the new ordering of ViewManagers.

getComponentHolderCount

public int getComponentHolderCount()

getComponentGroupCount

public int getComponentGroupCount()

focusLayerControlsOn

private void focusLayerControlsOn(ViewManager vm,
                                  boolean doShow)
Sets the active tab of the dashboard to the layer controls and makes the first layer (TODO: fix that!) of the given ViewManager the active layer.

Parameters:
vm - The ViewManager to make active.
doShow - Whether or not the layer controls should become the active tab in the dashboard.

inspectStack

private void inspectStack(String msg)
Helper method that'll display the ordering of the stack and a helpful debug message!


disableAllLayerVizAnimations

protected void disableAllLayerVizAnimations()
Turns off layer visibility animation for all ViewManagers. This is typically only useful for when the user has removed all layers without turning off the layer animation setting.