Search in sources :

Example 66 with PropertyKey

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

the class DashController method getTemplates.

public static Map getTemplates() {
    Prop templates = dash.templates.pget(PropertyKey.ROOT);
    TreeMap result = new TreeMap();
    for (int i = templates.getNumChildren(); i-- > 0; ) {
        PropertyKey childKey = templates.getChild(i);
        Prop child = dash.templates.pget(childKey);
        result.put(child.getID(), Prop.unqualifiedName(childKey.name()));
    }
    return result;
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) TreeMap(java.util.TreeMap) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 67 with PropertyKey

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

the class DashController method getDataAndDefectFilesInUse.

private static void getDataAndDefectFilesInUse(Set<String> filesInUse, PropertyKey node) {
    Prop p = dash.getHierarchy().pget(node);
    filesInUse.add(lower(p.getDataFile()));
    filesInUse.add(lower(p.getDefectLog()));
    for (int i = dash.getHierarchy().getNumChildren(node); i-- > 0; ) {
        PropertyKey child = dash.getHierarchy().getChildKey(node, i);
        getDataAndDefectFilesInUse(filesInUse, child);
    }
}
Also used : Prop(net.sourceforge.processdash.hier.Prop) PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 68 with PropertyKey

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

the class HTMLPreprocessor method processForTreeDirective.

/** process a fortree directive within the buffer */
private void processForTreeDirective(DirectiveMatch fortree) {
    StringBuffer text = fortree.buf;
    String blockNum = blockNum("fortree", fortree.directive);
    // find the matching endtree.
    DirectiveMatch endtree = new DirectiveMatch(text, blockNum + "endtree", fortree.end, true);
    if (!endtree.matches()) {
        // if the endtree is missing, delete this directive and abort.
        System.err.println("fortree directive without matching endtree - aborting.");
        fortree.replace("");
        return;
    }
    // determine the root prefix - possibly alter it based on the
    // directive's value for the startAt attribute.
    String rootPrefix = this.prefix;
    String startAt = fortree.getAttribute("startAt");
    if (startAt != null && startAt.length() > 0)
        rootPrefix = rootPrefix + "/" + startAt;
    PropertyKey rootNode = PropertyKey.fromPath(rootPrefix);
    // get the expandName from the directive.
    String expandName = fortree.getAttribute("expandName");
    // should the root node be included?
    boolean includeRoot = "true".equalsIgnoreCase(fortree.getAttribute("includeRoot"));
    // how deep should the iteration go?
    int maxDepth = Integer.MAX_VALUE;
    String depthStr = fortree.getAttribute("depth");
    if (depthStr != null)
        try {
            maxDepth = Integer.parseInt(depthStr);
        } catch (Exception e) {
        }
    // should the parent be displayed before or after children?
    boolean parentLast = "true".equalsIgnoreCase(fortree.getAttribute("parentLast"));
    // iterate over the tree and calculate the resulting contents.
    String loopContents = text.substring(fortree.end, endtree.begin);
    StringBuffer replacement = new StringBuffer();
    addSetDirective(replacement, "ROOT", rootPrefix);
    addSetDirective(replacement, "SPACER", SPACER);
    recurseTreeNode(replacement, loopContents, rootNode, 0, "", expandName, includeRoot, maxDepth, parentLast);
    // replace the directive with the iterated contents.  Note
    // that we explicitly replace the initial fortree tag with an
    // empty string, so the overall processing loop (in the
    // preprocess method) will process these iterated contents.
    text.replace(fortree.end, endtree.end, replacement.toString());
    fortree.replace("");
}
Also used : EscapeString(net.sourceforge.processdash.util.EscapeString) PropertyKey(net.sourceforge.processdash.hier.PropertyKey) MissingResourceException(java.util.MissingResourceException) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Example 69 with PropertyKey

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

the class SelectHierarchyNode method writeContents.

protected void writeContents() throws IOException {
    PropertyKey key = getStartingKey();
    if (key == null) {
        error();
        return;
    }
    String prefix = key.path();
    if ("/".equals(prefix))
        prefix = "";
    String prompt = getParameter("prompt");
    if (prompt == null)
        prompt = "Select a WBS item";
    prompt = HTMLUtils.escapeEntities(prompt);
    out.print("<html><head><title>");
    out.print(prompt);
    out.print("</title>\n" + "<link rel=stylesheet type='text/css' href='/style.css'>\n" + "<style>\n" + "  A:link    { color:black; text-decoration:none }\n" + "  A:visited { color:black; text-decoration:none }\n" + "  A:hover   { color:blue; text-decoration:underline }\n" + "</style><body>\n" + "<b>");
    out.print(prompt);
    out.print("</b><table>\n");
    String rootPrefix = prefix;
    initialize(getPSPProperties(), key, getRootId(), 0, rootPrefix);
    printTree(getPSPProperties(), key, getRootId(), 0, rootPrefix);
    out.println("</table>");
    String script = getScript();
    prefix = StringUtils.findAndReplace(prefix, "\\", "\\\\");
    prefix = StringUtils.findAndReplace(prefix, "'", "\\'");
    script = StringUtils.findAndReplace(script, "PREFIX", prefix);
    out.print(script);
    out.println("</body></html>");
}
Also used : PropertyKey(net.sourceforge.processdash.hier.PropertyKey)

Example 70 with PropertyKey

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

the class SelectLabelFilter method writeContents.

protected void writeContents() throws IOException {
    PropertyKey projectRootKey = getStartingKey();
    if (projectRootKey == null) {
        error();
        return;
    }
    String projectRoot = projectRootKey.path();
    String snippetDestUri = getParameter("destUri");
    out.print("<html><head><title>Choose Label Filter</title>\n");
    out.print(HTMLUtils.cssLinkHtml("/style.css"));
    out.print(HTMLUtils.cssLinkHtml("autocomplete.css"));
    out.print(HTMLUtils.scriptLinkHtml("/lib/prototype.js"));
    out.print(HTMLUtils.scriptLinkHtml("/lib/scriptaculous.js"));
    out.print("</head><body><h3>Choose Label Filter</h3>\n" + "<p>You can filter the view of project metrics, defects, and " + "earned value by selecting a label filter.  Only items from " + "the work breakdown structure whose labels match the filter " + "will be included.</p>");
    out.print("<form action='selectLabelFilter' method='POST'");
    if (snippetDestUri == null)
        out.print(" target='topFrame'>\n");
    else {
        out.print(">\n<input type='hidden' name='destUri' value=\"");
        out.print(HTMLUtils.escapeEntities(snippetDestUri));
        out.print("\">\n");
    }
    out.print("<table><tr>" + "<td><b>Label Filter:</b>&nbsp;</td>" + "<td><input type='text' name='filter' size='80' value='");
    String currentFilter = getCurrentFilter(getDataRepository(), projectRoot);
    if (currentFilter != null)
        out.print(HTMLUtils.escapeEntities(currentFilter));
    out.print("' id='labelFilter'/></td></tr>\n");
    out.print("<tr><td></td><td>" + "<input type='submit' name='apply' value='Apply Filter'/> " + "<input type='submit' name='remove' value='Remove Filter'/>" + "</td></tr></table></form>\n");
    out.print("<p>&nbsp;</p>");
    out.print("<p>Filters can describe complex search criteria. Here are " + "examples of several valid searches:<table border cellpadding=4 style='margin-left: 1cm'>" + "<tr><td>xyz</td><td>Choose all tasks that have the label <b>xyz</b></td></tr>\n" + "<tr><td>xyz*</td><td>Choose all tasks that have a label starting with the letters <b>xyz</b></td></tr>\n" + "<tr><td>xyz abc</td><td>Choose all tasks that have label <b>xyz</b> and label <b>abc</b></td></tr>\n" + "<tr><td>xyz | abc</td><td>Choose all tasks that have label <b>xyz</b> or label <b>abc</b></td></tr>\n" + "<tr><td>xyz -abc</td><td>Choose all tasks that have label <b>xyz</b> but not label <b>abc</b></td></tr>\n" + "<tr><td>(xyz -abc) | efg</td><td>Choose all tasks that have label <b>xyz</b> " + "and not label <b>abc</b>, or that have label <b>efg</b></td></tr>\n" + "</table>");
    out.print("<p>&nbsp;</p>");
    out.print("<p><i>Labels are attached to work breakdown structure " + "items using the Work Breakdown Structure editor, and are " + "copied to this project when you synchronize it to the WBS. " + "To perform these operations, see the Team Project Tools " + "and Settings page.</i></p>\n");
    JSONArray labels = getDefinedLabelsArray(projectRoot);
    if (!labels.isEmpty()) {
        out.write("<div id='autocomplete' style='display:none'></div>\n");
        out.write("<script language='JavaScript'>\n");
        out.write("    var labels = " + labels + ";\n");
        out.write("    new Autocompleter.Local('labelFilter', " + "'autocomplete', labels, " + "{ tokens: ' |()-'.split(''), partialChars: 1 });\n");
        out.write("</script>\n");
    }
    out.print("</body></html>\n");
}
Also used : JSONArray(org.json.simple.JSONArray) 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