Jump to content
We've recently updated our Privacy Statement, available here ×

Alter "design" after fill


ktrinad

Recommended Posts

By: Lucian Comanescu - lucicom

Alter "design" after fill

2004-06-02 06:20

Hi!

 

I'm not sure it is really a change request, so I wanted to post it first here for discussions.

 

I think it should be nice to be able to alter the "design" of a report after fill. After all, JasperPrint is just a "propietary format", isn't it? Why not allowing changes after the object is built?

 

Currently you can change the "text", for example, in JRPrintText (JRTemplatePrintText), but you can change neither the font, nor the colors, because:

- JRTemplatePrintElement contains a nop implementation of both setForecolor and setBackcolor

- JRTemplatePrintText has a nop setFont

 

I know that, for example, changing the width may drastically affect the design, but fonts and colors should be easy to alter (even if page by page). Or?

 

I would be also nice to get the "key" from JRDesignElement into the JRPrintElement, so you can easily identify the elements you want to alter.

 

[this will allow, for example, adding conditional format for text fields with variables and evaluation other than Now]

 

Of course, this is just my oppinion. Any pros and cons?

 

Lucian.

[Teodor]I even volunteer for this, as we badly need this feature :)

 

 

By: Chuck Deal - cdeal

RE: Alter "design" after fill

2004-06-02 07:41

Since you asked for comments...

 

I don't have a need myself for this feature, but the ability to change the colors might not be a bad idea.

 

From what I have read on the forums, changing the font may NOT be a good idea because Jasper uses the FontMetrics for layout and changing the font AFTER the layout has been completed could screw something up.

 

But why would you need to change the color/font after the fill? Couldn't you use the printWhenExpression, etc to control the filling process? Then you wouldn't need post-processing.

 

What about the new styledText feature?

 

 

By: Lucian Comanescu - lucicom

RE: Alter "design" after fill

2004-06-02 23:05

Hi!

 

>But why would you need to change the color/font

>after the fill? Couldn't you use the

>printWhenExpression, etc to control the filling

>process?

 

Actually my idea came from the imposibility to use printWhenExpression (with variables) in the group header. I have, let's say, a sum that must be displayed in the group header with diferent colors, depending on the value. I can postpone the evaluation of the text field until end of group, but the printWhenExpression is always evaluated when the header is "drawn", so my variable is always 0 (the initial value).

 

So I thought why not changing the attributes after fill, when I have all the informations? But I face the nop methods from above. The implementation may be easy: when you change the font or colors, you can easily create a clone for the "template" behind the text field, and change the attributes only on this clone. I didn't fully tested all the effects, but it seems to work. At least if you don't mess with the layout, but this is anyway at "your own risk" :)

 

>What about the new styledText feature?

 

This feature is REALLY a nice one, thanks Teodor for the idea. But, for my sums, I still need to go through the JasperPrint and find the sum fields and change the style. And I would really appreciate having the "key" attribute that would help me a lot to find the fields I want, but this is not available for JRPrintElements.

 

Btw, talking about styles, why not having also reportStyle that you can quote in element's style by name (or id), exaclty like reportFont - font pair? I know you can use entities, but, I guess, it will just be easier to understand for my "designers".

 

Back to JasperPrint, generic speaking, it is just a "propietary format" (quoting Teodor), so why not having this possibility? Especially now when you can anyway mess with the layout (if you have the possibility to change the style).

 

Lucian.

 

 

 

By: C-Box - c-box

RE: Alter "design" after fill

2004-06-03 05:07

Hi,

 

I also would like that feature, because it's no good solution to place a single field /variable twice on report just to get it in two different colors. Or imagine having 5 different sumfields and all could have 3 different values (smaller than O, exactly 0 or bigger than 0) so if you want to use red for negative, black for 0 and green for positive values... you must now add 15 (!!) fields on the report and edit each printwhenexpression and overlay the three fields for each of the 5 variables...

 

now explain that to a customer who want to change the layout of my pre-designed report.

 

So what about just a class that changes the color of "elements" (Field/StaticText or perhaps all drawable elements).

It needs the key of that element and its value (text) and with these two parameters you could easily change the color depending at the value.

I could image calling that method shortly before the elements are placed on the report. Perhaps even the scriptlet-class could used for that, because so the class is known by JasperReports engine!?!?

 

C-Box

 

 

By: Lucian Comanescu - lucicom

RE: Alter "design" after fill

2004-06-04 00:44

Hi cdeal!

 

Thanks a lot for your comments ... the suggestion with style was excellent. Currently I'm "frozen" with 0.5.0 in production, but, in the new release I'll upgrade to 0.5.3. I've tested yesterday and the <style> is in the element's "text" still after fill, so I can change it.

 

[for Teodor & Peter]

1. JRDesignElement's key

I know it is not really an orthodox idea to change the report after fill, but taking the "key" from JRDesignElement into the JRPrintElement, it is such a minor (and easy) change and, for my case and others with the same problem, it would be a really nice "feature". Maybe you take it into consideration?

2. reportStyle (see above)

I think the idea worth the implementation.

 

My best wishes to all jasper developers and users :)

Lucian.

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...