Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » LCA for your custom widget
LCA for your custom widget [message #37825] Mon, 16 July 2007 11:43 Go to next message
Eclipse UserFriend
Originally posted by: mehow.infogenia.pl

For a long time I was wondering why my custom widget doesn't work and
then discovered that RAP never loads my LCA class. So I wondered where
does it look for it and was quite stunned to discover the following:

If your widget class is

<package name>.<class name>

then your LCA class should be

<package name with 'internal' added anywhere>.<class name
lowercase>kit.<class>LCA

E.g. if your widget class is com.example.rap.widgets.MyCoolWidget, then
your LCA class should be one of the following:

internal.com.example.rap.widgets.mycoolwidgetkit.MyCoolWidge tLCA
com.internal.example.rap.widgets.mycoolwidgetkit.MyCoolWidge tLCA
com.example.internal.rap.widgets.mycoolwidgetkit.MyCoolWidge tLCA
com.example.rap.internal.widgets.mycoolwidgetkit.MyCoolWidge tLCA
com.example.rap.widgets.internal.mycoolwidgetkit.MyCoolWidge tLCA

Hope this helps others get their widgets working.

Michał
Re: LCA for your custom widget [message #37891 is a reply to message #37825] Mon, 16 July 2007 12:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: andreasruempel.gmx.net

> If your widget class is
>
> <package name>.<class name>
>
> then your LCA class should be
>
> <package name with 'internal' added anywhere>.<class name
> lowercase>kit.<class>LCA

You could also specify the LCA class directly in your custom widget
class using the getAdapter() method:

public Object getAdapter(final Class adapter) {
if(adapter == ILifeCycleAdapter.class) return new MyWidgetLCA();
return super.getAdapter(adapter);
}

Andi
Re: LCA for your custom widget [message #38032 is a reply to message #37891] Mon, 16 July 2007 14:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Hi,

Andreas Rümpel schrieb:
>> If your widget class is
>>
>> <package name>.<class name>
>>
>> then your LCA class should be
>>
>> <package name with 'internal' added anywhere>.<class name
>> lowercase>kit.<class>LCA
>
> You could also specify the LCA class directly in your custom widget
> class using the getAdapter() method:
>
> public Object getAdapter(final Class adapter) {
> if(adapter == ILifeCycleAdapter.class) return new MyWidgetLCA();
> return super.getAdapter(adapter);
> }

Interesting. I wasn't even aware that this was possible ;-)
But using the name conventions is surely the recommended practice.
That's the way all RWT Widgets plug their LCAs in.

Moreover, if you make your custom widget themeable, the theme manager
also looks for theme definition files in the internal <widget>kit packages.

Regards,

Ralf
Re: LCA for your custom widget [message #38135 is a reply to message #38032] Mon, 16 July 2007 16:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mehow.infogenia.pl

Ralf Sternberg pisze:
> Hi,
>
> Andreas Rümpel schrieb:
>>> If your widget class is
>>>
>>> <package name>.<class name>
>>>
>>> then your LCA class should be
>>>
>>> <package name with 'internal' added anywhere>.<class name
>>> lowercase>kit.<class>LCA
>>
>> You could also specify the LCA class directly in your custom widget
>> class using the getAdapter() method:
>>
>> public Object getAdapter(final Class adapter) {
>> if(adapter == ILifeCycleAdapter.class) return new MyWidgetLCA();
>> return super.getAdapter(adapter);
>> }
>
> Interesting. I wasn't even aware that this was possible ;-)
> But using the name conventions is surely the recommended practice.
> That's the way all RWT Widgets plug their LCAs in.
>
> Moreover, if you make your custom widget themeable, the theme manager
> also looks for theme definition files in the internal <widget>kit packages.

Talking about making custom widgets themeable, can you tell me how do I
do it? I can see that ThemeManager looks for two types of files:
<class name>.theme.xml
<class name>.appearances.js

I found many examples of *.theme.xml files in RWT sources, but I'm not
sure what is their function. Are there just for the generation of the
some theme file? Or maybe they're generated themselves from the js comments?

On the other hand I didn't find any example of an *.appearances.js file.
Can you tell me its structure and function, please?

Regards,

Michał


>
> Regards,
>
> Ralf
Theming of the custom widgets (was: LCA for your custom widget) [message #38498 is a reply to message #38135] Tue, 17 July 2007 08:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mehow.infogenia.pl

It seems that your response did not go to the newsgroup, so let me
answer there. Just a bunch of silly questions:

Ralf Sternberg wrote:
> Hi, Michał,
>
>> Talking about making custom widgets themeable, can you tell me how do
>> I do it? I can see that ThemeManager looks for two types of files:
>> <class name>.theme.xml
>> <class name>.appearances.js
>
>> I found many examples of *.theme.xml files in RWT sources, but I'm
>> not sure what is their function. Are there just for the generation of
>> the some theme file? Or maybe they're generated themselves from the
>> js comments?
>
> <Widget>.theme.xml is the theme definition file. Here you can set the
> properties that ought to be themeable for your widget. Colors, Borders
> and Fonts are automatically added to the appropriate theme files and
> can be referenced in the DefaultAppearance.js. Dimensions and box
> dimensions (paddings, margins) must be referenced using the
> THEME_VALUE macro as shown below.

What do you mean by "are automatically added to the appropriate theme
files"? Does it happen in runtime or is there some process you use to
generate those theme files?
Are the default values specified here applied automatically or are they
just used to create theme file comments (e.g. "# default: 247, 247, 251")?
DefaultAppearance.js is part of RWT, how can I use it? Should I copy it
to my code? Should I use it all? Or maybe it's enough to create
appropriate *.appearance.js file?

>> On the other hand I didn't find any example of an *.appearances.js
>> file. Can you tell me its structure and function, please?
>
> <Widget>.appearance.js is a JavaScript fragment to be included in the
> DefaultAppearance.js.
>
> It should look like this:
>
> ---8<---
> appearances = {
> // BEGIN TEMPLATE //
>
> "mywidget" : {
> style : function( states ) {
> return {
> border : "mywidget.border",
> backgroundColor : "mywidget.background",
> padding : THEME_VALUE( "mywidget.padding" ),
> ...
> }
> }
> }
>
> // END TEMPLATE //
> };
> --->8---

Again, do you mean it is included in runtime?

Should these two files be registered using
org.eclipse.rap.ui.workbench.resources extension point?

Should I use org.eclipse.rap.swt.themeableWidgets extension point? If
so, is the name attribute the same name that is to be used in the files
above ("mywidget" in your example)?

I did most of the steps mentioned, but my widget remains unthemeable.
Answers to these questions will help a lot. Thanks.

Michał

> Hope that helps so far, please feel free to ask further questions.
> I promise to prepare a tutorial.
>
> Regards,
> Ralf
>
Re: Theming of the custom widgets [message #38533 is a reply to message #38498] Tue, 17 July 2007 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Hi,

Michał Tkacz schrieb:
> It seems that your response did not go to the newsgroup, so let me
> answer there. Just a bunch of silly questions:

Oops, sorry, I received a private copy and accidentally answered this one.

>> <Widget>.theme.xml is the theme definition file. Here you can set the
>> properties that ought to be themeable for your widget. Colors, Borders
>> and Fonts are automatically added to the appropriate theme files and
>> can be referenced in the DefaultAppearance.js. Dimensions and box
>> dimensions (paddings, margins) must be referenced using the
>> THEME_VALUE macro as shown below.
>
> What do you mean by "are automatically added to the appropriate theme
> files"? Does it happen in runtime or is there some process you use to
> generate those theme files?

Qooxdoo allows for different theme files for colors, borders, fonts,
etc. These files are created automatically by RAP at application start,
based on the default values from the *.theme.xml files and the custom
theme files.

> Are the default values specified here applied automatically or are they
> just used to create theme file comments (e.g. "# default: 247, 247, 251")?

Both. It's applied automatically and used for the default comments.

> DefaultAppearance.js is part of RWT, how can I use it? Should I copy it
> to my code? Should I use it all? Or maybe it's enough to create
> appropriate *.appearance.js file?

Create a *.appearance.js file as in the example below. The use of these
files is not to have to patch the DefaultAppearance.js for custom widgets.

>>> On the other hand I didn't find any example of an *.appearances.js
>>> file. Can you tell me its structure and function, please?
>>
>> <Widget>.appearance.js is a JavaScript fragment to be included in the
>> DefaultAppearance.js.
>>
>> It should look like this:
>>
>> ---8<---
>> appearances = {
>> // BEGIN TEMPLATE //
>>
>> "mywidget" : {
>> style : function( states ) {
>> return {
>> border : "mywidget.border",
>> backgroundColor : "mywidget.background",
>> padding : THEME_VALUE( "mywidget.padding" ),
>> ...
>> }
>> }
>> }
>>
>> // END TEMPLATE //
>> };
>> --->8---
>
> Again, do you mean it is included in runtime?

Yes, it is read at application start and included in the
DefaultAppearances.js.

> Should these two files be registered using
> org.eclipse.rap.ui.workbench.resources extension point?

No, you don't have to register them. Just put them into the same
internal <widget>kit package as the LCA, the one you mentioned in the
first post.

> Should I use org.eclipse.rap.swt.themeableWidgets extension point? If
> so, is the name attribute the same name that is to be used in the files
> above ("mywidget" in your example)?
>
> I did most of the steps mentioned, but my widget remains unthemeable.
> Answers to these questions will help a lot. Thanks.

Have you registered your custom widget with the extension point
org.eclipse.rap.swt.themeableWidgets?

Ralf
Re: Theming of the custom widgets [message #38671 is a reply to message #38533] Tue, 17 July 2007 09:30 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mehow.infogenia.pl

Ralf Sternberg pisze:
> Hi,
>
> Michał Tkacz schrieb:
>> It seems that your response did not go to the newsgroup, so let me
>> answer there. Just a bunch of silly questions:
>
> Oops, sorry, I received a private copy and accidentally answered this one.
>
>>> <Widget>.theme.xml is the theme definition file. Here you can set the
>>> properties that ought to be themeable for your widget. Colors,
>>> Borders and Fonts are automatically added to the appropriate theme
>>> files and can be referenced in the DefaultAppearance.js. Dimensions
>>> and box dimensions (paddings, margins) must be referenced using the
>>> THEME_VALUE macro as shown below.
>>
>> What do you mean by "are automatically added to the appropriate theme
>> files"? Does it happen in runtime or is there some process you use to
>> generate those theme files?
>
> Qooxdoo allows for different theme files for colors, borders, fonts,
> etc. These files are created automatically by RAP at application start,
> based on the default values from the *.theme.xml files and the custom
> theme files.
>
>> Are the default values specified here applied automatically or are
>> they just used to create theme file comments (e.g. "# default: 247,
>> 247, 251")?
>
> Both. It's applied automatically and used for the default comments.
>
>> DefaultAppearance.js is part of RWT, how can I use it? Should I copy
>> it to my code? Should I use it all? Or maybe it's enough to create
>> appropriate *.appearance.js file?
>
> Create a *.appearance.js file as in the example below. The use of these
> files is not to have to patch the DefaultAppearance.js for custom widgets.
>
>>>> On the other hand I didn't find any example of an *.appearances.js
>>>> file. Can you tell me its structure and function, please?
>>>
>>> <Widget>.appearance.js is a JavaScript fragment to be included in the
>>> DefaultAppearance.js.
>>>
>>> It should look like this:
>>>
>>> ---8<---
>>> appearances = {
>>> // BEGIN TEMPLATE //
>>>
>>> "mywidget" : {
>>> style : function( states ) {
>>> return {
>>> border : "mywidget.border",
>>> backgroundColor : "mywidget.background",
>>> padding : THEME_VALUE( "mywidget.padding" ),
>>> ...
>>> }
>>> }
>>> }
>>>
>>> // END TEMPLATE //
>>> };
>>> --->8---
>>
>> Again, do you mean it is included in runtime?
>
> Yes, it is read at application start and included in the
> DefaultAppearances.js.
>
>> Should these two files be registered using
>> org.eclipse.rap.ui.workbench.resources extension point?
>
> No, you don't have to register them. Just put them into the same
> internal <widget>kit package as the LCA, the one you mentioned in the
> first post.
>
>> Should I use org.eclipse.rap.swt.themeableWidgets extension point? If
>> so, is the name attribute the same name that is to be used in the
>> files above ("mywidget" in your example)?
>>
>> I did most of the steps mentioned, but my widget remains unthemeable.
>> Answers to these questions will help a lot. Thanks.
>
> Have you registered your custom widget with the extension point
> org.eclipse.rap.swt.themeableWidgets?

Yes, I did. Here's my current setup:

1) Widget is pl.infogenia.rap.widgets.Box (it works)
2) There's Box.theme.xml in pl.infogenia.rap.widgets.internal.boxkit
package:

<?xml version="1.0" encoding="iso-8859-1" ?>
<!-- Themeable properties for Boxes -->
<theme>
<color name="box.background"
description="Background color for Boxes"
default="#FF0000"/>
</theme>

3) There's Box.appearances.js in the same package (it's "appearances.js"
and not "appearance.js" although it's easy to forget that):

appearances = {
// BEGIN TEMPLATE //
"box" :
{
style : function( states ) {
return {
backgroundColor : "box.background"
}
}
}
// END TEMPLATE //
}

4) There's an extension:

<extension
point="org.eclipse.rap.swt.themeableWidgets">
<widget
class="pl.infogenia.rap.widgets.Box"
id="pl.infogenia.rap.widgets.Box"
name="box">
</widget>
</extension>

When I run it, the background of the widget remains unchanged. If I
register a custom theme and try to set box.background property I get
this warning:

Could not register SWT theme 'pl.infogenia.rap.widgets.CustomTheme' from
file 'custom-theme.properties'. Reason: Undefined key: box.background

What am I missing?

Michał
Re: Theming of the custom widgets [message #38765 is a reply to message #38671] Tue, 17 July 2007 10:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Michał Tkacz schrieb:
> Yes, I did. Here's my current setup:
>
> 1) Widget is pl.infogenia.rap.widgets.Box (it works)
> 2) There's Box.theme.xml in pl.infogenia.rap.widgets.internal.boxkit
> package:
>
> <?xml version="1.0" encoding="iso-8859-1" ?>
> <!-- Themeable properties for Boxes -->
> <theme>
> <color name="box.background"
> description="Background color for Boxes"
> default="#FF0000"/>
> </theme>
>
> 3) There's Box.appearances.js in the same package (it's "appearances.js"
> and not "appearance.js" although it's easy to forget that):
>
> appearances = {
> // BEGIN TEMPLATE //
> "box" :
> {
> style : function( states ) {
> return {
> backgroundColor : "box.background"
> }
> }
> }
> // END TEMPLATE //
> }
>
> 4) There's an extension:
>
> <extension
> point="org.eclipse.rap.swt.themeableWidgets">
> <widget
> class="pl.infogenia.rap.widgets.Box"
> id="pl.infogenia.rap.widgets.Box"
> name="box">
> </widget>
> </extension>
>
> When I run it, the background of the widget remains unchanged. If I
> register a custom theme and try to set box.background property I get
> this warning:
>
> Could not register SWT theme 'pl.infogenia.rap.widgets.CustomTheme' from
> file 'custom-theme.properties'. Reason: Undefined key: box.background
>
> What am I missing?

Everything look fine for me. You can add the parameter
-Dorg.eclipse.swt.internal.theme.ThemeManager.log=true
to the VM args to make the ThemeManager write some debug output to the
console. It should write something like this:

....
Processing widget: org.eclipse.rap.custom.MyControl
looking through package internal.org.eclipse.rap.custom.mycontrolkit
looking through package org.internal.eclipse.rap.custom.mycontrolkit
looking through package org.eclipse.internal.rap.custom.mycontrolkit
looking through package org.eclipse.rap.internal.custom.mycontrolkit
looking through package org.eclipse.rap.custom.internal.mycontrolkit
Found theme definition file:
org/eclipse/rap/custom/internal/mycontrolkit/MyControl.theme .xml
Found appearance js file:
org/eclipse/rap/custom/internal/mycontrolkit/MyControl.appea rances.js
....

Could you please check that?

Ralf
Re: Theming of the custom widgets [message #38894 is a reply to message #38765] Tue, 17 July 2007 11:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mehow.infogenia.pl

Ha! I knew it must be some silly mistake. Instead of taking RAP plugins
from workspace (checked out from the CVS) I took ones from the target
platform (still M4). I fixed that and now it works great!

Thanks for the answers and sorry for the confusion,

Michał

Ralf Sternberg pisze:
> Michał Tkacz schrieb:
>> Yes, I did. Here's my current setup:
>>
>> 1) Widget is pl.infogenia.rap.widgets.Box (it works)
>> 2) There's Box.theme.xml in pl.infogenia.rap.widgets.internal.boxkit
>> package:
>>
>> <?xml version="1.0" encoding="iso-8859-1" ?>
>> <!-- Themeable properties for Boxes -->
>> <theme>
>> <color name="box.background"
>> description="Background color for Boxes"
>> default="#FF0000"/>
>> </theme>
>>
>> 3) There's Box.appearances.js in the same package (it's
>> "appearances.js" and not "appearance.js" although it's easy to forget
>> that):
>>
>> appearances = {
>> // BEGIN TEMPLATE //
>> "box" :
>> {
>> style : function( states ) {
>> return {
>> backgroundColor : "box.background"
>> }
>> }
>> }
>> // END TEMPLATE //
>> }
>>
>> 4) There's an extension:
>>
>> <extension
>> point="org.eclipse.rap.swt.themeableWidgets">
>> <widget
>> class="pl.infogenia.rap.widgets.Box"
>> id="pl.infogenia.rap.widgets.Box"
>> name="box">
>> </widget>
>> </extension>
>>
>> When I run it, the background of the widget remains unchanged. If I
>> register a custom theme and try to set box.background property I get
>> this warning:
>>
>> Could not register SWT theme 'pl.infogenia.rap.widgets.CustomTheme'
>> from file 'custom-theme.properties'. Reason: Undefined key:
>> box.background
>>
>> What am I missing?
>
> Everything look fine for me. You can add the parameter
> -Dorg.eclipse.swt.internal.theme.ThemeManager.log=true
> to the VM args to make the ThemeManager write some debug output to the
> console. It should write something like this:
>
> ...
> Processing widget: org.eclipse.rap.custom.MyControl
> looking through package internal.org.eclipse.rap.custom.mycontrolkit
> looking through package org.internal.eclipse.rap.custom.mycontrolkit
> looking through package org.eclipse.internal.rap.custom.mycontrolkit
> looking through package org.eclipse.rap.internal.custom.mycontrolkit
> looking through package org.eclipse.rap.custom.internal.mycontrolkit
> Found theme definition file:
> org/eclipse/rap/custom/internal/mycontrolkit/MyControl.theme .xml
> Found appearance js file:
> org/eclipse/rap/custom/internal/mycontrolkit/MyControl.appea rances.js
> ...
>
> Could you please check that?
>
> Ralf
Re: Theming of the custom widgets [message #38918 is a reply to message #38894] Tue, 17 July 2007 12:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Michał Tkacz schrieb:
> Ha! I knew it must be some silly mistake. Instead of taking RAP plugins
> from workspace (checked out from the CVS) I took ones from the target
> platform (still M4). I fixed that and now it works great!

Fine!

Now that your widget has a themeable background color you should also
add a <Widget>ThemeAdapter class that implements IControlThemeAdapter
and place it into the same package. This is the bridge to the SWT code
and makes sure that Control#getBackground() etc. return correct values.
Have a look at the ControlThemeAdapter for an example.

Ralf
Re: Theming of the custom widgets [message #39085 is a reply to message #38918] Tue, 17 July 2007 14:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mehow.infogenia.pl

Ralf Sternberg pisze:
> Michał Tkacz schrieb:
>> Ha! I knew it must be some silly mistake. Instead of taking RAP
>> plugins from workspace (checked out from the CVS) I took ones from the
>> target platform (still M4). I fixed that and now it works great!
>
> Fine!
>
> Now that your widget has a themeable background color you should also
> add a <Widget>ThemeAdapter class that implements IControlThemeAdapter
> and place it into the same package. This is the bridge to the SWT code
> and makes sure that Control#getBackground() etc. return correct values.
> Have a look at the ControlThemeAdapter for an example.
>
> Ralf

Ok, I did it. I have another problem though (sorry ;)

I'm trying to make a sub-component of my widget, the title, themeable. I
had no problem making its background color themeable, but I have
problems doing the same with the position.

In Box.theme.xml I added

<color name="box.title.background"
description="Background color for Boxes' titles"
default="255, 255, 255"/>

<dimension name="box.title.left"
description="Left offset for Boxes' titles"
default="5"/>


In Box.appearances.js if I add

"box-title" :
{
style : function( states ) {
return {
backgroundColor : "box.title.background",
left : 5
}
}
}

then both the background and the positioning work. However if I replace
"5" with

THEME_VALUE( "box.title.left" )

then the widget doesn't appear at all. There're no extra messages on the
console and no errors in the error console available in Firefox.

It seems to me that the macro is not expanded (it's not expanded in the
output visible in the console), but I don't know the reason. Can you
spot it? Should I use sth else instead of <dimension/>?

I hope I don't use too much of your time :)

Michał
Re: Theming of the custom widgets [message #39173 is a reply to message #39085] Tue, 17 July 2007 16:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Hi Michał,

Michał Tkacz schrieb:
> [...]
> It seems to me that the macro is not expanded (it's not expanded in the
> output visible in the console), but I don't know the reason. Can you
> spot it? Should I use sth else instead of <dimension/>?

Right, there was a substitution missing in the ThemeManager. I fixed it
in CVS. Sorry, theming for custom widgets is still bleeding edge ;-)

BTW: If you're about to start with themeable images for your custom
widgets, please wait until the end of this week. This is not working yet
and I'm gonna have to change something there.

> I hope I don't use too much of your time :)

Don't worry ;-) Your feedback is welcome!

Ralf
Re: Theming of the custom widgets [message #39234 is a reply to message #39173] Tue, 17 July 2007 18:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mehow.infogenia.pl

Ralf Sternberg wrote:
> Hi Michał,
>
> Michał Tkacz schrieb:
>> [...]
>> It seems to me that the macro is not expanded (it's not expanded in
>> the output visible in the console), but I don't know the reason. Can
>> you spot it? Should I use sth else instead of <dimension/>?
>
> Right, there was a substitution missing in the ThemeManager. I fixed it
> in CVS. Sorry, theming for custom widgets is still bleeding edge ;-)

I see. No problem. It's even more exciting ;)
Anyway it works now, thanks.

> BTW: If you're about to start with themeable images for your custom
> widgets, please wait until the end of this week. This is not working yet
> and I'm gonna have to change something there.

Aaah, your're reading my mind ;) Ok, I'll wait. In fact I didn't manage
to make the images work even without the theming yet.

I added following code to my Box.appearances.js, but the image does not
appear:

"box-toggle" :
{
style : function( states ) {
return {
source :
"pl/infogenia/rap/widgets/internal/boxkit/opentriangle.gif"
}
}
}

Here's how the image is created:

this._toggleObject = new qx.ui.basic.Image;
this._toggleObject.setAppearance("box-toggle");

I don't think I should register the file using resources extension
point, should I?

What do you think?

Michał

>
>> I hope I don't use too much of your time :)
>
> Don't worry ;-) Your feedback is welcome!
>
> Ralf
Re: Theming of the custom widgets [message #39540 is a reply to message #39234] Wed, 18 July 2007 10:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mehow.infogenia.pl

I also tried to replace "Image" with "Atom" and "source" with "icon" but
it didn't help :(

Michał

Michał Tkacz pisze:
> Ralf Sternberg wrote:
>> Hi Michał,
>>
>> Michał Tkacz schrieb:
>>> [...]
>>> It seems to me that the macro is not expanded (it's not expanded in
>>> the output visible in the console), but I don't know the reason. Can
>>> you spot it? Should I use sth else instead of <dimension/>?
>>
>> Right, there was a substitution missing in the ThemeManager. I fixed
>> it in CVS. Sorry, theming for custom widgets is still bleeding edge ;-)
>
> I see. No problem. It's even more exciting ;)
> Anyway it works now, thanks.
>
>> BTW: If you're about to start with themeable images for your custom
>> widgets, please wait until the end of this week. This is not working
>> yet and I'm gonna have to change something there.
>
> Aaah, your're reading my mind ;) Ok, I'll wait. In fact I didn't manage
> to make the images work even without the theming yet.
>
> I added following code to my Box.appearances.js, but the image does not
> appear:
>
> "box-toggle" :
> {
> style : function( states ) {
> return {
> source :
> "pl/infogenia/rap/widgets/internal/boxkit/opentriangle.gif"
> }
> }
> }
>
> Here's how the image is created:
>
> this._toggleObject = new qx.ui.basic.Image;
> this._toggleObject.setAppearance("box-toggle");
>
> I don't think I should register the file using resources extension
> point, should I?
>
> What do you think?
>
> Michał
>
>>
>>> I hope I don't use too much of your time :)
>>
>> Don't worry ;-) Your feedback is welcome!
>>
>> Ralf
Re: Theming of the custom widgets [message #39571 is a reply to message #39540] Wed, 18 July 2007 11:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Hi Michał,

Michał Tkacz schrieb:
> I also tried to replace "Image" with "Atom" and "source" with "icon" but
> it didn't help :(

Try "backgroundImage" instead of "icon". But, however, I haven't figured
out the ultimate way to register default images for custom widgets plus
I think that the theming should rather work with image sets instead of
images. This is still work in progress.

Ralf
Re: Theming of the custom widgets [message #46150 is a reply to message #39571] Wed, 12 September 2007 06:23 Go to previous messageGo to next message
Oliver Köhler is currently offline Oliver KöhlerFriend
Messages: 32
Registered: July 2009
Member
Hi all,
I'd like to add some thoughts and some question to this subject as we're
doing working on some custom widgets and some custom themes as well.
We had the need to change the appearance of some standard widgets not by
changing the color, border and font but to add background images as
well to the existing widgets. So there was the need to add new
appearances to
the already existing widgets.

So what we did now is exactly as described here.
- Created a widget which does exactly nothing ;-)
- declared the widget themeable by setting an extension point to this widget
- added a <widget>.appearances.js and <widget>.theme.xml to the
*.internal.<widget>kit folder

Result was that it is possible to add more than one appearance to his
<widget>.appearances.js file as well as adding more Colors and Fonts to
the <widget>.theme.xml file.
What now remains is to load images which are needed for the appearances.
My first test would be to simply add them to a plugin-local source
folder and to set the path according to that folder i.e.

// that is my appearance that has been defined in <widget>.appearance.js
"customlabel" :
{
style : function( states ) {
return {
backgroundImage : "resources/button.gif",
paddingTop: 5,
paddingLeft: 5
};
}
},

Also I have that image (button.gif) under the given folder /resources in
the same plugin.

If somebody has anything to add to this subject I would be very glad to
hear your thoughts.

Regards

Oliver

Ralf Sternberg schrieb:
> Hi Michał,
>
> Michał Tkacz schrieb:
>> I also tried to replace "Image" with "Atom" and "source" with "icon"
>> but it didn't help :(
>
> Try "backgroundImage" instead of "icon". But, however, I haven't figured
> out the ultimate way to register default images for custom widgets plus
> I think that the theming should rather work with image sets instead of
> images. This is still work in progress.
>
> Ralf
Re: Theming of the custom widgets [message #46180 is a reply to message #46150] Wed, 12 September 2007 07:05 Go to previous messageGo to next message
Oliver Köhler is currently offline Oliver KöhlerFriend
Messages: 32
Registered: July 2009
Member
Update:
After trying to use an appearance including an image we have found out
that this has failed. We have tried then to register the images in a
static block in the LCA of the DummyWidget but even this does not seem
to work.
Regards
Oliver

Poncho schrieb:
> Hi all,
> I'd like to add some thoughts and some question to this subject as we're
> doing working on some custom widgets and some custom themes as well.
> We had the need to change the appearance of some standard widgets not by
> changing the color, border and font but to add background images as
> well to the existing widgets. So there was the need to add new
> appearances to
> the already existing widgets.
>
> So what we did now is exactly as described here.
> - Created a widget which does exactly nothing ;-)
> - declared the widget themeable by setting an extension point to this
> widget
> - added a <widget>.appearances.js and <widget>.theme.xml to the
> *.internal.<widget>kit folder
>
> Result was that it is possible to add more than one appearance to his
> <widget>.appearances.js file as well as adding more Colors and Fonts to
> the <widget>.theme.xml file.
> What now remains is to load images which are needed for the appearances.
> My first test would be to simply add them to a plugin-local source
> folder and to set the path according to that folder i.e.
>
> // that is my appearance that has been defined in <widget>.appearance.js
> "customlabel" :
> {
> style : function( states ) {
> return {
> backgroundImage : "resources/button.gif",
> paddingTop: 5,
> paddingLeft: 5
> };
> }
> },
>
> Also I have that image (button.gif) under the given folder /resources in
> the same plugin.
>
> If somebody has anything to add to this subject I would be very glad to
> hear your thoughts.
>
> Regards
>
> Oliver
>
> Ralf Sternberg schrieb:
>> Hi Michał,
>>
>> Michał Tkacz schrieb:
>>> I also tried to replace "Image" with "Atom" and "source" with "icon"
>>> but it didn't help :(
>>
>> Try "backgroundImage" instead of "icon". But, however, I haven't
>> figured out the ultimate way to register default images for custom
>> widgets plus I think that the theming should rather work with image
>> sets instead of images. This is still work in progress.
>>
>> Ralf
Re: Theming of the custom widgets [message #46330 is a reply to message #46180] Wed, 12 September 2007 11:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Hi,

I assume that the static initializer is never executed as you don't
actually use the DummyWidget.
Have you tried to register the image via the
org.eclipse.rap.ui.resources extension point?

Cheers,
Rüdiger

Poncho wrote:
> Update:
> After trying to use an appearance including an image we have found out
> that this has failed. We have tried then to register the images in a
> static block in the LCA of the DummyWidget but even this does not seem
> to work.
> Regards
> Oliver
>
> Poncho schrieb:
>> Hi all,
>> I'd like to add some thoughts and some question to this subject as
>> we're doing working on some custom widgets and some custom themes as
>> well.
>> We had the need to change the appearance of some standard widgets not
>> by changing the color, border and font but to add background images
>> as well to the existing widgets. So there was the need to add new
>> appearances to
>> the already existing widgets.
>>
>> So what we did now is exactly as described here.
>> - Created a widget which does exactly nothing ;-)
>> - declared the widget themeable by setting an extension point to this
>> widget
>> - added a <widget>.appearances.js and <widget>.theme.xml to the
>> *.internal.<widget>kit folder
>>
>> Result was that it is possible to add more than one appearance to his
>> <widget>.appearances.js file as well as adding more Colors and Fonts
>> to the <widget>.theme.xml file.
>> What now remains is to load images which are needed for the appearances.
>> My first test would be to simply add them to a plugin-local source
>> folder and to set the path according to that folder i.e.
>>
>> // that is my appearance that has been defined in <widget>.appearance.js
>> "customlabel" :
>> {
>> style : function( states ) {
>> return {
>> backgroundImage : "resources/button.gif",
>> paddingTop: 5,
>> paddingLeft: 5
>> };
>> }
>> },
>>
>> Also I have that image (button.gif) under the given folder /resources
>> in the same plugin.
>>
>> If somebody has anything to add to this subject I would be very glad
>> to hear your thoughts.
>>
>> Regards
>>
>> Oliver
>>
>> Ralf Sternberg schrieb:
>>> Hi Michał,
>>>
>>> Michał Tkacz schrieb:
>>>> I also tried to replace "Image" with "Atom" and "source" with "icon"
>>>> but it didn't help :(
>>>
>>> Try "backgroundImage" instead of "icon". But, however, I haven't
>>> figured out the ultimate way to register default images for custom
>>> widgets plus I think that the theming should rather work with image
>>> sets instead of images. This is still work in progress.
>>>
>>> Ralf
Re: Theming of the custom widgets [message #46541 is a reply to message #46330] Wed, 12 September 2007 13:07 Go to previous message
Oliver Köhler is currently offline Oliver KöhlerFriend
Messages: 32
Registered: July 2009
Member
Hi Rüdiger,
yes that was the case.
We have now successfully started our application with our own appearances:
- created a widget
- declared the widget themeable
- added a <widget>.appearances.js to the *.internal.<widget>kit folder
- added a <widget>.theme.xml to the *.internal.<widget>kit folder
- added a static block to the LCA of our widget where the Images will be
registered
- instantiated an object of that widget where it doesn' hurt (ouch ;-) )
- added all neccessary borders to the appearances

This setting worked now. We are able to see all custom appearance from
startup of the application.

However several issues remain:
- The instantiation of the dummy widget is ok but is not a really good
solution. If there is any other possibility to load Images to the
appearances I'll be glad for any hints. Loading resources with an
extension point would be a fine way. I will try this once the migration
to M6 has been completed.
- The borders can only be defined inside the appearance template
(<widget>.appearances.js). Is there another way to define the borders
for the appearances as it is possible for Colors and Fonts?
- Will there be the possibility to have a <widget>.borders.js in the
future???
Regards
Oliver


Rüdiger Herrmann schrieb:
> Hi,
>
> I assume that the static initializer is never executed as you don't
> actually use the DummyWidget.
> Have you tried to register the image via the
> org.eclipse.rap.ui.resources extension point?
>
> Cheers,
> Rüdiger
>
> Poncho wrote:
>> Update:
>> After trying to use an appearance including an image we have found out
>> that this has failed. We have tried then to register the images in a
>> static block in the LCA of the DummyWidget but even this does not seem
>> to work.
>> Regards
>> Oliver
>>
>> Poncho schrieb:
>>> Hi all,
>>> I'd like to add some thoughts and some question to this subject as
>>> we're doing working on some custom widgets and some custom themes as
>>> well.
>>> We had the need to change the appearance of some standard widgets not
>>> by changing the color, border and font but to add background images
>>> as well to the existing widgets. So there was the need to add new
>>> appearances to
>>> the already existing widgets.
>>>
>>> So what we did now is exactly as described here.
>>> - Created a widget which does exactly nothing ;-)
>>> - declared the widget themeable by setting an extension point to this
>>> widget
>>> - added a <widget>.appearances.js and <widget>.theme.xml to the
>>> *.internal.<widget>kit folder
>>>
>>> Result was that it is possible to add more than one appearance to his
>>> <widget>.appearances.js file as well as adding more Colors and Fonts
>>> to the <widget>.theme.xml file.
>>> What now remains is to load images which are needed for the appearances.
>>> My first test would be to simply add them to a plugin-local source
>>> folder and to set the path according to that folder i.e.
>>>
>>> // that is my appearance that has been defined in <widget>.appearance.js
>>> "customlabel" :
>>> {
>>> style : function( states ) {
>>> return {
>>> backgroundImage : "resources/button.gif",
>>> paddingTop: 5,
>>> paddingLeft: 5
>>> };
>>> }
>>> },
>>>
>>> Also I have that image (button.gif) under the given folder /resources
>>> in the same plugin.
>>>
>>> If somebody has anything to add to this subject I would be very glad
>>> to hear your thoughts.
>>>
>>> Regards
>>>
>>> Oliver
>>>
>>> Ralf Sternberg schrieb:
>>>> Hi Michał,
>>>>
>>>> Michał Tkacz schrieb:
>>>>> I also tried to replace "Image" with "Atom" and "source" with
>>>>> "icon" but it didn't help :(
>>>>
>>>> Try "backgroundImage" instead of "icon". But, however, I haven't
>>>> figured out the ultimate way to register default images for custom
>>>> widgets plus I think that the theming should rather work with image
>>>> sets instead of images. This is still work in progress.
>>>>
>>>> Ralf
Previous Topic:Problems with listeners in M5
Next Topic:Error after updating to M5
Goto Forum:
  


Current Time: Tue Apr 16 09:55:39 GMT 2024

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

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

Back to the top