org.ibisph.mvc.view
Class Chart

java.lang.Object
  extended by org.ibisph.mvc.view.Chart
All Implemented Interfaces:
org.springframework.web.servlet.View

public class Chart
extends java.lang.Object
implements org.springframework.web.servlet.View

Spring framework MVC chart view. This has one property - the chart object which is passed into the constructor.

Author:
Garth Braithwaite, STG

Field Summary
protected  Chart chart
           
protected  java.lang.String responseContentType
           
protected  java.lang.String showChartConfidenceLimitsParameterName
           
 
Constructor Summary
Chart(Chart chart)
          Constructor which sets the required chart property.
 
Method Summary
 java.lang.String getContentType()
          Spring View required method.
 void render(java.util.Map modelMap, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Standard Spring framework MVC View Render method for chart requests.
 void setChart(Chart chart)
          Sets the chart property.
 void setContentType(java.lang.String responseContentType)
          Sets the HTTP response content type property.
 void setShowChartConfidenceLimitsParameterName(java.lang.String showChartConfidenceLimitsParameterName)
          Sets the HTTP Show Chart Confidence Limits Parameter Name chart property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

responseContentType

protected java.lang.String responseContentType

chart

protected Chart chart

showChartConfidenceLimitsParameterName

protected java.lang.String showChartConfidenceLimitsParameterName
Constructor Detail

Chart

public Chart(Chart chart)
Constructor which sets the required chart property.

Parameters:
chart - Actual chart object used to create and stream back a chart.
Method Detail

getContentType

public java.lang.String getContentType()
Spring View required method.

Specified by:
getContentType in interface org.springframework.web.servlet.View
Returns:
"image/svg+xml".

setContentType

public void setContentType(java.lang.String responseContentType)
Sets the HTTP response content type property. This value sets the value returned by the Spring required getContentType method.

Parameters:
responseContentType - HTTP content type. This value defaults to "image/svg+xml" and is not validated.

setChart

public void setChart(Chart chart)
Sets the chart property.

Parameters:
chart - Actual chart object used to create and stream back a chart.

setShowChartConfidenceLimitsParameterName

public void setShowChartConfidenceLimitsParameterName(java.lang.String showChartConfidenceLimitsParameterName)
Sets the HTTP Show Chart Confidence Limits Parameter Name chart property.

Parameters:
showChartConfidenceLimitsParameterName - HTTP request parameter name key to be retrieved. If this parameter is T/t/Y/y/X/x then the chart will have its CIs displayed. Defaults to "ShowChartCIs".

render

public void render(java.util.Map modelMap,
                   javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
            throws java.io.IOException
Standard Spring framework MVC View Render method for chart requests. The actual chart object is set as a property and the chart data is passed in as part of the model map. The chart's toOutputStream method is then called with the chart data and any other chart related model parameters to create the chart and stream it back to the user. This method also checks for the presence of the ShowChartCIs request parameter. If exists and matches this property parameter name and its value is T/t/Y/y/X/x then the chart will render CIs (if exists).

Specified by:
render in interface org.springframework.web.servlet.View
Parameters:
modelMap - Spring framework MVC model map which contains chart data and any other request parameters.
request - HTTP request passed from Spring MVC framework. The main request parameter that is checked for is the printer friendly flag.
response - HTTP response passed from Spring MVC framework. This is used to get the stream that the chart contents are sent to.
Throws:
java.io.IOException - Associated stream exceptions.