use of net.sf.mzmine.util.dialogs.AxesSetupDialog in project mzmine2 by mzmine.
the class RTMZAnalyzerWindow method actionPerformed.
public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand();
if (command.equals("SETUP_AXES")) {
AxesSetupDialog dialog = new AxesSetupDialog(this, plot.getChart().getXYPlot());
dialog.setVisible(true);
}
if (command.equals("SETUP_COLORS")) {
InterpolatingLookupPaintScaleSetupDialog colorDialog = new InterpolatingLookupPaintScaleSetupDialog(this, plot.getPaintScale());
colorDialog.setVisible(true);
if (colorDialog.getExitCode() == ExitCode.OK)
plot.setPaintScale(colorDialog.getPaintScale());
}
}
use of net.sf.mzmine.util.dialogs.AxesSetupDialog in project mzmine2 by mzmine.
the class ProjectionPlotWindow method actionPerformed.
public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand();
if (command.equals("SETUP_AXES")) {
AxesSetupDialog dialog = new AxesSetupDialog(this, plot.getChart().getXYPlot());
dialog.setVisible(true);
}
if (command.equals("TOGGLE_LABELS")) {
/*
* XYItemRenderer rend = plot.getChart().getXYPlot().getRenderer();
* rend.setBaseItemLabelsVisible(!rend.getBaseItemLabelsVisible());
*/
plot.cycleItemLabelMode();
}
}
use of net.sf.mzmine.util.dialogs.AxesSetupDialog in project mzmine2 by mzmine.
the class TwoDVisualizerWindow method actionPerformed.
/**
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand();
if (command.equals("SWITCH_PALETTE")) {
twoDPlot.getXYPlot().switchPalette();
}
if (command.equals("SHOW_DATA_POINTS")) {
twoDPlot.switchDataPointsVisible();
}
if (command.equals("SETUP_AXES")) {
AxesSetupDialog dialog = new AxesSetupDialog(this, twoDPlot.getXYPlot());
dialog.setVisible(true);
}
if (command.equals("SWITCH_PLOTMODE")) {
if (twoDPlot.getPlotMode() == PlotMode.CENTROID) {
toolBar.setCentroidButton(true);
twoDPlot.setPlotMode(PlotMode.CONTINUOUS);
} else {
toolBar.setCentroidButton(false);
twoDPlot.setPlotMode(PlotMode.CENTROID);
}
}
if (command.equals("SWITCH_TOOLTIPS")) {
if (tooltipMode) {
twoDPlot.showPeaksTooltips(false);
toolBar.setTooltipButton(false);
tooltipMode = false;
} else {
twoDPlot.showPeaksTooltips(true);
toolBar.setTooltipButton(true);
tooltipMode = true;
}
}
if (command.equals("SWITCH_LOG_SCALE")) {
if (twoDPlot != null) {
logScale = !logScale;
twoDPlot.setLogScale(logScale);
}
}
if ("PEAKLIST_CHANGE".equals(command)) {
final PeakList selectedPeakList = bottomPanel.getSelectedPeakList();
if (selectedPeakList != null) {
logger.finest("Loading a feature list " + selectedPeakList + " to a 2D view of " + dataFile);
twoDPlot.loadPeakList(selectedPeakList);
}
}
}
use of net.sf.mzmine.util.dialogs.AxesSetupDialog in project mzmine2 by mzmine.
the class IntensityPlotToolBar method actionPerformed.
public void actionPerformed(ActionEvent e) {
Object src = e.getSource();
if (src == linesVisibleButton) {
Plot plot = window.getChart().getPlot();
Boolean linesVisible;
if (plot instanceof CategoryPlot) {
LineAndShapeRenderer renderer = (LineAndShapeRenderer) ((CategoryPlot) plot).getRenderer();
linesVisible = renderer.getDefaultLinesVisible();
} else {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) ((XYPlot) plot).getRenderer();
linesVisible = renderer.getDefaultLinesVisible();
renderer.setDrawSeriesLineAsPath(true);
}
// check for null value
if (linesVisible == null)
linesVisible = false;
// update the icon
if (linesVisible) {
linesVisibleButton.setIcon(linesIcon);
} else {
linesVisibleButton.setIcon(pointsIcon);
}
// switch the button
linesVisible = !linesVisible;
if (plot instanceof CategoryPlot) {
LineAndShapeRenderer renderer = (LineAndShapeRenderer) ((CategoryPlot) plot).getRenderer();
renderer.setDefaultLinesVisible(linesVisible);
} else {
XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) ((XYPlot) plot).getRenderer();
renderer.setDefaultLinesVisible(linesVisible);
renderer.setDrawSeriesLineAsPath(true);
}
}
if (src == setupAxesButton) {
AxesSetupDialog dialog = new AxesSetupDialog(window, window.getChart().getXYPlot());
dialog.setVisible(true);
}
}
use of net.sf.mzmine.util.dialogs.AxesSetupDialog in project mzmine2 by mzmine.
the class SpectraVisualizerWindow method actionPerformed.
@Override
public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand();
if (command.equals("PEAKLIST_CHANGE")) {
// If no scan is loaded yet, ignore
if (currentScan == null)
return;
PeakList selectedPeakList = bottomPanel.getSelectedPeakList();
loadPeaks(selectedPeakList);
}
if (command.equals("PREVIOUS_SCAN")) {
if (dataFile == null)
return;
int msLevel = currentScan.getMSLevel();
int[] scanNumbers = dataFile.getScanNumbers(msLevel);
int scanIndex = Arrays.binarySearch(scanNumbers, currentScan.getScanNumber());
if (scanIndex > 0) {
final int prevScanIndex = scanNumbers[scanIndex - 1];
Runnable newThreadRunnable = new Runnable() {
@Override
public void run() {
loadRawData(dataFile.getScan(prevScanIndex));
}
};
Thread newThread = new Thread(newThreadRunnable);
newThread.start();
}
}
if (command.equals("NEXT_SCAN")) {
if (dataFile == null)
return;
int msLevel = currentScan.getMSLevel();
int[] scanNumbers = dataFile.getScanNumbers(msLevel);
int scanIndex = Arrays.binarySearch(scanNumbers, currentScan.getScanNumber());
if (scanIndex < (scanNumbers.length - 1)) {
final int nextScanIndex = scanNumbers[scanIndex + 1];
Runnable newThreadRunnable = new Runnable() {
@Override
public void run() {
loadRawData(dataFile.getScan(nextScanIndex));
}
};
Thread newThread = new Thread(newThreadRunnable);
newThread.start();
}
}
if (command.equals("SHOW_MSMS")) {
String selectedScanString = (String) bottomPanel.getMSMSSelector().getSelectedItem();
if (selectedScanString == null)
return;
int sharpIndex = selectedScanString.indexOf('#');
int commaIndex = selectedScanString.indexOf(',');
selectedScanString = selectedScanString.substring(sharpIndex + 1, commaIndex);
int selectedScan = Integer.valueOf(selectedScanString);
SpectraVisualizerModule.showNewSpectrumWindow(dataFile, selectedScan);
}
if (command.equals("TOGGLE_PLOT_MODE")) {
if (spectrumPlot.getPlotMode() == MassSpectrumType.CENTROIDED) {
spectrumPlot.setPlotMode(MassSpectrumType.PROFILE);
toolBar.setCentroidButton(MassSpectrumType.PROFILE);
} else {
spectrumPlot.setPlotMode(MassSpectrumType.CENTROIDED);
toolBar.setCentroidButton(MassSpectrumType.CENTROIDED);
}
}
if (command.equals("SHOW_DATA_POINTS")) {
spectrumPlot.switchDataPointsVisible();
}
if (command.equals("SHOW_ANNOTATIONS")) {
spectrumPlot.switchItemLabelsVisible();
}
if (command.equals("SHOW_PICKED_PEAKS")) {
spectrumPlot.switchPickedPeaksVisible();
}
if (command.equals("SHOW_ISOTOPE_PEAKS")) {
spectrumPlot.switchIsotopePeaksVisible();
}
if (command.equals("SETUP_AXES")) {
AxesSetupDialog dialog = new AxesSetupDialog(this, spectrumPlot.getXYPlot());
dialog.setVisible(true);
}
// library entry creation
if (command.equals("CREATE_LIBRARY_ENTRY")) {
// open window with all selected rows
MSMSLibrarySubmissionWindow libraryWindow = new MSMSLibrarySubmissionWindow();
libraryWindow.setData(currentScan);
libraryWindow.setVisible(true);
}
if (command.equals("EXPORT_SPECTRA")) {
ExportScansModule.showSetupDialog(currentScan);
}
if (command.equals("ADD_ISOTOPE_PATTERN")) {
IsotopePattern newPattern = IsotopePatternCalculator.showIsotopePredictionDialog(this, true);
if (newPattern == null)
return;
loadIsotopes(newPattern);
}
if ((command.equals("ZOOM_IN")) || (command.equals("ZOOM_IN_BOTH_COMMAND"))) {
spectrumPlot.getXYPlot().getDomainAxis().resizeRange(1 / zoomCoefficient);
}
if ((command.equals("ZOOM_OUT")) || (command.equals("ZOOM_OUT_BOTH_COMMAND"))) {
spectrumPlot.getXYPlot().getDomainAxis().resizeRange(zoomCoefficient);
}
if (command.equals("SET_SAME_RANGE")) {
// Get current axes range
NumberAxis xAxis = (NumberAxis) spectrumPlot.getXYPlot().getDomainAxis();
NumberAxis yAxis = (NumberAxis) spectrumPlot.getXYPlot().getRangeAxis();
double xMin = xAxis.getRange().getLowerBound();
double xMax = xAxis.getRange().getUpperBound();
double xTick = xAxis.getTickUnit().getSize();
double yMin = yAxis.getRange().getLowerBound();
double yMax = yAxis.getRange().getUpperBound();
double yTick = yAxis.getTickUnit().getSize();
// Get all frames of my class
Window[] spectraFrames = JFrame.getWindows();
// Set the range of these frames
for (Window frame : spectraFrames) {
if (!(frame instanceof SpectraVisualizerWindow))
continue;
SpectraVisualizerWindow spectraFrame = (SpectraVisualizerWindow) frame;
spectraFrame.setAxesRange(xMin, xMax, xTick, yMin, yMax, yTick);
}
}
if (command.equals("ONLINEDATABASESEARCH")) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
OnlineDBSpectraSearchModule.showSpectraIdentificationDialog(currentScan, spectrumPlot);
}
});
}
if (command.equals("CUSTOMDATABASESEARCH")) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
CustomDBSpectraSearchModule.showSpectraIdentificationDialog(currentScan, spectrumPlot);
}
});
}
if (command.equals("LIPIDSEARCH")) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
LipidSpectraSearchModule.showSpectraIdentificationDialog(currentScan, spectrumPlot);
}
});
}
if (command.equals("SUMFORMULA")) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SumFormulaSpectraSearchModule.showSpectraIdentificationDialog(currentScan, spectrumPlot);
}
});
}
if (command.equals("SPECTRALDATABASESEARCH")) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
SpectraIdentificationSpectralDatabaseModule.showSpectraIdentificationDialog(currentScan, spectrumPlot);
}
});
}
if (command.equals("SET_PROCESSING_PARAMETERS")) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (!dppmWindowOpen) {
dppmWindowOpen = true;
ExitCode exitCode = DataPointProcessingManager.getInst().getParameters().showSetupDialog(MZmineCore.getDesktop().getMainWindow(), true);
dppmWindowOpen = false;
if (exitCode == ExitCode.OK && DataPointProcessingManager.getInst().isEnabled()) {
// if processing was run before, this removes the previous results.
getSpectrumPlot().removeDataPointProcessingResultDataSets();
getSpectrumPlot().checkAndRunController();
}
}
}
});
}
if (command.equals("ENABLE_PROCESSING")) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
DataPointProcessingManager inst = DataPointProcessingManager.getInst();
inst.setEnabled(!inst.isEnabled());
bottomPanel.updateProcessingButton();
getSpectrumPlot().checkAndRunController();
// if the tick is removed, set the data back to default
if (!inst.isEnabled()) {
getSpectrumPlot().removeDataPointProcessingResultDataSets();
// loadRawData(currentScan);
}
}
});
}
}
Aggregations