Search in sources :

Example 31 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class IncludeTeamTools method getValue.

private String getValue(String name) {
    DataRepository data = getDataRepository();
    String dataName = DataRepository.createDataName(getPrefix(), name);
    SimpleData d = data.getSimpleValue(dataName);
    if (d == null)
        return null;
    String result = d.format();
    if (result == null || result.trim().length() == 0)
        return null;
    else
        return result;
}
Also used : DataRepository(net.sourceforge.processdash.data.repository.DataRepository) SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 32 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class PlanSummaryNameHeader method writeHierarchyIconNonFrame.

private void writeHierarchyIconNonFrame(String projectRoot, String uri) {
    String pathDisplay = "/";
    SimpleData wbsData = getDataContext().getSimpleValue("Project_WBS_ID_Filter");
    if (wbsData != null) {
        pathDisplay = wbsData.format();
        int slashPos = pathDisplay.indexOf('/');
        if (slashPos == -1)
            pathDisplay = "/";
        else
            pathDisplay = pathDisplay.substring(slashPos + 1);
    }
    boolean exporting = parameters.containsKey("EXPORT");
    if (!exporting) {
        String href = WebServer.urlEncodePath(projectRoot) + "//team/setup/" + uri;
        writeHyperlink(href, getSnippetParams(false, false));
    }
    out.print("<img border=0 src='/Images/hier.png' " + "style='margin: 0px 2px 0px 10px; position:relative; top:3px; width:16px; height:23px' ");
    if (!exporting)
        out.print("title='Drill-down in Hierarchy'></a>");
    else if ("/".equals(pathDisplay))
        out.print("title='Showing data from entire project hierarchy'>");
    else
        out.print("title='Hierarchy Drill-down is in effect'>");
    out.print(HTMLUtils.escapeEntities(pathDisplay));
    String dashVersion = (String) env.get("Dash_Package_pspdash");
    if (!exporting && VersionUtils.compareVersions(dashVersion, "1.15.2") > 0) {
        // this is a single rollup with a single data-driven filter. If
        // two pages are open to the same report, a filter change in one
        // will affect the data in the other. Add "active" data elements
        // to the page that will trigger a refresh in that scenario.
        // (Note that we only do this for version 1.15.3 and higher,
        // because this can trigger an infinite reload loop in earlier
        // versions of the dashboard.)
        out.print("<input type='hidden' name='[Project_WBS_ID_Filter]!'>");
        out.print("<input type='hidden' name='[Label//Filter]!'>");
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 33 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class SelectLabelFilter method getCurrentFilter.

/** If a filter is in effect for the given project, return its text.  If a
     * filter is not in effect, but one would make sense, return the empty
     * string.  Otherwise, return null.
     */
public static String getCurrentFilter(DataRepository data, String projectRoot) {
    // check to see if a filter is in effect.  If so, return its text.
    String dataName = DataRepository.createDataName(projectRoot, FILTER_DATA_NAME);
    SimpleData filterValue = data.getSimpleValue(dataName);
    if (filterValue != null && filterValue.test())
        return filterValue.format();
    // No filter is in effect.  Does a filter even make sense?  Check to
    // see if any labels are defined for this project.
    dataName = DataRepository.createDataName(projectRoot, LABELS_DATA_NAME);
    SimpleData labelsValue = data.getSimpleValue(dataName);
    if (labelsValue != null && labelsValue.test())
        return "";
    else
        return null;
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData)

Example 34 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class SelectLabelFilter method getDefinedLabelsArray.

private JSONArray getDefinedLabelsArray(String projectRoot) {
    String dataName = DataRepository.createDataName(projectRoot, LABELS_DATA_NAME);
    SimpleData labelsValue = getDataRepository().getSimpleValue(dataName);
    ListData list = ListData.asListData(labelsValue);
    JSONArray result = new JSONArray();
    try {
        result.addAll(Globsearch.getTags(list));
        Collections.sort(result, String.CASE_INSENSITIVE_ORDER);
    } catch (Throwable t) {
    // the Globsearch.getTags() method was added in PD 1.14.5.  In
    // earlier versions, this will throw an exception.  Gracefully
    // degrade and diable autocompletion support.
    }
    return result;
}
Also used : JSONArray(org.json.simple.JSONArray) SimpleData(net.sourceforge.processdash.data.SimpleData) ListData(net.sourceforge.processdash.data.ListData)

Example 35 with SimpleData

use of net.sourceforge.processdash.data.SimpleData in project processdash by dtuma.

the class UserDataWriter method writeActualDataForNode.

private void writeActualDataForNode(XmlSerializer ser, DashHierarchy hier, PropertyKey node) throws IOException {
    String path = node.path();
    String wbsID = getWbsOrClientIdForPath(path);
    if (!hasValue(wbsID))
        return;
    SimpleData actualTime = getData(path, "Time");
    SimpleData startDate = getData(path, "Started");
    SimpleData completionDate = getData(path, "Completed");
    boolean reportSubtasks = isPSPTaskWithReportableSubtaskData(hier, node, actualTime, completionDate);
    if (hasValue(actualTime) || hasValue(startDate) || hasValue(completionDate) || reportSubtasks) {
        ser.startTag(null, ACTUAL_DATA_TAG);
        ser.attribute(null, WBS_ID_ATTR, wbsID);
        writeTimeDataAttr(ser, TIME_ATTR, actualTime);
        writeActualDataAttr(ser, START_DATE_ATTR, startDate);
        writeActualDataAttr(ser, COMPLETION_DATE_ATTR, completionDate);
        if (reportSubtasks)
            writeActualDataForPSPPhases(ser, hier, node);
        ser.endTag(null, ACTUAL_DATA_TAG);
    }
}
Also used : SimpleData(net.sourceforge.processdash.data.SimpleData)

Aggregations

SimpleData (net.sourceforge.processdash.data.SimpleData)164 ListData (net.sourceforge.processdash.data.ListData)20 DoubleData (net.sourceforge.processdash.data.DoubleData)15 SaveableData (net.sourceforge.processdash.data.SaveableData)14 StringData (net.sourceforge.processdash.data.StringData)13 IOException (java.io.IOException)11 DataRepository (net.sourceforge.processdash.data.repository.DataRepository)11 DateData (net.sourceforge.processdash.data.DateData)10 Iterator (java.util.Iterator)9 List (java.util.List)7 PropertyKey (net.sourceforge.processdash.hier.PropertyKey)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 ImmutableDoubleData (net.sourceforge.processdash.data.ImmutableDoubleData)6 NumberData (net.sourceforge.processdash.data.NumberData)6 Element (org.w3c.dom.Element)6 Map (java.util.Map)5 DataContext (net.sourceforge.processdash.data.DataContext)5 EscapeString (net.sourceforge.processdash.util.EscapeString)5 File (java.io.File)4