Class IdvChooserManager

All Implemented Interfaces:
ActionListener, EventListener, IdvConstants

public class IdvChooserManager extends IdvManager
This creates and manages the set of choosers. It makes the chooser GUI from an xml specification e.g.: /ucar/unidata/idv/resources/choosers.xml It uses the XmlUi to process the xml.

This class also processes the end-user created choosers. This piece has always been a bit flaky

Version:
$Revision: 1.98 $Date: 2007/07/30 19:38:22 $
Author:
IDV development team
  • Field Details

  • Constructor Details

    • IdvChooserManager

      public IdvChooserManager(IntegratedDataViewer idv)
      Create a new IdvChooserManager.
      Parameters:
      idv - The singleton IDV
  • Method Details

    • removeAddeServerGroup

      public void removeAddeServerGroup(AddeServer server, AddeServer.Group group, boolean markAsInactive)
      Remove the group held by the server. Write out the addeservers.xml file
      Parameters:
      server - The server
      group - The group to remove
      markAsInactive - If true then don't really remove the group, just mark it as inactive
    • activateAddeServerGroup

      public void activateAddeServerGroup(AddeServer server, AddeServer.Group group)
      Make the group active
      Parameters:
      server - The server
      group - The group to remove
    • addAddeServerGroup

      public AddeServer.Group addAddeServerGroup(AddeServer server, String groupName, String type)
      Add the given AddeServer.Group into the list of servers. Write out the addeserver.xml file
      Parameters:
      server - Server to add
      groupName - The new group name
      type - Its type
      Returns:
      The new Group
    • writeAddeServers

      public void writeAddeServers()
      Write out the addeservers.xml file
    • addAddeServer

      public AddeServer addAddeServer(String name)
      Create a new AddeServer or find an existing one with the given name. If a new one is created then also write out the addeservers.xml file
      Parameters:
      name - new server name
      Returns:
      The server
    • removeAddeServer

      public void removeAddeServer(AddeServer server, boolean markAsInactive)
      Remove the given adde server. Write out the addeservers.xml file
      Parameters:
      server - The server to remove
      markAsInactive - If true then don't really remove the server, just mark it as inactive
    • getAddeServers

      public List getAddeServers(String groupType)
      Get AddeServers to use
      Parameters:
      groupType - If null return all, else return the servers that have groups of the given type
      Returns:
      List of AddeServers
    • getAddeServers

      public List getAddeServers(String groupType, boolean onlyActive)
      Get AddeServers to use
      Parameters:
      groupType - If null return all, else return the servers that have groups of the given type
      onlyActive - If true then only fetch the active servers
      Returns:
      List of AddeServers
    • getChoosers

      public List getChoosers()
      Get the list of current choosers. This looks at all of the IdvWindows in existence and checks for their component group 'choosers'.
      Returns:
      List of current choosers
    • getChooserContents

      public JComponent getChooserContents()
      Get the chooser contents deprecated no longer in use
      Returns:
      null
    • init

      public void init()
      Initialize the set of choosers. Go through the chooser resources and create the chooser gui.
    • createChoosers

      public JComponent createChoosers(boolean inTabs)
      Create the Choosers component from the choosers.xml resources
      Parameters:
      inTabs - Do we use the buttontabbedpane or the treepanel
      Returns:
      choosers gui
    • createChoosers

      public JComponent createChoosers(boolean inTabs, List theseChoosers, Element choosersNode)
      Create the Choosers component from the choosers.xml resources
      Parameters:
      inTabs - Do we use the buttontabbedpane or the treepanel
      theseChoosers - List to add the created choosers into
      choosersNode - The xml node of the chooser skin
      Returns:
      choosers gui
    • createXmlUi

      protected XmlUi createXmlUi(Element root)
      Factory method to create the IdvXmlUi to be used for the given chooser xml node
      Parameters:
      root - The chooser xml node
      Returns:
      _more_
    • createChooser

      public Component createChooser(Node chooserNode)
      Overwrite the component factory method in XmlUi to handler chooser xml nodes.
      Parameters:
      chooserNode - The chooser node
      Returns:
      The chooser's gui
    • showCatalogUrl

      public void showCatalogUrl(String url)
      Show the given catalog URL in the XmlChooser
      Parameters:
      url - The URL to show
    • showFileChooser

      public void showFileChooser(String path)
      show the file chooser in the chooser GUI with the given file path
    • makeChooserMenus

      public List makeChooserMenus(List items)
      Make the chooser menu items
      Parameters:
      items - List to put the menu items in
      Returns:
      List of chooser menu items
    • getChooserId

      public static String getChooserId(Element node)
      This tries to find some identifier for the chooser defied by the given xml node. This is used when the end user can define what choosers they want to see in the chooser GUI.
      Parameters:
      node - The chooser node
      Returns:
      Some (hopefully) unique identifier
    • getChooserIds

      public List getChooserIds()
      Return a list of the (String) chooser ids that have been processed by this manager. We have this here for the end user to define what choosers they want to see
      Returns:
      The list of (String) chooser ids.
    • getChooserName

      public String getChooserName(String chooserId)
      Get the name of the given chooser
      Parameters:
      chooserId - The id of the chooser
      Returns:
      Its name
    • addUserChooserToMenu

      public JMenu addUserChooserToMenu(JMenu menu, JMenu pullRight)
      Inserts menu items into the given menu for creating the data sources that are defined by the user chooser
      Parameters:
      menu - The menu
      pullRight - Will end up being the sub menu
      Returns:
      The pullRight menu
    • sortDataSourceIds

      public List sortDataSourceIds(List ids)
      _more_
      Parameters:
      ids - _more_
      Returns:
      _more_
    • dataSourceIdSelected

      public void dataSourceIdSelected(String id)
      _more_
      Parameters:
      id - _more_
    • makeDataSourceFromXml

      public void makeDataSourceFromXml(Element theNode)
      Create the data source from the given user chooser xml
      Parameters:
      theNode - User chooser xml node that defines a data source
    • closeDataChooser

      public void closeDataChooser()
      Close me
    • shouldMakeDialog

      protected boolean shouldMakeDialog()
      Should we make a dialog
      Overrides:
      shouldMakeDialog in class WindowHolder
      Returns:
      true
    • getWindowTitle

      protected String getWindowTitle()
      Window title
      Overrides:
      getWindowTitle in class WindowHolder
      Returns:
      window title
    • popupXmlChooserDialog

      protected void popupXmlChooserDialog(Element tabNode, Element dirNode)
      Show the dialog for editing the user chooser entry
      Parameters:
      tabNode - What tab the entry is in
      dirNode - What entry
    • processChooserXml

      public void processChooserXml()
      Process the user chooser resources
    • processChooserXml

      public void processChooserXml(boolean writable, Element root)
      Process the user chooser xml root
      Parameters:
      writable - Is this the writable resource
      root - The xml document root
    • writeChooserXml

      protected void writeChooserXml()
      Write out the user chooser xml document
    • getDataSourcesComponent

      public JComboBox getDataSourcesComponent(boolean justFileSources, DataManager dataManager)
      Return the component that holds the dataSources combo box
      Parameters:
      justFileSources - If true then just use data sources that access files
      dataManager - The data manager
      Returns:
      The GUI for the data sources selector
    • getDataSourcesComponent

      public JComboBox getDataSourcesComponent(boolean justFileSources, DataManager dataManager, boolean addLucky)
      Get the component for listing data source types
      Parameters:
      justFileSources - true for just files
      dataManager - the data manager
      addLucky - true to add the "I'm Feeiling Lucky" option
      Returns:
      the component