Search in sources :

Example 6 with DefectPhase

use of net.sourceforge.processdash.log.defects.DefectPhase in project processdash by dtuma.

the class DefectDialog method phaseComboBox.

private JComboBox phaseComboBox(DefectPhaseList phases, int selectedPos) {
    JComboBox result = new JComboBox();
    result.setRenderer(new DefectPhaseItemRenderer());
    for (DefectPhase p : phases) result.addItem(p);
    if (selectedPos != -1)
        result.setSelectedIndex(selectedPos);
    return result;
}
Also used : JComboBox(javax.swing.JComboBox) DefectPhase(net.sourceforge.processdash.log.defects.DefectPhase)

Example 7 with DefectPhase

use of net.sourceforge.processdash.log.defects.DefectPhase in project processdash by dtuma.

the class DefectPhaseItemRenderer method checkForMultipleWorkflows.

private void checkForMultipleWorkflows(JList list) {
    int numItems = list.getModel().getSize();
    if (numItems == lastScannedSize)
        return;
    hasMultipleProcesses = false;
    String processNameFound = null;
    for (int i = numItems; i-- > 0; ) {
        DefectPhase p = (DefectPhase) list.getModel().getElementAt(i);
        String oneName = p.processName;
        if (oneName != null) {
            if (processNameFound == null)
                processNameFound = oneName;
            else if (!processNameFound.equals(oneName))
                hasMultipleProcesses = true;
        }
    }
    lastScannedSize = numItems;
}
Also used : DefectPhase(net.sourceforge.processdash.log.defects.DefectPhase)

Example 8 with DefectPhase

use of net.sourceforge.processdash.log.defects.DefectPhase in project processdash by dtuma.

the class DefectPhaseItemRenderer method getListCellRendererComponent.

@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    checkForMultipleWorkflows(list);
    Object display = (value == MorePhaseOptionsHandler.MORE_OPTIONS ? moreItemText : value);
    super.getListCellRendererComponent(list, display, index, isSelected, cellHasFocus);
    if (index == -1 || hasMultipleProcesses == false)
        return this;
    DefectPhase phase = (DefectPhase) value;
    boolean isFirstPhase = isFirstPhase(list, phase, index);
    separator.setVisible(index > 0 && isFirstPhase);
    label.setText(phase.processName);
    label.setVisible(isFirstPhase);
    if (StringUtils.hasValue(phase.processName))
        setBorder(border);
    panel.add(this, BorderLayout.SOUTH);
    return panel;
}
Also used : DefectPhase(net.sourceforge.processdash.log.defects.DefectPhase)

Example 9 with DefectPhase

use of net.sourceforge.processdash.log.defects.DefectPhase 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)

Example 10 with DefectPhase

use of net.sourceforge.processdash.log.defects.DefectPhase in project processdash by dtuma.

the class MorePhaseOptionsHandler method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    JComboBox cb = (JComboBox) e.getSource();
    DefectPhase selectedItem = (DefectPhase) cb.getSelectedItem();
    if (selectedItem == MORE_OPTIONS) {
        cb.hidePopup();
        DefectPhase p = showMorePhasesDialog(cb);
        if (p != null)
            DefectDialog.phaseComboSelect(cb, lastSelectedPhase = p);
        else
            cb.setSelectedItem(lastSelectedPhase);
    } else {
        lastSelectedPhase = selectedItem;
    }
}
Also used : JComboBox(javax.swing.JComboBox) DefectPhase(net.sourceforge.processdash.log.defects.DefectPhase)

Aggregations

DefectPhase (net.sourceforge.processdash.log.defects.DefectPhase)11 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)3 JComboBox (javax.swing.JComboBox)2 Phase (net.sourceforge.processdash.process.WorkflowInfo.Phase)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 JScrollPane (javax.swing.JScrollPane)1 JTree (javax.swing.JTree)1 TreeNode (javax.swing.tree.TreeNode)1 TreePath (javax.swing.tree.TreePath)1 Workflow (net.sourceforge.processdash.process.WorkflowInfo.Workflow)1 JOptionPaneClickHandler (net.sourceforge.processdash.ui.lib.JOptionPaneClickHandler)1