Class McvComponentGroup

All Implemented Interfaces:
PropertyChangeListener, EventListener, Sharable

Extends the IDV component groups so that we can intercept clicks for Bruce's tab popup menu and handle drag and drop. It also intercepts ViewManager creation in order to wrap components in McIDASVComponentHolders rather than IdvComponentHolders. Doing this allows us to associate ViewManagers back to their ComponentHolders, and this functionality is taken advantage of to form the hierarchical names seen in the McIDASVViewPanel.
  • Field Details

  • Constructor Details

    • McvComponentGroup

      Default constructor for serialization.
    • McvComponentGroup

      A pretty typical constructor.
      Parameters:
      idv - The main IDV instance.
      name - Presumably the name of this component group?
    • McvComponentGroup

      This constructor catches the window that will be contained in this group.
      Parameters:
      idv - The main IDV instance.
      name - Presumably the name of this component group?
      window - The window holding this component group.
  • Method Details

    • getHideTabArea

      public boolean getHideTabArea()
    • setHideTabArea

      public void setHideTabArea(boolean hide)
    • getHideTitleBar

      public boolean getHideTitleBar()
    • setHideTitleBar

      public void setHideTitleBar(boolean hide)
    • init

      private void init()
      Initializes the various UI components.
    • initWith

      public void initWith(Element node)
      Overrides:
      initWith in class IdvComponentGroup
    • doMakeContents

      Create and return the GUI contents. Overridden so that McV can implement the right click tab menu and draggable tabs.
      Overrides:
      doMakeContents in class ComponentGroup
      Returns:
      GUI contents
    • importDisplayControl

      Importing a display control entails adding the control to the component group and informing the UI that the control is no longer in its own window.

      Overridden in McV so that the display control is wrapped in a McIDASVComponentHolder rather than a IdvComponentHolder.

      Overrides:
      importDisplayControl in class IdvComponentGroup
      Parameters:
      dc - The display control to import.
    • makeDynamicSkin

      public void makeDynamicSkin(Element root)
      Basically just creates a McVCompHolder for holding a dynamic skin and sets the name of the component holder.
      Parameters:
      root - The XML skin that we'll use.
    • createXmlNode

      Doesn't do anything for the time being...
      Overrides:
      createXmlNode in class IdvComponentGroup
      Parameters:
      doc -
      Returns:
      XML representation of the contents of this component group.
    • makeSkin

      public void makeSkin(int index)
      Handles creation of the component represented by the XML skin at the given index.

      Overridden so that McV can wrap the component in a McIDASVComponentHolder.

      Overrides:
      makeSkin in class IdvComponentGroup
      Parameters:
      index - The index of the skin within the skin resource.
    • makeSkinAtIndex

      public IdvComponentHolder makeSkinAtIndex(int index)
    • makeNew

      public void makeNew(String what)
      Create a new component whose type will be determined by the contents of what.

      Overridden so that McV can wrap up the components in McVComponentHolders, which allow McV to map ViewManagers to ComponentHolders.

      Overrides:
      makeNew in class IdvComponentGroup
      Parameters:
      what - String that determines what sort of component we create.
    • redoLayout

      public void redoLayout()
      Forces this group to layout its components. Extended because the IDV was doing extra work that McIDAS-V doesn't need, such as dealing with layouts other than LAYOUT_TABS and needlessly reinitializing the group's container.
      Overrides:
      redoLayout in class ComponentGroup
      See Also:
    • getViewManagers

      public void getViewManagers(List viewManagers)
      Overrides:
      getViewManagers in class IdvComponentGroup
    • addComponent

      public void addComponent(ComponentHolder holder, int index)
      Adds a component holder to this group. Extended so that the added holder becomes the active tab, and the component is explicitly set to visible in an effort to fix that heavyweight/lightweight component problem.
      Overrides:
      addComponent in class ComponentGroup
      Parameters:
      holder -
      index -
      See Also:
    • shouldGenerateName

      private boolean shouldGenerateName(ComponentHolder h, int i)
    • setActiveComponentHolder

      Used to set the tab associated with holder as the active tab in our JTabbedPane.
      Parameters:
      holder - The active component holder.
    • getActiveIndex

      public int getActiveIndex()
      Get the index of the active tab in a group.
      Returns:
      The index of the active component holder within this group.
    • setActiveIndex

      public boolean setActiveIndex(int index)
      Make the component holder at index active.
      Parameters:
      index - The index of the desired component holder.
      Returns:
      True if the active component holder was set, false otherwise.
    • indexOf

      public int indexOf(ComponentHolder holder)
      Returns the index of holder within this component group.
      Overrides:
      indexOf in class ComponentGroup
      Returns:
      Either the index of holder, or -1 if ComponentGroup.getDisplayComponents() returns a null List.
      See Also:
    • getHolderAt

      protected ComponentHolder getHolderAt(int index)
      Returns the ComponentHolder at the given position within this component group.
      Parameters:
      index - Index of the ComponentHolder to return.
      Returns:
      ComponentHolder at index.
      See Also:
    • getActiveComponentHolder

      Returns:
      Component holder that corresponds to the selected tab.
    • setIdv

      public void setIdv(IntegratedDataViewer newIdv)
      Overridden so that McV can also update its copy of the IDV reference.
      Overrides:
      setIdv in class IdvComponentGroup
    • makeWindowTitle

      private String makeWindowTitle(String title)
      Create a window title suitable for an application window.
      Parameters:
      title - Window title
      Returns:
      Application title plus the window title.
    • getDisplayComponentCount

      protected int getDisplayComponentCount()
      Returns the number of display components "in" this group.
      Returns:
      Either the size() of the List returned by ComponentGroup.getDisplayComponents() or -1 if getDisplayComponents() returns a null List.
    • doMakeTabMenu

      Create the JPopupMenu that will be displayed for a tab.
      Returns:
      Menu initialized with tab options
    • ejectDisplay

      private ComponentHolder ejectDisplay(int idx)
      Remove the component holder at index idx. This method does not destroy the component holder.
      Parameters:
      idx - Index of the ejected component holder.
      Returns:
      Component holder that was ejected.
    • renameDisplay

      protected void renameDisplay(int idx)
      Prompt the user to change the name of the component holder at index idx. Nothing happens if the user doesn't enter anything.
      Parameters:
      idx - Index of the component holder.
    • destroyDisplay

      protected boolean destroyDisplay(int idx)
      Prompts the user to confirm removal of the component holder at index idx. Nothing happens if the user declines.
      Parameters:
      idx - Index of the component holder.
      Returns:
      Either true if the user elected to remove, false otherwise.
    • quietRemoveComponentAt

      Remove the component at index without forcing the IDV-land component group to redraw.
      Parameters:
      index - The index of the component to be removed.
      Returns:
      The removed component.
    • quietAddComponent

      public int quietAddComponent(ComponentHolder component)
      Adds a component to the end of the list of display components without forcing the IDV-land code to redraw.
      Parameters:
      component - The component to add.
      Returns:
      The index of the newly added component, or -1 if ComponentGroup.getDisplayComponents() returned a null List.