Class CatalogTreeView

  • All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible

    public class CatalogTreeView
    extends JPanel
    A Swing widget for THREDDS clients to display catalogs in a JTree, and allows the user to select a dataset. When a new catalog is read, or a dataset is selected, a java.beans.PropertyChangeEvent is thrown, see addPropertyChangeListener.

    Example:

      CatalogTreeView  tree = new CatalogTreeView();
        tree.addPropertyChangeListener(  new java.beans.PropertyChangeListener() {
          public void propertyChange( java.beans.PropertyChangeEvent e) {
            if (e.getPropertyName().equals("Selection")) {
              ...
            } else if (e.getPropertyName().equals("Dataset")) {
              ...
            } else if (e.getPropertyName().equals("Catalog")) {
              ...
            }
          }
        });
     
    Handles Catalog References internally. Catalogs are read in a background thread, which can be cancelled by the user.

    You probably want to use CatalogChooser or ThreddsDatasetChooser for more complete functionality.

    See Also:
    Serialized Form
    • Constructor Detail

      • CatalogTreeView

        public CatalogTreeView()
        Constructor.
    • Method Detail

      • setOpenCatalogReferences

        public void setOpenCatalogReferences​(boolean openCatalogReferences)
        Set whether catalog references are opened. default is true.
      • setOpenDatasetScans

        public void setOpenDatasetScans​(boolean openDatasetScans)
        Set whether catalog references from dataset scans are opened. default is true.
      • setAccessOnly

        public void setAccessOnly​(boolean accessOnly)
        Whether to throw events only if dataset has an Access.
        Parameters:
        accessOnly - if true, throw events only if dataset has an Access
      • getCatalog

        public Catalog getCatalog()
        Get the current catalog.
      • getCatalogURL

        public String getCatalogURL()
        Get the URL of the current catalog.
      • getSelectedDataset

        public DatasetNode getSelectedDataset()
        Get the currently selected InvDataset.
        Returns:
        selected InvDataset, or null if none.
      • setSelectedDataset

        public void setSelectedDataset​(Dataset ds)
        Set the currently selected InvDataset.
        Parameters:
        ds - select this InvDataset, must be already in the tree. LOOK does this work ?? doesnt throw event
      • openAll

        public void openAll​(boolean includeCatref)
        Open all nodes of the tree.
        Parameters:
        includeCatref - open catrefs?
      • setCatalog

        public void setCatalog​(String location)
        Set the InvCatalog to display. The catalog is read asynchronously and displayed if successfully read. You must use a PropertyChangeEventListener to be notified if successful.
        Parameters:
        location - The URL of the InvCatalog.
      • redisplay

        public void redisplay()
      • setCatalog

        public void setCatalog​(Catalog catalog)
        Set the catalog to be displayed. If ok, then a "Catalog" PropertyChangeEvent is sent.
        Parameters:
        catalog - to be displayed