Class EarthDataReaderChooser

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class EarthDataReaderChooser extends JPanel
The EarthDataReaderChooser class allows the user to choose a dataset and list of variables for opening geographic data files recognized by the EarthDataReaderFactory class. For ease of use, a static instance can be obtained from getInstance(). Use the showDialog(java.awt.Component, java.io.File) method to display the instance which blocks the parent until the user hits OK or Cancel, then check that the state returned by getState() gives a value of State.SELECTED. You can then use the result of the getReader() method which returns the selected reader with statistics assigned to the variables that the user chose, which you can obtain from EarthDataReader.getStatisticsVariables().
Since:
3.8.1
Author:
Peter Hollemans
See Also:
  • Field Details

  • Constructor Details

    • EarthDataReaderChooser

      public EarthDataReaderChooser()
      Creates a new chooser panel.
  • Method Details

    • getInstance

      public static EarthDataReaderChooser getInstance()
    • getState

      public EarthDataReaderChooser.State getState()
      Gets the state of the chooser after being shown by the showDialog(java.awt.Component, java.io.File) method. The State.UNSELECTED value indicates that either the user cancelled the dialog, or the file selected is not a valid reader. The State.SELECTED value indicates that a valid reader can be obtained from getReader().
    • getReader

      public EarthDataReader getReader()
      Gets the currently selected reader.
      Returns:
      the currently selected reader, or null if no file is selected, or the selected file does not contain data supported by the EarthDataReaderFactory. The selected file is only valid when getState() returns State.SELECTED.
      See Also:
    • showDialog

      public void showDialog(Component parent, File selectedFile)
      Shows this chooser in a dialog window with an OK and Cancel button. The user can select a file and variables of interest, and statistics are computed for the variables.
      Parameters:
      parent - the parent component to use for the dialog or null for no parent.
      selectedFile - the file to initially show as selected, or null to use the currently selected file.
      See Also:
    • setSelectedFile

      public void setSelectedFile(File file)
      Sets the file selected in the chooser.
      Parameters:
      file - the file to show selected.
    • main

      public static void main(String[] argv) throws Exception
      Tests this class.
      Parameters:
      argv - the array of command line parameters.
      Throws:
      Exception