Example #1
0
 public List<VariableBean> getStructureVariables(Structure s) {
   List<VariableBean> vlist = new ArrayList<VariableBean>();
   for (Variable v : s.getVariables()) {
     vlist.add(new VariableBean(v));
   }
   return vlist;
 }
Example #2
0
 public List<VariableBean> getVariableBeans(NetcdfFile ds) {
   List<VariableBean> vlist = new ArrayList<VariableBean>();
   for (Variable v : ds.getVariables()) {
     vlist.add(new VariableBean(v));
   }
   return vlist;
 }
Example #3
0
  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();
  }
Example #4
0
  private void setSelected(Variable v) {
    eventsOK = false;

    List<Variable> vchain = new ArrayList<Variable>();
    vchain.add(v);

    Variable vp = v;
    while (vp.isMemberOfStructure()) {
      vp = vp.getParentStructure();
      vchain.add(0, vp); // reverse
    }

    for (int i = 0; i < vchain.size(); i++) {
      vp = vchain.get(i);
      NestedTable ntable = setNestedTable(i, vp.getParentStructure());
      ntable.setSelected(vp);
    }

    eventsOK = true;
  }
Example #5
0
  private NestedTable setNestedTable(int level, Structure s) {
    NestedTable ntable;
    if (nestedTableList.size() < level + 1) {
      ntable = new NestedTable(level);
      nestedTableList.add(ntable);

    } else {
      ntable = nestedTableList.get(level);
    }

    if (s != null) // variables inside of records
    ntable.table.setBeans(getStructureVariables(s));

    ntable.show();
    return ntable;
  }