Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Theming a subclass of Button
Theming a subclass of Button [message #768704] Tue, 20 December 2011 16:25 Go to next message
Sam Missing name is currently offline Sam Missing nameFriend
Messages: 14
Registered: May 2011
Junior Member

In our application we have subclass of Button (i know, it isnt intended to be subclassed, but changing this would take quite long), lets call it MButton.
The size-computing of this subclass should be like it is with the normal Button.
In Button.computeSize() the ControlThemeAdapter.getPadding()-method uses getPrimaryElement() to determine the class which returns "MButton".
Now ThemeUtil retrieves the css-value with "MButton","padding".
I registered a theme extension (MButton.css) with an entry for MButton:
MButton {
background-image: none;
padding: 4px 5px;
spacing: 2px;
cursor: default;
animation: none;
color: #4a4a4a;
background-color: white;
opacity: 1;
I debugged already and it seems that ThemeCssValuesMap takes only values for widgets that are present in themeablewidgets and discards the others.
So the ControlThemeAdapter doesnt get the padding from the css-file.
I tried to register MButton as themeablewidget over the extensionpoint but then it doesnt find any elements (i suppose this are the values defined in xml-files the *kit's) but i also read in the help to rap that the xml-style of themeing is discontinued.
What did i miss?

Thanks in advance
Re: Theming a subclass of Button [message #769027 is a reply to message #768704] Wed, 21 December 2011 09:22 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member


Where did you read that "the xml-style of themeing is discontinued"?
This might be an ambiguous statement in the docs. In early versions,
RAP used property files for theming, but there has never been an
"xml-style" of theming.

When you've registered a themeable widget, you should create a file
MyWidget.theme.xml and a MyWidget.default.css place them in the package
that follows the naming convention outlined in the help. These files
are only found by a naming convention.

As you observed, only those properties, states and styles declared in
the theme.xml file are actually applied. For every declared property
there must be a default value in the default.css file.

Hope this helps, but you should really get rid of the sub-classed Button!

Regards, Ralf

Ralf Sternberg

Twitter: @EclipseRAP

Professional services for RAP and RCP?
Re: Theming a subclass of Button [message #779821 is a reply to message #769027] Mon, 16 January 2012 16:15 Go to previous message
Sam Missing name is currently offline Sam Missing nameFriend
Messages: 14
Registered: May 2011
Junior Member

Thank you for your quick reply, it worked!
I got a little confused reading about the theming thing regarding xml, css and so on.
Getting rid of the sub class of Button is on the list, but the application we are porting is very big and grown over the time and the class is used more than 8000 times and some code for automated testing tools may rely on this class being a subclass of Button. So its one of the last items of a long list Wink, if there are no more problems to come that originate out of the fact that it is a subclass of Button.

Previous Topic:why does the document.getElementById(this._id) return null?
Next Topic:about rap help integration
Goto Forum:

Current Time: Wed Jun 07 10:25:26 GMT 2023

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

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

Back to the top