Search in sources :

Example 6 with TICPlot

use of net.sf.mzmine.modules.visualization.tic.TICPlot in project mzmine2 by mzmine.

the class ParameterSetupDialogWithChromatogramPreview method addDialogComponents.

/**
 * This function add all the additional components for this dialog over the original
 * ParameterSetupDialog.
 */
@Override
protected void addDialogComponents() {
    super.addDialogComponents();
    dataFiles = MZmineCore.getProjectManager().getCurrentProject().getDataFiles();
    if (dataFiles.length == 0)
        return;
    RawDataFile[] selectedFiles = MZmineCore.getDesktop().getSelectedDataFiles();
    if (selectedFiles.length > 0)
        previewDataFile = selectedFiles[0];
    else
        previewDataFile = dataFiles[0];
    previewCheckBox = new JCheckBox("Show preview");
    previewCheckBox.addActionListener(this);
    previewCheckBox.setHorizontalAlignment(SwingConstants.CENTER);
    mainPanel.add(new JSeparator(), 0, getNumberOfParameters() + 1, 3, 1);
    mainPanel.add(previewCheckBox, 0, getNumberOfParameters() + 2, 3, 1);
    // Elements of pnlLab
    JPanel pnlLab = new JPanel();
    pnlLab.setLayout(new BoxLayout(pnlLab, BoxLayout.Y_AXIS));
    pnlLab.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    pnlLab.add(Box.createVerticalStrut(5));
    pnlLab.add(new JLabel("Data file "));
    pnlLab.add(Box.createVerticalStrut(20));
    pnlLab.add(new JLabel("Plot Type "));
    pnlLab.add(Box.createVerticalStrut(25));
    pnlLab.add(new JLabel("RT range "));
    pnlLab.add(Box.createVerticalStrut(15));
    pnlLab.add(new JLabel("m/z range "));
    // Elements of pnlFlds
    JPanel pnlFlds = new JPanel();
    pnlFlds.setLayout(new BoxLayout(pnlFlds, BoxLayout.Y_AXIS));
    pnlFlds.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    comboDataFileName = new JComboBox<RawDataFile>(dataFiles);
    comboDataFileName.setSelectedItem(previewDataFile);
    comboDataFileName.addActionListener(this);
    ticViewComboBox = new JComboBox<TICPlotType>(TICPlotType.values());
    ticViewComboBox.setSelectedItem(TICPlotType.TIC);
    ticViewComboBox.addActionListener(this);
    rtRangeBox = new DoubleRangeComponent(MZmineCore.getConfiguration().getRTFormat());
    rtRangeBox.setValue(previewDataFile.getDataRTRange(1));
    mzRangeBox = new DoubleRangeComponent(MZmineCore.getConfiguration().getMZFormat());
    mzRangeBox.setValue(previewDataFile.getDataMZRange(1));
    pnlFlds.add(comboDataFileName);
    pnlFlds.add(Box.createVerticalStrut(10));
    pnlFlds.add(ticViewComboBox);
    pnlFlds.add(Box.createVerticalStrut(20));
    pnlFlds.add(rtRangeBox);
    pnlFlds.add(Box.createVerticalStrut(5));
    pnlFlds.add(mzRangeBox);
    // Put all together
    pnlPreviewFields = new JPanel(new BorderLayout());
    pnlPreviewFields.add(pnlLab, BorderLayout.WEST);
    pnlPreviewFields.add(pnlFlds, BorderLayout.CENTER);
    pnlPreviewFields.setVisible(false);
    ticPlot = new TICPlot(this);
    ticPlot.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
    ticPlot.setMinimumSize(new Dimension(400, 300));
    mainPanel.add(pnlPreviewFields, 0, getNumberOfParameters() + 3, 3, 1, 0, 0);
    updateMinimumSize();
    pack();
}
Also used : JPanel(javax.swing.JPanel) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JSeparator(javax.swing.JSeparator) JCheckBox(javax.swing.JCheckBox) TICPlotType(net.sf.mzmine.modules.visualization.tic.TICPlotType) BorderLayout(java.awt.BorderLayout) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) TICPlot(net.sf.mzmine.modules.visualization.tic.TICPlot) DoubleRangeComponent(net.sf.mzmine.parameters.parametertypes.ranges.DoubleRangeComponent)

Aggregations

BorderLayout (java.awt.BorderLayout)6 JPanel (javax.swing.JPanel)6 TICPlot (net.sf.mzmine.modules.visualization.tic.TICPlot)6 Dimension (java.awt.Dimension)5 JLabel (javax.swing.JLabel)5 JCheckBox (javax.swing.JCheckBox)4 BasicStroke (java.awt.BasicStroke)3 ValueMarker (org.jfree.chart.plot.ValueMarker)3 Color (java.awt.Color)2 FlowLayout (java.awt.FlowLayout)2 Stroke (java.awt.Stroke)2 JButton (javax.swing.JButton)2 JSeparator (javax.swing.JSeparator)2 JTextField (javax.swing.JTextField)2 XYPlot (org.jfree.chart.plot.XYPlot)2 Range (com.google.common.collect.Range)1 Files (com.google.common.io.Files)1 Font (java.awt.Font)1 GridLayout (java.awt.GridLayout)1 Image (java.awt.Image)1