Exemplo n.º 1
0
  public GridUI(
      PreferencesExt pstore, RootPaneContainer root, FileManager fileChooser, int defaultHeight) {
    // this.topUI = topUI;
    this.store = pstore;
    this.fileChooser = fileChooser;

    try {
      choosers = new ArrayList();
      fieldChooser = new SuperComboBox(root, "field", true, null);
      choosers.add(new Chooser("field", fieldChooser, true));
      levelChooser = new SuperComboBox(root, "level", false, null);
      choosers.add(new Chooser("level", levelChooser, false));
      timeChooser = new SuperComboBox(root, "time", false, null);
      choosers.add(new Chooser("time", timeChooser, false));
      ensembleChooser = new SuperComboBox(root, "ensemble", false, null);
      choosers.add(new Chooser("ensemble", ensembleChooser, false));
      runtimeChooser = new SuperComboBox(root, "runtime", false, null);
      choosers.add(new Chooser("runtime", runtimeChooser, false));

      makeActionsDataset();
      makeActionsToolbars();

      gridTable = new GridTable("field");
      gtWindow =
          new IndependentWindow(
              "Grid Table Information", BAMutil.getImage("GDVs"), gridTable.getPanel());

      PreferencesExt dsNode = (PreferencesExt) pstore.node("DatasetTable");
      dsTable = new GeoGridTable(dsNode, true);
      dsDialog = dsTable.makeDialog(root, "NetcdfDataset Info", false);
      // dsDialog.setIconImage( BAMutil.getImage( "GDVs"));
      Rectangle bounds =
          (Rectangle) dsNode.getBean("DialogBounds", new Rectangle(50, 50, 800, 450));
      dsDialog.setBounds(bounds);

      controller = new GridController(this, store);
      makeUI(defaultHeight);
      controller.finishInit();

      // other components
      geotiffFileChooser = new FileManager(parent);
      geotiffFileChooser.setCurrentDirectory(store.get(GEOTIFF_FILECHOOSER_DEFAULTDIR, "."));

    } catch (Exception e) {
      System.out.println("UI creation failed");
      e.printStackTrace();
    }
  }
Exemplo n.º 2
0
  /**
   * initiate a new TDS radar dataset collection object
   *
   * @param desc description
   * @param dsc_location location of dataset
   * @param elem dataset root element
   * @param ns dataset namespace
   * @param errlog error log
   * @throws IOException _more_
   */
  private TDSRadarDatasetCollection(
      String desc, String dsc_location, Element elem, Namespace ns, StringBuffer errlog)
      throws IOException {
    super();
    Element serviceElem = readElements(elem, "service");
    Element dsElem = readElements(elem, "dataset");

    Element metaElem = readElements(dsElem, "metadata");
    // HashMap stationHMap = readSelectStations(metaElem, ns);
    String sts = dsc_location.replaceFirst("dataset.xml", "stations.xml");
    HashMap<String, Station> stationHMap = readRadarStations(sts);
    LatLonRect radarRegion = readSelectRegion(metaElem, ns);
    List<String> radarTimeSpan = readSelectTime(metaElem, ns);
    List<Product> productList = readSelectVariable(metaElem, ns);
    String summary = readSelectDocument(metaElem, ns);

    // gotta have these
    if (stationHMap == null) {
      errlog.append("TDSRadarDatasetCollection must have station selected");
      return;
    }
    if (radarRegion == null) {
      errlog.append("TDSRadarDatasetCollection must have region selected");
      return;
    }
    if (radarTimeSpan == null) {
      errlog.append("TDSRadarDatasetCollection must have time span selected");
      return;
    }

    this.desc = desc;
    this.dsc_location = dsc_location;
    this.radarProducts = productList;
    this.summary = summary;
    this.stationHMap = stationHMap;
    this.radarRegion = radarRegion;
    this.radarTimeSpan = radarTimeSpan;
    this.startDate = DateUnit.getStandardOrISO((String) radarTimeSpan.get(0));
    this.endDate = DateUnit.getStandardOrISO((String) radarTimeSpan.get(1));

    try {
      timeUnit = new DateUnit("hours since 1991-01-01T00:00");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 3
0
  /**
   * _more_
   *
   * @param desc _more_
   * @param dqc _more_
   * @param selService _more_
   * @param service _more_
   * @param selStation _more_
   * @param selRegion _more_
   * @param selTime _more_
   */
  private DqcRadarDatasetCollection(
      String desc,
      QueryCapability dqc,
      SelectService selService,
      SelectService.ServiceChoice service,
      SelectStation selStation,
      SelectGeoRegion selRegion,
      SelectList selTime) {
    super();
    //  this.ds = ds;
    this.desc = desc;
    this.dqc = dqc;
    this.selService = selService;
    this.selStation = selStation;
    this.selRegion = selRegion;
    this.selTime = selTime;
    this.service = service;

    ArrayList stationList = selStation.getStations();
    stations = new HashMap(stationList.size());
    for (int i = 0; i < stationList.size(); i++) {
      thredds.catalog.query.Station station = (thredds.catalog.query.Station) stationList.get(i);
      //  DqcRadarStation dd = new DqcRadarStation(station);
      stations.put(station.getValue(), station);
    }

    ArrayList timeList = selTime.getChoices();
    relTimesList = new HashMap(timeList.size());
    for (int i = 0; i < timeList.size(); i++) {
      thredds.catalog.query.Choice tt = (thredds.catalog.query.Choice) timeList.get(i);
      relTimesList.put(tt.getValue(), tt);
    }

    String ql = dqc.getQuery().getUriResolved().toString();

    startDate = new Date();
    endDate = new Date();

    try {
      timeUnit = new DateUnit("hours since 1991-01-01T00:00");
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Exemplo n.º 4
0
  public DatasetEditor() {
    JTabbedPane tabs = new JTabbedPane();

    metadataPP = new PrefPanel("Edit Catalog Dataset", null, null);
    tabs.add("metadata", metadataPP);

    int row = 0;
    metadataPP.addHeading("Basic", row++);

    // row 0
    metadataPP.addTextField(NAME, "Name", "", 0, row++, "8,1");
    // row 1
    metadataPP.addTextField(ID, "ID", "", 0, row, null);
    addPopups(metadataPP.addTextField(AUTHORITY, "Authority", "", 2, row, null));
    addPopups(metadataPP.addTextField(SERVICE_NAME, "Service", "", 4, row, null));

    row++;
    // row 2
    addPopups(
        metadataPP.addEnumComboField(
            FORMAT_TYPE, "Data format", DataFormatType.getAllTypes(), true, 0, row, null));
    addPopups(
        metadataPP.addEnumComboField(
            DATA_TYPE, "Data type", Arrays.asList(FeatureType.values()), true, 2, row, null));
    metadataPP.addEnumComboField(
        COLLECTION_TYPE, "Collection type", CollectionType.getAllTypes(), true, 4, row++, null);

    ////////////
    metadataPP.addHeading("GeoSpatial Coverage", row++);

    // addCheckBoxField("localMetadata.geospatialCoverage.global", "Global", false, 0, row);
    gc_type = metadataPP.addEnumComboField(GC_TYPE, "type", inherit_types, false, 0, row, null);
    gc_type.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            String mode = (String) gc_type.getValue();
            setGCmode(getMode(mode));
          }
        });

    extractGCButton = makeButton("Extract Geospatial");
    extractGCButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            extractGeospatial();
          }
        });
    metadataPP.addComponent(extractGCButton, 2, row, "left, center");

    metadataPP.addCheckBoxField(ZPOSITIVE_UP, "Z positive up", false, 4, row);
    row++;

    /* JPanel geoPanel = new JPanel();
    Field.CheckBox global = new Field.CheckBox( "localMetadata.geospatialCoverage.global", "Global", false, persBean);
    geoPanel.add( new JLabel("Global: "));
    geoPanel.add( global.getEditComponent());
    geoPanel.add( new JButton("Read Dataset"));
    pp.addComponent(geoPanel, 0, row++, "left, center"); */

    // 4 columns in 3 rows
    metadataPP.addDoubleField(LAT_START, "Starting Latitude", 0.0, 5, 0, row, null);
    metadataPP.addDoubleField(LAT_EXTENT, "Size", 0.0, 5, 2, row, null);
    metadataPP.addDoubleField(LAT_RESOLUTION, "Resolution", 0.0, 5, 4, row, null);
    metadataPP.addTextField(LAT_UNITS, "Units", "", 6, row, null);
    metadataPP.addDoubleField(LON_START, "Starting Longitude", 0.0, 5, 0, row + 1, null);
    metadataPP.addDoubleField(LON_EXTENT, "Size", 0.0, 5, 2, row + 1, null);
    metadataPP.addDoubleField(LON_RESOLUTION, "Resolution", 0.0, 5, 4, row + 1, null);
    metadataPP.addTextField(LON_UNITS, "Units", "", 6, row + 1, null);
    metadataPP.addDoubleField(HEIGHT_START, "Starting Height", 0.0, 5, 0, row + 2, null);
    metadataPP.addDoubleField(HEIGHT_EXTENT, "Size", 0.0, 5, 2, row + 2, null);
    metadataPP.addDoubleField(HEIGHT_RESOLUTION, "Resolution", 0.0, 5, 4, row + 2, null);
    metadataPP.addTextField(HEIGHT_UNITS, "Units", "", 6, row + 2, null);
    // addTextField("localMetadata.geospatialCoverage.ZPositive", "Z is Positive", "up", 6, row+3,
    // null);
    row += 3;

    //////
    metadataPP.addHeading("Temporal Coverage", row++);
    tc_type = metadataPP.addEnumComboField(TC_TYPE, "type", inherit_types, false, 0, row++, null);
    tc_type.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent evt) {
            String mode = (String) tc_type.getValue();
            setTCmode(getMode(mode));
          }
        });

    DateRange range = null;
    try {
      range = new DateRange();
    } catch (Exception e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }
    dateRangeSelector = new RangeDateSelector("", range, false, false, null, false, false);
    DateField minDateField = dateRangeSelector.getMinDateField();
    DateField maxDateField = dateRangeSelector.getMaxDateField();
    DurationField durationField = dateRangeSelector.getDurationField();
    DurationField resolutionField = dateRangeSelector.getResolutionField();

    metadataPP.addField(minDateField, 0, row, null);
    metadataPP.addField(maxDateField, 2, row, null);
    metadataPP.addField(durationField, 4, row, null);
    metadataPP.addField(resolutionField, 6, row++, null);

    ////
    metadataPP.addHeading("Digital Library Info", row++);
    metadataPP.addCheckBoxField(HARVEST, "Harvest", false, 0, row++);

    addPopups(metadataPP.addTextAreaField(SUMMARY, "Summary", null, 7, 0, row, "3,1"));
    addPopups(metadataPP.addTextAreaField(RIGHTS, "Rights", null, 2, 0, row + 1, "3,1"));

    addPopups(metadataPP.addTextAreaField(HISTORY, "History", null, 7, 4, row, "3,1"));
    addPopups(metadataPP.addTextAreaField(PROCESSING, "Process", null, 2, 4, row + 1, "3,1"));
    row += 2;

    metadataPP.addEmptyRow(row++, 10);

    JTabbedPane tabPane = new JTabbedPane();
    metadataPP.addComponent(tabPane, 0, row, "8,1");

    ArrayList<Field.BeanTableField> tables = new ArrayList<>();

    tabPane.addTab("Variables", makeVariablesPanel());
    tables.add(variablesFld);

    creatorsFld =
        new Field.BeanTableField(
            CREATORS, "Creators", null, ThreddsMetadata.Source.class, null, null);
    tabPane.addTab("Creators", creatorsFld.getEditComponent());
    tables.add(creatorsFld);

    publishersFld =
        new Field.BeanTableField(
            PUBLISHERS, "Publishers", null, ThreddsMetadata.Source.class, null, null);
    tabPane.addTab("Publishers", publishersFld.getEditComponent());
    tables.add(publishersFld);

    projectsFld =
        new Field.BeanTableField(
            PROJECTS, "Projects", null, ThreddsMetadata.Vocab.class, null, null);
    tabPane.addTab("Projects", projectsFld.getEditComponent());
    tables.add(projectsFld);

    keywordsFld =
        new Field.BeanTableField(
            KEYWORDS, "Keywords", null, ThreddsMetadata.Vocab.class, null, null);
    tabPane.addTab("Keywords", keywordsFld.getEditComponent());
    tables.add(keywordsFld);

    datesFld = new Field.BeanTableField(DATES, "Dates", null, DateType.class, null, null);
    tabPane.addTab("Dates", datesFld.getEditComponent());
    tables.add(datesFld);

    contributorsFld =
        new Field.BeanTableField(
            CONTRIBUTORS, "Contributors", null, ThreddsMetadata.Contributor.class, null, null);
    tabPane.addTab("Contributors", contributorsFld.getEditComponent());
    tables.add(contributorsFld);

    docsFld =
        new Field.BeanTableField(
            DOCUMENTATION, "Documentation", null, InvDocumentation.class, null, null);
    tabPane.addTab("Documentation", docsFld.getEditComponent());
    tables.add(docsFld);

    for (Field.BeanTableField table : tables) addPopups(table);

    metadataPP.finish(false);

    makeDscanPanel();
    tabs.add("datasetScan", dscanPP);

    setLayout(new BorderLayout());
    add(tabs, BorderLayout.CENTER);
  }