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;
}
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;
}
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;
}
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;
}
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;
}
}
Aggregations