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))); }
// set all menu items related to debugging enabled, all else disabled; // for insert, remove and fetch: continue, step // additionally for scripts: next and sometimes cancel private void enableDebug(boolean isScript, boolean enableCancel) { setAllEnabled(false); debugMenu.setEnabled(true); stepAction.setEnabled(true); cancelAction.setEnabled(enableCancel); nextAction.setEnabled(isScript); contAction.setEnabled(true); breakpointsItem.setEnabled(true); treeStatsMenu.setEnabled(true); utilItem.setEnabled(true); predSzItem.setEnabled(true); slotCntItem.setEnabled(true); }
// enable all menu items/menus for operations that require // a Gist to work on, excluding the debugging functions private void enableIndexOpened() { DbgOutput.println(1, "enableIndexOpened()"); setAllEnabled(true); // debugging operations only during operations stepAction.setEnabled(false); stopAction.setEnabled(false); cancelAction.setEnabled(false); nextAction.setEnabled(false); contAction.setEnabled(false); // no profile opened completeAnalysisItem.setEnabled(false); wkldStatsItem.setEnabled(false); splitStatsItem.setEnabled(false); penaltyStatsItem.setEnabled(false); }
// enable/disable all menu items/actions private void setAllEnabled(boolean enabled) { DbgOutput.println(2, "enabled: " + enabled); fileMenu.setEnabled(enabled); newItem.setEnabled(enabled); openItem.setEnabled(enabled); closeItem.setEnabled(enabled); // dumpItem.setEnabled(enabled); flushItem.setEnabled(enabled); optionsItem.setEnabled(enabled); settingsItem.setEnabled(enabled); debugMenu.setEnabled(enabled); stepAction.setEnabled(enabled); stopAction.setEnabled(enabled); cancelAction.setEnabled(enabled); nextAction.setEnabled(enabled); contAction.setEnabled(enabled); breakpointsItem.setEnabled(enabled); opsMenu.setEnabled(enabled); insertItem.setEnabled(enabled); deleteItem.setEnabled(enabled); searchItem.setEnabled(enabled); executeItem.setEnabled(enabled); treeStatsMenu.setEnabled(enabled); utilItem.setEnabled(enabled); predSzItem.setEnabled(enabled); slotCntItem.setEnabled(enabled); analysisMenu.setEnabled(enabled); newAnalysisItem.setEnabled(enabled); openAnalysisItem.setEnabled(enabled); completeAnalysisItem.setEnabled(enabled); wkldStatsItem.setEnabled(enabled); splitStatsItem.setEnabled(enabled); penaltyStatsItem.setEnabled(enabled); // these are never disabled windowsMenu.setEnabled(true); showCmdsItem.setEnabled(true); showResultsItem.setEnabled(true); showTraceItem.setEnabled(true); tileItem.setEnabled(true); }
/** save all data in the PersistentStore */ public void storePersistentData() { store.putInt("vertSplit", splitDraw.getDividerLocation()); store.putBoolean( "navToolbarAction", ((Boolean) navToolbarAction.getValue(BAMutil.STATE)).booleanValue()); store.putBoolean( "moveToolbarAction", ((Boolean) moveToolbarAction.getValue(BAMutil.STATE)).booleanValue()); if (projManager != null) projManager.storePersistentData(); /* if (csManager != null) csManager.storePersistentData(); if (sysConfigDialog != null) sysConfigDialog.storePersistentData(); */ dsTable.save(); dsTable.getPrefs().putBeanObject("DialogBounds", dsDialog.getBounds()); store.put(GEOTIFF_FILECHOOSER_DEFAULTDIR, geotiffFileChooser.getCurrentDirectory()); controller.storePersistentData(); }
public void putValue(String key, Object newValue) { super.putValue(key, newValue); if (key == Actions.SELECTED_KEY) { if (palette != null) { AbstractOSXApplication application = getApplication(); boolean b = (Boolean) newValue; if (b) { application.addPalette(palette); palette.setVisible(true); } else { application.removePalette(palette); palette.setVisible(false); } } } }
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); }
void setSelected(boolean b) { selected = b; showGridTableAction.setEnabled(b); showNcMLAction.setEnabled(b); showNcMLAction.setEnabled(b); showNetcdfDatasetAction.setEnabled(b); showGridDatasetInfoAction.setEnabled(b); // showNetcdfXMLAction.setEnabled( b); navToolbarAction.setEnabled(b); moveToolbarAction.setEnabled(b); controller.showGridAction.setEnabled(b); controller.showContoursAction.setEnabled(b); controller.showContourLabelsAction.setEnabled(b); redrawAction.setEnabled(b); minmaxHorizAction.setEnabled(b); minmaxLogAction.setEnabled(b); minmaxHoldAction.setEnabled(b); fieldLoopAction.setEnabled(b); levelLoopAction.setEnabled(b); timeLoopAction.setEnabled(b); panz.setEnabledActions(b); }
// set all menu items except for "stop" to disabled private void enableStop() { setAllEnabled(false); debugMenu.setEnabled(true); stopAction.setEnabled(true); }