|Theming a subclass of Button [message #768704]
||Tue, 20 December 2011 16:25
| Sam Missing name
Registered: May 2011
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:
padding: 4px 5px;
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
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!
Professional services for RAP and RCP?
Powered by FUDForum
. Page generated in 0.02074 seconds