Search in sources :

Example 31 with PropertyKey

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

the class WorkflowProbeScriptSource method getProbeTaskPaths.

private List<String> getProbeTaskPaths(String path) {
    String workflowRoot = getWorkflowParent(path);
    PropertyKey workflowRootKey = context.getHierarchy().findExistingKey(workflowRoot);
    if (workflowRootKey == null)
        return Collections.EMPTY_LIST;
    List<String> result = new ArrayList();
    findProbeTasks(result, workflowRootKey);
    return result;
}
Also used : ArrayList(java.util.ArrayList) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 32 with PropertyKey

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

the class TemplateLoader method createScriptMaps.

private static void createScriptMaps(DashHierarchy templates) {
    Enumeration nodes = templates.keys();
    PropertyKey key;
    while (nodes.hasMoreElements()) {
        key = (PropertyKey) nodes.nextElement();
        if (key.getParent().equals(PropertyKey.ROOT))
            addScriptMaps(templates, key, null, null);
    }
}
Also used : Enumeration(java.util.Enumeration) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 33 with PropertyKey

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

the class SizeInventoryForm method writeContents.

public void writeContents() throws IOException {
    String prefix = getPrefix();
    if (prefix == null)
        prefix = "/";
    DashHierarchy hierarchy = getPSPProperties();
    PropertyKey key = hierarchy.findExistingKey(prefix);
    String uri = getURI();
    highlightTimestamp = getHighlightTimestamp();
    out.println(HTML_HEADER);
    out.println("<h2>");
    out.print(HTMLUtils.escapeEntities(prefix));
    out.println("</h2><form name='sizes'>");
    out.flush();
    if (!prefix.endsWith("/"))
        prefix = prefix + "/";
    expansionText = new StringBuffer();
    writeHierarchy(uri, prefix, key, hierarchy);
    if (highlightTimestamp > 0 && expansionText.length() == 0) {
        // if we were asked to highlight, but no matching sections were
        // found, clear the highlight request and draw all sections.
        highlightTimestamp = -1;
        writeHierarchy(uri, prefix, key, hierarchy);
    }
    if (highlightTimestamp <= 0)
        writeHierarchyExpanders(expansionText);
    expansionText = null;
    out.println("</form><script src='/data.js'>" + "document.writeln('<p>Problem loading the script!');" + "</script>");
    out.println("</body></html>");
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 34 with PropertyKey

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

the class GenericPlanSummaryForm method writeContents.

protected void writeContents() throws IOException {
    StringBuffer uri = new StringBuffer((String) env.get("SCRIPT_PATH"));
    uri.setLength(uri.length() - 6);
    uri.append(".shtm");
    String unit, units;
    DataRepository data = getDataRepository();
    String prefix = getPrefix();
    SimpleData d = data.getSimpleValue(prefix + "/" + UNITS_NAME);
    units = (d != null ? d.format() : null);
    if (units == null || units.trim().length() == 0)
        units = resources.getString("Default_Units");
    int semicolonPos = units.indexOf(';');
    if (semicolonPos > -1) {
        unit = units.substring(0, semicolonPos);
        units = units.substring(semicolonPos + 1);
    } else if (units.endsWith("s")) {
        unit = units.substring(0, units.length() - 1);
    } else {
        unit = units;
    }
    HTMLUtils.appendQuery(uri, "Unit", unit);
    HTMLUtils.appendQuery(uri, "Units", units);
    DashHierarchy props = getPSPProperties();
    PropertyKey self = props.findExistingKey(getPrefix());
    int numPhases = props.getNumChildren(self);
    for (int i = 0; i < numPhases; i++) HTMLUtils.appendQuery(uri, "Phases", props.getChildKey(self, i).name());
    String text = getRequestAsString(uri.toString());
    out.write(text);
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) DataRepository(net.sourceforge.processdash.data.repository.DataRepository) SimpleData(net.sourceforge.processdash.data.SimpleData) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 35 with PropertyKey

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

the class CycleSummaryForm method getCycleList.

/** Get the list of PSP3 cycle names under the current PSP3 task. */
private String[] getCycleList() {
    String prefix = (String) env.get("PATH_TRANSLATED");
    DashHierarchy props = getPSPProperties();
    PropertyKey self = props.findExistingKey(prefix);
    // WARNING: the "4" on the next line is a magic number which
    // depends on the structure of the PSP3 template.
    int numCycles = props.getNumChildren(self) - 4;
    if (numCycles < 0)
        numCycles = 0;
    String[] result = new String[numCycles];
    while (numCycles-- > 0) // WARNING: the "3" on the next line is a magic number which
    // depends on the structure of the PSP3 template.
    result[numCycles] = props.getChildKey(self, numCycles + 3).name();
    return result;
}
Also used : DashHierarchy(net.sourceforge.processdash.hier.DashHierarchy) 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