jasper-rails 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +29 -9
- data/lib/jasper-rails.rb +56 -19
- data/lib/jasper-rails/version.rb +1 -1
- data/lib/java/{jasperreports-4.7.1.jar → jasperreports-5.0.0.jar} +0 -0
- data/spec/controllers/people_controller_spec.rb +42 -22
- data/spec/internal/app/controllers/people_controller.rb +18 -5
- data/spec/internal/app/views/people/java_parameter.jrxml +118 -0
- data/spec/internal/app/views/people/nil_datasource.jrxml +118 -0
- data/spec/internal/config/routes.rb +2 -0
- metadata +7 -3
data/README.md
CHANGED
@@ -46,9 +46,9 @@ Note: This list will become your datasource inside the report.
|
|
46
46
|
|
47
47
|
2) Create your jasper report source file using iReport or any compatible jasper tool.
|
48
48
|
|
49
|
-
3) Set the "Query Text" and "The language for the dataset query" properties of your report.
|
49
|
+
3) Set the "Query Text" and "The language for the dataset query" properties of your report.
|
50
50
|
|
51
|
-
Note: If you're using iReport, you can find those properties in the "Properties panel".
|
51
|
+
Note: If you're using iReport, you can find those properties in the "Properties panel".
|
52
52
|
Don't forget to select the report root node in your "Report inspector".
|
53
53
|
|
54
54
|
Example: If you have a list of people, you should have something like:
|
@@ -60,7 +60,7 @@ Example: If you have a list of people, you should have something like:
|
|
60
60
|
5) Save the report source file in your views folder (just like any other html view file):
|
61
61
|
|
62
62
|
Example:
|
63
|
-
|
63
|
+
|
64
64
|
* app/views/people/index.jrxml
|
65
65
|
|
66
66
|
## Parameters
|
@@ -78,7 +78,27 @@ Example:
|
|
78
78
|
|
79
79
|
All you have to do now is to create, in iReport, a parameter called "user" (yes, without the "@") and drop it in your report!
|
80
80
|
|
81
|
-
Limitation: By now, all parameters are converted to java String. We intend to change this in the near future.
|
81
|
+
Limitation: By now, all parameters that aren't manually converted to Rjb java classes/instances are converted to java String. We intend to change this in the near future.
|
82
|
+
|
83
|
+
## Passing Java parameters directly
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
title = (Rjb::import 'java.lang.String').new("The Beatles")
|
87
|
+
@parameter_that_is_a_java_class = (Rjb::import 'java.util.HashMap').new
|
88
|
+
@parameter_that_is_a_java_class.put("title", title)
|
89
|
+
```
|
90
|
+
|
91
|
+
For more information check out issue: [#13](https://github.com/fortesinformatica/jasper-rails/pull/13)
|
92
|
+
|
93
|
+
## Global configuration
|
94
|
+
|
95
|
+
You can change any default report param by setting JasperRails.config[:report_params], e.g., in your "config/application.rb" you might have something like:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
config.after_initialize do
|
99
|
+
JasperRails.config[:report_params]["REPORT_LOCALE"] = JasperRails::Locale.new('pt', 'BR')
|
100
|
+
end
|
101
|
+
```
|
82
102
|
|
83
103
|
## RSpec integration
|
84
104
|
Check out: [jasper-rails-rspec](http://github.com/fortesinformatica/jasper-rails-rspec).
|
@@ -88,14 +108,14 @@ For a running example, just clone: [jasper-rails-demo](http://github.com/fortesi
|
|
88
108
|
|
89
109
|
## History
|
90
110
|
This project was first developed at Grupo Fortes in 2011 and we have been using it in several projects since then.
|
91
|
-
Pay attention that all the features it supports right now were based in those project's especific needs. Therefore you might find a lot of
|
92
|
-
JasperResports' features that are not yet supported.
|
93
|
-
|
111
|
+
Pay attention that all the features it supports right now were based in those project's especific needs. Therefore you might find a lot of
|
112
|
+
JasperResports' features that are not yet supported.
|
113
|
+
|
94
114
|
## LICENSE
|
95
115
|
|
96
116
|
Copyright (C) 2012 Marlus Saraiva, Rodrigo Maia
|
97
117
|
|
98
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
118
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
99
119
|
a copy of this software and associated documentation files (the
|
100
120
|
"Software"), to deal in the Software without restriction, including
|
101
121
|
without limitation the rights to use, copy, modify, merge, publish,
|
@@ -108,7 +128,7 @@ included in all copies or substantial portions of the Software.
|
|
108
128
|
|
109
129
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
110
130
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
111
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
131
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
112
132
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
113
133
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
114
134
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
data/lib/jasper-rails.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
#
|
1
|
+
#
|
2
2
|
# Copyright (C) 2012 Marlus Saraiva, Rodrigo Maia
|
3
|
-
#
|
4
|
-
# Permission is hereby granted, free of charge, to any person obtaining
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
5
|
# a copy of this software and associated documentation files (the
|
6
6
|
# "Software"), to deal in the Software without restriction, including
|
7
7
|
# without limitation the rights to use, copy, modify, merge, publish,
|
8
8
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
9
|
# permit persons to whom the Software is furnished to do so, subject to
|
10
10
|
# the following conditions:
|
11
|
-
#
|
11
|
+
#
|
12
12
|
# The above copyright notice and this permission notice shall be
|
13
13
|
# included in all copies or substantial portions of the Software.
|
14
|
-
#
|
14
|
+
#
|
15
15
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
16
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
-
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
18
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
19
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
20
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
@@ -31,23 +31,29 @@ end
|
|
31
31
|
|
32
32
|
module JasperRails
|
33
33
|
|
34
|
+
class << self
|
35
|
+
attr_accessor :config
|
36
|
+
end
|
37
|
+
|
34
38
|
classpath = '.'
|
35
39
|
Dir["#{File.dirname(__FILE__)}/java/*.jar"].each do |jar|
|
36
40
|
classpath << File::PATH_SEPARATOR + File.expand_path(jar)
|
37
41
|
end
|
38
|
-
|
42
|
+
|
39
43
|
Dir["lib/*.jar"].each do |jar|
|
40
44
|
classpath << File::PATH_SEPARATOR + File.expand_path(jar)
|
41
45
|
end
|
42
46
|
|
43
47
|
Rjb::load( classpath, ['-Djava.awt.headless=true','-Xms128M', '-Xmx256M'] )
|
44
48
|
|
49
|
+
Locale = Rjb::import 'java.util.Locale'
|
45
50
|
JRException = Rjb::import 'net.sf.jasperreports.engine.JRException'
|
46
51
|
JasperCompileManager = Rjb::import 'net.sf.jasperreports.engine.JasperCompileManager'
|
47
52
|
JasperExportManager = Rjb::import 'net.sf.jasperreports.engine.JasperExportManager'
|
48
53
|
JasperFillManager = Rjb::import 'net.sf.jasperreports.engine.JasperFillManager'
|
49
54
|
JasperPrint = Rjb::import 'net.sf.jasperreports.engine.JasperPrint'
|
50
55
|
JRXmlUtils = Rjb::import 'net.sf.jasperreports.engine.util.JRXmlUtils'
|
56
|
+
JREmptyDataSource = Rjb::import 'net.sf.jasperreports.engine.JREmptyDataSource'
|
51
57
|
# This is here to avoid the "already initialized constant QUERY_EXECUTER_FACTORY_PREFIX" warnings.
|
52
58
|
JRXPathQueryExecuterFactory = silence_warnings{Rjb::import 'net.sf.jasperreports.engine.query.JRXPathQueryExecuterFactory'}
|
53
59
|
InputSource = Rjb::import 'org.xml.sax.InputSource'
|
@@ -57,6 +63,15 @@ module JasperRails
|
|
57
63
|
JavaString = Rjb::import 'java.lang.String'
|
58
64
|
JFreeChart = Rjb::import 'org.jfree.chart.JFreeChart'
|
59
65
|
|
66
|
+
# Default report params
|
67
|
+
self.config = {
|
68
|
+
:report_params=>{
|
69
|
+
"REPORT_LOCALE" => Locale.new('en', 'US'),
|
70
|
+
"XML_LOCALE" => Locale.new('en', 'US'),
|
71
|
+
"XML_DATE_PATTERN" => 'yyyy-MM-dd'
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
60
75
|
module Jasper
|
61
76
|
module Rails
|
62
77
|
def self.render_pdf(jasper_file, datasource, parameters, options)
|
@@ -65,11 +80,17 @@ module JasperRails
|
|
65
80
|
jrxml_file = jasper_file.sub(/\.jasper$/, ".jrxml")
|
66
81
|
|
67
82
|
begin
|
68
|
-
#
|
69
|
-
# Pay attention that, for now, all parameters are converted to string!
|
83
|
+
# Converting default report params to java HashMap
|
70
84
|
jasper_params = HashMap.new
|
71
|
-
|
72
|
-
jasper_params.put(
|
85
|
+
JasperRails.config[:report_params].each do |k,v|
|
86
|
+
jasper_params.put(k, v)
|
87
|
+
end
|
88
|
+
|
89
|
+
# Convert the ruby parameters' hash to a java HashMap, but keeps it as
|
90
|
+
# default when they already represent a JRB entity.
|
91
|
+
# Pay attention that, for now, all other parameters are converted to string!
|
92
|
+
parameters.each do |key, value|
|
93
|
+
jasper_params.put(JavaString.new(key.to_s), parameter_value_of(value))
|
73
94
|
end
|
74
95
|
|
75
96
|
# Compile it, if needed
|
@@ -78,16 +99,20 @@ module JasperRails
|
|
78
99
|
end
|
79
100
|
|
80
101
|
# Fill the report
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
102
|
+
if datasource
|
103
|
+
input_source = InputSource.new
|
104
|
+
input_source.setCharacterStream(StringReader.new(datasource.to_xml(options).to_s))
|
105
|
+
data_document = silence_warnings do
|
106
|
+
# This is here to avoid the "already initialized constant DOCUMENT_POSITION_*" warnings.
|
107
|
+
JRXmlUtils._invoke('parse', 'Lorg.xml.sax.InputSource;', input_source)
|
108
|
+
end
|
109
|
+
|
110
|
+
jasper_params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, data_document)
|
111
|
+
jasper_print = JasperFillManager.fillReport(jasper_file, jasper_params)
|
112
|
+
else
|
113
|
+
jasper_print = JasperFillManager.fillReport(jasper_file, jasper_params, JREmptyDataSource.new)
|
86
114
|
end
|
87
115
|
|
88
|
-
jasper_params.put(JRXPathQueryExecuterFactory.PARAMETER_XML_DATA_DOCUMENT, data_document)
|
89
|
-
jasper_print = JasperFillManager.fillReport(jasper_file, jasper_params)
|
90
|
-
|
91
116
|
# Export it!
|
92
117
|
JasperExportManager._invoke('exportReportToPdf', 'Lnet.sf.jasperreports.engine.JasperPrint;', jasper_print)
|
93
118
|
rescue Exception=>e
|
@@ -100,6 +125,18 @@ module JasperRails
|
|
100
125
|
raise e
|
101
126
|
end
|
102
127
|
end
|
128
|
+
|
129
|
+
# Returns the value without conversion when it's converted to Java Types.
|
130
|
+
# When isn't a Rjb class, returns a Java String of it.
|
131
|
+
def self.parameter_value_of(param)
|
132
|
+
# Using Rjb::import('java.util.HashMap').new, it returns an instance of
|
133
|
+
# Rjb::Rjb_JavaProxy, so the Rjb_JavaProxy parent is the Rjb module itself.
|
134
|
+
if param.class.parent == Rjb
|
135
|
+
param
|
136
|
+
else
|
137
|
+
JavaString.new(param.to_s)
|
138
|
+
end
|
139
|
+
end
|
103
140
|
end
|
104
141
|
end
|
105
142
|
|
data/lib/jasper-rails/version.rb
CHANGED
Binary file
|
@@ -1,69 +1,89 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe PeopleController do
|
4
|
-
|
4
|
+
|
5
5
|
describe "GET index" do
|
6
6
|
before do
|
7
7
|
Person.stub(:all).and_return([
|
8
|
-
Person.new(:name=>'john' , :email=>'lennon@beatles.com'),
|
8
|
+
Person.new(:name=>'john' , :email=>'lennon@beatles.com'),
|
9
9
|
Person.new(:name=>'george', :email=>'harrison@beatles.com')
|
10
10
|
])
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
it "should respond success" do
|
14
14
|
get :index, :format => :pdf
|
15
|
-
|
15
|
+
|
16
16
|
response.should be_success
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
it "should not contain nulls" do
|
20
20
|
get :index, :format => :pdf
|
21
|
-
|
21
|
+
|
22
22
|
response.should_not contain("null")
|
23
23
|
end
|
24
24
|
|
25
25
|
it "should show all fields in the report" do
|
26
26
|
get :index, :format => :pdf
|
27
|
-
|
27
|
+
|
28
28
|
response.should contain("john")
|
29
29
|
response.should contain("lennon@beatles.com")
|
30
30
|
response.should contain("george")
|
31
31
|
response.should contain("harrison@beatles.com")
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
it "should clip the text if it's larger than the Text Field" do
|
35
35
|
Person.stub(:all).and_return([
|
36
|
-
Person.new(:name=>'jonh' , :email=>'a_very_long_text_that_is_larger_than_the_text_field_in_the_report')
|
36
|
+
Person.new(:name=>'jonh' , :email=>'a_very_long_text_that_is_larger_than_the_text_field_in_the_report')
|
37
37
|
])
|
38
|
-
|
38
|
+
|
39
39
|
get :index, :format => :pdf
|
40
|
-
|
40
|
+
|
41
41
|
response.should_not contain("a_very_long_text_that_is_larger_than_the_text_field_in_the_report")
|
42
42
|
response.should contain("a_very_long_text_that_is_larger_than_the_text_field_in_the_")
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
45
|
it "should show the parameters defined in the controller" do
|
46
46
|
get :index, :format => :pdf
|
47
|
-
|
47
|
+
|
48
48
|
response.should contain("I'm a parameter. I was defined in the controller")
|
49
49
|
end
|
50
|
-
|
50
|
+
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
describe "GET compile_time_error_report" do
|
54
|
-
|
54
|
+
|
55
55
|
it "should raise a RuntimeError if the report's design is not valid" do
|
56
56
|
expect { get :compile_time_error_report, :format => :pdf }.to raise_error(RuntimeError, /Report design not valid/)
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
describe "GET runtime_error_report" do
|
62
|
-
|
62
|
+
|
63
63
|
it "should raise a RuntimeError if the report could not be filled due to a runtime error" do
|
64
64
|
expect { get :runtime_error_report, :format => :pdf }.to raise_error(RuntimeError)
|
65
65
|
end
|
66
|
-
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "GET nil_datasource" do
|
70
|
+
|
71
|
+
it "should treat nil datasources" do
|
72
|
+
get :nil_datasource, :format => :pdf
|
73
|
+
|
74
|
+
response.should contain("I'm a parameter. I was defined in the controller")
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
describe "GET java_parameter" do
|
80
|
+
|
81
|
+
it "accepts java parameter without converting it to string" do
|
82
|
+
get :java_parameter, :format => :pdf
|
83
|
+
|
84
|
+
response.should contain("The Beatles")
|
85
|
+
end
|
86
|
+
|
67
87
|
end
|
68
|
-
|
69
|
-
end
|
88
|
+
|
89
|
+
end
|
@@ -3,18 +3,31 @@ class PeopleController < ActionController::Base
|
|
3
3
|
|
4
4
|
def index
|
5
5
|
@people = Person.all
|
6
|
-
|
6
|
+
|
7
7
|
@parameter_defined_in_the_controller = "I'm a parameter. I was defined in the controller"
|
8
|
-
|
8
|
+
|
9
9
|
respond_with @people
|
10
10
|
end
|
11
11
|
|
12
|
-
def compile_time_error_report
|
12
|
+
def compile_time_error_report
|
13
13
|
respond_with []
|
14
14
|
end
|
15
|
-
|
16
|
-
def runtime_error_report
|
15
|
+
|
16
|
+
def runtime_error_report
|
17
17
|
respond_with []
|
18
18
|
end
|
19
19
|
|
20
|
+
def nil_datasource
|
21
|
+
@parameter_defined_in_the_controller = "I'm a parameter. I was defined in the controller"
|
22
|
+
respond_with nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def java_parameter
|
26
|
+
title = (Rjb::import 'java.lang.String').new("The Beatles")
|
27
|
+
@parameter_that_is_a_java_class = (Rjb::import 'java.util.HashMap').new
|
28
|
+
@parameter_that_is_a_java_class.put("title", title)
|
29
|
+
|
30
|
+
respond_with nil
|
31
|
+
end
|
32
|
+
|
20
33
|
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="index" language="groovy" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="311ea5a2-cc66-43bf-9af3-b2e0a552b1de">
|
3
|
+
<property name="ireport.zoom" value="1.0"/>
|
4
|
+
<property name="ireport.x" value="0"/>
|
5
|
+
<property name="ireport.y" value="0"/>
|
6
|
+
<style name="Title" forecolor="#FFFFFF" fontName="Arial" fontSize="26" isBold="true" pdfFontName="Helvetica-Bold"/>
|
7
|
+
<style name="SubTitle" forecolor="#666666" fontName="Arial" fontSize="18"/>
|
8
|
+
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
|
9
|
+
<style name="Detail" fontName="Arial" fontSize="12"/>
|
10
|
+
<parameter name="parameter_that_is_a_java_class" class="java.util.Map"/>
|
11
|
+
<queryString language="xPath">
|
12
|
+
<![CDATA[/people/person]]>
|
13
|
+
</queryString>
|
14
|
+
<field name="name" class="java.lang.String">
|
15
|
+
<fieldDescription><![CDATA[name]]></fieldDescription>
|
16
|
+
</field>
|
17
|
+
<field name="email" class="java.lang.String">
|
18
|
+
<fieldDescription><![CDATA[email]]></fieldDescription>
|
19
|
+
</field>
|
20
|
+
<background>
|
21
|
+
<band splitType="Stretch"/>
|
22
|
+
</background>
|
23
|
+
<title>
|
24
|
+
<band height="70" splitType="Stretch">
|
25
|
+
<image>
|
26
|
+
<reportElement uuid="0b15b501-e65d-4f8b-b890-759a6d279efe" x="-20" y="0" width="595" height="64"/>
|
27
|
+
<imageExpression><![CDATA["wood.jpg"]]></imageExpression>
|
28
|
+
</image>
|
29
|
+
<staticText>
|
30
|
+
<reportElement uuid="dfeee47e-d32e-4525-a708-7cc3d6ec3f91" style="Title" x="0" y="5" width="263" height="33"/>
|
31
|
+
<textElement verticalAlignment="Middle"/>
|
32
|
+
<text><![CDATA[jasper-rails]]></text>
|
33
|
+
</staticText>
|
34
|
+
<textField>
|
35
|
+
<reportElement uuid="91699025-171b-40b4-ae45-eb9cdca69b2b" x="97" y="38" width="358" height="20" forecolor="#FFFFFF"/>
|
36
|
+
<textElement>
|
37
|
+
<font size="15"/>
|
38
|
+
</textElement>
|
39
|
+
<textFieldExpression><![CDATA[$P{parameter_that_is_a_java_class}.get("title")]]></textFieldExpression>
|
40
|
+
</textField>
|
41
|
+
</band>
|
42
|
+
</title>
|
43
|
+
<pageHeader>
|
44
|
+
<band splitType="Stretch"/>
|
45
|
+
</pageHeader>
|
46
|
+
<columnHeader>
|
47
|
+
<band height="36" splitType="Stretch">
|
48
|
+
<line>
|
49
|
+
<reportElement uuid="6a63817d-d338-4966-9432-96e7baffc7f8" positionType="FixRelativeToBottom" x="0" y="35" width="555" height="1"/>
|
50
|
+
<graphicElement>
|
51
|
+
<pen lineWidth="0.5" lineColor="#999999"/>
|
52
|
+
</graphicElement>
|
53
|
+
</line>
|
54
|
+
<staticText>
|
55
|
+
<reportElement uuid="89d037e3-230c-4845-b0aa-a43920c60dc2" x="48" y="15" width="100" height="20"/>
|
56
|
+
<textElement/>
|
57
|
+
<text><![CDATA[name]]></text>
|
58
|
+
</staticText>
|
59
|
+
<staticText>
|
60
|
+
<reportElement uuid="6920786b-3719-4243-bee2-9e4073274cb1" x="245" y="15" width="100" height="20"/>
|
61
|
+
<textElement/>
|
62
|
+
<text><![CDATA[email]]></text>
|
63
|
+
</staticText>
|
64
|
+
</band>
|
65
|
+
</columnHeader>
|
66
|
+
<detail>
|
67
|
+
<band height="21" splitType="Stretch">
|
68
|
+
<textField>
|
69
|
+
<reportElement uuid="63d9b6a9-caa5-40d8-8bb0-41822dd43364" x="48" y="0" width="185" height="20"/>
|
70
|
+
<textElement/>
|
71
|
+
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
|
72
|
+
</textField>
|
73
|
+
<textField>
|
74
|
+
<reportElement uuid="83b41533-c6ed-4de6-8c48-5545c9c78e43" x="245" y="0" width="290" height="20"/>
|
75
|
+
<textElement/>
|
76
|
+
<textFieldExpression><![CDATA[$F{email}]]></textFieldExpression>
|
77
|
+
</textField>
|
78
|
+
</band>
|
79
|
+
</detail>
|
80
|
+
<columnFooter>
|
81
|
+
<band height="45" splitType="Stretch">
|
82
|
+
<line>
|
83
|
+
<reportElement uuid="9642b713-530f-4d6e-a4dd-b6e7b4d07e2b" positionType="FixRelativeToBottom" x="0" y="3" width="555" height="1"/>
|
84
|
+
<graphicElement>
|
85
|
+
<pen lineWidth="0.5" lineColor="#999999"/>
|
86
|
+
</graphicElement>
|
87
|
+
</line>
|
88
|
+
</band>
|
89
|
+
</columnFooter>
|
90
|
+
<pageFooter>
|
91
|
+
<band height="20" splitType="Stretch">
|
92
|
+
<textField>
|
93
|
+
<reportElement uuid="06b23f1b-7ac0-4c70-bb2e-2aeb039f67a3" style="Column header" x="433" y="0" width="80" height="20"/>
|
94
|
+
<textElement textAlignment="Right">
|
95
|
+
<font size="10" isBold="false"/>
|
96
|
+
</textElement>
|
97
|
+
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
|
98
|
+
</textField>
|
99
|
+
<textField evaluationTime="Report">
|
100
|
+
<reportElement uuid="b8b7868e-fe9c-4e1b-8a24-75b97450ef73" style="Column header" x="513" y="0" width="40" height="20"/>
|
101
|
+
<textElement>
|
102
|
+
<font size="10" isBold="false"/>
|
103
|
+
</textElement>
|
104
|
+
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
|
105
|
+
</textField>
|
106
|
+
<textField pattern="EEEEE dd MMMMM yyyy">
|
107
|
+
<reportElement uuid="f924a532-c0df-4366-baad-4126ffb1462f" style="Column header" x="0" y="0" width="197" height="20"/>
|
108
|
+
<textElement>
|
109
|
+
<font size="10" isBold="false"/>
|
110
|
+
</textElement>
|
111
|
+
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
|
112
|
+
</textField>
|
113
|
+
</band>
|
114
|
+
</pageFooter>
|
115
|
+
<summary>
|
116
|
+
<band splitType="Stretch"/>
|
117
|
+
</summary>
|
118
|
+
</jasperReport>
|
@@ -0,0 +1,118 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="index" language="groovy" pageWidth="595" pageHeight="842" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="311ea5a2-cc66-43bf-9af3-b2e0a552b1de">
|
3
|
+
<property name="ireport.zoom" value="1.0"/>
|
4
|
+
<property name="ireport.x" value="0"/>
|
5
|
+
<property name="ireport.y" value="0"/>
|
6
|
+
<style name="Title" forecolor="#FFFFFF" fontName="Arial" fontSize="26" isBold="true" pdfFontName="Helvetica-Bold"/>
|
7
|
+
<style name="SubTitle" forecolor="#666666" fontName="Arial" fontSize="18"/>
|
8
|
+
<style name="Column header" forecolor="#666666" fontName="Arial" fontSize="12" isBold="true"/>
|
9
|
+
<style name="Detail" fontName="Arial" fontSize="12"/>
|
10
|
+
<parameter name="parameter_defined_in_the_controller" class="java.lang.String"/>
|
11
|
+
<queryString language="xPath">
|
12
|
+
<![CDATA[/people/person]]>
|
13
|
+
</queryString>
|
14
|
+
<field name="name" class="java.lang.String">
|
15
|
+
<fieldDescription><![CDATA[name]]></fieldDescription>
|
16
|
+
</field>
|
17
|
+
<field name="email" class="java.lang.String">
|
18
|
+
<fieldDescription><![CDATA[email]]></fieldDescription>
|
19
|
+
</field>
|
20
|
+
<background>
|
21
|
+
<band splitType="Stretch"/>
|
22
|
+
</background>
|
23
|
+
<title>
|
24
|
+
<band height="70" splitType="Stretch">
|
25
|
+
<image>
|
26
|
+
<reportElement uuid="0b15b501-e65d-4f8b-b890-759a6d279efe" x="-20" y="0" width="595" height="64"/>
|
27
|
+
<imageExpression><![CDATA["wood.jpg"]]></imageExpression>
|
28
|
+
</image>
|
29
|
+
<staticText>
|
30
|
+
<reportElement uuid="dfeee47e-d32e-4525-a708-7cc3d6ec3f91" style="Title" x="0" y="5" width="263" height="33"/>
|
31
|
+
<textElement verticalAlignment="Middle"/>
|
32
|
+
<text><![CDATA[jasper-rails]]></text>
|
33
|
+
</staticText>
|
34
|
+
<textField>
|
35
|
+
<reportElement uuid="91699025-171b-40b4-ae45-eb9cdca69b2b" x="97" y="38" width="358" height="20" forecolor="#FFFFFF"/>
|
36
|
+
<textElement>
|
37
|
+
<font size="15"/>
|
38
|
+
</textElement>
|
39
|
+
<textFieldExpression><![CDATA[$P{parameter_defined_in_the_controller}]]></textFieldExpression>
|
40
|
+
</textField>
|
41
|
+
</band>
|
42
|
+
</title>
|
43
|
+
<pageHeader>
|
44
|
+
<band splitType="Stretch"/>
|
45
|
+
</pageHeader>
|
46
|
+
<columnHeader>
|
47
|
+
<band height="36" splitType="Stretch">
|
48
|
+
<line>
|
49
|
+
<reportElement uuid="6a63817d-d338-4966-9432-96e7baffc7f8" positionType="FixRelativeToBottom" x="0" y="35" width="555" height="1"/>
|
50
|
+
<graphicElement>
|
51
|
+
<pen lineWidth="0.5" lineColor="#999999"/>
|
52
|
+
</graphicElement>
|
53
|
+
</line>
|
54
|
+
<staticText>
|
55
|
+
<reportElement uuid="89d037e3-230c-4845-b0aa-a43920c60dc2" x="48" y="15" width="100" height="20"/>
|
56
|
+
<textElement/>
|
57
|
+
<text><![CDATA[name]]></text>
|
58
|
+
</staticText>
|
59
|
+
<staticText>
|
60
|
+
<reportElement uuid="6920786b-3719-4243-bee2-9e4073274cb1" x="245" y="15" width="100" height="20"/>
|
61
|
+
<textElement/>
|
62
|
+
<text><![CDATA[email]]></text>
|
63
|
+
</staticText>
|
64
|
+
</band>
|
65
|
+
</columnHeader>
|
66
|
+
<detail>
|
67
|
+
<band height="21" splitType="Stretch">
|
68
|
+
<textField>
|
69
|
+
<reportElement uuid="63d9b6a9-caa5-40d8-8bb0-41822dd43364" x="48" y="0" width="185" height="20"/>
|
70
|
+
<textElement/>
|
71
|
+
<textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
|
72
|
+
</textField>
|
73
|
+
<textField>
|
74
|
+
<reportElement uuid="83b41533-c6ed-4de6-8c48-5545c9c78e43" x="245" y="0" width="290" height="20"/>
|
75
|
+
<textElement/>
|
76
|
+
<textFieldExpression><![CDATA[$F{email}]]></textFieldExpression>
|
77
|
+
</textField>
|
78
|
+
</band>
|
79
|
+
</detail>
|
80
|
+
<columnFooter>
|
81
|
+
<band height="45" splitType="Stretch">
|
82
|
+
<line>
|
83
|
+
<reportElement uuid="9642b713-530f-4d6e-a4dd-b6e7b4d07e2b" positionType="FixRelativeToBottom" x="0" y="3" width="555" height="1"/>
|
84
|
+
<graphicElement>
|
85
|
+
<pen lineWidth="0.5" lineColor="#999999"/>
|
86
|
+
</graphicElement>
|
87
|
+
</line>
|
88
|
+
</band>
|
89
|
+
</columnFooter>
|
90
|
+
<pageFooter>
|
91
|
+
<band height="20" splitType="Stretch">
|
92
|
+
<textField>
|
93
|
+
<reportElement uuid="06b23f1b-7ac0-4c70-bb2e-2aeb039f67a3" style="Column header" x="433" y="0" width="80" height="20"/>
|
94
|
+
<textElement textAlignment="Right">
|
95
|
+
<font size="10" isBold="false"/>
|
96
|
+
</textElement>
|
97
|
+
<textFieldExpression><![CDATA["Page "+$V{PAGE_NUMBER}+" of"]]></textFieldExpression>
|
98
|
+
</textField>
|
99
|
+
<textField evaluationTime="Report">
|
100
|
+
<reportElement uuid="b8b7868e-fe9c-4e1b-8a24-75b97450ef73" style="Column header" x="513" y="0" width="40" height="20"/>
|
101
|
+
<textElement>
|
102
|
+
<font size="10" isBold="false"/>
|
103
|
+
</textElement>
|
104
|
+
<textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
|
105
|
+
</textField>
|
106
|
+
<textField pattern="EEEEE dd MMMMM yyyy">
|
107
|
+
<reportElement uuid="f924a532-c0df-4366-baad-4126ffb1462f" style="Column header" x="0" y="0" width="197" height="20"/>
|
108
|
+
<textElement>
|
109
|
+
<font size="10" isBold="false"/>
|
110
|
+
</textElement>
|
111
|
+
<textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
|
112
|
+
</textField>
|
113
|
+
</band>
|
114
|
+
</pageFooter>
|
115
|
+
<summary>
|
116
|
+
<band splitType="Stretch"/>
|
117
|
+
</summary>
|
118
|
+
</jasperReport>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jasper-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-12-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rjb
|
@@ -97,7 +97,7 @@ files:
|
|
97
97
|
- lib/java/commons-logging-1.1.jar
|
98
98
|
- lib/java/groovy-all-1.7.5.jar
|
99
99
|
- lib/java/iText-2.1.7.jar
|
100
|
-
- lib/java/jasperreports-
|
100
|
+
- lib/java/jasperreports-5.0.0.jar
|
101
101
|
- lib/java/jcommon-1.0.15.jar
|
102
102
|
- lib/java/jfreechart-1.0.12.jar
|
103
103
|
- lib/java/xalan.jar
|
@@ -107,6 +107,8 @@ files:
|
|
107
107
|
- spec/internal/app/views/people/compile_time_error_report.jrxml
|
108
108
|
- spec/internal/app/views/people/index.jasper
|
109
109
|
- spec/internal/app/views/people/index.jrxml
|
110
|
+
- spec/internal/app/views/people/java_parameter.jrxml
|
111
|
+
- spec/internal/app/views/people/nil_datasource.jrxml
|
110
112
|
- spec/internal/app/views/people/runtime_error_report.jrxml
|
111
113
|
- spec/internal/app/views/people/wood.jpg
|
112
114
|
- spec/internal/config/routes.rb
|
@@ -143,6 +145,8 @@ test_files:
|
|
143
145
|
- spec/internal/app/views/people/compile_time_error_report.jrxml
|
144
146
|
- spec/internal/app/views/people/index.jasper
|
145
147
|
- spec/internal/app/views/people/index.jrxml
|
148
|
+
- spec/internal/app/views/people/java_parameter.jrxml
|
149
|
+
- spec/internal/app/views/people/nil_datasource.jrxml
|
146
150
|
- spec/internal/app/views/people/runtime_error_report.jrxml
|
147
151
|
- spec/internal/app/views/people/wood.jpg
|
148
152
|
- spec/internal/config/routes.rb
|