Jump to content
JasperReports Library 7.0 is now available ×

Add support for custom genereated class


Recommended Posts

By: Gallot Dominique - zovi

Add support for custom genereated class

2002-11-15 01:20

It will be great to be able to add import statement

in the report genereated class.

 

This will allow espression to be simplier.

It will be also geat the to able to ad class field in the genereated class, for keeping for example a dateformater, a class utility

 

For allowing to provide a factory for the JRClassGenerator or to allow passing it to the JRCompiler would be great.

 

If you 'd like have can give you my patch !

 

Dominique Gallot

cdga@europay.com

 

 

By: Teodor Danciu - teodord

RE: Add support for custom genereated class

2002-11-17 12:28

 

Hi,

 

Adding import statements into report designs is

a good idea. I thought about it once but never

implemented it due to other priorities.

 

However, note that you can simplify the report

expressions if you place them in a separate class.

The preferred way would be to use the scriptlet

class because there is a built-in parameter that

points to the scriptlet instance associated with the

current report filling process (see the last page of

the "scriptlet" sample).

Why bother declaring fields in the expressions

class if you can declare extra report variables to

store values or declare those utility fields in the

scriptlet class and access them from there?

 

A date formatter could be created using the

<initialValueExpression> of a variable which points

to itself like this (never tested it, but it should work):

 

<variable name="MyFormatter" resetType="Report" calculation="Nothing">

<variableExpression>$V{MyFormatter}</variableExpression>

<initialValueExpression>new SimpleDateFormat()</initialValueExpression>

</variable>

 

What I meant is that the MyFormatter variable

should get initialized only once and never change

its value till the end of the report. The same effect

could be obtained using calculation="System",

without the need for a variable expression.

 

Probably I should provide a sample for this.

 

BTW, have you checked the "pattern" attribute

of text fields?

 

Thank you,

Teodor

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...