Search in sources :

Example 1 with Workflow

use of net.sourceforge.processdash.process.WorkflowInfo.Workflow in project processdash by dtuma.

the class MorePhaseOptionsHandler method buildTree.

private JTree buildTree() {
    // build a tree model to contain the phase options.
    DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    // Add all known workflows to the model.
    for (Workflow workflow : workflowPhases.workflowInfo.getWorkflows()) {
        DefaultMutableTreeNode workflowNode = new DefaultMutableTreeNode(workflow.getWorkflowName());
        root.add(workflowNode);
        for (Phase onePhase : workflow.getPhases()) {
            DefectPhase dp = new DefectPhase(onePhase);
            if (!"Postmortem".equals(dp.legacyPhase))
                workflowNode.add(new DefaultMutableTreeNode(dp));
        }
    }
    // Add MCF phases to the model.
    if (processPhases != null && !processPhases.isEmpty()) {
        String processName = processPhases.get(0).processName;
        if (!StringUtils.hasValue(processName))
            processName = resources.getString("More_Options.Process_Phases");
        DefaultMutableTreeNode mcfNode = new DefaultMutableTreeNode(processName);
        root.add(mcfNode);
        for (DefectPhase onePhase : processPhases) mcfNode.add(new DefaultMutableTreeNode(onePhase));
    }
    // Create a JTree for this model.
    JTree result = new JTree(root);
    result.setRootVisible(false);
    result.setShowsRootHandles(true);
    result.setToggleClickCount(4);
    result.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    result.setVisibleRowCount(10);
    new JOptionPaneClickHandler().install(result);
    return result;
}
Also used : JTree(javax.swing.JTree) DefectPhase(net.sourceforge.processdash.log.defects.DefectPhase) Phase(net.sourceforge.processdash.process.WorkflowInfo.Phase) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) Workflow(net.sourceforge.processdash.process.WorkflowInfo.Workflow) DefectPhase(net.sourceforge.processdash.log.defects.DefectPhase) JOptionPaneClickHandler(net.sourceforge.processdash.ui.lib.JOptionPaneClickHandler)

Aggregations

JTree (javax.swing.JTree)1 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 DefectPhase (net.sourceforge.processdash.log.defects.DefectPhase)1 Phase (net.sourceforge.processdash.process.WorkflowInfo.Phase)1 Workflow (net.sourceforge.processdash.process.WorkflowInfo.Workflow)1 JOptionPaneClickHandler (net.sourceforge.processdash.ui.lib.JOptionPaneClickHandler)1