Skip to main content



      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] Fri, 31 May 2013 22:25 Go to next message
Eclipse UserFriend
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 01:49 Go to previous messageGo to next message
Eclipse UserFriend
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 14:20 Go to previous messageGo to next message
Eclipse UserFriend
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 05:17 Go to previous message
Eclipse UserFriend
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 Jul 22 21:17:55 EDT 2025

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

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

Back to the top