public void setBufrFile(RandomAccessFile raf) throws IOException { this.raf = raf; java.util.List<MessageBean> beanList = new ArrayList<MessageBean>(); scan = new MessageScanner(raf); while (scan.hasNext()) { Message m = scan.next(); if (m == null) continue; beanList.add(new MessageBean(m)); } messageTable.setBeans(beanList); obsTable.setBeans(new ArrayList()); ddsTable.setBeans(new ArrayList()); }
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(); }
private void setObs(Message m) { java.util.List<ObsBean> beanList = new ArrayList<ObsBean>(); try { NetcdfDataset ncd = getBufrMessageAsDataset(m); Variable v = ncd.findVariable(BufrIosp.obsRecord); if ((v != null) && (v instanceof Structure)) { Structure obs = (Structure) v; StructureDataIterator iter = obs.getStructureIterator(); while (iter.hasNext()) { beanList.add(new ObsBean(obs, iter.next())); } } } catch (Exception ex) { JOptionPane.showMessageDialog(BufrMessageViewer.this, ex.getMessage()); ex.printStackTrace(); } obsTable.setBeans(beanList); }