Search in sources :

Example 1 with MultiChoiceParameter

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

the class PeakListsComponent method actionPerformed.

public void actionPerformed(ActionEvent event) {
    Object src = event.getSource();
    if (src == detailsButton) {
        PeakListsSelectionType type = (PeakListsSelectionType) typeCombo.getSelectedItem();
        if (type == PeakListsSelectionType.SPECIFIC_PEAKLISTS) {
            final MultiChoiceParameter<PeakList> plsParameter = new MultiChoiceParameter<PeakList>("Select feature lists", "Select feature lists", MZmineCore.getProjectManager().getCurrentProject().getPeakLists(), currentValue.getSpecificPeakLists());
            final SimpleParameterSet paramSet = new SimpleParameterSet(new Parameter[] { plsParameter });
            final Window parent = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
            final ExitCode exitCode = paramSet.showSetupDialog(parent, true);
            if (exitCode == ExitCode.OK) {
                PeakList[] pls = paramSet.getParameter(plsParameter).getValue();
                currentValue.setSpecificPeakLists(pls);
            }
        }
        if (type == PeakListsSelectionType.NAME_PATTERN) {
            final StringParameter nameParameter = new StringParameter("Name pattern", "Set name pattern that may include wildcards (*), e.g. *mouse* matches any name that contains mouse", currentValue.getNamePattern());
            final SimpleParameterSet paramSet = new SimpleParameterSet(new Parameter[] { nameParameter });
            final Window parent = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
            final ExitCode exitCode = paramSet.showSetupDialog(parent, true);
            if (exitCode == ExitCode.OK) {
                String namePattern = paramSet.getParameter(nameParameter).getValue();
                currentValue.setNamePattern(namePattern);
            }
        }
    }
    if (src == typeCombo) {
        PeakListsSelectionType type = (PeakListsSelectionType) typeCombo.getSelectedItem();
        currentValue.setSelectionType(type);
        detailsButton.setEnabled((type == PeakListsSelectionType.NAME_PATTERN) || (type == PeakListsSelectionType.SPECIFIC_PEAKLISTS));
    }
    updateNumPeakLists();
}
Also used : Window(java.awt.Window) StringParameter(net.sf.mzmine.parameters.parametertypes.StringParameter) SimpleParameterSet(net.sf.mzmine.parameters.impl.SimpleParameterSet) ExitCode(net.sf.mzmine.util.ExitCode) PeakList(net.sf.mzmine.datamodel.PeakList) MultiChoiceParameter(net.sf.mzmine.parameters.parametertypes.MultiChoiceParameter)

Example 2 with MultiChoiceParameter

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

the class RawDataFilesComponent method actionPerformed.

public void actionPerformed(ActionEvent event) {
    Object src = event.getSource();
    if (src == detailsButton) {
        RawDataFilesSelectionType type = (RawDataFilesSelectionType) typeCombo.getSelectedItem();
        if (type == RawDataFilesSelectionType.SPECIFIC_FILES) {
            final MultiChoiceParameter<RawDataFile> filesParameter = new MultiChoiceParameter<RawDataFile>("Select files", "Select files", MZmineCore.getProjectManager().getCurrentProject().getDataFiles(), currentValue.getSpecificFiles());
            final SimpleParameterSet paramSet = new SimpleParameterSet(new Parameter[] { filesParameter });
            final Window parent = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
            final ExitCode exitCode = paramSet.showSetupDialog(parent, true);
            if (exitCode == ExitCode.OK) {
                RawDataFile[] files = paramSet.getParameter(filesParameter).getValue();
                currentValue.setSpecificFiles(files);
            }
        }
        if (type == RawDataFilesSelectionType.NAME_PATTERN) {
            final StringParameter nameParameter = new StringParameter("Name pattern", "Set name pattern that may include wildcards (*), e.g. *mouse* matches any name that contains mouse", currentValue.getNamePattern());
            final SimpleParameterSet paramSet = new SimpleParameterSet(new Parameter[] { nameParameter });
            final Window parent = (Window) SwingUtilities.getAncestorOfClass(Window.class, this);
            final ExitCode exitCode = paramSet.showSetupDialog(parent, true);
            if (exitCode == ExitCode.OK) {
                String namePattern = paramSet.getParameter(nameParameter).getValue();
                currentValue.setNamePattern(namePattern);
            }
        }
    }
    if (src == typeCombo) {
        RawDataFilesSelectionType type = (RawDataFilesSelectionType) typeCombo.getSelectedItem();
        currentValue.setSelectionType(type);
        detailsButton.setEnabled((type == RawDataFilesSelectionType.NAME_PATTERN) || (type == RawDataFilesSelectionType.SPECIFIC_FILES));
    }
    updateNumFiles();
}
Also used : Window(java.awt.Window) StringParameter(net.sf.mzmine.parameters.parametertypes.StringParameter) RawDataFile(net.sf.mzmine.datamodel.RawDataFile) SimpleParameterSet(net.sf.mzmine.parameters.impl.SimpleParameterSet) ExitCode(net.sf.mzmine.util.ExitCode) MultiChoiceParameter(net.sf.mzmine.parameters.parametertypes.MultiChoiceParameter)

Aggregations

Window (java.awt.Window)2 SimpleParameterSet (net.sf.mzmine.parameters.impl.SimpleParameterSet)2 MultiChoiceParameter (net.sf.mzmine.parameters.parametertypes.MultiChoiceParameter)2 StringParameter (net.sf.mzmine.parameters.parametertypes.StringParameter)2 ExitCode (net.sf.mzmine.util.ExitCode)2 PeakList (net.sf.mzmine.datamodel.PeakList)1 RawDataFile (net.sf.mzmine.datamodel.RawDataFile)1