Sophie

Sophie

distrib > Fedora > 17 > i386 > by-pkgid > cf79c2d0ed7fa2678c515072ee6f31e4 > files > 101

jasperreports-manual-4.0.2-4.fc17.noarch.rpm

<html xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:jr="http://jasperreports.sourceforge.net/jasperreports">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JasperReports 4.0.2 - Shapes Sample</title>
<style type="text/css">
.title {
	font-family: Arial, Verdana, Helvetica, sans-serif;
	font-size: 28px;
	font-weight: normal;
}

.toc {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: normal;
}

.name {
	font-family: Courier New, Courier, serif;
	font-size: 16px;
	font-weight: bold;
}

.label {
	font-family: Arial, Verdana, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	font-style: italic;
}

.description {
	font-family: Arial, Verdana, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: normal;
}

.value {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: normal;
}

.element {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: normal;
}

.attribute {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: bold;
}

.code {
	font-family: Courier New, Courier, serif;
	font-size: 12px;
	font-weight: normal;
}

.copy {
	font-decoration: none;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 8pt;
	font-style: normal;
	color: #000000;
}

.subtitle {
	font-family: inherit;
	font-size: inherit;
	font-style: inherit;
	font-weight: bold;
	text-decoration: none;
	color: inherit;
}

</style>
</head>
<body bgcolor="#FFFFFF">
<a name="top"></a>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td colspan="2" align="right"><span class="element"><a href="../../sample.reference.html">Sample Reference</a> - <a href="../../schema.reference.html">Schema Reference</a> - <a href="../../config.reference.html">Configuration Reference</a> - <a href="http://jasperreports.sourceforge.net/api/index.html">API (Javadoc)</a></span>
<br>
</td>
</tr>
<tr>
<td colspan="2">
<hr size="1">
</td>
</tr>
<tr valign="middle">
<td nowrap="true"><span class="title">JasperReports - Shapes Sample (version 4.0.2)</span></td><td align="right"><img src="../../resources/jasperreports.png" border="0"></td>
</tr>
<tr>
<td colspan="2">
<hr size="1">
</td>
</tr>
</table>
<br>
<span class="description"><span class="description">Shows how various graphic elements could be used inside report templates.</span></span>
<br>
<br>
<span class="element"><a href="http://sourceforge.net/projects/jasperreports/files/jasperreports/JasperReports%204.0.2/jasperreports-4.0.2-project.zip/download" target="_blank">Download All Sample Source Files</a></span>
<br>
<span class="element"><a href="http://jasperforge.org/scm/viewvc.php/tags/jr-4-0-2/jasperreports/demo/samples/shapes/?root=jasperreports" target="_blank">Browse Sample Source Files on SVN</a></span>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="width: 20px;">
<br>
</td><td>
<br>
</td>
</tr>
<tr>
<td colspan="2"><span class="label">Main Features in This Sample</span></td>
</tr>
<tr>
<td>
<br>
</td><td><span class="element"><a href="#shapes">Lines, Rectangles, Ellipses (Shapes)</a></span></td>
</tr>
</table>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td><img src="../../resources/px.gif" border="0" width="20" height="1"></td><td><img src="../../resources/px.gif" border="0" width="20" height="1"></td><td><img src="../../resources/px.gif" border="0" width="20" height="1"></td><td><img src="../../resources/px.gif" border="0" width="20" height="1"></td><td width="80%">
<br>
</td><td width="20%">
<br>
</td>
</tr>
<tr>
<td colspan="6" align="right"><a name="shapes"></a><a href="#top" class="toc">top</a></td>
</tr>
<tr>
<td colspan="6">
<hr size="1">
</td>
</tr>
<tr valign="top">
<td><img src="../../resources/jr-16x16.png" border="0"></td><td colspan="4"><span class="name">Lines, Rectangles, Ellipses (Shapes)</span></td><td align="right"><span class="copy">Documented by 
	<a href="mailto:shertage@users.sourceforge.net" class="copy">Sanda Zaharia</a></span></td>
</tr>
<tr>
<td colspan="6">
<br>
</td>
</tr>
<tr valign="top">
<td>
<br>
</td><td nowrap="true"><span class="label">Description / Goal</span></td><td>
<br>
</td><td colspan="3"><span class="description">
How to use shape elements such as rectangles, ellipses and lines.
    </span></td>
</tr>
<tr valign="top">
<td>
<br>
</td><td colspan="1"><span class="label">Since</span></td><td>
<br>
</td><td colspan="3"><span class="description">0.1.0</span></td>
</tr>
<tr>
<td colspan="6">
<br>
</td>
</tr>
<tr>
<td>
<br>
</td><td colspan="5"><span class="description">
    <b>Common graphic elements</b>
    
<br>
    
<br>
Shapes are predefined geometric objects, very useful when drawing diagrams, flowcharts and other schematic representations. 
There are a lot of shapes: lines, rectangles, arrows, callouts, stars, etc. All of them can be obtained from a set of line shapes, taking into account that a line shape can be either straight or curved.
<br>
JasperReports provides support for lines, rectangles and ellipses. All shape objects in JasperReports are graphic report elements which implement both <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRCommonElement.html" target="_blank">JRCommonElement</a></span> and <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRGraphicElement.html" target="_blank">JRGraphicElement</a></span> interfaces. 
<br>
By default any common element is characterized by its width, height, unique key identifier, visualization mode, foreground and background colors. Methods exposed by the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRCommonElement.html" target="_blank">JRCommonElement</a></span> are:
<ul>

<li>
<span class="code"><code>public int getWidth();</code></span>
</li>

<li>
<span class="code"><code>public int getHeight();</code></span>
</li>

<li>
<span class="code"><code>public String getKey();</code></span>
</li>

<li>
<span class="code"><code>public ModeEnum getModeValue();</code></span>
</li>

<li>
<span class="code"><code>public ModeEnum getOwnModeValue();</code></span>
</li>

<li>
<span class="code"><code>public void setMode(ModeEnum mode);</code></span>
</li>

<li>
<span class="code"><code>public Color getForecolor();</code></span>
</li>

<li>
<span class="code"><code>public Color getOwnForecolor();</code></span>
</li>

<li>
<span class="code"><code>public void setForecolor(Color forecolor);</code></span>
</li>

<li>
<span class="code"><code>public Color getBackcolor();</code></span>
</li>

<li>
<span class="code"><code>public Color getOwnBackcolor();</code></span>
</li>

<li>
<span class="code"><code>public void setBackcolor(Color backcolor);</code></span>
</li>

</ul>


<br>
The <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRGraphicElement.html" target="_blank">JRGraphicElement</a></span> interface extends the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRCommonGraphicElement.html" target="_blank">JRCommonGraphicElement</a></span>. By default any common graphic element (or shape) should have a contour line and a fill type (ie solid, no fill, etc). 
<br>
Methods which should be implemented from the <span class="code"><code>JRCommonGraphicElement</code></span> interface are:
<ul>

<li>
<span class="code"><code>public JRPen getLinePen();</code></span>
</li>

<li>
<span class="code"><code>public FillEnum getFillValue();</code></span>
</li>

<li>
<span class="code"><code>public FillEnum getOwnFillValue();</code></span>
</li>

<li>
<span class="code"><code>public void setFill(FillEnum fillEnum);</code></span>
</li>

</ul>

<b>The line shape</b>

<br>

<br>
Derived from common graphic elements, a line is an one-dimensional shape which is supposed to have a given direction. Any line element should implement the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRLine.html" target="_blank">JRLine</a></span> interface which exposes the following methods:
<ul>

<li>
<span class="code"><code>public LineDirectionEnum getDirectionValue();</code></span>
</li>

<li>
<span class="code"><code>public void setDirection(LineDirectionEnum lineDirectionEnum);</code></span>
</li>

</ul>
Possible line directions are: top-down or bottom-up. The default direction is top-down.
<br>
In the .jrxml file a line element is represented as follows:
<pre>
  &lt;line direction="BottomUp"&gt;
    &lt;reportElement x="0" y="150" width="200" height="40" forecolor="#ff00"/&gt;
    &lt;graphicElement&gt;
      &lt;pen lineWidth="4"/&gt;
    &lt;/graphicElement&gt;
  &lt;/line&gt;
</pre>
The graphicElement's fill attribute is not specified because at the moment only the solid fill type is taken into account and, it is considered as default value.
<br>

<br>

<b>The rectangle shape</b>

<br>

<br>
A rectangle is a bi-dimensional shape having either rounded corners or no-rounded ones. The radius element, if set, indicates how the rectangle's corners should be rounded. By default corners are not rounded in a rectangle.
<br>
Any rectangle shape implements the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRRectangle.html" target="_blank">JRRectangle</a></span> interface, which extends the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRCommonRectangle.html" target="_blank">JRCommonRectangle</a></span>.
The <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRCommonRectangle.html" target="_blank">JRCommonRectangle</a></span> exposes the following methods:
<ul>

<li>
<span class="code"><code>public int getRadius();</code></span>
</li>

<li>
<span class="code"><code>public Integer getOwnRadius();</code></span>
</li>

<li>
<span class="code"><code>public void setRadius(int radius);</code></span>
</li>

<li>
<span class="code"><code>public void setRadius(Integer radius);</code></span>
</li>

</ul>
In the .jrxml file a rectangle element is represented as follows:
<pre>
  &lt;rectangle radius="15"&gt;
    &lt;reportElement x="0" y="350" width="200" height="40" backcolor="#ffff00"/&gt;
    &lt;graphicElement&gt;
      &lt;pen lineWidth="2"/&gt;
    &lt;/graphicElement&gt;
  &lt;/rectangle&gt;
</pre>
If corners are not rounded, then the <span class="code"><code>radius</code></span> attribute is not necessary.
<br>

<br>

<b>The ellipse shape</b>

<br>

<br>
An ellipse is a closed bi-dimensional curved shape characterized by 2 semiaxis: the semimajor and the semiminor axis. When the semimajor axis equals the semiminor axis, the ellipse becomes a circle.
<br>
Any ellipse shape implements the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JREllipse.html" target="_blank">JREllipse</a></span> interface, which extends the <span class="element"><a href="http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/JRGraphicElement.html" target="_blank">JRGraphicElement</a></span>.
<br>
No supplementary methods are needed, because both ellipse's semiaxis can be determined from the common element's <span class="code"><code>width</code></span> and <span class="code"><code>height</code></span> attributes.
<br>
In the .jrxml file an ellipse element is represented as follows:
<pre>
  &lt;ellipse&gt;
    &lt;reportElement x="0" y="600" width="200" height="40" forecolor="#ff0000" backcolor="#ffff99"/&gt;
    &lt;graphicElement&gt;
      &lt;pen lineWidth="2"/&gt;
    &lt;/graphicElement&gt;
  &lt;/ellipse&gt;
</pre>

<b>Running the Sample</b>

<br>

<br>
Running the sample requires the <a href="http://ant.apache.org/" target="_blank" class="element">Apache Ant</a> library. Make sure that <span class="code"><code>ant</code></span> is already installed on your system (version 1.5 or later).
<br>
In a command prompt/terminal window set the current folder to <span class="code"><code>demo/samples/shapes</code></span> within the JasperReports source project and run the <span class="code"><code>&gt; ant test view</code></span> command.
<br>
It will generate all supported document types containing the sample report in the <span class="code"><code>demo/samples/shapes/build/reports</code></span> directory. 
<br>
Then the report will open in the JasperReports internal viewer.
    </span></td>
</tr>
<tr>
<td colspan="6">
<br>
</td>
</tr>
</table>
<br>
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td>
<hr size="1">
</td>
</tr>
<tr>
<td align="center"><span class="copy">&copy; 2001-2010 Jaspersoft Corporation <a href="http://www.jaspersoft.com" target="_blank" class="copy">www.jaspersoft.com</a></span></td>
</tr>
</table>
</body>
</html>