|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.servlet.GenericServlet com.objectplanet.chart.ChartServlet
public class ChartServlet
This servlet generates a chart as a PNG image.
Field Summary | |
---|---|
protected Chart |
chart
The chart component used. |
protected ChartDataLoader |
dataLoader
The data loader used to load chart parameters. |
protected java.lang.String |
encoding
The encoding used to read data from an URL. |
protected java.lang.String |
format
The image format to use. |
protected GaugeChart |
gaugeChart
The gauge chart component used. |
protected java.util.Hashtable |
imageList
The list of image parameters read. |
protected int |
jpegQuality
The quality of the returned jpeg image. |
protected PlotterChart |
plotterChart
The plotter chart component used. |
protected PngEncoder |
pngEncoder
The png encoder used to encode the charts as png images. |
protected java.lang.String |
type
The chart may be of "bar", "line", "pie", "time_line", "spline", "plotter" type. |
protected java.util.Hashtable |
urlList
The list of url parameters read. |
protected java.util.Hashtable |
urlTargetList
The list of url target parameters read. |
Constructor Summary | |
---|---|
ChartServlet()
|
Method Summary | |
---|---|
protected static java.lang.String |
convertLineBreaks(java.lang.String label)
Converts '\n' to . |
protected java.lang.String |
convertURL(java.lang.String url,
javax.servlet.ServletRequest req,
java.lang.String separator,
java.lang.String equals)
Converts the data URL to use the standard parameter separator (&) instead of the one the servlet tag has to use (¤). |
protected void |
encodeChartImage(java.awt.Image image,
int width,
int height,
java.io.OutputStream out,
javax.servlet.ServletResponse res)
Encodes the specified java image to a jpeg/png bytestream. |
protected void |
generateChartImage(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res,
java.util.Hashtable parameters,
java.lang.String error)
Generates a chart image based on the given parameters |
void |
generateImagemap(java.lang.String type,
javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
Generates and prints out an imagemap to implement drilldown functionality for the chart. |
protected java.awt.Image |
getImage(java.awt.Component chart,
int width,
int height,
boolean antialias)
Returns the current chart as an image. |
void |
init(javax.servlet.ServletConfig config)
This method is called when the servlet is placed into service. |
protected void |
loadInputParameters(java.io.InputStream input,
java.util.Hashtable parameters,
java.util.Hashtable urlList,
java.util.Hashtable urlTargetList,
java.util.Hashtable imageList)
Loads the parameters from the given data input stream. |
protected void |
loadURLParameters(java.lang.String urlString,
java.util.Hashtable parameters,
java.util.Hashtable urlList,
java.util.Hashtable urlTargetList,
java.util.Hashtable imageList)
Loads the parameters from the specified url. |
protected void |
paintError(java.awt.Graphics g,
java.lang.String label)
Paints a multiline label broken with \n. |
protected void |
paintLabel(java.awt.Graphics g,
java.lang.String label,
int label_x,
int label_y)
Paints a multiline label broken with \n. |
void |
service(javax.servlet.ServletRequest req,
javax.servlet.ServletResponse res)
The service. |
Methods inherited from class javax.servlet.GenericServlet |
---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Chart chart
protected ChartDataLoader dataLoader
protected java.lang.String encoding
protected java.lang.String format
protected GaugeChart gaugeChart
protected java.util.Hashtable imageList
protected int jpegQuality
protected PlotterChart plotterChart
protected PngEncoder pngEncoder
protected java.lang.String type
protected java.util.Hashtable urlList
protected java.util.Hashtable urlTargetList
Constructor Detail |
---|
public ChartServlet()
Method Detail |
---|
protected static java.lang.String convertLineBreaks(java.lang.String label)
label
- The label with the \ and n.protected java.lang.String convertURL(java.lang.String url, javax.servlet.ServletRequest req, java.lang.String separator, java.lang.String equals)
url
- The data url to convert.req
- The servlet request.separator
- The separator used in the servlet tag.equals
- The equals sign.
protected void encodeChartImage(java.awt.Image image, int width, int height, java.io.OutputStream out, javax.servlet.ServletResponse res) throws java.io.IOException
image
- The image to encode.width
- The width of the image.height
- The height of the image.out
- The output stream to encode it to.res
- The servlet response.
java.io.IOException
protected void generateChartImage(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res, java.util.Hashtable parameters, java.lang.String error) throws java.io.IOException
req
- The servlet request.res
- The servlet response.parameters
- Paramters passed to the servlet.error
- Message to display on the image if an error happens.
java.io.IOException
- If an I/O exception has occurred.public void generateImagemap(java.lang.String type, javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws java.io.IOException
type
- The type of the chart.req
- The servlet request.res
- The servlet response.
java.io.IOException
protected java.awt.Image getImage(java.awt.Component chart, int width, int height, boolean antialias)
chart
- The chart to get the image from.width
- The width of the chart in pixels.height
- The height of the chart in pixels.antialias
- True if antialiased, falst otherwise.
public void init(javax.servlet.ServletConfig config)
init
in interface javax.servlet.Servlet
init
in class javax.servlet.GenericServlet
protected void loadInputParameters(java.io.InputStream input, java.util.Hashtable parameters, java.util.Hashtable urlList, java.util.Hashtable urlTargetList, java.util.Hashtable imageList) throws java.lang.Exception
input
- The input stream to read the data from.parameters
- Read the parameters into this hashtable.urlList
- Read the drilldown parameters into this hashtable.urlTargetList
- Read the url target parameters into this hashtable.imageList
- Read the image parameters into this hashtable.
java.lang.Exception
protected void loadURLParameters(java.lang.String urlString, java.util.Hashtable parameters, java.util.Hashtable urlList, java.util.Hashtable urlTargetList, java.util.Hashtable imageList) throws java.lang.Exception
urlString
- The url to load the data from.parameters
- Read the parameters into this hashtable.urlList
- Read the drilldown parameters into this hashtable.urlTargetList
- Read the url target parameters into this hashtable.imageList
- Read the image parameters into this hashtable.
java.lang.Exception
protected void paintError(java.awt.Graphics g, java.lang.String label)
g
- The graphics context used to paint with.label
- The label to paint.protected void paintLabel(java.awt.Graphics g, java.lang.String label, int label_x, int label_y)
g
- The graphics context used to paint with.label
- The label to paint.label_x
- The x position of the label.label_y
- The y position of the label.public void service(javax.servlet.ServletRequest req, javax.servlet.ServletResponse res) throws javax.servlet.ServletException, java.io.IOException
service
in interface javax.servlet.Servlet
service
in class javax.servlet.GenericServlet
javax.servlet.ServletException
- If the call could not be processed.
java.io.IOException
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |