ApplicationConfig appConfig = context.getApplicationConfig();
// graphs at cluster level are not yet supported
assert !appConfig.isCluster();
GraphConfig graphConfig = appConfig.findGraph(id);
HtmlElement applet = new HtmlElement("applet");
applet.addAttribute("code", "org/jmanage/webui/applets/GraphApplet.class");
applet.addAttribute("archive", "/applets/applets.jar,/applets/jfreechart-0.9.20.jar,/applets/jcommon-0.9.5.jar");
applet.addAttribute("width", width);
applet.addAttribute("height", height);
ParamElement param = null;
param = new ParamElement(GraphAppletParameters.GRAPH_TITLE, graphConfig.getName());
applet.addChildElement(param);
param = new ParamElement(GraphAppletParameters.POLLING_INTERVAL, graphConfig.getPollingInterval());
applet.addChildElement(param);
String remoteURL = Utils.getServerBaseURL(request) +
"/app/fetchAttributeValues.do;jsessionid=" +
Utils.getCookieValue(request, "JSESSIONID");
param = new ParamElement(GraphAppletParameters.REMOTE_URL, remoteURL);
applet.addChildElement(param);
param = new ParamElement(GraphAppletParameters.ATTRIBUTE_DISPLAY_NAMES,
graphConfig.getAttributeDisplayNames());
applet.addChildElement(param);
param = new ParamElement(GraphAppletParameters.ATTRIBUTES,
graphConfig.getAttributesAsString());
applet.addChildElement(param);
param = new ParamElement(GraphAppletParameters.Y_AXIS_LABEL,
graphConfig.getYAxisLabel());
applet.addChildElement(param);
if(graphConfig.getScaleFactor() != null){
param = new ParamElement(GraphAppletParameters.SCALE_FACTOR,
graphConfig.getScaleFactor());
applet.addChildElement(param);
}
if(graphConfig.isScaleUp() != null){
param = new ParamElement(GraphAppletParameters.SCALE_UP,
graphConfig.isScaleUp());
applet.addChildElement(param);
}
final JspWriter writer = pageContext.getOut();
try {
writer.println(applet.toString());
} catch (IOException e) {
throw new JspException(e);
}
return SKIP_BODY;
}