ucar.unidata.idv
Class VMManager

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

public class VMManager
extends IdvManager

This class manages the set of ViewManagers. It handles initializing them after unpersistence, managing the set of view manager states (this is where you can save off the state of a view manager and then reapply it. So you can save projection, map, etc., name it and use it later.)

Author:
IDV development team

Field Summary
 
Fields inherited from class ucar.unidata.ui.WindowHolder
contents, dialog, frame, window
 
Fields inherited from interface ucar.unidata.idv.IdvConstants
ARG_B64BUNDLE, 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_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_TIMEZONE, FILE_VMSTATE, 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_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_HISTORY, PREF_LASTVERSION, PREF_LATLON_FORMAT, PREF_LOCALE, PREF_LOOKANDFEEL, PREF_MAXIMAGESIZE, 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_TIMEZONE, PREF_VERTICALCS, PREF_VERTICALUNIT, 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_JNLPCODEBASE, PROP_JNLPTEMPLATE, PROP_JNLPTITLE, PROP_LOADINGXML, PROP_OLDCONTROLDESCRIPTORS, PROP_ONEINSTANCEPORT, PROP_PREFERENCES, PROP_PROJ_NAME, PROP_RESOURCEFILES, PROP_SHOWDASHBOARD, PROP_SHOWDATATREE, PROP_SHOWFORMULAS, PROP_SHOWSPLASH, PROP_SPLASHICON, PROP_UI_DESKTOP, 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
VMManager(IntegratedDataViewer idv)
          Construct this manager with the given idv.
 
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.
 void addViewManagers(List newVms)
          Add the view managers in the list
 void applyPreferences()
          Apply the user preferences to all ViewManagers
 void captureAll()
          Capture an image for all ViewManagers
 void center()
          Set the projection on all MapViewManagers to be the projection of the first display.
 void center(EarthLocation el)
          Center all of the MapViewManager-s at the given point
 void center(EarthLocation el, List viewManagers)
          Center the view managers in the list to the given point
 void center(List viewManagers)
          Set the projection on all MapViewManagers to be the projection of the first display.
 void center(MapProjection mp)
          Center all of the MapViewManager-s at the given point
 void center(MapProjection mp, List viewManagers)
          Center all of the MapViewManager-s at the given point
 void center(ucar.unidata.geoloc.ProjectionRect pr)
          Zoom and center all of the MapViewManager-s at the given rect
 void center(ucar.unidata.geoloc.ProjectionRect pr, List viewManagers)
          Zoom and center all of the MapViewManager-s at the given rect
 ViewManager createViewManager(ViewDescriptor viewDescriptor, String properties)
          Create the given ViewManager
 ViewManager findOrCreateViewManager(ViewDescriptor viewDescriptor, String properties)
          As the name implies find the view manager identified by the given viewDescriptor or create a new one.
 List findTransectDrawingControls()
          Find a TDC
 ViewManager findViewManager(ViewDescriptor viewDescriptor)
          Find the view manager identified by the given view descriptor
static ViewManager findViewManagerInList(ViewDescriptor viewDescriptor, List vms)
          Find the view manager in the given list that is defined by the given view descriptor.
 ViewManager getLastActiveViewManager()
          Get the ViewManager whose window was last active.
 List getViewManagers()
          Get the list of active ViewManagers
 List getViewManagers(Class c)
          Get all of the view managers of the given class
 List getVMState()
          Instantiates (if needed) and returns the list of TwoFacedObjects that is the set of saved ViewManagers
 boolean haveMoreThanOneMainViewManager()
          Is there currently more than one possibly active viewmanager
 void removeAllViewManagers()
          Remove all view managers
 void removeAllViewManagers(boolean andDestroyThem)
          Remove all view managers
 void removeViewManager(ViewManager viewManager)
          Remove the given view manager from the list.
protected  void saveViewManagerState(ViewManager vm)
          Popup a dialog asking the user for the name of the saved ViewManager.
protected  void setDisplayMastersActive()
          Iterate through all of the ViewManager-s and tell each on to setMasterActive
protected  void setDisplayMastersInactive()
          Iterate through all of the ViewManager-s and tell each on to setMasterInactive
 void setLastActiveViewManager(ViewManager viewManager)
          Set the ViewManager whose window was last active.
 void setTransect(Transect transect)
          Set the Transect used for all TransectViewManagers
 void showProjectionManager()
          Find the first ViewManager in the list and have it show its @[link ucar.unidata.view.geoloc.ProjectionManager}.
 void transectViewsChanged()
          Be notified that a transect view manager has changed.
 void unpersistViewManagers(List newViewManagers)
          Do the initialization of the unpersisted ViewManager.
 void writeVMState()
          Write the vmState list to the file: ~user/.metapps/<APP>/vmstate.xml
 
Methods inherited from class ucar.unidata.idv.IdvManager
getArgsManager, getCollabManager, getColorTableManager, getDataManager, getIdv, getIdvChooserManager, getIdvClass, getIdvProjectionManager, getIdvUIManager, getImageGenerator, getJythonManager, getPersistenceManager, getPreferenceManager, getProperty, getProperty, getProperty, getPublishManager, getResourceManager, getStateManager, getStationModelManager, getStore, getVMManager, logException, showNormalCursor, showWaitCursor, waitUntilDisplaysAreDone
 
Methods inherited from class ucar.unidata.ui.WindowHolder
actionPerformed, close, doMakeContents, getContents, getDialog, getFrame, getWindow, getWindowTitle, isShowing, removeAll, 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
 

Constructor Detail

VMManager

public VMManager(IntegratedDataViewer idv)
Construct this manager with the given idv.

Parameters:
idv - The IDV
Method Detail

getViewManagers

public List getViewManagers()
Get the list of active ViewManagers

Returns:
List of view managers.

getViewManagers

public List getViewManagers(Class c)
Get all of the view managers of the given class

Parameters:
c - ViewManager class
Returns:
List of ViewManagers

captureAll

public void captureAll()
Capture an image for all ViewManagers


applyPreferences

public void applyPreferences()
Apply the user preferences to all ViewManagers


setLastActiveViewManager

public void setLastActiveViewManager(ViewManager viewManager)
Set the ViewManager whose window was last active.

Parameters:
viewManager - The last active view manager

haveMoreThanOneMainViewManager

public boolean haveMoreThanOneMainViewManager()
Is there currently more than one possibly active viewmanager

Returns:
More than one active view managers

getLastActiveViewManager

public ViewManager getLastActiveViewManager()
Get the ViewManager whose window was last active.

Returns:
The last active view manager

findViewManager

public ViewManager findViewManager(ViewDescriptor viewDescriptor)
Find the view manager identified by the given view descriptor

Parameters:
viewDescriptor - The id of the VM
Returns:
The VM or null if none found

findViewManagerInList

public static ViewManager findViewManagerInList(ViewDescriptor viewDescriptor,
                                                List vms)
Find the view manager in the given list that is defined by the given view descriptor.

Parameters:
viewDescriptor - The view descriptor
vms - List of ViewManagers
Returns:
The view manager or null if none found

transectViewsChanged

public void transectViewsChanged()
Be notified that a transect view manager has changed. This may be from a zoom, etc. Notify any TransectDrawingControls.


findTransectDrawingControls

public List findTransectDrawingControls()
Find a TDC

Returns:
The TDC

writeVMState

public void writeVMState()
Write the vmState list to the file: ~user/.metapps/<APP>/vmstate.xml


getVMState

public List getVMState()
Instantiates (if needed) and returns the list of TwoFacedObjects that is the set of saved ViewManagers

Returns:
List that holds the view manager states

saveViewManagerState

protected void saveViewManagerState(ViewManager vm)
Popup a dialog asking the user for the name of the saved ViewManager. If provided, add a new TwoFacedObject to the list of saved ViewManagers and write the list to disk.

Parameters:
vm - The view manager to save

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.

Parameters:
newViewManager - The new view manager

addViewManagers

public void addViewManagers(List newVms)
Add the view managers in the list

Parameters:
newVms - New view managers

removeAllViewManagers

public void removeAllViewManagers()
Remove all view managers


removeAllViewManagers

public void removeAllViewManagers(boolean andDestroyThem)
Remove all view managers

Parameters:
andDestroyThem - If true then also call destroy

removeViewManager

public void removeViewManager(ViewManager viewManager)
Remove the given view manager from the list.

Parameters:
viewManager - The view manager to be removed.

showProjectionManager

public void showProjectionManager()
Find the first ViewManager in the list and have it show its @[link ucar.unidata.view.geoloc.ProjectionManager}.


unpersistViewManagers

public void unpersistViewManagers(List newViewManagers)
Do the initialization of the unpersisted ViewManager.

Parameters:
newViewManagers - List of view managers to unpersist

setDisplayMastersActive

protected void setDisplayMastersActive()
Iterate through all of the ViewManager-s and tell each on to setMasterActive


setDisplayMastersInactive

protected void setDisplayMastersInactive()
Iterate through all of the ViewManager-s and tell each on to setMasterInactive


findOrCreateViewManager

public ViewManager findOrCreateViewManager(ViewDescriptor viewDescriptor,
                                           String properties)
As the name implies find the view manager identified by the given viewDescriptor or create a new one.

Parameters:
viewDescriptor - The id to look for
properties - Properties to pass if we create one.
Returns:
The found or created ViewManager

createViewManager

public ViewManager createViewManager(ViewDescriptor viewDescriptor,
                                     String properties)
Create the given ViewManager

Parameters:
viewDescriptor - Identifies the VM
properties - Property string to pass
Returns:
The new one

center

public void center(EarthLocation el)
            throws VisADException,
                   RemoteException
Center all of the MapViewManager-s at the given point

Parameters:
el - The point
Throws:
RemoteException - On badness
VisADException - On badness

center

public void center(EarthLocation el,
                   List viewManagers)
            throws VisADException,
                   RemoteException
Center the view managers in the list to the given point

Parameters:
el - Point to center to
viewManagers - ViewManagers to center
Throws:
RemoteException - On badness
VisADException - On badness

center

public void center(MapProjection mp)
            throws VisADException,
                   RemoteException
Center all of the MapViewManager-s at the given point

Parameters:
mp - Set all view managers projection to the
Throws:
RemoteException - On badness
VisADException - On badness

center

public void center(MapProjection mp,
                   List viewManagers)
            throws VisADException,
                   RemoteException
Center all of the MapViewManager-s at the given point

Parameters:
mp - new projection
viewManagers - ViewManagers to center
Throws:
RemoteException - On badness
VisADException - On badness

center

public void center(ucar.unidata.geoloc.ProjectionRect pr)
            throws VisADException,
                   RemoteException
Zoom and center all of the MapViewManager-s at the given rect

Parameters:
pr - The projection rect to zoom and center to
Throws:
RemoteException - On badness
VisADException - On badness

center

public void center(ucar.unidata.geoloc.ProjectionRect pr,
                   List viewManagers)
            throws VisADException,
                   RemoteException
Zoom and center all of the MapViewManager-s at the given rect

Parameters:
pr - The projection rect to zoom and center to
viewManagers - ViewManagers to center
Throws:
RemoteException - On badness
VisADException - On badness

center

public void center()
            throws VisADException,
                   RemoteException
Set the projection on all MapViewManagers to be the projection of the first display.

Throws:
RemoteException - On badness
VisADException - On badness

center

public void center(List viewManagers)
            throws VisADException,
                   RemoteException
Set the projection on all MapViewManagers to be the projection of the first display.

Parameters:
viewManagers - ViewManagers to center
Throws:
RemoteException - On badness
VisADException - On badness

setTransect

public void setTransect(Transect transect)
Set the Transect used for all TransectViewManagers

Parameters:
transect - The transect