java/cewolf-1.0/src/site/devguide.html
author František Kučera <franta-hg@frantovo.cz>
Sat, 28 Feb 2009 21:31:02 +0100
changeset 1 639991d0808a
permissions -rw-r--r--
Rozbalená knihovna verze 1.0
franta-hg@1
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
franta-hg@1
     2
<html>
franta-hg@1
     3
<head>
franta-hg@1
     4
  <title></title>
franta-hg@1
     5
  <meta name="author" content="Guido Laures">
franta-hg@1
     6
  <link href="cewolf.css" rel="stylesheet" type="text/css">
franta-hg@1
     7
</head>
franta-hg@1
     8
<body>
franta-hg@1
     9
<h1><a name="Developer Guido">Developer Guide</a></h1>
franta-hg@1
    10
<p> Let us assume the following (standard) scenario in which Cewolf
franta-hg@1
    11
might be a solution.<br>
franta-hg@1
    12
You have a running web application and you want to know which pages are
franta-hg@1
    13
most visited by your users. You want to have a vertical bar chart which
franta-hg@1
    14
looks like the one below </p>
franta-hg@1
    15
<p> <img src="img/guidevbarchart.gif" alt="verticalbar"> </p>
franta-hg@1
    16
<p> </p>
franta-hg@1
    17
<h2>1. Prepare Your Application</h2>
franta-hg@1
    18
<p> If you have not yet downloaded the Cewolf distribution, this is the
franta-hg@1
    19
point when you should do it (look at <a
franta-hg@1
    20
 href="http://sourceforge.net/project/showfiles.php?group_id=57282"
franta-hg@1
    21
 target="new">Download</a>). Put the <tt>cewolf.jar</tt> file into your
franta-hg@1
    22
web application's <tt>/WEB-INF/lib</tt> directory.<br>
franta-hg@1
    23
That should be all you have to do to prepare your application for
franta-hg@1
    24
Cewolf usage. If you encounter any problems in using the Cewolf tags
franta-hg@1
    25
(e.g. "No Tags" is displayed in your containers console) you can
franta-hg@1
    26
additionally put the <tt>cewolf.tld</tt> file from the distribution's <tt>etc</tt>
franta-hg@1
    27
directory into a directory of your choice under your web application's
franta-hg@1
    28
root and reference this file as the cewolf tag library from your JSPs. </p>
franta-hg@1
    29
<h2>2. Provide a DatasetProducer</h2>
franta-hg@1
    30
<p> As Cewolf uses a MVC (Model-View-Control) approach the data which
franta-hg@1
    31
are shown in your chart are separated from the view defined in the JSP
franta-hg@1
    32
page. So you can change them separately. To provide the chart with the
franta-hg@1
    33
correct data you must provide an object which implements the interface<tt>de.laures.cewolf.DatasetProducer</tt>.
franta-hg@1
    34
This object is asked to produce data every time a chart is rendered.
franta-hg@1
    35
Below you see an implementation of a DatasetProducer which could be used
franta-hg@1
    36
to provide data needed for our example scenario. </p>
franta-hg@1
    37
<p> </p>
franta-hg@1
    38
to be continued ...
franta-hg@1
    39
<h2>3. Install the Cewolf Servlet in your Web App</h2>
franta-hg@1
    40
tbd.
franta-hg@1
    41
<h2>4. Define the chart in your JSP</h2>
franta-hg@1
    42
<pre>&lt;%@page contentType="text/html"%&gt;<br>&lt;%@taglib uri='/WEB-INF/cewolf.tld' prefix='cewolf' %&gt;<br>&lt;jsp:useBean id="pageViews" class="de.laures.cewolf.example.PageViewCountData"/&gt;<br>&lt;cewolf:chart <br>    id="horizontalBarChart" <br>    title="HorizontalBarChart" <br>    renderer="servlet/chart" <br>    width="300" height="300" <br>    type="horizontalBar" <br>    xAxisLabel="Page" <br>    yAxisLabel="Views"&gt;<br>    &lt;cewolf:data producer="pageViews" /&gt;<br>&lt;/cewolf:chart&gt;<br></pre>
franta-hg@1
    43
<p> <a href="http://sourceforge.net" target="new" height="30"><img
franta-hg@1
    44
 src="http://sourceforge.net/sflogo.php?group_id=57282&amp;type=5"
franta-hg@1
    45
 height="30" border="0" alt="SourceForge Logo"></a> </p>
franta-hg@1
    46
</body>
franta-hg@1
    47
</html>