Class McIDASVXmlUi

All Implemented Interfaces:
ActionListener, ItemListener, EventListener

public class McIDASVXmlUi extends IdvXmlUi

McIDAS-V mostly extends this class to preempt the IDV. McIDAS-V needs to control some HTML processing, ensure that McvComponentGroups and McvComponentHolders are created, and handle some special problems that occur when attempting to load bundles that do not contain component groups.

  • Field Details

  • Constructor Details

  • Method Details

    • decodeHtml

      private static String decodeHtml(String text)
      Convert the &gt; and &lt; entities to > and <.
      Parameters:
      text - The text you'd like to convert.
      Returns:
      The converted text!
    • addComponent

      public void addComponent(String id, Element component)
      Add the component.
      Overrides:
      addComponent in class XmlUi
      Parameters:
      id - id
      component - component
    • makeComponentGroup

      Overridden so that any attempts to generate IdvComponentGroups or IdvComponentHolders will return the respective McIDAS-V equivalents.

      It makes things like the draggable tabs possible.

      Overrides:
      makeComponentGroup in class IdvXmlUi
      Parameters:
      node - XML representation of the desired component group.
      Returns:
      An McvComponentGroup based upon the contents of node.
    • createComponent

      McIDAS-V overrides this so that it can seize control of some HTML processing in addition to attempting to associate newly-created ViewManagers with ViewManagers found in a bundle.

      The latter is done so that McIDAS-V can load bundles that do not use component groups. A "dynamic skin" is built with ViewManagers for each ViewManager in the bundle. The "viewid" attribute of the dynamic skin ViewManager is the name of the ViewDescriptor from the bundled ViewManager. createViewManager() is used to actually associate the new ViewManager with its bundled ViewManager.

      Overrides:
      createComponent in class IdvXmlUi
      Parameters:
      node - The XML describing the component to be created.
      id - ID of node.
      Returns:
      The Component described by node.
      See Also:
    • getElapsedGuiTime

      public long getElapsedGuiTime()
      Return the total amount of time spent in createComponent(Element, String).

      Be aware that each McV window should have its own McIDASXmlUi instance, so in order to determine the total time, iterate over the results from IdvWindow.getWindows().

      The elapsed time is merely a quick estimate. The only way to obtain accurate timing information with the JVM is using JMH.

      Returns:
      Nanoseconds spent creating GUI components in this window.
    • createViewManager

      Attempts to build a ViewManager based upon node. If the XML has a "viewid" attribute, the value will be used to search for a ViewManager that has been cached by the McIDAS-V UIManager. If the UIManager has a matching ViewManager, we'll use the cached ViewManager to initialize a "blank" ViewManager. The cached ViewManager is then removed from the cache and deleted. This method will return null if no cached ViewManager was found.

      The ViewManager "cache" will only contain bundled ViewManagers that were not held in a component holder. This means that any ViewManager returned was created for a dynamic skin, but initialized with the contents of the corresponding bundled ViewManager.

      Parameters:
      node - XML description of the ViewManager that needs building.
      Returns:
      null if there was no cached ViewManager, otherwise a ViewManager that has been initialized with a bundled ViewManager.
    • createTreePanel

      private TreePanel createTreePanel(Element node, String id)
    • getReffedNode

      private Element getReffedNode(Element node)
      The xml nodes can contain an idref field. If so this returns the node that that id defines
      Parameters:
      node - node
      Returns:
      The node or the referenced node