Search in sources :

Example 1 with DoubleComponent

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

the class GraphicsExportDialog method renewPreview.

/**
 * renew chart preview with specified size
 */
protected void renewPreview() {
    // set dimensions to chartpanel
    try {
        // update param
        updateParameterSetFromComponents();
        // 
        if (parameters.isUseOnlyWidth()) {
            double height = (ChartLogics.calcHeightToWidth(chartPanel, parameters.getWidthPixel(), false));
            DoubleParameter p = parameters.getParameter(GraphicsExportParameters.height).getEmbeddedParameter();
            DoubleComponent c = ((OptionalParameterComponent<DoubleComponent>) parametersAndComponents.get(p.getName())).getEmbeddedComponent();
            p.setValueToComponent(c, height);
            p.setValueFromComponent(c);
            chartPanel.setSize((int) parameters.getWidthPixel(), (int) parameters.getHeightPixel());
            getPnChartPreview().repaint();
        } else {
            chartPanel.setSize((int) parameters.getWidthPixel(), (int) parameters.getHeightPixel());
            chartPanel.repaint();
        }
    } catch (Exception ex) {
        ex.printStackTrace();
        LOG.log(Level.SEVERE, "Error while renewing preview of graphics export dialog ", ex);
    }
}
Also used : DoubleComponent(net.sf.mzmine.parameters.parametertypes.DoubleComponent) DoubleParameter(net.sf.mzmine.parameters.parametertypes.DoubleParameter) OptionalParameterComponent(net.sf.mzmine.parameters.parametertypes.OptionalParameterComponent)

Example 2 with DoubleComponent

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

the class MSMSLibrarySubmissionWindow method addListener.

private void addListener() {
    // listen for changes in masslist selection and preprocessing
    MassListComponent mc = getMassListComponent();
    mc.addDocumentListener(new DelayedDocumentListener(e -> updateSettingsOnAllSelectors()));
    DoubleComponent nc = getNoiseLevelComponent();
    nc.addDocumentListener(new DelayedDocumentListener(e -> updateSettingsOnAllSelectors()));
    IntegerComponent minc = getMinSignalComponent();
    minc.addDocumentListener(new DelayedDocumentListener(e -> updateSettingsOnAllSelectors()));
    ComboComponent<ScanSortMode> sortc = getComboSortMode();
    sortc.addItemListener(e -> updateSortModeOnAllSelectors());
    IntegerComponent mslevel = getMSLevelComponent();
    mslevel.addDocumentListener(new DelayedDocumentListener(e -> {
        updateParameterSetFromComponents();
        Integer level = paramMeta.getParameter(LibraryMetaDataParameters.MS_LEVEL).getValue();
        setFragmentScan(level != null && level > 1);
    }));
}
Also used : Color(java.awt.Color) OptionalModuleComponent(net.sf.mzmine.parameters.parametertypes.submodules.OptionalModuleComponent) Arrays(java.util.Arrays) URL(java.net.URL) ItemListener(java.awt.event.ItemListener) DataPoint(net.sf.mzmine.datamodel.DataPoint) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) PeakListRow(net.sf.mzmine.datamodel.PeakListRow) ChartViewWrapper(net.sf.mzmine.chartbasics.gui.wrapper.ChartViewWrapper) EChartPanel(net.sf.mzmine.chartbasics.gui.swing.EChartPanel) Map(java.util.Map) ScanSortMode(net.sf.mzmine.util.scans.sorting.ScanSortMode) LibrarySubmitTask(net.sf.mzmine.modules.peaklistmethods.io.spectraldbsubmit.LibrarySubmitTask) UserParameter(net.sf.mzmine.parameters.UserParameter) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) JFrame(javax.swing.JFrame) JMenuBar(javax.swing.JMenuBar) ScrollPaneConstants(javax.swing.ScrollPaneConstants) GridBagPanel(net.sf.mzmine.util.components.GridBagPanel) SortingProperty(net.sf.mzmine.util.SortingProperty) Font(java.awt.Font) PeakListRowSorter(net.sf.mzmine.util.PeakListRowSorter) LibraryMetaDataParameters(net.sf.mzmine.modules.peaklistmethods.io.spectraldbsubmit.param.LibraryMetaDataParameters) JMenu(javax.swing.JMenu) GUIUtils(net.sf.mzmine.util.GUIUtils) GridBagConstraints(java.awt.GridBagConstraints) Logger(java.util.logging.Logger) LibrarySubmitParameters(net.sf.mzmine.modules.peaklistmethods.io.spectraldbsubmit.param.LibrarySubmitParameters) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) Platform(javafx.application.Platform) Dimension(java.awt.Dimension) List(java.util.List) Stream(java.util.stream.Stream) ComboComponent(net.sf.mzmine.parameters.parametertypes.ComboComponent) EmptyBorder(javax.swing.border.EmptyBorder) AbstractMSMSIdentity(net.sf.mzmine.datamodel.identities.ms2.interf.AbstractMSMSIdentity) JPanel(javax.swing.JPanel) Scan(net.sf.mzmine.datamodel.Scan) MZmineCore(net.sf.mzmine.main.MZmineCore) Parameter(net.sf.mzmine.parameters.Parameter) ActionListener(java.awt.event.ActionListener) JSplitPane(javax.swing.JSplitPane) LibrarySubmitModule(net.sf.mzmine.modules.peaklistmethods.io.spectraldbsubmit.LibrarySubmitModule) HashMap(java.util.HashMap) LibrarySubmitIonParameters(net.sf.mzmine.modules.peaklistmethods.io.spectraldbsubmit.param.LibrarySubmitIonParameters) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) GridLayout(java.awt.GridLayout) IntegerComponent(net.sf.mzmine.parameters.parametertypes.IntegerComponent) DelayedDocumentListener(net.sf.mzmine.framework.listener.DelayedDocumentListener) JMenuItem(javax.swing.JMenuItem) JFreeChart(org.jfree.chart.JFreeChart) Hashtable(java.util.Hashtable) JComponent(javax.swing.JComponent) HelpWindow(net.sf.mzmine.desktop.impl.helpwindow.HelpWindow) MZTolerance(net.sf.mzmine.parameters.parametertypes.tolerances.MZTolerance) JButton(javax.swing.JButton) MigLayout(net.miginfocom.swing.MigLayout) ValueAxis(org.jfree.chart.axis.ValueAxis) ActionEvent(java.awt.event.ActionEvent) ChartGroup(net.sf.mzmine.chartbasics.chartgroups.ChartGroup) Consumer(java.util.function.Consumer) JScrollPane(javax.swing.JScrollPane) SortingDirection(net.sf.mzmine.util.SortingDirection) MassListComponent(net.sf.mzmine.parameters.parametertypes.MassListComponent) OptionalParameterComponent(net.sf.mzmine.parameters.parametertypes.OptionalParameterComponent) JLabel(javax.swing.JLabel) DialogLoggerUtil(net.sf.mzmine.util.DialogLoggerUtil) PseudoSpectrumDataSet(net.sf.mzmine.modules.visualization.spectra.multimsms.pseudospectra.PseudoSpectrumDataSet) DoubleComponent(net.sf.mzmine.parameters.parametertypes.DoubleComponent) DoubleComponent(net.sf.mzmine.parameters.parametertypes.DoubleComponent) ScanSortMode(net.sf.mzmine.util.scans.sorting.ScanSortMode) IntegerComponent(net.sf.mzmine.parameters.parametertypes.IntegerComponent) DelayedDocumentListener(net.sf.mzmine.framework.listener.DelayedDocumentListener) MassListComponent(net.sf.mzmine.parameters.parametertypes.MassListComponent)

Example 3 with DoubleComponent

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

the class KovatsIndexExtractionDialog method addDialogComponents.

@Override
protected void addDialogComponents() {
    super.addDialogComponents();
    mainPanel.removeAll();
    mainPanel.getParent().remove(mainPanel);
    ddlKovats = new DelayedDocumentListener(e -> updateKovatsList());
    DelayedDocumentListener ddlUpdateChart = new DelayedDocumentListener(e -> updateChart());
    newMainPanel = new JPanel(new MigLayout("fill", "[right][grow,fill]", ""));
    getContentPane().add(newMainPanel, BorderLayout.SOUTH);
    JPanel pnCenter = new JPanel(new BorderLayout());
    getContentPane().add(pnCenter, BorderLayout.CENTER);
    pnChart = new JPanel(new BorderLayout());
    pnCenter.add(pnChart, BorderLayout.CENTER);
    Box sizedummy = new Box(BoxLayout.X_AXIS);
    sizedummy.setMinimumSize(new Dimension(200, 450));
    sizedummy.setPreferredSize(new Dimension(200, 450));
    pnChart.add(sizedummy, BorderLayout.CENTER);
    // left: Kovats: min max and list
    JPanel west = new JPanel(new BorderLayout());
    newMainPanel.add(west);
    // add min max
    JPanel pnKovatsParam = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
    west.add(pnKovatsParam, BorderLayout.NORTH);
    minc = (IntegerComponent) getComponentForParameter(KovatsIndexExtractionParameters.minKovats);
    maxc = (IntegerComponent) getComponentForParameter(KovatsIndexExtractionParameters.maxKovats);
    minc.addDocumentListener(ddlKovats);
    maxc.addDocumentListener(ddlKovats);
    pnKovatsParam.add(new JLabel("Min carbon:"));
    pnKovatsParam.add(minc);
    pnKovatsParam.add(new JLabel("Max carbon:"));
    pnKovatsParam.add(maxc);
    // kovats list
    JPanel pnKovatsSelect = new JPanel(new BorderLayout());
    west.add(pnKovatsSelect, BorderLayout.CENTER);
    comboKovats = (MultiChoiceComponent) getComponentForParameter(KovatsIndexExtractionParameters.kovats);
    comboKovats.addValueChangeListener(() -> handleKovatsSelectionChange());
    pnKovatsSelect.add(comboKovats, BorderLayout.CENTER);
    // center: Chart and parameters
    JPanel center = new JPanel(new BorderLayout());
    newMainPanel.add(center);
    // all parameters on peak pick panel
    JPanel pnSouth = new JPanel(new BorderLayout());
    center.add(pnSouth, BorderLayout.SOUTH);
    JPanel pnPeakPick = new JPanel(new MigLayout("", "[right][]", ""));
    pnSouth.add(pnPeakPick, BorderLayout.CENTER);
    valuesComponent = (StringComponent) getComponentForParameter(KovatsIndexExtractionParameters.pickedKovatsValues);
    MZRangeComponent mzc = (MZRangeComponent) getComponentForParameter(KovatsIndexExtractionParameters.mzRange);
    RTRangeComponent rtc = (RTRangeComponent) getComponentForParameter(KovatsIndexExtractionParameters.rtRange);
    DoubleComponent noisec = (DoubleComponent) getComponentForParameter(KovatsIndexExtractionParameters.noiseLevel);
    DoubleComponent edgeRatioC = (DoubleComponent) getComponentForParameter(KovatsIndexExtractionParameters.ratioTopEdge);
    valuesComponent.addDocumentListener(new DelayedDocumentListener(e -> kovatsValuesChanged()));
    valuesComponent.setLayout(new GridLayout(1, 1));
    pnCenter.add(valuesComponent, BorderLayout.SOUTH);
    JPanel pnButtonFlow = new JPanel();
    pnPeakPick.add(pnButtonFlow, "cell 0 0 2 1");
    JButton btnUpdateChart = new JButton("Update chart");
    btnUpdateChart.addActionListener(e -> updateChart());
    pnButtonFlow.add(btnUpdateChart);
    JButton btnPickRT = new JButton("Pick peaks");
    btnPickRT.addActionListener(e -> pickRetentionTimes());
    pnButtonFlow.add(btnPickRT);
    JButton btnSaveFile = new JButton("Save to file");
    btnSaveFile.setToolTipText("Save Kovats index file");
    btnSaveFile.addActionListener(e -> saveToFile());
    pnButtonFlow.add(btnSaveFile);
    JButton btnLoad = new JButton("Load");
    btnLoad.setToolTipText("Load Kovats index file");
    btnLoad.addActionListener(e -> loadFile());
    pnButtonFlow.add(btnLoad);
    JButton btnCombineFiles = new JButton("Combine files");
    btnCombineFiles.setToolTipText("Select multiple Kovats index files to be combined into one");
    btnCombineFiles.addActionListener(e -> combineFiles());
    pnButtonFlow.add(btnCombineFiles);
    // add combo for raw data file
    dataFiles = MZmineCore.getProjectManager().getCurrentProject().getDataFiles();
    comboDataFileName = new JComboBox<RawDataFile>(dataFiles);
    comboDataFileName2 = new JComboBox<RawDataFile>(dataFiles);
    cbSecondRaw = new JCheckBox();
    initRawDataFileSelection();
    pnPeakPick.add(new JLabel("Raw data file(s)"), "cell 0 1");
    pnPeakPick.add(comboDataFileName);
    cbSecondRaw.addItemListener(e -> useSecondDataFile(cbSecondRaw.isSelected()));
    pnPeakPick.add(cbSecondRaw, "cell 0 2");
    pnPeakPick.add(comboDataFileName2);
    // direct alkane selection < CxH2x+1 >
    JPanel pnAlkaneSelect = new JPanel();
    Dimension dim = new Dimension(SIZE, SIZE);
    JButton btnPrevAlkane = new JButton(iconPrev);
    btnPrevAlkane.addActionListener(e -> setMzRangeByAlkane(-1));
    btnPrevAlkane.setPreferredSize(dim);
    btnPrevAlkane.setMaximumSize(dim);
    JButton btnNextAlkane = new JButton(iconNext);
    btnNextAlkane.addActionListener(e -> setMzRangeByAlkane(1));
    btnNextAlkane.setPreferredSize(dim);
    btnNextAlkane.setMaximumSize(dim);
    lbCurrentAlkane = new JLabel("");
    cbCurrentAlkaneSubH = new JCheckBox("-H");
    cbCurrentAlkaneSubH.setSelected(true);
    cbCurrentAlkaneSubH.addItemListener(e -> setMzRangeByAlkane(0));
    pnAlkaneSelect.add(btnPrevAlkane);
    pnAlkaneSelect.add(lbCurrentAlkane);
    pnAlkaneSelect.add(btnNextAlkane);
    pnAlkaneSelect.add(cbCurrentAlkaneSubH);
    pnPeakPick.add(pnAlkaneSelect, "cell 1 3");
    pnPeakPick.add(new JLabel("m/z range"), "cell 0 4");
    pnPeakPick.add(mzc);
    pnPeakPick.add(new JLabel(KovatsIndexExtractionParameters.rtRange.getName()), "cell 0 5");
    pnPeakPick.add(rtc);
    pnPeakPick.add(new JLabel(KovatsIndexExtractionParameters.noiseLevel.getName()), "cell 0 6");
    pnPeakPick.add(noisec);
    pnPeakPick.add(new JLabel(KovatsIndexExtractionParameters.ratioTopEdge.getName()), "cell 0 7");
    pnPeakPick.add(edgeRatioC);
    // add listeners
    comboDataFileName.addItemListener(e -> updateChart());
    mzc.addDocumentListener(ddlUpdateChart);
    rtc.addDocumentListener(ddlUpdateChart);
    // show
    revalidate();
    updateMinimumSize();
    pack();
    updateChart();
}
Also used : Color(java.awt.Color) StringComponent(net.sf.mzmine.parameters.parametertypes.StringComponent) Arrays(java.util.Arrays) FileAndPathUtil(net.sf.mzmine.util.files.FileAndPathUtil) ChartGestureHandler(net.sf.mzmine.chartbasics.gestures.ChartGestureHandler) ValueMarker(org.jfree.chart.plot.ValueMarker) MultiChoiceComponent(net.sf.mzmine.parameters.parametertypes.MultiChoiceComponent) ParameterSet(net.sf.mzmine.parameters.ParameterSet) Event(net.sf.mzmine.chartbasics.gestures.ChartGesture.Event) JFileChooser(javax.swing.JFileChooser) BorderLayout(java.awt.BorderLayout) JComboBox(javax.swing.JComboBox) Image(java.awt.Image) Key(net.sf.mzmine.chartbasics.gestures.ChartGesture.Key) Font(java.awt.Font) Range(com.google.common.collect.Range) MZRangeComponent(net.sf.mzmine.parameters.parametertypes.ranges.MZRangeComponent) Icon(javax.swing.Icon) Logger(java.util.logging.Logger) StandardCharsets(java.nio.charset.StandardCharsets) Box(javax.swing.Box) ChartGestureDragDiffEvent(net.sf.mzmine.chartbasics.gestures.ChartGestureDragDiffEvent) Dimension(java.awt.Dimension) List(java.util.List) Stream(java.util.stream.Stream) XYDataset(org.jfree.data.xy.XYDataset) Entry(java.util.Map.Entry) JCheckBox(javax.swing.JCheckBox) Entity(net.sf.mzmine.chartbasics.gestures.ChartGesture.Entity) RTRangeComponent(net.sf.mzmine.parameters.parametertypes.ranges.RTRangeComponent) BasicStroke(java.awt.BasicStroke) JPanel(javax.swing.JPanel) MZmineCore(net.sf.mzmine.main.MZmineCore) ColorPalettes(net.sf.mzmine.util.ColorPalettes) JTextField(javax.swing.JTextField) FileNameExtensionFilter(javax.swing.filechooser.FileNameExtensionFilter) MzRangeFormulaCalculatorModule(net.sf.mzmine.modules.tools.mzrangecalculator.MzRangeFormulaCalculatorModule) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) ArrayUtils(org.apache.commons.lang3.ArrayUtils) NumberFormat(java.text.NumberFormat) Button(net.sf.mzmine.chartbasics.gestures.ChartGesture.Button) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) GridLayout(java.awt.GridLayout) IntegerComponent(net.sf.mzmine.parameters.parametertypes.IntegerComponent) FileNameComponent(net.sf.mzmine.parameters.parametertypes.filenames.FileNameComponent) DelayedDocumentListener(net.sf.mzmine.framework.listener.DelayedDocumentListener) Files(com.google.common.io.Files) ChartGesture(net.sf.mzmine.chartbasics.gestures.ChartGesture) TxtWriter(net.sf.mzmine.util.io.TxtWriter) ImageIcon(javax.swing.ImageIcon) TICPlot(net.sf.mzmine.modules.visualization.tic.TICPlot) ParameterSetupDialog(net.sf.mzmine.parameters.dialogs.ParameterSetupDialog) BoxLayout(javax.swing.BoxLayout) Stroke(java.awt.Stroke) FlowLayout(java.awt.FlowLayout) MZTolerance(net.sf.mzmine.parameters.parametertypes.tolerances.MZTolerance) JButton(javax.swing.JButton) KovatsIndex(net.sf.mzmine.modules.tools.kovats.KovatsValues.KovatsIndex) TICPlotType(net.sf.mzmine.modules.visualization.tic.TICPlotType) MigLayout(net.miginfocom.swing.MigLayout) Window(java.awt.Window) DecimalFormat(java.text.DecimalFormat) RawDataFilesSelection(net.sf.mzmine.parameters.parametertypes.selectors.RawDataFilesSelection) TICSumDataSet(net.sf.mzmine.modules.visualization.tic.TICSumDataSet) IOException(java.io.IOException) IonizationType(net.sf.mzmine.datamodel.IonizationType) File(java.io.File) Consumer(java.util.function.Consumer) RectangleInsets(org.jfree.chart.ui.RectangleInsets) TreeMap(java.util.TreeMap) ChartGestureDragDiffHandler(net.sf.mzmine.chartbasics.gestures.ChartGestureDragDiffHandler) JLabel(javax.swing.JLabel) RawDataFilesSelectionType(net.sf.mzmine.parameters.parametertypes.selectors.RawDataFilesSelectionType) DialogLoggerUtil(net.sf.mzmine.util.DialogLoggerUtil) DoubleComponent(net.sf.mzmine.parameters.parametertypes.DoubleComponent) DoubleComponent(net.sf.mzmine.parameters.parametertypes.DoubleComponent) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) MigLayout(net.miginfocom.swing.MigLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) MZRangeComponent(net.sf.mzmine.parameters.parametertypes.ranges.MZRangeComponent) JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) DelayedDocumentListener(net.sf.mzmine.framework.listener.DelayedDocumentListener) RTRangeComponent(net.sf.mzmine.parameters.parametertypes.ranges.RTRangeComponent)

Aggregations

DoubleComponent (net.sf.mzmine.parameters.parametertypes.DoubleComponent)3 BorderLayout (java.awt.BorderLayout)2 Color (java.awt.Color)2 Dimension (java.awt.Dimension)2 Font (java.awt.Font)2 GridLayout (java.awt.GridLayout)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 Logger (java.util.logging.Logger)2 Stream (java.util.stream.Stream)2 JButton (javax.swing.JButton)2 JComboBox (javax.swing.JComboBox)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 MigLayout (net.miginfocom.swing.MigLayout)2 DelayedDocumentListener (net.sf.mzmine.framework.listener.DelayedDocumentListener)2 MZmineCore (net.sf.mzmine.main.MZmineCore)2 IntegerComponent (net.sf.mzmine.parameters.parametertypes.IntegerComponent)2