コード例 #1
0
ファイル: DatasetViewer.java プロジェクト: mazl123321/thredds
  public void showAtts() {
    if (ds == null) return;
    if (attTable == null) {
      // global attributes
      attTable =
          new BeanTableSorted(
              AttributeBean.class, (PreferencesExt) prefs.node("AttributeBeans"), false);
      PopupMenu varPopup = new ucar.nc2.ui.widget.PopupMenu(attTable.getJTable(), "Options");
      varPopup.addAction(
          "Show Attribute",
          new AbstractAction() {
            public void actionPerformed(ActionEvent e) {
              AttributeBean bean = (AttributeBean) attTable.getSelectedBean();
              if (bean != null) {
                infoTA.setText(bean.att.toString());
                infoTA.gotoTop();
                infoWindow.show();
              }
            }
          });
      attWindow =
          new IndependentWindow("Global Attributes", BAMutil.getImage("netcdfUI"), attTable);
      attWindow.setBounds(
          (Rectangle) prefs.getBean("AttWindowBounds", new Rectangle(300, 100, 500, 800)));
    }

    List<AttributeBean> attlist = new ArrayList<AttributeBean>();
    for (Attribute att : ds.getGlobalAttributes()) {
      attlist.add(new AttributeBean(att));
    }
    attTable.setBeans(attlist);
    attWindow.show();
  }
コード例 #2
0
ファイル: DatasetViewer.java プロジェクト: mazl123321/thredds
  public DatasetViewer(PreferencesExt prefs, FileManager fileChooser) {
    this.prefs = prefs;
    this.fileChooser = fileChooser;

    // create the variable table(s)
    tablePanel = new JPanel(new BorderLayout());
    setNestedTable(0, null);

    // the tree view
    datasetTree = new DatasetTreeView();
    datasetTree.addPropertyChangeListener(
        new PropertyChangeListener() {
          public void propertyChange(PropertyChangeEvent e) {
            setSelected((Variable) e.getNewValue());
          }
        });

    // layout
    mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, datasetTree, tablePanel);
    mainSplit.setDividerLocation(prefs.getInt("mainSplit", 100));

    setLayout(new BorderLayout());
    add(mainSplit, BorderLayout.CENTER);

    // the info window
    infoTA = new TextHistoryPane();
    infoWindow =
        new IndependentWindow("Variable Information", BAMutil.getImage("netcdfUI"), infoTA);
    infoWindow.setBounds(
        (Rectangle) prefs.getBean("InfoWindowBounds", new Rectangle(300, 300, 500, 300)));

    // the data Table
    dataTable = new StructureTable((PreferencesExt) prefs.node("structTable"));
    dataWindow = new IndependentWindow("Data Table", BAMutil.getImage("netcdfUI"), dataTable);
    dataWindow.setBounds(
        (Rectangle) prefs.getBean("dataWindow", new Rectangle(50, 300, 1000, 600)));

    // the ncdump Pane
    dumpPane = new NCdumpPane((PreferencesExt) prefs.node("dumpPane"));
    dumpWindow =
        new IndependentWindow("NCDump Variable Data", BAMutil.getImage("netcdfUI"), dumpPane);
    dumpWindow.setBounds(
        (Rectangle) prefs.getBean("DumpWindowBounds", new Rectangle(300, 300, 300, 200)));
  }
コード例 #3
0
ファイル: DatasetViewer.java プロジェクト: mazl123321/thredds
  public void addActions(JPanel buttPanel) {

    AbstractAction netcdfAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            String location = ds.getLocation();
            if (location == null) location = "test";
            int pos = location.lastIndexOf(".");
            if (pos > 0) location = location.substring(0, pos);

            String filename = fileChooser.chooseFilenameToSave(location + ".nc");
            if (filename == null) return;
            writeNetCDF(filename);
          }
        };
    BAMutil.setActionProperties(netcdfAction, "netcdf", "Write netCDF-3 file", false, 'S', -1);
    BAMutil.addActionToContainer(buttPanel, netcdfAction);

    AbstractAction ncstreamAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            String location = ds.getLocation();
            if (location == null) location = "test";
            int pos = location.lastIndexOf(".");
            if (pos > 0) location = location.substring(0, pos);

            String filename = fileChooser.chooseFilenameToSave(location + ".ncs");
            if (filename == null) return;
            writeNcstream(filename);
          }
        };
    BAMutil.setActionProperties(ncstreamAction, "netcdf", "Write ncstream file", false, 'S', -1);
    BAMutil.addActionToContainer(buttPanel, ncstreamAction);

    AbstractButton compareButton = BAMutil.makeButtcon("Select", "Compare to another file", false);
    compareButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            compareDataset();
          }
        });
    buttPanel.add(compareButton);

    AbstractAction attAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            showAtts();
          }
        };
    BAMutil.setActionProperties(attAction, "FontDecr", "global attributes", false, 'A', -1);
    BAMutil.addActionToContainer(buttPanel, attAction);
  }