Search in sources :

Example 1 with DPPModuleTreeNode

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode in project mzmine2 by mzmine.

the class ProcessingComponent method setupTreeViews.

private void setupTreeViews() {
    tiProcessingRoot = new DefaultMutableTreeNode("Processing queues");
    msLevelNodes = new DPPMSLevelTreeNode[MSLevel.cropValues().length];
    for (MSLevel mslevel : MSLevel.cropValues()) {
        msLevelNodes[mslevel.ordinal()] = new DPPMSLevelTreeNode(mslevel);
        tiProcessingRoot.add(msLevelNodes[mslevel.ordinal()]);
    }
    tiAllModulesRoot = new DefaultMutableTreeNode("Modules");
    // create category items dynamically, if a new category is added later on.
    DPPModuleCategoryTreeNode[] moduleCategories = new DPPModuleCategoryTreeNode[ModuleSubCategory.values().length];
    for (int i = 0; i < moduleCategories.length; i++) {
        moduleCategories[i] = new DPPModuleCategoryTreeNode(ModuleSubCategory.values()[i]);
        tiAllModulesRoot.add(moduleCategories[i]);
    }
    // add modules to their module category items
    Collection<MZmineModule> moduleList = MZmineCore.getAllModules();
    for (MZmineModule module : moduleList) {
        if (module instanceof DataPointProcessingModule) {
            DataPointProcessingModule dppm = (DataPointProcessingModule) module;
            // add each module as a child of the module category items
            for (DPPModuleCategoryTreeNode catItem : moduleCategories) {
                if (dppm.getModuleSubCategory().equals(catItem.getCategory())) {
                    catItem.add(new DPPModuleTreeNode(dppm));
                }
            }
        }
    }
    // add the categories to the root item
    tvProcessing = new JTree(tiProcessingRoot);
    tvAllModules = new JTree(tiAllModulesRoot);
    tvProcessing.setCellRenderer(new DisableableTreeCellRenderer());
    tvAllModules.setRootVisible(true);
    tvProcessing.setRootVisible(true);
    expandAllNodes(tvAllModules);
}
Also used : DisableableTreeCellRenderer(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DisableableTreeCellRenderer) DPPMSLevelTreeNode(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPMSLevelTreeNode) JTree(javax.swing.JTree) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DPPModuleCategoryTreeNode(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleCategoryTreeNode) DPPModuleTreeNode(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode) DataPointProcessingModule(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.DataPointProcessingModule) MSLevel(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.MSLevel) MZmineModule(net.sf.mzmine.modules.MZmineModule)

Example 2 with DPPModuleTreeNode

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode in project mzmine2 by mzmine.

the class ProcessingComponent method setParameters.

/**
 * Opens the parameter setup dialog of the selected module.
 */
private void setParameters(@Nonnull DefaultMutableTreeNode _selected) {
    if (_selected == null || !(_selected instanceof DPPModuleTreeNode))
        return;
    DPPModuleTreeNode selected = (DPPModuleTreeNode) _selected;
    ParameterSet stepParameters = selected.getParameters();
    if (stepParameters.getParameters().length > 0 && !selected.isDialogShowing()) {
        selected.setDialogShowing(true);
        ExitCode exitCode = stepParameters.showSetupDialog(null, true);
        selected.setDialogShowing(false);
        if (exitCode == ExitCode.OK) {
            // store the parameters in the tree item
            selected.setParameters(stepParameters);
        // sendValueWrapper(); // update the list
        }
    }
}
Also used : ParameterSet(net.sf.mzmine.parameters.ParameterSet) DPPModuleTreeNode(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode) ExitCode(net.sf.mzmine.util.ExitCode)

Example 3 with DPPModuleTreeNode

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode in project mzmine2 by mzmine.

the class ProcessingComponent method removeModule.

/**
 * Removes the selected module in the tvProcessingList from the list
 */
private void removeModule() {
    DefaultMutableTreeNode selected = getSelectedItem(tvProcessing);
    if (selected == null)
        return;
    if (selected instanceof DPPModuleTreeNode) {
        DefaultMutableTreeNode parent = (DefaultMutableTreeNode) selected.getParent();
        if (parent instanceof DPPMSLevelTreeNode && ((DPPMSLevelTreeNode) parent).isEnabled()) {
            parent.remove(selected);
            logger.finest("Removed module " + ((DPPModuleTreeNode) selected).getModule().getName() + " from processing list.");
        }
    } else {
        logger.finest("Cannot remove item " + selected.toString() + " from processing list.");
    }
    ((DefaultTreeModel) tvProcessing.getModel()).reload();
    expandAllNodes(tvProcessing);
}
Also used : DPPMSLevelTreeNode(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPMSLevelTreeNode) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DPPModuleTreeNode(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Example 4 with DPPModuleTreeNode

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode in project mzmine2 by mzmine.

the class ProcessingComponent method getProcessingQueueFromNode.

/**
 * Creates DataPointProcessingQueues from the items currently in the tree view.
 *
 * @return Instance of DataPointProcessingQueue.
 */
@Nonnull
public DataPointProcessingQueue getProcessingQueueFromNode(DPPMSLevelTreeNode parentNode) {
    DataPointProcessingQueue list = new DataPointProcessingQueue();
    if (parentNode.getChildCount() < 1)
        return list;
    Enumeration<?> nodes = parentNode.children();
    do {
        DefaultMutableTreeNode item = (DefaultMutableTreeNode) nodes.nextElement();
        if (!(item instanceof DPPModuleTreeNode))
            continue;
        DPPModuleTreeNode moduleitem = (DPPModuleTreeNode) item;
        list.add(createProcessingStep(moduleitem));
    } while (nodes.hasMoreElements());
    return list;
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DPPModuleTreeNode(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode) DataPointProcessingQueue(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.DataPointProcessingQueue) Nonnull(javax.annotation.Nonnull)

Example 5 with DPPModuleTreeNode

use of net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode in project mzmine2 by mzmine.

the class ProcessingComponent method addModule.

/**
 * Adds a module in the tvAllModules to the processing list
 */
private void addModule(@Nonnull DPPModuleTreeNode node, @Nonnull DPPMSLevelTreeNode target) {
    if (nodeContains(target, node)) {
        logger.finest("Cannot add module " + ((DPPModuleTreeNode) node).getModule().getName() + " to processing list twice.");
        return;
    }
    if (!moduleFitsMSLevel(node.getModule(), target)) {
        logger.warning("The use of module \"" + node.getModule().getName() + "\" (" + node.getModule().getApplicableMSLevel() + ") is not recommended for processing scans of MS-level \"" + target.getMSLevel().toString() + "\". This might lead to unexpected results.");
    }
    DefaultMutableTreeNode root = (DefaultMutableTreeNode) tvProcessing.getModel().getRoot();
    ((DefaultTreeModel) tvProcessing.getModel()).insertNodeInto(node, target, target.getChildCount());
    logger.finest("Added module " + node.getModule().getName() + " to " + target.getMSLevel().toString() + " processing list.");
    expandAllNodes(tvProcessing);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DPPModuleTreeNode(net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode) DefaultTreeModel(javax.swing.tree.DefaultTreeModel)

Aggregations

DPPModuleTreeNode (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleTreeNode)7 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)5 DPPMSLevelTreeNode (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPMSLevelTreeNode)4 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)3 Nonnull (javax.annotation.Nonnull)1 JTree (javax.swing.JTree)1 MZmineModule (net.sf.mzmine.modules.MZmineModule)1 DataPointProcessingModule (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.DataPointProcessingModule)1 DataPointProcessingQueue (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.DataPointProcessingQueue)1 MSLevel (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.MSLevel)1 DPPModuleCategoryTreeNode (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DPPModuleCategoryTreeNode)1 DisableableTreeCellRenderer (net.sf.mzmine.modules.visualization.spectra.simplespectra.datapointprocessing.datamodel.customguicomponents.DisableableTreeCellRenderer)1 ParameterSet (net.sf.mzmine.parameters.ParameterSet)1 ExitCode (net.sf.mzmine.util.ExitCode)1