private JPanel makeVariablesPanel() {
    variablesFld =
        new Field.BeanTable(
            VARIABLES, "Variables", null, ThreddsMetadata.Variable.class, null, null);

    extractVButton = makeButton("Extract Variables");
    extractVButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            extractVariables();
          }
        });

    JPanel buttPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0));
    buttPanel.add(extractVButton);

    JPanel vPanel = new JPanel(new BorderLayout());
    vPanel.add(buttPanel, BorderLayout.NORTH);
    vPanel.add(variablesFld.getEditComponent(), BorderLayout.CENTER);
    return vPanel;
  }
  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");

    tables = new ArrayList();

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

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

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

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

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

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

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

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

    for (int i = 0; i < tables.size(); i++) addPopups((Field.BeanTable) tables.get(i));

    metadataPP.finish(false);

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

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