Home » Eclipse Projects » Remote Application Platform (RAP) » How to make custom widgets themeable?
|
Re: How to make custom widgets themeable? [message #1231302 is a reply to message #1231274] |
Tue, 14 January 2014 09:59 |
Tim Buschtoens Messages: 396 Registered: July 2009 |
Senior Member |
|
|
Hi.
> Dropdown-Widget as base and made the needed changes for my widget.
You should be aware that this widget uses internals[1] and not the
recommended public API[2]. (I can afford to use internals since I'm
doing or at least approving all RAP internal JavaScript changes myself.)
The CKEditor[3] would be a better template. However, the theming is
currently not officially supported by the new API either, so if you
absolutely require that you admittedly must use internals.
> In some
> documentations(http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.rap.help%2Fhelp%2Fhtml%2Fadvanced%2Ftheming-custom.html)
> it states, that i have to register my widget as "themeableWidget" and
> add a ThemeAdapter. But the extensionpoint only allows classes of type
> "Control". I think this documentation is to old for rap 2.2.
>
It should still be correct[4].
> So my question is, how do i properly register a css-file/appearance, so
> that i'am able to access it on clientside(javascript)?
DropDown widget requires you to use the ApplicationConfiguration API[5]
to start your application. There any widget can be themeable[6].
Since this configuration code is not guaranteed to be present, the
DropDown code uses a try-catch. Please look at the getStyleMap function
to see how I it does that.
However, again, DropDown not being a control is a very special case and
not a good example (perhaps i should note that in the code). If you
build a custom widget, it should definitely extend a Composite[7].
I'm sorry for the confusion, I will add an entry on themeability to the
custom widget FAQ when I get around to it.
[1]
https://wiki.eclipse.org/RAP/Custom_Widgets_FAQ#Isn.27t_RAP_based_on_qooxdoo.3F_Can.2FShould_I_use_that.3F
[2]
http://download.eclipse.org/rt/rap/doc/2.2/guide/reference/jsdoc/index.html
[3] https://github.com/eclipsesource/rap-ckeditor
[4]
http://download.eclipse.org/rt/rap/doc/2.2/guide/reference/extension-points/org_eclipse_rap_ui_themeableWidgets.html
[5]
http://eclipse.org/rap/developers-guide/devguide.php?topic=application-configuration.html&version=2.2
[6]
http://download.eclipse.org/rt/rap/doc/2.2/guide/reference/api/org/eclipse/rap/rwt/application/Application.html#addThemableWidget%28java.lang.Class%29
[7]
http://wiki.eclipse.org/RAP/Custom_Widgets_FAQ#What_is_the_basic_architecture_of_a_Custom_Widget.3F
--
Tim Buschtöns
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Re: How to make custom widgets themeable? [message #1231763 is a reply to message #1231302] |
Wed, 15 January 2014 10:39 |
Christian Mohr Messages: 34 Registered: June 2012 |
Member |
|
|
Hi, thanks for your reply.
At the beginning i looked at both Incubator-Widgets(DropDown and CKEditor). The DropDown widget was closer to my custom widget, because it's an extension for a Text-Control, too. I don't absolutely require theming, but i wanted to keep the widget as customizable as possible (especially when i decide to make it available for others). I saw your try-catch block and used it the see whether the client gets the style information from the server, or not.
The "addThemableWidget" function was the missing hint that i needed, to understand how your DropDown widget registers its appearance. I was looking for it, but sadly i searched for themEable (with E), because the extension point for "plugin.xml" registration is written with E. And probably i've skipped this line unvoluntarily.
Do you think, there will be any plans on adding a plubic API for themes?
Thanks again for your help. I think i'll drop the theming for now and concentrate on the other parts
|
|
| | |
Goto Forum:
Current Time: Sat May 04 15:15:06 GMT 2024
Powered by FUDForum. Page generated in 0.03827 seconds
|