private void writeDataElement(XmlSerializer xml, String name, SimpleData value, int depth) throws IOException { String elemName = null; String text = null; if (value instanceof TagData) { elemName = TAG_ELEM; } else if (value instanceof DateData) { elemName = DATE_ELEM; Date d = ((DateData) value).getValue(); if (d != null) text = XMLUtils.saveDate(d); } else if (value instanceof NumberData) { elemName = NUMBER_ELEM; text = numberFormat.format(((NumberData) value).getDouble()); } else { elemName = STRING_ELEM; text = value.toString(); } if (elemName != null) { indent(xml, depth); xml.startTag(null, elemName); xml.attribute(null, NAME_ATTR, name); if (text != null) xml.text(text); xml.endTag(null, elemName); xml.ignorableWhitespace(NEWLINE); } }
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-right:2px' width='16' height='23' "); 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]!'>"); } }
private String getString(String path, String name) { SimpleData sd = getValue(path, name); return (sd == null ? null : sd.format()); }