Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Run Time Element Formatting(Set Styles on runtime to labels or data items created in script)
Run Time Element Formatting [message #713515] Mon, 08 August 2011 14:56 Go to next message
karvesh ghunsam is currently offline karvesh ghunsam
Messages: 95
Registered: July 2011
Member
Dear All,

I am a newbie to BIRT and I am just getting in touch with the power of scripting..

According to explanations provided by Jason Weathersby (thanks a lot), i have been able to include the following script in the BeforeFactory event of the report:

[i]tcell = header.getCells( ).get( i );
label = elementFactory.newLabel( null );
label.setText(columnHeaderArray);//$NON-NLS-1$
tcell.getContent( ).add( label );


As a result, a header of labels are created successfully depending on the number of columns i pass in the parameter.
The question here is how to set styles to the labels newly created. After digging in the forum, the closest i could come up with was a code like:

reportContext.getDesignHandle().findelement("mylabel").setstyleName("highlight-orange");

Unfortunately, my labels do not have names and i am not so familiar with the methods of label objects. Is there any where i could get some documentation or recommendations about how to change these objects in run-time?

Any help would be greatly welcomed...

Thanking you in advance,
Karvesh
Re: Run Time Element Formatting [message #713661 is a reply to message #713515] Mon, 08 August 2011 18:39 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Have you tried

label.setStyleName("highlight-orange");
Just do this right after you create the label.

Jason

On 8/8/2011 10:56 AM, karvesh wrote:
> Dear All,
>
> I am a newbie to BIRT and I am just getting in touch with the power of
> scripting..
>
> According to explanations provided by Jason Weathersby (thanks a lot), i
> have been able to include the following script in the BeforeFactory
> event of the report:
>
> [i]tcell = header.getCells( ).get( i );
> label = elementFactory.newLabel( null );
> label.setText(columnHeaderArray);//$NON-NLS-1$
> tcell.getContent( ).add( label );
>
> As a result, a header of labels are created successfully depending on
> the number of columns i pass in the parameter. The question here is how
> to set styles to the labels newly created. After digging in the forum,
> the closest i could come up with was a code like:
>
> reportContext.getDesignHandle().findelement("mylabel").setstyleName("highlight-orange");
>
>
> Unfortunately, my labels do not have names and i am not so familiar with
> the methods of label objects. Is there any where i could get some
> documentation or recommendations about how to change these objects in
> run-time?
>
> Any help would be greatly welcomed...
>
> Thanking you in advance,
> Karvesh
>
Re: Run Time Element Formatting [message #713771 is a reply to message #713661] Tue, 09 August 2011 02:57 Go to previous message
karvesh ghunsam is currently offline karvesh ghunsam
Messages: 95
Registered: July 2011
Member
Dear Jason

Thanks a lot
Its working all fine

Karvesh
Previous Topic:Suppress Table Header row in the last page
Next Topic:BIRT on Eclipse Indigo
Goto Forum:
  


Current Time: Thu Oct 23 12:34:22 GMT 2014

Powered by FUDForum. Page generated in 0.01683 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software