ucar.unidata.idv
Class ViewManager

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.idv.ViewManager
All Implemented Interfaces:
ActionListener, ItemListener, EventListener, Sharable, ControlListener, DisplayListener
Direct Known Subclasses:
CrossSectionViewManager, NavigatedViewManager, SoundingViewManager, TimeHeightViewManager

public class ViewManager
extends SharableImpl
implements ActionListener, ItemListener, ControlListener, DisplayListener

A wrapper around a DisplayMaster. Provides an interface for managing user interactions, gui creation, etc.

Author:
IDV development team

Nested Class Summary
static class ViewManager.MatrixCommand
          Class MatrixCommand manages changes to the viewpoint matrix
 
Field Summary
protected  JComponent animationHolder
          The panel that holds the animation widget
protected  JMenu animationMenu
          This holds the visibility toggle animation commands.
static Color borderHighlightColor
          border hightlight color
static int borderWidth
          border width
protected  boolean clickToFocus
          Do we focus on this one only when the user clicks
protected  Rectangle displayBounds
          The bounds of the display_
protected  JFrame fullScreenWindow
          The window for full screen
protected static Border highlightBorder
          highlight border
protected  JComponent innerContents
          The inner gui
protected  boolean lastActive
          Is the the currently active VM
protected  long lastTimeActivated
          Keeps track of the last time this VM was set as the active VM
protected  JLabel nameLabel
          name label
protected static Border normalBorder
          normal border
static String PREF_3DCLIP
          Preference for clipping at 3d box_
static String PREF_ANIREADOUT
          Preference for showing the time string in the display
static String PREF_BGCOLOR
          For the bg color
static String PREF_BORDERCOLOR
          For the currently selected panel.
static String PREF_DIMENSION
          Preference for 3d or 2d _
static String PREF_DISPLAYLISTCOLOR
          For the display list color
static String PREF_DISPLAYLISTFONT
          For the display list font
static String PREF_FGCOLOR
          For the foreground color
static String PREF_PREFIX
          Prefix used for preference String ids
static String PREF_SHAREVIEWS
          Preference for sharing view points
static String PREF_SHOWANIMATIONBOXES
          Show the bottom legend
static String PREF_SHOWBOTTOMLEGEND
          Show the bottom legend
static String PREF_SHOWCURSOR
          Preference for showing cursor readout
static String PREF_SHOWDISPLAYLIST
          Preference for showing cursor readout
static String PREF_SHOWSCALES
          Preference for showing the wireframe box
static String PREF_SHOWSIDELEGEND
          Show the side legend
static String PREF_SHOWTOOLBAR
          For hiding/showing components of the toolbar
static String PREF_SHOWTRANSECTSCALES
          Preference for showing the wireframe box
static String PREF_TOOLBARSFLOATABLE
          are the toolbars floatable
static String PREF_WAITMSG
          For the visibility of the please wait message
static String PREF_WIREFRAME
          Preference for showing the wireframe box
protected  boolean showControlLegend
          Do we show the control legends
protected  boolean showControlMenu
          Do we show the control menu
static String TAG_COLORPAIR
          Xml tag for the color pair
static String TAG_COLORPAIRS
          Xml tag for the color pairs xml
protected  List toolbarIds
          List of the ids (String), one for each component in the toolbars list We keep this around so the user could have a preference to show or not show toolbar components.
protected  List toolbarNames
          List of the names (String), one for each component in the toolbars list We keep this around so the user could have a preference to show or not show toolbar components.
protected  List toolbars
          List of Components that are shown in the left side, vertical tool bar
protected  Rectangle windowBounds
          We keep the window bounds around for persisting/unpersisting this ViewManager.
 
Constructor Summary
ViewManager()
          A parameter-less ctor for the XmlEncoder based decoding.
ViewManager(ViewContext viewContext)
          Create this ViewManager
ViewManager(ViewContext viewContext, AnimationInfo info)
          Instantiate this ViewManager with the given AnimationInfo
ViewManager(ViewContext viewContext, DisplayMaster master, ViewDescriptor viewDescriptor, String properties)
          Create this ViewManager
ViewManager(ViewContext viewContext, ViewDescriptor viewDescriptor, String properties)
          Instantiate this ViewManager with the given AnimationInfo
ViewManager(ViewContext viewContext, ViewDescriptor viewDescriptor, String properties, AnimationInfo info)
          Instantiate this ViewManager with the given AnimationInfo
 
Method Summary
 void actionPerformed(ActionEvent event)
          Required interface for ActionEvents, to implement ActionListener for the UI objects such as JButton-s and MenuItem-s
protected  void addBooleanProperty(BooleanProperty bp)
          Add in the BooleanProperty into the list of properties.
protected  void addCommand(Command cmd)
          Add the command to the command manager.
 void addContextMenuItems(List menuItems)
          Add items to the context menu.
 boolean addDisplayInfo(DisplayInfo displayInfo)
          Add the DisplayInfo to the list of DisplayInfo-s If I have a DisplayMaster then set the master to be inactive and add the displayable held by the displayInfo into the displayMaster.
 void addDisplayListener(DisplayListener listener)
          Adds the given display listener to the DisplayMaster
protected  void addPropertiesComponents(JTabbedPane tabbedPane)
          Add a JTabbedPane to the properties component
protected  void addToolBar(Component component, String id, String name)
          Add the given component into the list of toolbar components.
 void addViewDescriptor(ViewDescriptor vd)
          Add the view descriptor
protected  void adjustSplitPane()
          set the state of the main split pane
 boolean animationOk()
          Should this ViewManager create an animation object/widget.
protected  void animationTimeChanged()
          The time changed
 void applyPreferences()
          Some user preferences have changed.
 boolean applyProperties()
          Apply properties
 void aspectSliderChanged(int value)
          Handle an aspect slider change.
 boolean canBe(ViewManager that)
          Can this view manager be used in exchange for the given view manager
 void checkToolBarVisibility()
          Turn on/off the toolbar components based on the user preferences.
 void clearDisplays()
          This removes all of the display controls
 void clearImageGrabber(ImageSequenceGrabber grabber)
          The given grabber is done.
 void controlChanged(ControlEvent e)
          This is the default method (no-op) for the ControlListener interface
protected  JCheckBoxMenuItem createCBMI(JMenu menu, String id)
          A helper to create a check box menu item from the id for a BooleanProperty.
 void destroy()
          Destroy this view manager.
 void displayChanged(DisplayEvent de)
          An implementation of the the DisplayListener interface.
 void displayControlChanged(DisplayControl displayControl)
          Called when the dispay category or other state of the display control has changed.
 void displayControlVisibilityChanged(DisplayControl displayControl)
          handle when the display control has changed
protected  void doClose()
          Called when the window is closed.
 void doDrop(Object object)
          Handle the drop action
protected  Container doMakeContents()
          Create the main GUI contents.
protected  DisplayMaster doMakeDisplayMaster()
          Make the DisplayMaster for this ViewManger.
protected  JMenuBar doMakeMenuBar()
          Create and return the menu bar.
 ArrayList doMakeMenuList()
          Return a list of components that are used to create the menubar.
protected  void doneFirstFrame()
          We have received the very first framedone event.
 void doPrintImage()
          Print an image
 void doPublishImage()
          Hook into the publishing interface to "publish" the screen image.
 void doPublishImage(String props)
          Hook into the publishing interface to "publish" the screen image.
 void doSaveImage()
          User has requested saving display as an image.
 void doSaveImage(boolean andSaveBundle)
          Save the image (and the bundle that does with it);
 void doSaveImageInThread()
          User has requested saving display as an image.
 void doSaveState()
          Save this state of this view manager.
protected  void fillLegends()
          This is called when the list of display controls has changed.
protected  void fillLegendsInner()
          actually fill the legends and update the display list
 void fillLegendsLater()
          Wait until there have been no calls to fillLegends for a little bit and then fill the legends
 void firstInitializeViewMenu(JMenu viewMenu)
          Initialize the view menu.
 List getAliases()
          Get the Aliases property.
 Animation getAnimation()
          Return the Animation that is used.
 AnimationInfo getAnimationInfo()
          Get the AnimationInfo property.
 boolean getAnimationStringVisible()
          Deprecated. Use getAniReadout now
 DateTime[] getAnimationTimes()
          Get the array of animation times
 AnimationWidget getAnimationWidget()
          Return the AnimationWidget that is used.
 boolean getAniReadout()
          Get the animation readout flag
protected  JComponent getAspectPropertiesComponent()
          Get the aspect properties component
 double[] getAspectRatio()
          Get the AspectRatio property.
 Color getBackground()
          Get the background color or black if it is null
 Hashtable getBooleanPropertiesForPersistence()
          Get the BooleanPropertiesForPersistence property.
protected  BooleanProperty getBooleanProperty(String propertyId)
          Find, or create, the BooleanProperty identified with the given id
protected  boolean getBp(String propertyId)
          Get the value of the BooleanProperty
 boolean getClickToFocus()
          Get the click to focus property.
 CommandManager getCommandManager()
          Create, if needed, and return the command manager
 JComponent getComponent()
          Return the GUI component from the DisplayMaster
 Container getContents()
          Return the full GUI contents.
protected  Border getContentsBorder()
          Get the border for the contents
 List getControls()
          Return the list of DisplayControls displayed in this ViewManager.
 List getControlsForLegend()
          Return the list of DisplayControls displayed in this ViewManager that are meant to be shown in a legend
protected  Color getDefaultBackground()
          Get the default background color
protected  Color getDefaultForeground()
          Get the default foreground color
 Rectangle getDisplayBounds()
          Get the DisplayBounds property.
 DisplayConventions getDisplayConventions()
          A wrapper around IdvBase.getDisplayConventions()
protected  List getDisplayInfos()
          Get the list of DisplayInfo-s
 Color getDisplayListColor()
          Get the display list color property.
 Font getDisplayListFont()
          Get the display list font property.
 double[] getDisplayMatrix()
          Get the display matrix array
 DisplayRenderer getDisplayRenderer()
          get the display renderer
 IdvWindow getDisplayWindow()
          We call this getDisplayWindow instead of getWindow so the window is not treated as a persistable property.
 Animation getExternalAnimation()
          Get the ExternalAnimation property.
 AnimationWidget getExternalAnimationWidget()
          Get the ExternalAnimationWidget property.
 Color getForeground()
          Get the foreground color or white if it is null
 int getFullScreenHeight()
          Get the FullScreenHeight property.
 int getFullScreenWidth()
          Get the FullScreenWidth property.
 boolean getHasWindow()
          Getter method for xml persistence.
protected  boolean getHaveInitialized()
          have we initialized
static Border getHighlightBorder()
          Get the border to use when this ViewManager is the currently selected ViewManager
 IntegratedDataViewer getIdv()
          Get the IDV
 IdvUIManager getIdvUIManager()
          Get the IdvUIManager to use.
protected  boolean getInitDone()
          Have we finished initializing
protected  void getInitialBooleanProperties(List props)
          Get the intial BooleanProperties
 JComponent getInnerContents()
          This is meant to be overrode by a derived class to return the contents (typically the display master's component) that is the "abbreviated" gui.
 boolean getIsActive()
          Is the DisplayMaster currently active.
 boolean getIsDestroyed()
          Has this ViewManager been destroyed.
 boolean getIsShared()
          Get the IsShared property.
 long getLastFrameDoneTime()
          Get the last time we've seen a FRAME_DONE event
 long getLastTimeActivated()
          Get the time that this was last the active VM
 boolean getLegendOnLeft()
          Get the LegendOnLeft property.
 String getLegendState()
          Get the LegendState property.
protected  JComponent getMainPropertiesComponent()
          Get main properties component
 DisplayMaster getMaster()
          Get the DisplayMaster.
 Dimension getMySize()
          Get the default size of the DisplayMaster held by this view.
 String getName()
          Get the Name property.
static Border getNormalBorder()
          Get the normal border
 boolean getPerspectiveView()
          Get whether this is in a perspective view or not
 ProjectionControl getProjectionControl()
          Get the projection control
 List getProjectionList()
          Get the list of Projections available.
 Hashtable getProperties()
          Get the Properties property.
 JComponent getPropertiesComponent()
          Get the component for setting properties on the display.
 Object getProperty(Object key)
          get a property.
 PublishManager getPublishManager()
          Get the PublishManager to use.
 boolean getReallyHasWindow()
          This returns the value of the hasWindow member which was set when unpersisting.
 IdvResourceManager getResourceManager()
          Get the IdvResourceManager to use.
 boolean getShareViews()
          Get the share view state flag
 boolean getShowAnimationBoxes()
          Should we show the animation widget boxes
 boolean getShowBottomLegend()
          Should we show the bottom legend that holds the list of display controls.
 boolean getShowControlLegend()
          Get whether we should show any of the display control legends.
 boolean getShowDisplayList()
          Get the show display list flag
 boolean getShowSideLegend()
          Should we show the side legend that holds the list of display controls.
protected  JComponent getSideComponent(JComponent sideLegend)
          Get the component that might hold the sideLegend By default this just returns the side legend component.
 int getSideDividerLocation()
          Get the location of the side legend or -1 if there is no side legend
 SideLegend getSideLegend()
          Get the SideLegend property.
 JSplitPane getSideLegendContainer()
          Get the component that holds the side legend
 Hashtable getSkinProperties()
          Get the SkinProperties property.
 String getSkinProperty(String name)
          Get the named property for the skin
 StateManager getStateManager()
          Get the StateManager to use.
 XmlObjectStore getStore()
          Wrapper around IdvBase.getStore()
 JComponent getTimelineComponent()
          make the timeline gui
 boolean getToolbarsFloatable()
          are the toolbars floatable
 String getTypeName()
          What type of view is this
 String getUniqueId()
          Override the base class method to return a (hopefully) unique id.
 boolean getUseFastRendering(boolean b)
          This is called by display controls and allows us to force fast rendering
 ViewDescriptor getViewDescriptor()
          Get the ViewDescriptor.
 ViewManager getViewManager()
          Get the view manager
 GeoLocationInfo getVisibleGeoBounds()
          Does this viewmanager have any bounds that are visible.
 VMManager getVMManager()
          Get the VMManager to use.
 boolean getWaitMessageVisible()
          Get the please wait visible state flag
 boolean getWireframe()
          Get the show wireframe box flag
 void guiInitializationDone()
          This gets called when the initial guis (windows, etc) have been created and shown
protected  void handleBooleanPropertyChange(String id, boolean value)
          The BooleanProperty identified byt he given id has changed.
protected  void handleControlChanged(ControlEvent e)
          Handle a control changed.
protected  boolean hasBooleanProperty(String propertyId)
          Check to see if this view manager has the property
 boolean hasDisplayMaster()
          See if this has a display master
protected  void init()
          Initialize.
 void initAfterUnPersistence(IntegratedDataViewer idv)
          Called after this object has been unpersisted from xml.
protected  void initBooleanProperties()
          Create the set of BooleanPropertys.
 void initColorMenu(JMenu colorMenu)
          Dynamically add the menu items into the color menu
 void initDisplayMenu(JMenu displayMenu)
          This is called when the list of display controls has changed to update the display menu.
 void initFromSkin(Element skinNode)
          Initialize from a skin
 void initializeViewMenu(JMenu viewMenu)
          Dynamically initialize the view menu
 void initPreferences(IdvPreferenceManager preferenceManager)
          A hook so derived classes can add in their own preference widgets.
protected  void initToolBars()
          A hook so derived classes can add in their toolbar components
protected  void initUI()
          Create the ui
 void initViewStateMenu(JMenu viewStateMenu)
          Initialize the View State menu
 void initWith(ViewManager that)
          Initialize this ViewManager with the state in the that ViewManager
 void initWith(ViewManager that, boolean ignoreWindow)
          Initialize this ViewManager with the state in the that ViewManager.
protected  void initWithInner(ViewManager that, boolean ignoreWindow)
          Initialize this ViewManager with the state in the that ViewManager.
protected  void insertSideLegend()
          Place the side legend where it belongs
 boolean isClassOk(ViewDescriptor vd)
          If the given view descriptor has one or more class names is the class name of this ViewManager in the list
 boolean isDefinedBy(ViewDescriptor vd)
          Does this view manager have the given view descriptor
protected  boolean isFullScreen()
          Are we in full screen mode.
 boolean isInteractive()
          Is this an interactive session
 void itemStateChanged(ItemEvent e)
          Responds to ItemEvents handled by an ItemListener; in this class, from JCheckBoxes.
 void keyWasTyped(KeyEvent keyEvent)
          Process sthe key event
 void logException(String msg, Exception exc)
          Helper to log errors
 JMenu makeColorMenu()
          make the color set menu
 DropPanel makeDropPanel(JComponent contents, boolean doBorder)
          Make a dnd panel
 void makeFrames()
          Make frames
protected  JMenu makeSavedViewsMenu()
          Make the saved views menu
protected  JMenu makeShowMenu()
          Create and return the show menu.
 JMenu makeViewMenu()
          Create and return the view menu.
protected  void makeViewStateMenu(JMenu viewStateMenu)
          Make the view state menu
protected  void notifyDisplayControls(String property)
          Tell the display controls that the projection has changed.
 boolean okToImportDisplay(DisplayControl control)
          Can this view manager import the given display control.
 void parseProperties(String properties)
          Parse and apply the properties in the semi-colon delimited list of name=value pairs.
 void putProperty(Object key, Object value)
          Set a property.
protected  void reallyFillLegends()
          tell the legends to fill themselves
 void removeColorPair(String name)
          Remove the named color pair from the users xml
 void removeDisplayInfo(DisplayInfo displayInfo)
          This removes the given DisplayInfo.
 void resetAspectSliders()
          Reset the aspect sliders.
 void resetFullScreen()
          Go back to normal screen
protected  void resetProjectionControl()
          Reset the projection control
 void setAliases(List value)
          Set the Aliases property.
 void setAnimatedVisibility(boolean state)
          Turn on/off the display control visibility toggling animation
 void setAnimationInfo(AnimationInfo value)
          Set the AnimationInfo property.
 void setAnimationStringVisible(boolean visible)
          Deprecated. Use setAniReadout now
 void setAniReadout(boolean value)
          Set the show animation readout flag
 void setAspectRatio(double[] value)
          Set the AspectRatio property.
 void setBackground(Color c)
          Set the background color
protected  void setBooleanProperties(ViewManager vm)
          Set the different boolean flags from thise held by the given view manager.
 void setBooleanPropertiesForPersistence(Hashtable value)
          Set the BooleanPropertiesForPersistence property.
protected  void setBp(String propertyId, boolean value)
          Helper to set the value of a BooleanProperty
 void setClickToFocus(boolean value)
          Set the click to focus property.
 void setColors(Color foreground, Color background)
          Set the foreground and background colors in the display.
 void setContentsBorder(Border b)
          Set the contents boreder
 void setCursorInDisplay(Cursor c)
          Set the cursor in the component of the main display
 void setDisplayBounds(Rectangle value)
          Set the DisplayBounds property.
 void setDisplayListColor(Color value)
          Set the display list color property.
 void setDisplayListFont(Font value)
          Set the display list font property.
protected  void setDisplayMaster(DisplayMaster master)
          Set the DisplayMaster
 void setDisplayMatrix(double[] newMatrix)
          Set the display matrix array
 void setExternalAnimation(Animation value, AnimationWidget widget)
          Set the ExternalAnimation property.
 void setForeground(Color c)
          Set the foreground color
 void setFullScreen()
          Go to full screen mode
 void setFullScreenHeight(int value)
          Set the FullScreenHeight property.
 void setFullScreenWidth(int value)
          Set the FullScreenWidth property.
 void