Class 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 Details

  • Constructor Details

  • Method Details

    • 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

      Returns:
      Reference to the stack of previously active ViewManagers.
    • 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

      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

    • 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!
      Parameters:
      msg - Message to include in output.
    • 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.