/* * Copyright (c) 2009 The Jackson Laboratory * * This software was developed by Gary Churchill's Lab at The Jackson * Laboratory (see http://research.jax.org/faculty/churchill). * * This is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software. If not, see <http://www.gnu.org/licenses/>. */ package org.jax.qtl.scan.gui; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JComboBox; import javax.swing.JPanel; import org.jax.analyticgraph.framework.Graph2DComponent; import org.jax.qtl.gui.SaveGraphImageAction; /** * A panel for displaying a scanone graph along with a toolbar * @author <A HREF="mailto:keith.sheppard@jax.org">Keith Sheppard</A> */ public class ScanOnePanel extends JPanel { /** * every {@link java.io.Serializable} is supposed to have one of these */ private static final long serialVersionUID = -6938105819789635761L; /** * the graph 2D component that holds the scanone graph */ private final Graph2DComponent scanOneGraphPanel; /** * Constructor * @param graphPanel * the graph panel * @param scanOneGraph * the graph */ public ScanOnePanel(Graph2DComponent graphPanel, ScanOneGraph scanOneGraph) { this.scanOneGraphPanel = graphPanel; this.initComponents(); this.postGuiInit(scanOneGraph); } /** * Take care of the GUI initialization that isn't handled by the * GUI builder code * @param scanOneGraph * the scan one graph to show */ private void postGuiInit(final ScanOneGraph scanOneGraph) { this.toolbar.add(new EditScanOneGraphSettingsAction(scanOneGraph)); this.toolbar.add(new SaveGraphImageAction(this.scanOneGraphPanel)); final JComboBox scanLodColumnNameComboBox = new JComboBox( scanOneGraph.getScanOneResult().getSignificanceValueColumnNames()); scanLodColumnNameComboBox.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if(e.getStateChange() == ItemEvent.SELECTED) { scanOneGraph.updateLodColumn( (String)scanLodColumnNameComboBox.getSelectedItem(), scanLodColumnNameComboBox.getSelectedIndex()); } } }); // limit the size or the toolbar will try to make the drop-down huge scanLodColumnNameComboBox.setMaximumSize( scanLodColumnNameComboBox.getPreferredSize()); this.toolbar.add(scanLodColumnNameComboBox); } /** * This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("all") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { toolbar = new javax.swing.JToolBar(); scanOneGraphPanelDownCast = this.scanOneGraphPanel; setLayout(new java.awt.BorderLayout()); toolbar.setRollover(true); add(toolbar, java.awt.BorderLayout.NORTH); add(scanOneGraphPanelDownCast, java.awt.BorderLayout.CENTER); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel scanOneGraphPanelDownCast; private javax.swing.JToolBar toolbar; // End of variables declaration//GEN-END:variables }