use of net.sf.mzmine.parameters.parametertypes.BooleanParameter in project mzmine2 by mzmine.
the class MsMsVisualizerWindow method actionPerformed.
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand();
if (command.equals("SHOW_SPECTRUM")) {
CursorPosition pos = getCursorPosition();
if (pos != null) {
SpectraVisualizerModule.showNewSpectrumWindow(pos.getDataFile(), pos.getScanNumber());
}
}
if (command.equals("SETUP_AXES")) {
AxesSetupDialog dialog = new AxesSetupDialog(this, IDAPlot.getXYPlot());
dialog.setVisible(true);
}
if (command.equals("SHOW_DATA_POINTS")) {
IDAPlot.switchDataPointsVisible();
}
if (command.equals("SWITCH_TOOLTIPS")) {
if (tooltipMode) {
IDAPlot.showPeaksTooltips(false);
toolBar.setTooltipButton(false);
tooltipMode = false;
} else {
IDAPlot.showPeaksTooltips(true);
toolBar.setTooltipButton(true);
tooltipMode = true;
}
}
if (command.equals("FIND_SPECTRA")) {
// Parameters
final DoubleParameter inputMZ = new DoubleParameter("Ion m/z", "m/z value of ion to search for.");
final MZToleranceParameter inputMZTolerance = new MZToleranceParameter();
final DoubleParameter inputIntensity = new DoubleParameter("Min. ion intensity", "Only ions with intensities above this value will be searched for.");
final BooleanParameter inputNL = new BooleanParameter("Neutral Loss", "If selected, the ion to be searched for will be a neutral loss ion.\nIn this case, only ions above the min. intensity will be examined.", false);
final ComboParameter<Colors> inputColors = new ComboParameter<Colors>("Color", "The color which the data points will be marked with.", Colors.values());
Parameter<?>[] parameters = new Parameter<?>[5];
parameters[0] = inputMZ;
parameters[1] = inputMZTolerance;
parameters[2] = inputIntensity;
parameters[3] = inputNL;
parameters[4] = inputColors;
final ParameterSet parametersSearch = new SimpleParameterSet(parameters);
ExitCode exitCode = parametersSearch.showSetupDialog(this, true);
if (exitCode != ExitCode.OK)
return;
double searchMZ = parametersSearch.getParameter(inputMZ).getValue();
MZTolerance searchMZTolerance = parametersSearch.getParameter(inputMZTolerance).getValue();
double minIntensity = parametersSearch.getParameter(inputIntensity).getValue();
boolean neutralLoss = parametersSearch.getParameter(inputNL).getValue();
Color highligtColor = Color.red;
;
if (parametersSearch.getParameter(inputColors).getValue().equals(Colors.green)) {
highligtColor = Color.green;
}
if (parametersSearch.getParameter(inputColors).getValue().equals(Colors.blue)) {
highligtColor = Color.blue;
}
// Find and highlight spectra with specific ion
dataset.highlightSpectra(searchMZ, searchMZTolerance, minIntensity, neutralLoss, highligtColor);
// Add legend entry
LegendItemCollection chartLegend = IDAPlot.getXYPlot().getLegendItems();
chartLegend.add(new LegendItem("Ion: " + searchMZ, "", "MS/MS spectra which contain the " + searchMZ + " ion\nTolerance: " + searchMZTolerance.toString() + "\nMin intensity: " + minIntensity, "", new Ellipse2D.Double(0, 0, 7, 7), highligtColor));
IDAPlot.getXYPlot().setFixedLegendItems(chartLegend);
}
}
Aggregations