Search in sources :

Example 91 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class TimeLogMessageHandler method saveModification.

private void saveModification(MessageEvent message, TimeLogEntry mod) {
    // if the mod specifies a node ID, resolve it to an actual path
    String path = mod.getPath();
    if (path != null && !path.startsWith("/")) {
        PropertyKey key = ctx.getHierarchy().findKeyByNodeID(path);
        if (key != null) {
            TimeLogEntry setPath = new TimeLogEntryVO(mod.getID(), key.path(), null, 0, 0, null);
            mod = TimeLogEntryVO.applyChanges(mod, setPath, true);
        } else {
            logger.warning("When handling message with ID '" + message.getMessageId() + "', could not find any node with ID '" + path + "'. Discarding time log entry.");
            return;
        }
    }
    // add the modification to the dashboard time log
    DashboardTimeLog timeLog = (DashboardTimeLog) ctx.getTimeLog();
    ChangeFlaggedTimeLogEntry cftle = (ChangeFlaggedTimeLogEntry) mod;
    timeLog.addModification(cftle);
    // notify the time logging model about external additions
    if (cftle.getChangeFlag() == ChangeFlagged.ADDED)
        timeLog.getTimeLoggingModel().handleExternalAddition(mod);
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 92 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey 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();
}
Also used : Enumeration(java.util.Enumeration) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) DefectLogID(net.sourceforge.processdash.log.defects.DefectLogID) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 93 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class DefectLogEditor method reload.

protected void reload() {
    PropertyKey pKey;
    Prop prop;
    DefectLog dl;
    String defLogName;
    Defect[] defects;
    defectLogs.clear();
    Enumeration pKeys = useProps.keys();
    while (pKeys.hasMoreElements()) {
        pKey = (PropertyKey) pKeys.nextElement();
        prop = useProps.pget(pKey);
        defLogName = prop.getDefectLog();
        if (defLogName != null && defLogName.length() != 0) {
            dl = new DefectLog(dashboard.getDirectory() + defLogName, pKey.path(), data);
            defects = dl.readDefects();
            defectLogs.put(pKey, new DefectListID(pKey, dl, defects));
        }
    }
}
Also used : DefectLog(net.sourceforge.processdash.log.defects.DefectLog) Enumeration(java.util.Enumeration) Prop(net.sourceforge.processdash.hier.Prop) Defect(net.sourceforge.processdash.log.defects.Defect) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 94 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class DefectLogEditor method reupdateImportActions.

private void reupdateImportActions() {
    DefaultMutableTreeNode selectedTreeNode = getSelectedNode();
    if (selectedTreeNode == null)
        return;
    PropertyKey selectedKey = treeModel.getPropKey(useProps, selectedTreeNode.getPath());
    if (selectedKey == null || hasDefLog(selectedKey) == false)
        return;
    PropertyKey currPhase = dashboard.getCurrentPhase();
    if (currPhase == null)
        return;
    if (currPhase.path().startsWith(selectedKey.path() + "/"))
        updateImportActions(currPhase, selectedKey);
}
Also used : DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 95 with PropertyKey

use of net.sourceforge.processdash.hier.PropertyKey in project processdash by dtuma.

the class DefectButton method updateAll.

private void updateAll() {
    PropertyKey currentPhase = parent.getActiveTaskModel().getNode();
    setPaths(currentPhase);
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Aggregations

PropertyKey (net.sourceforge.processdash.hier.PropertyKey)125 DashHierarchy (net.sourceforge.processdash.hier.DashHierarchy)40 Prop (net.sourceforge.processdash.hier.Prop)16 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)10 SimpleData (net.sourceforge.processdash.data.SimpleData)7 ArrayList (java.util.ArrayList)6 Enumeration (java.util.Enumeration)6 IOException (java.io.IOException)5 Iterator (java.util.Iterator)5 StringTokenizer (java.util.StringTokenizer)5 TreePath (javax.swing.tree.TreePath)5 ListData (net.sourceforge.processdash.data.ListData)5 DefectLog (net.sourceforge.processdash.log.defects.DefectLog)5 List (java.util.List)4 ProcessDashboard (net.sourceforge.processdash.ProcessDashboard)4 HierarchyAlterer (net.sourceforge.processdash.hier.HierarchyAlterer)4 HierarchyAlterationException (net.sourceforge.processdash.hier.HierarchyAlterer.HierarchyAlterationException)4 DefectLogID (net.sourceforge.processdash.log.defects.DefectLogID)4 TinyCGIException (net.sourceforge.processdash.net.http.TinyCGIException)4 Point (java.awt.Point)3