Search in sources :

Example 1 with MZRangeParameter

use of net.sf.mzmine.parameters.parametertypes.ranges.MZRangeParameter in project mzmine2 by mzmine.

the class PeakSelectionComponent method actionPerformed.

public void actionPerformed(ActionEvent event) {
    Object src = event.getSource();
    if (src == addButton) {
        final IntRangeParameter idParameter = new IntRangeParameter("ID", "Range of included peak IDs", false, null);
        final MZRangeParameter mzParameter = new MZRangeParameter(false);
        final RTRangeParameter rtParameter = new RTRangeParameter(false);
        final StringParameter nameParameter = new StringParameter("Name", "Peak identity name", null, false);
        SimpleParameterSet paramSet = new SimpleParameterSet(new Parameter[] { idParameter, mzParameter, rtParameter, nameParameter });
        Window parent = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
        ExitCode exitCode = paramSet.showSetupDialog(parent, true);
        if (exitCode == ExitCode.OK) {
            Range<Integer> idRange = paramSet.getParameter(idParameter).getValue();
            Range<Double> mzRange = paramSet.getParameter(mzParameter).getValue();
            Range<Double> rtRange = paramSet.getParameter(rtParameter).getValue();
            String name = paramSet.getParameter(nameParameter).getValue();
            PeakSelection ps = new PeakSelection(idRange, mzRange, rtRange, name);
            selectionListModel.addElement(ps);
        }
    }
    if (src == allButton) {
        PeakSelection ps = new PeakSelection(null, null, null, null);
        selectionListModel.clear();
        selectionListModel.addElement(ps);
    }
    if (src == removeButton) {
        for (PeakSelection p : selectionList.getSelectedValuesList()) {
            selectionListModel.removeElement(p);
        }
    }
    if (src == clearButton) {
        selectionListModel.clear();
    }
}
Also used : Window(java.awt.Window) StringParameter(net.sf.mzmine.parameters.parametertypes.StringParameter) RTRangeParameter(net.sf.mzmine.parameters.parametertypes.ranges.RTRangeParameter) SimpleParameterSet(net.sf.mzmine.parameters.impl.SimpleParameterSet) IntRangeParameter(net.sf.mzmine.parameters.parametertypes.ranges.IntRangeParameter) ExitCode(net.sf.mzmine.util.ExitCode) MZRangeParameter(net.sf.mzmine.parameters.parametertypes.ranges.MZRangeParameter)

Aggregations

Window (java.awt.Window)1 SimpleParameterSet (net.sf.mzmine.parameters.impl.SimpleParameterSet)1 StringParameter (net.sf.mzmine.parameters.parametertypes.StringParameter)1 IntRangeParameter (net.sf.mzmine.parameters.parametertypes.ranges.IntRangeParameter)1 MZRangeParameter (net.sf.mzmine.parameters.parametertypes.ranges.MZRangeParameter)1 RTRangeParameter (net.sf.mzmine.parameters.parametertypes.ranges.RTRangeParameter)1 ExitCode (net.sf.mzmine.util.ExitCode)1