View Full Version : Changing label values run-time

06-12-2002, 04:37 PM
Is there a way to change the value of a label element, e.g., the text that is displayed in the label, at run-time. I would like to be able to do this after the report has been created so that I can avoid editing the report definition file. I hope that this will allow for the display of user report criteria.

Thank you in advance for you help.


06-13-2002, 02:10 AM
Maybe use a ReportPropertyFunction? You need yesterday's bugfixes in cvs to make it work. See also the thread 'ReportPropertyFunction question'.

06-14-2002, 04:26 PM
I answered my own question:

((LabelElement) report.getReportHeader().getElement("lblRptHeaderTitle")).setLabel("This Is My Report Title");
((LabelElement) report.getReportHeader().getElement("lblRptHeaderDateBegin")).setLabel("6/01/02");
((LabelElement) report.getReportHeader().getElement("lblRptHeaderDateEnd")).setLabel("6/30/02");

((LabelElement) report.getPageHeader().getElement("lblPgHeaderTitle")).setLabel("This Is My Report Title");
((LabelElement) report.getPageHeader().getElement("lblPgHeaderDateBegin")).setLabel("6/01/02");
((LabelElement) report.getPageHeader().getElement("lblPgHeaderDateEnd")).setLabel("6/30/02");


06-17-2002, 02:00 PM
Does anybody have any ideas on how the above example could work with labels inside of groups or inside of ItemBands? I can get the reference I want inside of ReportHeaders and ReportFooters and inside of PageHeaders and PageFooters, but not anywhere else. I run into the same issue when I attempt to get the bounds (Rectangle2D) of a label inside of a group so that I can add labels beneath it. There does not seem to be a method such as getElement(String elementName).

Any suggestions are very much appreciated.



06-18-2002, 03:08 AM


report.getItemBand(). ...
report.getGroup("name").getHeader() ...
report.getGroup("name").getFooter() ...

for the missing bands.

There is no global getElement()-function to get all elements of an report, as elements are bound to a specific band. The names of the elements have to be unique within a band for the elements to be retrieved.

As far as I remember, there should be a function to get a list of all elements for a band for iteration over all elements.

Have more fun,
said Thomas