use of net.sourceforge.processdash.ev.ui.chart.HtmlEvChart in project processdash by dtuma.
the class EVReport method writeCharts.
protected List<ChartItem> writeCharts(EVTaskList evModel, EVSchedule schedule, EVTaskFilter filter, boolean hideNames, int width, int height, ChartListPurpose p, String singleChartId, Map<String, String> chartHelpMap) {
DashboardContext ctx = getDashboardContext();
Object exportMarker = parameters.get("EXPORT");
boolean filterInEffect = (filter != null);
boolean isRollup = (evModel instanceof EVTaskListRollup);
List<ChartItem> chartList = TaskScheduleChartUtil.getChartsForTaskList(evModel.getID(), getDataRepository(), filterInEffect, isRollup, hideNames, p);
for (Iterator i = chartList.iterator(); i.hasNext(); ) {
ChartItem chart = (ChartItem) i.next();
if (chart == null) {
i.remove();
continue;
}
try {
SnippetWidget w = chart.snip.getWidget("view", null);
if (w instanceof HtmlEvChart) {
String chartId = getChartId(chart);
if (chartHelpMap != null && w instanceof HelpAwareEvChart) {
String helpUri = ((HelpAwareEvChart) w).getHelpUri();
if (StringUtils.hasValue(helpUri))
chartHelpMap.put(chartId, helpUri);
}
if (singleChartId != null && !singleChartId.equals(chartId))
continue;
Map environment = TaskScheduleChartUtil.getEnvironment(evModel, schedule, filter, chart.snip, ctx);
Map params = TaskScheduleChartUtil.getParameters(chart.settings);
params.put("title", chart.name);
params.put("width", Integer.toString(width));
params.put("height", Integer.toString(height));
params.put("noBorder", "t");
if (hideNames)
params.put(CUSTOMIZE_HIDE_NAMES, "t");
if (exportMarker != null)
params.put("EXPORT", exportMarker);
else if (singleChartId == null)
params.put("href", getChartDrillDownUrl(chartId));
// write the chart to an in-memory buffer. If any errors
// occur, we will fall out to the exception handler.
StringWriter buf = new StringWriter();
((HtmlEvChart) w).writeChartAsHtml(buf, environment, params);
// The generation of the chart was successful. Write out
// the chart, surrounded by a DIV to control layout.
out.write("<div class='evChartItem' style='width:" + width + "px; height:" + height + "px'>");
out.write(buf.toString());
out.write("</div>");
} else {
i.remove();
}
out.write(" ");
} catch (Exception e) {
logger.log(Level.SEVERE, "Unexpected error when displaying " + "EV snippet widget with id '" + chart.snip.getId() + "'", e);
}
}
return chartList;
}
use of net.sourceforge.processdash.ev.ui.chart.HtmlEvChart in project processdash by dtuma.
the class EVReport method writeChartOrderingItem.
private boolean writeChartOrderingItem(ChartItem chart) {
if (chart == null)
return false;
try {
SnippetWidget w = chart.snip.getWidget("view", null);
if (w instanceof HtmlEvChart) {
out.write("<div class='chartOrderItem'>");
out.write("<input type='hidden' name='chartOrder' value='");
out.write(HTMLUtils.escapeEntities(getChartId(chart)));
out.write("'>");
out.write(HTMLUtils.escapeEntities(chart.name));
out.write("</div>\n");
}
} catch (Exception e) {
}
return true;
}
Aggregations