AccessLogPanel(PreferencesExt p) { super(p, true); logTable = new AccessLogTable(startDateField, endDateField, p, dnsCache); logTable.addPropertyChangeListener( new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent e) { if (e.getPropertyName().equals("UrlDump")) { String path = (String) e.getNewValue(); gotoUrlDump(path); } } }); AbstractAction allAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { resetLogs(); } }; BAMutil.setActionProperties(allAction, "Refresh", "show All Logs", false, 'A', -1); BAMutil.addActionToContainer(topPanel, allAction); AbstractAction dnsAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { showDNS(); } }; BAMutil.setActionProperties(dnsAction, "Dataset", "lookup DNS", false, 'D', -1); BAMutil.addActionToContainer(topPanel, dnsAction); add(logTable, BorderLayout.CENTER); }
private void makeActionsToolbars() { navToolbarAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { Boolean state = (Boolean) getValue(BAMutil.STATE); if (state.booleanValue()) toolPanel.add(navToolbar); else toolPanel.remove(navToolbar); } }; BAMutil.setActionProperties( navToolbarAction, "MagnifyPlus", "show Navigate toolbar", true, 'M', 0); navToolbarAction.putValue( BAMutil.STATE, new Boolean(store.getBoolean("navToolbarAction", true))); moveToolbarAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { Boolean state = (Boolean) getValue(BAMutil.STATE); if (state.booleanValue()) toolPanel.add(moveToolbar); else toolPanel.remove(moveToolbar); } }; BAMutil.setActionProperties(moveToolbarAction, "Up", "show Move toolbar", true, 'M', 0); moveToolbarAction.putValue( BAMutil.STATE, new Boolean(store.getBoolean("moveToolbarAction", true))); }
public void showAtts() { if (ds == null) return; if (attTable == null) { // global attributes attTable = new BeanTable(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<>(); for (Attribute att : ds.getGlobalAttributes()) { attlist.add(new AttributeBean(att)); } attTable.setBeans(attlist); attWindow.show(); }
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))); }
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); }
public static void main(String args[]) throws HTTPException { // prefs storage try { String prefStore = ucar.util.prefs.XMLStore.makeStandardFilename(".unidata", "TdsMonitor.xml"); store = ucar.util.prefs.XMLStore.createFromFile(prefStore, null); prefs = store.getPreferences(); Debug.setStore(prefs.node("Debug")); } catch (IOException e) { System.out.println("XMLStore Creation failed " + e); } // initializations BAMutil.setResourcePath("/resources/nj22/ui/icons/"); // put UI in a JFrame frame = new JFrame("TDS Monitor"); ui = new TdsMonitor(prefs, frame); frame.setIconImage(BAMutil.getImage("netcdfUI")); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { if (!done) ui.exit(); } }); frame.getContentPane().add(ui); Rectangle bounds = (Rectangle) prefs.getBean(FRAME_SIZE, new Rectangle(50, 50, 800, 450)); frame.setBounds(bounds); frame.pack(); frame.setBounds(bounds); frame.setVisible(true); }
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(); } }
public CoordSysTable(PreferencesExt prefs, JPanel buttPanel) { this.prefs = prefs; if (buttPanel != null) { AbstractAction attAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { showAtts(); } }; BAMutil.setActionProperties(attAction, "FontDecr", "global attributes", false, 'A', -1); BAMutil.addActionToContainer(buttPanel, attAction); } varTable = new BeanTable(VariableBean.class, (PreferencesExt) prefs.node("VariableBeans"), false); varTable.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { VariableBean vb = (VariableBean) varTable.getSelectedBean(); if (null != vb.firstCoordSys) setSelectedCoordinateSystem(vb.firstCoordSys); } }); csTable = new BeanTable( CoordinateSystemBean.class, (PreferencesExt) prefs.node("CoordinateSystemBean"), false); csTable.addListSelectionListener( new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { CoordinateSystemBean csb = (CoordinateSystemBean) csTable.getSelectedBean(); setSelectedCoordinateAxes(csb.coordSys); } }); axisTable = new BeanTable(AxisBean.class, (PreferencesExt) prefs.node("CoordinateAxisBean"), false); ucar.nc2.ui.widget.PopupMenu varPopup = new PopupMenu(varTable.getJTable(), "Options"); varPopup.addAction( "Show Declaration", new AbstractAction() { public void actionPerformed(ActionEvent e) { VariableBean vb = (VariableBean) varTable.getSelectedBean(); Variable v = ds.findVariable(vb.getName()); if (v == null) return; infoTA.clear(); infoTA.appendLine(v.toString()); infoTA.appendLine(showMissing(v)); infoTA.gotoTop(); infoWindow.show(); } }); varPopup.addAction( "Try as Grid", new AbstractAction() { public void actionPerformed(ActionEvent e) { VariableBean vb = (VariableBean) varTable.getSelectedBean(); VariableEnhanced v = (VariableEnhanced) ds.findVariable(vb.getName()); if (v == null) return; infoTA.clear(); infoTA.appendLine(tryGrid(v)); infoTA.gotoTop(); infoWindow.show(); } }); PopupMenu csPopup = new PopupMenu(csTable.getJTable(), "Options"); csPopup.addAction( "Show CoordSys", new AbstractAction() { public void actionPerformed(ActionEvent e) { CoordinateSystemBean csb = (CoordinateSystemBean) csTable.getSelectedBean(); CoordinateSystem coordSys = csb.coordSys; infoTA.clear(); infoTA.appendLine("Coordinate System = " + coordSys.getName()); for (CoordinateAxis axis : coordSys.getCoordinateAxes()) { infoTA.appendLine(" " + axis.getAxisType() + " " + axis.writeCDL(true, false)); } infoTA.appendLine(" Coordinate Transforms"); for (CoordinateTransform ct : coordSys.getCoordinateTransforms()) { infoTA.appendLine(" " + ct.getName() + " type=" + ct.getTransformType()); for (Parameter p : ct.getParameters()) { infoTA.appendLine(" " + p); } if (ct instanceof ProjectionCT) { ProjectionCT pct = (ProjectionCT) ct; if (pct.getProjection() != null) { infoTA.appendLine(" impl.class= " + pct.getProjection().getClass().getName()); // pct.getProjection(); } } if (ct instanceof VerticalCT) { VerticalCT vct = (VerticalCT) ct; infoTA.appendLine(" VerticalCT= " + vct); } } infoTA.gotoTop(); infoWindow.show(); } }); PopupMenu axisPopup = new PopupMenu(axisTable.getJTable(), "Options"); axisPopup.addAction( "Show Declaration", new AbstractAction() { public void actionPerformed(ActionEvent e) { AxisBean bean = (AxisBean) axisTable.getSelectedBean(); if (bean == null) return; VariableDS axis = (VariableDS) ds.findVariable(bean.getName()); if (axis == null) return; infoTA.clear(); infoTA.appendLine(axis.toString()); infoTA.appendLine(showMissing(axis)); infoTA.gotoTop(); infoWindow.show(); } }); axisPopup.addAction( "Show Values", new AbstractAction() { public void actionPerformed(ActionEvent e) { AxisBean bean = (AxisBean) axisTable.getSelectedBean(); if (bean == null) return; infoTA.clear(); showValues(bean.axis); infoTA.gotoTop(); infoWindow.show(); } }); axisPopup.addAction( "Show Value Differences", new AbstractAction() { public void actionPerformed(ActionEvent e) { AxisBean bean = (AxisBean) axisTable.getSelectedBean(); if (bean == null) return; infoTA.clear(); showValueDiffs(bean.axis); infoTA.gotoTop(); infoWindow.show(); } }); axisPopup.addAction( "Show Values as Date", new AbstractAction() { public void actionPerformed(ActionEvent e) { AxisBean bean = (AxisBean) axisTable.getSelectedBean(); if (bean == null) return; infoTA.clear(); showValuesAsDates(bean.axis); infoTA.gotoTop(); infoWindow.show(); } }); // the info window infoTA = new TextHistoryPane(); infoWindow = new IndependentWindow("Extra Information", BAMutil.getImage("netcdfUI"), infoTA); infoWindow.setBounds( (Rectangle) prefs.getBean("InfoWindowBounds", new Rectangle(300, 300, 500, 300))); split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false, varTable, csTable); split.setDividerLocation(prefs.getInt("splitPos", 500)); split2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, false, split, axisTable); split2.setDividerLocation(prefs.getInt("splitPos2", 500)); setLayout(new BorderLayout()); add(split2, BorderLayout.CENTER); }
OpPanel(PreferencesExt prefs, boolean isAccess) { this.prefs = prefs; this.isAccess = isAccess; ta = new TextHistoryPane(true); infoWindow = new IndependentWindow("Details", BAMutil.getImage("netcdfUI"), new JScrollPane(ta)); Rectangle bounds = (Rectangle) prefs.getBean(FRAME_SIZE, new Rectangle(200, 50, 500, 700)); infoWindow.setBounds(bounds); topPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 0)); // which server serverCB = new JComboBox(); serverCB.setModel(manage.getServersCB().getModel()); serverCB.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { String server = (String) serverCB.getSelectedItem(); setServer(server); } }); // serverCB.setModel(manage.getServers().getModel()); topPanel.add(new JLabel("server:")); topPanel.add(serverCB); // the date selectors startDateField = new JTextArea(" "); endDateField = new JTextArea(" "); topPanel.add(new JLabel("Start Date:")); topPanel.add(startDateField); topPanel.add(new JLabel("End Date:")); topPanel.add(endDateField); AbstractAction showAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { showLogs(); } }; BAMutil.setActionProperties(showAction, "Import", "get logs", false, 'G', -1); BAMutil.addActionToContainer(topPanel, showAction); AbstractAction filterAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { Boolean state = (Boolean) getValue(BAMutil.STATE); removeTestReq = state.booleanValue(); } }; BAMutil.setActionProperties(filterAction, "time", "remove test Requests", true, 'F', -1); BAMutil.addActionToContainer(topPanel, filterAction); AbstractAction filter2Action = new AbstractAction() { public void actionPerformed(ActionEvent e) { Boolean state = (Boolean) getValue(BAMutil.STATE); problemsOnly = state.booleanValue(); } }; BAMutil.setActionProperties(filter2Action, "time", "only show problems", true, 'F', -1); BAMutil.addActionToContainer(topPanel, filter2Action); AbstractAction infoAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { Formatter f = new Formatter(); showInfo(f); ta.setText(f.toString()); infoWindow.show(); } }; BAMutil.setActionProperties( infoAction, "Information", "info on selected logs", false, 'I', -1); BAMutil.addActionToContainer(topPanel, infoAction); setLayout(new BorderLayout()); add(topPanel, BorderLayout.NORTH); }
LoopControlAction(SuperComboBox cbox) { this.scbox = cbox; BAMutil.setActionProperties(this, null, cbox.getName(), false, 0, 0); }
void addActionsToMenus(JMenu datasetMenu, JMenu configMenu, JMenu toolMenu) { // Info BAMutil.addActionToMenu(datasetMenu, showGridTableAction); BAMutil.addActionToMenu(datasetMenu, showDatasetInfoAction); BAMutil.addActionToMenu(datasetMenu, showNcMLAction); BAMutil.addActionToMenu(datasetMenu, showGridDatasetInfoAction); BAMutil.addActionToMenu(datasetMenu, showNetcdfDatasetAction); // BAMutil.addActionToMenu( datasetMenu, geotiffAction); // BAMutil.addActionToMenu( infoMenu, showNetcdfXMLAction); /// Configure JMenu toolbarMenu = new JMenu("Toolbars"); toolbarMenu.setMnemonic('T'); configMenu.add(toolbarMenu); BAMutil.addActionToMenu(toolbarMenu, navToolbarAction); BAMutil.addActionToMenu(toolbarMenu, moveToolbarAction); BAMutil.addActionToMenu(configMenu, chooseProjectionAction); BAMutil.addActionToMenu(configMenu, saveCurrentProjectionAction); /* BAMutil.addActionToMenu( configMenu, chooseColorScaleAction); BAMutil.addActionToMenu( configMenu, controller.dataProjectionAction); */ //// tools menu JMenu displayMenu = new JMenu("Display control"); displayMenu.setMnemonic('D'); BAMutil.addActionToMenu(displayMenu, controller.showGridAction); BAMutil.addActionToMenu(displayMenu, controller.showContoursAction); BAMutil.addActionToMenu(displayMenu, controller.showContourLabelsAction); BAMutil.addActionToMenu(displayMenu, redrawAction); toolMenu.add(displayMenu); // Loop Control JMenu loopMenu = new JMenu("Loop control"); loopMenu.setMnemonic('L'); BAMutil.addActionToMenu(loopMenu, fieldLoopAction); BAMutil.addActionToMenu(loopMenu, levelLoopAction); BAMutil.addActionToMenu(loopMenu, timeLoopAction); toolMenu.add(loopMenu); // MinMax Control JMenu mmMenu = new JMenu("ColorScale min/max"); mmMenu.setMnemonic('C'); BAMutil.addActionToMenu(mmMenu, minmaxHorizAction); BAMutil.addActionToMenu(mmMenu, minmaxLogAction); BAMutil.addActionToMenu(mmMenu, minmaxHoldAction); toolMenu.add(mmMenu); // Zoom/Pan JMenu zoomMenu = new JMenu("Zoom/Pan"); zoomMenu.setMnemonic('Z'); panz.addActionsToMenu(zoomMenu); // items are added by NavigatedPanelToolbar toolMenu.add(zoomMenu); }
private void makeUI(int defaultHeight) { datasetNameLabel = new JLabel(); /* gridPP = new PrefPanel("GridView", (PreferencesExt) store.node("GridViewPrefs")); gridUrlIF = gridPP.addTextComboField("url", "Gridded Data URL", null, 10, false); gridPP.addButton( BAMutil.makeButtconFromAction( chooseLocalDatasetAction )); gridPP.finish(true, BorderLayout.EAST); gridPP.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { InvDatasetImpl ds = new InvDatasetImpl( gridUrlIF.getText(), thredds.catalog.DataType.GRID, ServiceType.NETCDF); setDataset( ds); } }); */ // top tool panel toolPanel = new JPanel(); toolPanel.setBorder(new EtchedBorder()); toolPanel.setLayout(new MFlowLayout(FlowLayout.LEFT, 0, 0)); // menus JMenu dataMenu = new JMenu("Dataset"); dataMenu.setMnemonic('D'); configMenu = new JMenu("Configure"); configMenu.setMnemonic('C'); JMenu toolMenu = new JMenu("Controls"); toolMenu.setMnemonic('T'); addActionsToMenus(dataMenu, configMenu, toolMenu); JMenuBar menuBar = new JMenuBar(); menuBar.add(dataMenu); menuBar.add(configMenu); menuBar.add(toolMenu); toolPanel.add(menuBar); // field choosers fieldPanel = new JPanel(); fieldPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); toolPanel.add(fieldPanel); // stride toolPanel.add(controller.strideSpinner); // buttcons BAMutil.addActionToContainer(toolPanel, controller.drawHorizAction); BAMutil.addActionToContainer(toolPanel, controller.drawVertAction); mapBeanMenu = MapBean.makeMapSelectButton(); toolPanel.add(mapBeanMenu.getParentComponent()); // the Navigated panel and its toolbars panz.setLayout(new FlowLayout()); navToolbar = panz.getNavToolBar(); moveToolbar = panz.getMoveToolBar(); if (((Boolean) navToolbarAction.getValue(BAMutil.STATE)).booleanValue()) toolPanel.add(navToolbar); if (((Boolean) moveToolbarAction.getValue(BAMutil.STATE)).booleanValue()) toolPanel.add(moveToolbar); BAMutil.addActionToContainer(toolPanel, panz.setReferenceAction); BAMutil.addActionToContainer(toolPanel, controller.dataProjectionAction); BAMutil.addActionToContainer(toolPanel, controller.showGridAction); BAMutil.addActionToContainer(toolPanel, controller.showContoursAction); BAMutil.addActionToContainer(toolPanel, controller.showContourLabelsAction); BAMutil.addActionToContainer(toolPanel, redrawAction); // vertical split vertPanel = new VertPanel(); splitDraw = new JSplitPane(JSplitPane.VERTICAL_SPLIT, panz, vertPanel); int divLoc = store.getInt("vertSplit", 2 * defaultHeight / 3); splitDraw.setDividerLocation(divLoc); drawingPanel = new JPanel(new BorderLayout()); // filled later // status panel JPanel statusPanel = new JPanel(new BorderLayout()); statusPanel.setBorder(new EtchedBorder()); positionLabel = new JLabel("position"); positionLabel.setToolTipText("position at cursor"); dataValueLabel = new JLabel("data value", SwingConstants.CENTER); dataValueLabel.setToolTipText("data value (double click on grid)"); statusPanel.add(positionLabel, BorderLayout.WEST); statusPanel.add(dataValueLabel, BorderLayout.CENTER); panz.setPositionLabel(positionLabel); // colorscale panel colorScalePanel = new ColorScale.Panel(this, controller.getColorScale()); csDataMinMax = new JComboBox(GridRenderer.MinMaxType.values()); csDataMinMax.setToolTipText("ColorScale Min/Max setting"); csDataMinMax.addActionListener( new AbstractAction() { public void actionPerformed(ActionEvent e) { controller.setDataMinMaxType((GridRenderer.MinMaxType) csDataMinMax.getSelectedItem()); } }); JPanel westPanel = new JPanel(new BorderLayout()); westPanel.add(colorScalePanel, BorderLayout.CENTER); westPanel.add(csDataMinMax, BorderLayout.NORTH); // lay it out JPanel northPanel = new JPanel(); // northPanel.setLayout( new BoxLayout(northPanel, BoxLayout.Y_AXIS)); northPanel.setLayout(new BorderLayout()); northPanel.add(datasetNameLabel, BorderLayout.NORTH); northPanel.add(toolPanel, BorderLayout.SOUTH); setLayout(new BorderLayout()); add(northPanel, BorderLayout.NORTH); add(statusPanel, BorderLayout.SOUTH); add(westPanel, BorderLayout.WEST); add(drawingPanel, BorderLayout.CENTER); setDrawHorizAndVert(controller.drawHorizOn, controller.drawVertOn); }
// actions that control the dataset private void makeActionsDataset() { // choose local dataset AbstractAction chooseLocalDatasetAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { String filename = fileChooser.chooseFilename(); if (filename == null) return; InvDataset invDs; try { invDs = new InvDatasetImpl(filename, FeatureType.GRID, ServiceType.NETCDF); } catch (Exception ue) { JOptionPane.showMessageDialog( GridUI.this, "Invalid filename = <" + filename + ">\n" + ue.getMessage()); ue.printStackTrace(); return; } setDataset(invDs); } }; BAMutil.setActionProperties( chooseLocalDatasetAction, "FileChooser", "open Local dataset...", false, 'L', -1); /* saveDatasetAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { String fname = controller.getDatasetName(); if (fname != null) { savedDatasetList.add( fname); BAMutil.addActionToMenu( savedDatasetMenu, new DatasetAction( fname), 0); } } }; BAMutil.setActionProperties( saveDatasetAction, null, "save dataset", false, 'S', 0); */ // Configure chooseProjectionAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { getProjectionManager().setVisible(); } }; BAMutil.setActionProperties( chooseProjectionAction, null, "Projection Manager...", false, 'P', 0); saveCurrentProjectionAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { getProjectionManager(); // set the bounding box ProjectionImpl proj = panz.getProjectionImpl().constructCopy(); proj.setDefaultMapArea(panz.getMapArea()); // if (debug) System.out.println(" GV save projection "+ proj); // projManage.setMap(renderAll.get("Map")); LOOK! // projManager.saveProjection( proj); } }; BAMutil.setActionProperties( saveCurrentProjectionAction, null, "save Current Projection", false, 'S', 0); /* chooseColorScaleAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (null == csManager) // lazy instantiation makeColorScaleManager(); csManager.show(); } }; BAMutil.setActionProperties( chooseColorScaleAction, null, "ColorScale Manager...", false, 'C', 0); */ // redraw redrawAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { repaint(); controller.start(true); controller.draw(true); } }; BAMutil.setActionProperties(redrawAction, "alien", "RedRaw", false, 'W', 0); showDatasetInfoAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (infoWindow == null) { datasetInfoTA = new TextHistoryPane(); infoWindow = new IndependentWindow( "Dataset Information", BAMutil.getImage("GDVs"), datasetInfoTA); infoWindow.setSize(700, 700); infoWindow.setLocation(100, 100); } datasetInfoTA.clear(); datasetInfoTA.appendLine(controller.getDatasetInfo()); datasetInfoTA.gotoTop(); infoWindow.show(); } }; BAMutil.setActionProperties( showDatasetInfoAction, "Information", "Show info...", false, 'S', -1); showNcMLAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (ncmlWindow == null) { ncmlTA = new TextHistoryPane(); ncmlWindow = new IndependentWindow("Dataset NcML", BAMutil.getImage("GDVs"), ncmlTA); ncmlWindow.setSize(700, 700); ncmlWindow.setLocation(200, 70); } ncmlTA.clear(); // datasetInfoTA.appendLine( "GeoGrid XML for "+ controller.getDatasetName()+"\n"); ncmlTA.appendLine(controller.getNcML()); ncmlTA.gotoTop(); ncmlWindow.show(); } }; BAMutil.setActionProperties(showNcMLAction, null, "Show NcML...", false, 'X', -1); showGridDatasetInfoAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { if (ncmlWindow == null) { ncmlTA = new TextHistoryPane(); ncmlWindow = new IndependentWindow("Dataset NcML", BAMutil.getImage("GDVs"), ncmlTA); ncmlWindow.setSize(700, 700); ncmlWindow.setLocation(200, 70); } ncmlTA.clear(); // datasetInfoTA.appendLine( "GeoGrid XML for "+ controller.getDatasetName()+"\n"); ncmlTA.appendLine(controller.getDatasetXML()); ncmlTA.gotoTop(); ncmlWindow.show(); } }; BAMutil.setActionProperties( showGridDatasetInfoAction, null, "Show GridDataset Info XML...", false, 'X', -1); // show gridTable showGridTableAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { gtWindow.show(); } }; BAMutil.setActionProperties(showGridTableAction, "Table", "grid Table...", false, 'T', -1); // show netcdf dataset Table showNetcdfDatasetAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { NetcdfDataset netcdfDataset = controller.getNetcdfDataset(); if (null != netcdfDataset) { try { dsTable.setDataset(netcdfDataset, null); } catch (IOException e1) { e1.printStackTrace(); return; } dsDialog.show(); } } }; BAMutil.setActionProperties( showNetcdfDatasetAction, "netcdf", "NetcdfDataset Table Info...", false, 'D', -1); /* write geotiff file geotiffAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { GeoGrid grid = controller.getCurrentField(); ucar.ma2.Array data = controller.getCurrentHorizDataSlice(); if ((grid == null) || (data == null)) return; String filename = geotiffFileChooser.chooseFilename(); if (filename == null) return; GeoTiff geotiff = null; try { /* System.out.println("write to= "+filename); ucar.nc2.geotiff.Writer.write2D(grid, data, filename+".tfw"); geotiff = new GeoTiff(filename); // read back in geotiff.read(); System.out.println( geotiff.showInfo()); //geotiff.testReadData(); geotiff.close(); * / // write two ucar.nc2.geotiff.GeotiffWriter writer = new ucar.nc2.geotiff.GeotiffWriter(filename); writer.writeGrid(grid, data, false); geotiff = new GeoTiff(filename); // read back in geotiff.read(); System.out.println( "*************************************"); System.out.println( geotiff.showInfo()); //geotiff.testReadData(); geotiff.close(); } catch (IOException ioe) { ioe.printStackTrace(); } finally { try { if (geotiff != null) geotiff.close(); } catch (IOException ioe) { } } } }; BAMutil.setActionProperties( geotiffAction, "Geotiff", "Write Geotiff file", false, 'G', -1); */ minmaxHorizAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { csDataMinMax.setSelectedItem(GridRenderer.MinMaxType.horiz); controller.setDataMinMaxType(GridRenderer.MinMaxType.horiz); } }; BAMutil.setActionProperties(minmaxHorizAction, null, "Horizontal plane", false, 'H', 0); minmaxLogAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { csDataMinMax.setSelectedItem(GridRenderer.MinMaxType.log); controller.setDataMinMaxType(GridRenderer.MinMaxType.log); } }; BAMutil.setActionProperties(minmaxLogAction, null, "log horiz plane", false, 'V', 0); /* minmaxVolAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { csDataMinMax.setSelectedIndex(GridRenderer.VOL_MinMaxType); controller.setDataMinMaxType(GridRenderer.MinMaxType.vert; } }; BAMutil.setActionProperties( minmaxVolAction, null, "Grid volume", false, 'G', 0); */ minmaxHoldAction = new AbstractAction() { public void actionPerformed(ActionEvent e) { csDataMinMax.setSelectedItem(GridRenderer.MinMaxType.hold); controller.setDataMinMaxType(GridRenderer.MinMaxType.hold); } }; BAMutil.setActionProperties(minmaxHoldAction, null, "Hold scale constant", false, 'C', 0); fieldLoopAction = new LoopControlAction(fieldChooser); levelLoopAction = new LoopControlAction(levelChooser); timeLoopAction = new LoopControlAction(timeChooser); }