use of net.sf.mzmine.parameters.parametertypes.ranges.DoubleRangeComponent in project mzmine2 by mzmine.
the class XICManualPickerDialog method addDialogComponents.
@Override
protected void addDialogComponents() {
super.addDialogComponents();
Color l = new Color(50, 255, 50, 150), u = new Color(255, 50, 50, 150);
Stroke stroke = new BasicStroke(1.0f);
// make new panel, put tic into the middle of a border layout.
remove(this.mainPanel);
rtRangeComp = new DoubleRangeComponent(MZmineCore.getConfiguration().getRTFormat());
mzRangeComp = new DoubleRangeComponent(MZmineCore.getConfiguration().getMZFormat());
applyMassRange = new JButton("Set");
applyMassRange.addActionListener(a -> setMassRange());
addListenertoRTComp(rtRangeComp);
JLabel rtLabel = new JLabel("Retention time range");
JLabel mzLabel = new JLabel("m/z range");
mainPanel.add(rtLabel, 0, getNumberOfParameters() + 1);
mainPanel.add(rtRangeComp, 1, getNumberOfParameters() + 1);
mainPanel.add(mzLabel, 0, getNumberOfParameters() + 2);
mainPanel.add(mzRangeComp, 1, getNumberOfParameters() + 2);
mainPanel.add(applyMassRange, 2, getNumberOfParameters() + 2);
BorderLayout borderLayout = new BorderLayout();
Panel pnlNewMain = new Panel(borderLayout);
// put another border layout for south of the new main panel, so we can place controls and
// integration specific stuff there
Panel pnlControlsAndParameters = new Panel(new BorderLayout());
pnlControlsAndParameters.add(this.mainPanel, BorderLayout.CENTER);
pnlNewMain.add(pnlControlsAndParameters, BorderLayout.SOUTH);
// now make another panel to put the integration specific stuff, like the buttons and the
// current area
Panel pnlIntegration = new Panel(new FlowLayout());
setLower = GUIUtils.addButton(pnlIntegration, null, icoLower, this, "SETLOWER", "Set the lower integration boundary.");
setUpper = GUIUtils.addButton(pnlIntegration, null, icoUpper, this, "SETUPPER", "Set the upper integration boundary.");
GUIUtils.addSeparator(pnlIntegration);
pnlIntegration.add(new Label("Area: "));
txtArea = new JTextField(10);
txtArea.setEditable(false);
pnlIntegration.add(txtArea);
pnlControlsAndParameters.add(pnlIntegration, BorderLayout.NORTH);
ticPlot = new TICPlot(this);
ticPlot.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
ticPlot.setMinimumSize(new Dimension(400, 200));
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
ticPlot.setPreferredSize(new Dimension((int) (screenSize.getWidth() / 1.3d), (int) (screenSize.getHeight() / 1.8d)));
pnlNewMain.add(ticPlot, BorderLayout.CENTER);
// add a mouse listener to place the boundaries
getTicPlot().addChartMouseListener(new ChartMouseListener() {
// https://stackoverflow.com/questions/1512112/jfreechart-get-mouse-coordinates
// draw a marker at the current position
@Override
public void chartMouseMoved(ChartMouseEvent event) {
Point2D p = ticPlot.translateScreenToJava2D(event.getTrigger().getPoint());
Rectangle2D plotArea = ticPlot.getScreenDataArea();
XYPlot plot = ticPlot.getXYPlot();
double rtValue = plot.getDomainAxis().java2DToValue(p.getX(), plotArea, plot.getDomainAxisEdge());
Color clr = (nextBorder == NextBorder.LOWER) ? l : u;
addMarkers();
plot.addDomainMarker(new ValueMarker(rtValue, clr, stroke));
}
@Override
public void chartMouseClicked(ChartMouseEvent event) {
Point2D p = ticPlot.translateScreenToJava2D(event.getTrigger().getPoint());
Rectangle2D plotArea = ticPlot.getScreenDataArea();
XYPlot plot = ticPlot.getXYPlot();
double rtValue = plot.getDomainAxis().java2DToValue(p.getX(), plotArea, plot.getDomainAxisEdge());
inputSource = InputSource.GRAPH;
setRTBoundary(rtValue);
inputSource = InputSource.OTHER;
}
});
add(pnlNewMain);
pack();
}
use of net.sf.mzmine.parameters.parametertypes.ranges.DoubleRangeComponent 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();
}
Aggregations