Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » What is the correct to set a CSS selector on a subclass
What is the correct to set a CSS selector on a subclass [message #1061494] Sat, 01 June 2013 02:25 Go to next message
Corby James is currently offline Corby JamesFriend
Messages: 6
Registered: June 2013
Junior Member
I'm trying to set the font on a eclipse ui forms widget - Section - which inherits from ExpandableComposite, which is a widget that supports custom theme-ing.

Can this be done and if so, how so I set CSS selector for it in my code?

I'm currently doing the following in code:

Section section = new Section(composite, style );
section.setData(RWT.CUSTOM_VARIANT, "viewlet_header");
section.setText(text);



In the CSS, I tried

Section.viewlet_header

viewlet_header

ExpandableComposite.viewlet_header

all to no avail.

Thanks for any help.

Re: What is the correct to set a CSS selector on a subclass [message #1061576 is a reply to message #1061494] Mon, 03 June 2013 05:49 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
as Section (ExpandableComposite) is not a direct themeable widget you
have to set your custom variant on the Composite CSS element:
Composite.viewlet_header
HTH,
Ivan

On 6/3/2013 4:29 AM, Corby James wrote:
> I'm trying to set the font on a eclipse ui forms widget - Section -
> which inherits from ExpandableComposite, which is a widget that
> supports custom theme-ing.
>
> Can this be done and if so, how so I set CSS selector for it in my code?
>
> I'm currently doing the following in code:
>
>
> Section section = new Section(composite, style );
> section.setData(RWT.CUSTOM_VARIANT, "viewlet_header");
> section.setText(text);
>
>
>
> In the CSS, I tried
> Section.viewlet_header
>
> viewlet_header
>
> ExpandableComposite.viewlet_header
>
> all to no avail.
>
> Thanks for any help.
>
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: What is the correct to set a CSS selector on a subclass [message #1063957 is a reply to message #1061576] Sun, 16 June 2013 18:20 Go to previous messageGo to next message
Corby James is currently offline Corby JamesFriend
Messages: 6
Registered: June 2013
Junior Member
Tried using the composite for the selector and its not firing. I'm calling the setData method on the section in the sub-class. Will that cause any issues?

Thanks,
Corby
Re: What is the correct to set a CSS selector on a subclass [message #1064011 is a reply to message #1063957] Mon, 17 June 2013 09:17 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Corby,
I looked at the Section code the there is a textLabel (Label/Hyperlink
widget) responsible for the text. To change the font of this textLabel
you have to set the custom variant on that widget. Unfortunately, this
internal textLabel control is not accessible (it is protected and can be
accessed by subclasses). A style sheet like:
Label.viewlet_header {
font: 18px Arial, sans-serif;
}
should work if you manage to set the custom variant on
Section#textLabel. Don't forget that the property set by the code
overrides the property set by the theming. In other word - Section sets
the font by code automatically. If you want your theme value, you have
to reset the font to null manually first - section.setFont( null );.
From my point of view it will be easier in your case to set your
desired font programmatically and not by the theming.
HTH,
Ivan

On 6/16/2013 9:20 PM, Corby James wrote:
> Tried using the composite for the selector and its not firing. I'm
> calling the setData method on the section in the sub-class. Will that
> cause any issues?
>
> Thanks,
> Corby

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:[ANN] RAP 2.1 RC2 is available
Next Topic:Calling RAP Code From The Outside
Goto Forum:
  


Current Time: Tue Apr 23 13:03:33 GMT 2024

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

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

Back to the top