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();
}
}
Aggregations