List of usage examples for javax.swing AbstractButton setName
public void setName(String name)
From source file:org.esa.snap.rcp.statistics.ChartPagePanel.java
private JPanel createTopPanel() { refreshButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/ViewRefresh22.png"), false); refreshButton.setToolTipText("Refresh View"); refreshButton.setName("refreshButton"); refreshButton.addActionListener(e -> { updateChartData();/*from ww w . j a v a 2 s.c o m*/ refreshButton.setEnabled(false); }); AbstractButton switchToTableButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Table24.png"), false); switchToTableButton.setToolTipText("Switch to Table View"); switchToTableButton.setName("switchToTableButton"); switchToTableButton.setEnabled(hasAlternativeView()); switchToTableButton.addActionListener(e -> showAlternativeView()); final TableLayout tableLayout = new TableLayout(6); tableLayout.setColumnFill(2, TableLayout.Fill.HORIZONTAL); tableLayout.setColumnWeightX(2, 1.0); tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0)); JPanel buttonPanel = new JPanel(tableLayout); buttonPanel.add(refreshButton); tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0)); buttonPanel.add(switchToTableButton); buttonPanel.add(new JPanel()); return buttonPanel; }
From source file:org.esa.snap.rcp.statistics.ChartPagePanel.java
private JPanel createChartBottomPanel(final ChartPanel chartPanel) { final AbstractButton zoomAllButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/view-fullscreen.png"), false); zoomAllButton.setToolTipText("Zoom all."); zoomAllButton.setName("zoomAllButton."); zoomAllButton.addActionListener(e -> { chartPanel.restoreAutoBounds();//from w w w .j a v a2 s. com chartPanel.repaint(); }); final AbstractButton propertiesButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Edit24.gif"), false); propertiesButton.setToolTipText("Edit properties."); propertiesButton.setName("propertiesButton."); propertiesButton.addActionListener(e -> chartPanel.doEditChartProperties()); final AbstractButton saveButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); saveButton.setToolTipText("Save chart as image."); saveButton.setName("saveButton."); saveButton.addActionListener(e -> { try { chartPanel.doSaveAs(); } catch (IOException e1) { JOptionPane.showMessageDialog(chartPanel, "Could not save chart:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } }); final AbstractButton printButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Print24.gif"), false); printButton.setToolTipText("Print chart."); printButton.setName("printButton."); printButton.addActionListener(e -> chartPanel.createChartPrintJob()); final TableLayout tableLayout = new TableLayout(6); tableLayout.setColumnFill(4, TableLayout.Fill.HORIZONTAL); tableLayout.setColumnWeightX(4, 1.0); JPanel buttonPanel = new JPanel(tableLayout); tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0)); buttonPanel.add(zoomAllButton); tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0)); buttonPanel.add(propertiesButton); buttonPanel.add(saveButton); buttonPanel.add(printButton); buttonPanel.add(new JPanel()); buttonPanel.add(getHelpButton()); return buttonPanel; }
From source file:org.esa.beam.visat.toolviews.stat.ChartPagePanel.java
private JPanel createChartBottomPanel(final ChartPanel chartPanel) { final AbstractButton zoomAllButton = ToolButtonFactory.createButton( UIUtils.loadImageIcon("/com/bc/ceres/swing/actions/icons_22x22/view-fullscreen.png"), false); zoomAllButton.setToolTipText("Zoom all."); zoomAllButton.setName("zoomAllButton."); zoomAllButton.addActionListener(new ActionListener() { @Override//from ww w . jav a 2s. c o m public void actionPerformed(ActionEvent e) { chartPanel.restoreAutoBounds(); chartPanel.repaint(); } }); final AbstractButton propertiesButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Edit24.gif"), false); propertiesButton.setToolTipText("Edit properties."); propertiesButton.setName("propertiesButton."); propertiesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { chartPanel.doEditChartProperties(); } }); final AbstractButton saveButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); saveButton.setToolTipText("Save chart as image."); saveButton.setName("saveButton."); saveButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { chartPanel.doSaveAs(); } catch (IOException e1) { JOptionPane.showMessageDialog(chartPanel, "Could not save chart:\n" + e1.getMessage(), "Error", JOptionPane.ERROR_MESSAGE); } } }); final AbstractButton printButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Print24.gif"), false); printButton.setToolTipText("Print chart."); printButton.setName("printButton."); printButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { chartPanel.createChartPrintJob(); } }); final TableLayout tableLayout = new TableLayout(6); tableLayout.setColumnFill(4, TableLayout.Fill.HORIZONTAL); tableLayout.setColumnWeightX(4, 1.0); JPanel buttonPanel = new JPanel(tableLayout); tableLayout.setRowPadding(0, new Insets(0, 4, 0, 0)); buttonPanel.add(zoomAllButton); tableLayout.setRowPadding(0, new Insets(0, 0, 0, 0)); buttonPanel.add(propertiesButton); buttonPanel.add(saveButton); buttonPanel.add(printButton); buttonPanel.add(new JPanel()); buttonPanel.add(getHelpButton()); return buttonPanel; }
From source file:org.eumetsat.metop.visat.IasiInfoView.java
@Override protected JComponent createControl() { JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("Sounder Info", createInfoComponent()); tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent()); tabbedPane.add("Radiance Analysis", createRadianceAnalysisComponent()); tabbedPane.add("Sounder Layer", createSounderLayerComponent()); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId()); }// w w w.j a v a2 s . c o m InternalFrameListener internalFrameListener = new InternalFrameAdapter() { @Override public void internalFrameActivated(InternalFrameEvent e) { final Container contentPane = e.getInternalFrame().getContentPane(); if (contentPane instanceof ProductSceneView) { final ProductSceneView view = (ProductSceneView) contentPane; final IasiLayer layer = getIasiLayer(); if (layer != null) { modelChanged(layer); } else { final LayerListener layerListener = new AbstractLayerListener() { @Override public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) { final IasiLayer layer = getIasiLayer(); if (layer != null) { modelChanged(layer); view.getRootLayer().removeListener(this); } } }; view.getRootLayer().addListener(layerListener); } } } @Override public void internalFrameDeactivated(InternalFrameEvent e) { if (currentOverlay != null) { currentOverlay.removeListener(overlayListener); } updateUI(null); editor.setModel(null); } }; VisatApp.getApp().addInternalFrameListener(internalFrameListener); if (MetopSounderVPI.isValidAvhrrProductSceneViewSelected()) { final IasiLayer layer = getIasiLayer(); if (layer != null) { modelChanged(layer); } } final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"), false); helpButton.setToolTipText("Help."); /*I18N*/ helpButton.setName("helpButton"); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId()); HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId()); } final JPanel containerPanel = new JPanel(new BorderLayout()); containerPanel.add(tabbedPane, BorderLayout.CENTER); final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.add(helpButton, BorderLayout.EAST); containerPanel.add(buttonPanel, BorderLayout.SOUTH); return containerPanel; }
From source file:org.eumetsat.metop.visat.SounderInfoView.java
@Override protected JComponent createControl() { overlayListener = new SounderOverlayListener() { @Override//from w ww . j a v a 2 s . c o m public void selectionChanged(SounderOverlay overlay) { updateUI(overlay); } @Override public void dataChanged(SounderOverlay overlay) { updateUI(overlay); } }; internalFrameListener = new InternalFrameAdapter() { @Override public void internalFrameActivated(final InternalFrameEvent e) { final Container contentPane = e.getInternalFrame().getContentPane(); if (contentPane instanceof ProductSceneView) { final ProductSceneView view = (ProductSceneView) contentPane; final SounderLayer layer = getSounderLayer(view); if (layer != null) { layerChanged(layer); } else { final LayerListener layerListener = new AbstractLayerListener() { @Override public void handleLayersAdded(Layer parentLayer, Layer[] childLayers) { final SounderLayer layer = getSounderLayer(view); if (layer != null) { layerChanged(layer); view.getRootLayer().removeListener(this); } } }; view.getRootLayer().addListener(layerListener); } } } @Override public void internalFrameDeactivated(final InternalFrameEvent e) { final Container contentPane = e.getInternalFrame().getContentPane(); if (contentPane instanceof ProductSceneView) { final ProductSceneView view = (ProductSceneView) contentPane; final SounderLayer layer = getSounderLayer(view); if (layer != null) { layer.getOverlay().removeListener(overlayListener); } } } @Override public void internalFrameClosed(InternalFrameEvent e) { if (getSounderLayer() == null) { clearUI(); editor.setModel(null); } } }; VisatApp.getApp().addInternalFrameListener(internalFrameListener); final JTabbedPane tabbedPane = new JTabbedPane(); tabbedPane.add("Sounder Info", createInfoComponent()); tabbedPane.add("Sounder Spectrum", createSpectrumChartComponent()); tabbedPane.add("Sounder Layer", createSounderLayerComponent()); final SounderLayer layer = getSounderLayer(); if (layer != null) { layerChanged(layer); } final AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help24.gif"), false); helpButton.setToolTipText("Help."); /*I18N*/ helpButton.setName("helpButton"); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId()); HelpSys.enableHelpKey(tabbedPane, getDescriptor().getHelpId()); } final JPanel containerPanel = new JPanel(new BorderLayout()); containerPanel.add(tabbedPane, BorderLayout.CENTER); final JPanel buttonPanel = new JPanel(new BorderLayout()); buttonPanel.add(helpButton, BorderLayout.EAST); containerPanel.add(buttonPanel, BorderLayout.SOUTH); return containerPanel; }
From source file:org.esa.snap.rcp.spectrum.SpectrumTopComponent.java
private void initUI() { final JFreeChart chart = ChartFactory.createXYLineChart(Bundle.CTL_SpectrumTopComponent_Name(), "Wavelength (nm)", "", null, PlotOrientation.VERTICAL, true, true, false); chart.getXYPlot().getRangeAxis().addChangeListener(axisChangeEvent -> { if (!isCodeInducedAxisChange) { rangeAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); }//from w w w . j ava2 s.co m }); chart.getXYPlot().getDomainAxis().addChangeListener(axisChangeEvent -> { if (!isCodeInducedAxisChange) { domainAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } }); chart.getXYPlot().getRangeAxis().setAutoRange(false); rangeAxisAdjustmentIsFrozen = false; chart.getXYPlot().getDomainAxis().setAutoRange(false); domainAxisAdjustmentIsFrozen = false; chartPanel = new ChartPanel(chart); chartHandler = new ChartHandler(chart); final XYPlotMarker plotMarker = new XYPlotMarker(chartPanel, new XYPlotMarker.Listener() { @Override public void pointSelected(XYDataset xyDataset, int seriesIndex, Point2D dataPoint) { //do nothing } @Override public void pointDeselected() { //do nothing } }); filterButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Filter24.gif"), false); filterButton.setName("filterButton"); filterButton.setEnabled(false); filterButton.addActionListener(e -> { selectSpectralBands(); recreateChart(); }); showSpectrumForCursorButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true); showSpectrumForCursorButton.addActionListener(e -> recreateChart()); showSpectrumForCursorButton.setName("showSpectrumForCursorButton"); showSpectrumForCursorButton.setSelected(true); showSpectrumForCursorButton.setToolTipText("Show spectrum at cursor position."); showSpectraForSelectedPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true); showSpectraForSelectedPinsButton.addActionListener(e -> { if (isShowingSpectraForAllPins()) { showSpectraForAllPinsButton.setSelected(false); } else if (!isShowingSpectraForSelectedPins()) { plotMarker.setInvisible(); } recreateChart(); }); showSpectraForSelectedPinsButton.setName("showSpectraForSelectedPinsButton"); showSpectraForSelectedPinsButton.setToolTipText("Show spectra for selected pins."); showSpectraForAllPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true); showSpectraForAllPinsButton.addActionListener(e -> { if (isShowingSpectraForSelectedPins()) { showSpectraForSelectedPinsButton.setSelected(false); } else if (!isShowingSpectraForAllPins()) { plotMarker.setInvisible(); } recreateChart(); }); showSpectraForAllPinsButton.setName("showSpectraForAllPinsButton"); showSpectraForAllPinsButton.setToolTipText("Show spectra for all pins."); showGridButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SpectrumGrid24.gif"), true); showGridButton.addActionListener(e -> chartHandler.setGridVisible(showGridButton.isSelected())); showGridButton.setName("showGridButton"); showGridButton.setToolTipText("Show diagram grid."); AbstractButton exportSpectraButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); exportSpectraButton.addActionListener(new SpectraExportAction(this)); exportSpectraButton.setToolTipText("Export spectra to text file."); exportSpectraButton.setName("exportSpectraButton"); AbstractButton helpButton = ToolButtonFactory.createButton(new HelpAction(this), false); helpButton.setName("helpButton"); helpButton.setToolTipText("Help."); final JPanel buttonPane = GridBagUtils.createPanel(); final GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets.top = 2; gbc.gridy = 0; buttonPane.add(filterButton, gbc); gbc.gridy++; buttonPane.add(showSpectrumForCursorButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForSelectedPinsButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForAllPinsButton, gbc); gbc.gridy++; buttonPane.add(showGridButton, gbc); gbc.gridy++; buttonPane.add(exportSpectraButton, gbc); gbc.gridy++; gbc.insets.bottom = 0; gbc.fill = GridBagConstraints.VERTICAL; gbc.weighty = 1.0; gbc.gridwidth = 2; buttonPane.add(new JLabel(" "), gbc); // filler gbc.fill = GridBagConstraints.NONE; gbc.weighty = 0.0; gbc.gridy = 10; gbc.anchor = GridBagConstraints.EAST; buttonPane.add(helpButton, gbc); chartPanel.setPreferredSize(new Dimension(300, 200)); chartPanel.setBackground(Color.white); chartPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2))); chartPanel.addChartMouseListener(plotMarker); JPanel mainPane = new JPanel(new BorderLayout(4, 4)); mainPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPane.add(BorderLayout.CENTER, chartPanel); mainPane.add(BorderLayout.EAST, buttonPane); mainPane.setPreferredSize(new Dimension(320, 200)); SnapApp.getDefault().getProductManager().addListener(new ProductManager.Listener() { @Override public void productAdded(ProductManager.Event event) { // ignored } @Override public void productRemoved(ProductManager.Event event) { final Product product = event.getProduct(); if (getCurrentProduct() == product) { chartPanel.getChart().getXYPlot().setDataset(null); setCurrentView(null); setCurrentProduct(null); } if (currentView != null) { final RasterDataNode currentRaster = currentView.getRaster(); if (rasterToSpectraMap.containsKey(currentRaster)) { rasterToSpectraMap.remove(currentRaster); } if (rasterToSpectralBandsMap.containsKey(currentRaster)) { rasterToSpectralBandsMap.remove(currentRaster); } } PlacemarkGroup pinGroup = product.getPinGroup(); for (int i = 0; i < pinGroup.getNodeCount(); i++) { chartHandler.removePinInformation(pinGroup.get(i)); } } }); final ProductSceneView view = getSelectedProductSceneView(); if (view != null) { productSceneViewSelected(view); } setDisplayName(Bundle.CTL_SpectrumTopComponent_Name()); setLayout(new BorderLayout()); add(mainPane, BorderLayout.CENTER); updateUIState(); }
From source file:org.esa.beam.visat.toolviews.spectrum.SpectrumToolView.java
@Override public JComponent createControl() { final JFreeChart chart = ChartFactory.createXYLineChart(CHART_TITLE, "Wavelength (nm)", "", null, PlotOrientation.VERTICAL, true, true, false); chart.getXYPlot().getRangeAxis().addChangeListener(new AxisChangeListener() { @Override//from w w w .j a v a 2s . co m public void axisChanged(AxisChangeEvent axisChangeEvent) { if (!isCodeInducedAxisChange) { rangeAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } } }); chart.getXYPlot().getDomainAxis().addChangeListener(new AxisChangeListener() { @Override public void axisChanged(AxisChangeEvent axisChangeEvent) { if (!isCodeInducedAxisChange) { domainAxisAdjustmentIsFrozen = !((ValueAxis) axisChangeEvent.getAxis()).isAutoRange(); } } }); chart.getXYPlot().getRangeAxis().setAutoRange(false); rangeAxisAdjustmentIsFrozen = false; chart.getXYPlot().getDomainAxis().setAutoRange(false); domainAxisAdjustmentIsFrozen = false; chartPanel = new ChartPanel(chart); chartHandler = new ChartHandler(chart); final XYPlotMarker plotMarker = new XYPlotMarker(chartPanel, new XYPlotMarker.Listener() { @Override public void pointSelected(XYDataset xyDataset, int seriesIndex, Point2D dataPoint) { if (hasDiagram()) { if (cursorSynchronizer == null) { cursorSynchronizer = new CursorSynchronizer(VisatApp.getApp()); } if (!cursorSynchronizer.isEnabled()) { cursorSynchronizer.setEnabled(true); } } } @Override public void pointDeselected() { cursorSynchronizer.setEnabled(false); } }); titleBase = getDescriptor().getTitle(); filterButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Filter24.gif"), false); filterButton.setName("filterButton"); filterButton.setEnabled(false); filterButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { selectSpectralBands(); recreateChart(); } }); showSpectrumForCursorButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/CursorSpectrum24.gif"), true); showSpectrumForCursorButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { recreateChart(); } }); showSpectrumForCursorButton.setName("showSpectrumForCursorButton"); showSpectrumForCursorButton.setSelected(true); showSpectrumForCursorButton.setToolTipText("Show spectrum at cursor position."); showSpectraForSelectedPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/SelectedPinSpectra24.gif"), true); showSpectraForSelectedPinsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isShowingSpectraForAllPins()) { showSpectraForAllPinsButton.setSelected(false); } else if (!isShowingSpectraForSelectedPins()) { plotMarker.setInvisible(); } recreateChart(); } }); showSpectraForSelectedPinsButton.setName("showSpectraForSelectedPinsButton"); showSpectraForSelectedPinsButton.setToolTipText("Show spectra for selected pins."); showSpectraForAllPinsButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/PinSpectra24.gif"), true); showSpectraForAllPinsButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (isShowingSpectraForSelectedPins()) { showSpectraForSelectedPinsButton.setSelected(false); } else if (!isShowingSpectraForAllPins()) { plotMarker.setInvisible(); } recreateChart(); } }); showSpectraForAllPinsButton.setName("showSpectraForAllPinsButton"); showSpectraForAllPinsButton.setToolTipText("Show spectra for all pins."); // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // showAveragePinSpectrumButton = ToolButtonFactory.createButton( // UIUtils.loadImageIcon("icons/AverageSpectrum24.gif"), true); // showAveragePinSpectrumButton.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // // todo - implement // } // }); // showAveragePinSpectrumButton.setName("showAveragePinSpectrumButton"); // showAveragePinSpectrumButton.setToolTipText("Show average spectrum of all pin spectra."); showGridButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/SpectrumGrid24.gif"), true); showGridButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { chartHandler.setGridVisible(showGridButton.isSelected()); } }); showGridButton.setName("showGridButton"); showGridButton.setToolTipText("Show diagram grid."); // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // showGraphPointsButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/GraphPoints24.gif"), true); // showGraphPointsButton.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) { // // todo - implement // JOptionPane.showMessageDialog(null, "Not implemented"); // } // }); // showGraphPointsButton.setName("showGraphPointsButton"); // showGraphPointsButton.setToolTipText("Show graph points grid."); AbstractButton exportSpectraButton = ToolButtonFactory .createButton(UIUtils.loadImageIcon("icons/Export24.gif"), false); exportSpectraButton.addActionListener(new SpectraExportAction(this)); exportSpectraButton.setToolTipText("Export spectra to text file."); exportSpectraButton.setName("exportSpectraButton"); AbstractButton helpButton = ToolButtonFactory.createButton(UIUtils.loadImageIcon("icons/Help22.png"), false); helpButton.setName("helpButton"); helpButton.setToolTipText("Help."); /*I18N*/ final JPanel buttonPane = GridBagUtils.createPanel(); final GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.NONE; gbc.insets.top = 2; gbc.gridy = 0; buttonPane.add(filterButton, gbc); gbc.gridy++; buttonPane.add(showSpectrumForCursorButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForSelectedPinsButton, gbc); gbc.gridy++; buttonPane.add(showSpectraForAllPinsButton, gbc); gbc.gridy++; // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // buttonPane.add(showAveragePinSpectrumButton, gbc); // gbc.gridy++; buttonPane.add(showGridButton, gbc); gbc.gridy++; // todo - not yet implemented for 4.1 but planned for 4.2 (mp - 31.10.2007) // buttonPane.add(showGraphPointsButton, gbc); // gbc.gridy++; buttonPane.add(exportSpectraButton, gbc); gbc.gridy++; gbc.insets.bottom = 0; gbc.fill = GridBagConstraints.VERTICAL; gbc.weighty = 1.0; gbc.gridwidth = 2; buttonPane.add(new JLabel(" "), gbc); // filler gbc.fill = GridBagConstraints.NONE; gbc.weighty = 0.0; gbc.gridy = 10; gbc.anchor = GridBagConstraints.EAST; buttonPane.add(helpButton, gbc); chartPanel.setPreferredSize(new Dimension(300, 200)); chartPanel.setBackground(Color.white); chartPanel.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createBevelBorder(BevelBorder.LOWERED), BorderFactory.createEmptyBorder(2, 2, 2, 2))); chartPanel.addChartMouseListener(plotMarker); JPanel mainPane = new JPanel(new BorderLayout(4, 4)); mainPane.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); mainPane.add(BorderLayout.CENTER, chartPanel); mainPane.add(BorderLayout.EAST, buttonPane); mainPane.setPreferredSize(new Dimension(320, 200)); if (getDescriptor().getHelpId() != null) { HelpSys.enableHelpOnButton(helpButton, getDescriptor().getHelpId()); HelpSys.enableHelpKey(mainPane, getDescriptor().getHelpId()); } // Add an internal frame listener to VISAT so that we can update our // spectrum dialog with the information of the currently activated // product scene view. // VisatApp.getApp().addInternalFrameListener(new SpectrumIFL()); VisatApp.getApp().getProductManager().addListener(new ProductManager.Listener() { @Override public void productAdded(ProductManager.Event event) { // ignored } @Override public void productRemoved(ProductManager.Event event) { final Product product = event.getProduct(); if (getCurrentProduct() == product) { chartPanel.getChart().getXYPlot().setDataset(null); setCurrentView(null); setCurrentProduct(null); } if (productToAllSpectraMap.containsKey(product)) { productToAllSpectraMap.remove(product); } if (productToBandsMap.containsKey(product)) { productToBandsMap.remove(product); } PlacemarkGroup pinGroup = product.getPinGroup(); for (int i = 0; i < pinGroup.getNodeCount(); i++) { chartHandler.removePinInformation(pinGroup.get(i)); } } }); final ProductSceneView view = VisatApp.getApp().getSelectedProductSceneView(); if (view != null) { handleViewActivated(view); } else { setCurrentView(view); } updateUIState(); return mainPane; }