use of net.sourceforge.processdash.log.defects.DefectLogID in project processdash by dtuma.
the class DefectLogEditor method applyFilter.
void applyFilter() {
PropertyKey selectedKey = null, defectLogKey = null;
PropertyKey key = null;
DefaultMutableTreeNode selected = getSelectedNode();
String extraPathFilter = null;
if (selected != null) {
key = selectedKey = treeModel.getPropKey(useProps, selected.getPath());
if (key != null) {
String selectedPath = key.path();
DefectLogID logid = useProps.defectLog(key, "unimportant");
if (logid != null) {
defectLogKey = logid.path;
if (logid.path != key) {
key = logid.path;
String defectLogPath = key.path();
extraPathFilter = selectedPath.substring(defectLogPath.length() + 1);
} else {
PropertyKey currPhase = dashboard.getCurrentPhase();
if (currPhase != null && currPhase.getParent().equals(selectedKey))
selectedKey = currPhase;
}
}
}
}
updateImportActions(selectedKey, defectLogKey);
// apply the filter and load the vector (and the table)
VTableModel model = (VTableModel) table.table.getModel();
Object[] row = new Object[11];
DefectListID dli;
DefectListEntry dle;
PropertyKey pk;
currentLog.removeAllElements();
model.setNumRows(0);
Enumeration dlList = defectLogs.keys();
while (dlList.hasMoreElements()) {
pk = (PropertyKey) dlList.nextElement();
if (key != null) {
if (!pk.key().equals(key.key()) && (!pk.isChildOf(key)))
// this one filtered
continue;
}
dli = (DefectListID) defectLogs.get(pk);
for (int ii = 0; ii < dli.defects.length; ii++) {
dle = new DefectListEntry(dli, ii);
if (extraPathFilter != null && !matchesExtraPath(dle.defect.phase_injected, extraPathFilter) && !matchesExtraPath(dle.defect.phase_removed, extraPathFilter))
continue;
currentLog.addElement(dle);
row[0] = dle.pk.path();
row[1] = dle.defect.number;
row[2] = dle.defect.defect_type;
row[3] = dle.defect.injected.phaseName;
row[4] = dle.defect.removed.phaseName;
row[5] = dle.defect.getLocalizedFixTime();
row[6] = Integer.toString(dle.defect.fix_count);
row[7] = dle.defect.fix_defect;
row[8] = dle.defect.fix_pending ? "*" : "";
row[9] = dle.defect.description;
row[10] = FormatUtil.formatDate(dle.defect.date);
model.addRow(row);
}
}
table.doResizeRepaint();
maybeEnableButtons();
}
Aggregations