SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 187 | Next

John Ward

"Practical Data Analysis and Reporting with BIRT"

getElementFactory();
dataElement = elementFactory.newLabel("testElement");
//set the text from the valueFromScript variable and add
//to the report designs body
dataElement.setText(valueFromScript);
design.getDesignHandle().getBody().add(dataElement);
So let's take a look at this example. The valueFromScript variable is assigned from the
Report Parameter (retrieved from the reportContext, same as the previous example).
The next two lines are not really necessary, but they do illustrate that we will be using
objects retrieved from the BIRT API packages. This is the same as using the intrinsic
Java objects in our Expressions earlier, except we are using the BIRT API packages.
The next step is to retrieve the Design Handle from the reportContext. First, we use
getReportRunnable, which is a reference to the open Report Design. Then we use
the designHandle reference to get the Report Design Handle.
The next two lines retrieve the report element factory, which is a convenient way
to create Report Design elements (from the Design Handle), then use that element
factory to create a new Label element called testElement. Then we set the text of
that label to valueFromScript.
Chapter 10
[ 247 ]
The last part of the Script needs to reference the getBody method in order to get a slot
in the report to add a new element to.


Pages:
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6