Previous examples I had seen didn't include the setIconTheme and
setWidgetTheme calls. This does work for me in the sense that the app
uses the right icons. That is, until I change themes. If I allow users
to change themes later, the change in theme will overwrite my aliases.

I raised the point in my OP that I don't think anything in the Qooxdoo
framework space should ever override a setting in Qooxdoo user space
which is what happens when setIconTheme is called.

As an example, try the following:

qx.core.Init.defineInitialize(function()
{
 qx.manager.object.ImageManager.setIconTheme(qx.theme.icon.CrystalSvgIconTheme);
qx.manager.object.ImageManager.setWidgetTheme(qx.theme.icon.WindowsWidgetTheme);

qx.manager.object.ImageManager.defineAlias("static",
"/qooxdoo/resource/static");
qx.manager.object.ImageManager.defineAlias("widget",
"/qooxdoo/resource/widget/windows");
qx.manager.object.ImageManager.defineAlias("icon",
"/qooxdoo/resource/icon/crystalsvg");

qx.manager.object.ImageManager.setIconTheme(qx.theme.icon.NuvolaIconTheme);
});

Or, alternatively, switch the order of your defineAlias and
setIconTheme and setWidgetTheme calls, it won't work.

As a user, I shouldn't have to worry that the framework has removed
one of my application settings. The question I asked was, why is this
happening? Setting an Icon or Widget theme seem to be a different
concern than defining an alias and I can't tell from looking at the
code why setting a theme *must* redefine an existing alias. Aliases
potentially have other uses outside widgets and icons, when the
internals of framework components munge aliases, it could potentially
break other application code.

I think the convention for icons/widgets on the filesystem is great. I
 just think the framework impl. needs to be decoupled from it a bit
more. For example, I should be able to define the global icon alias as:

qx.manager.object.ImageManager.defineAlias("icon",
"/qooxdoo/resource/icon");

The SVG theme could simply then append "crystalsvg" or whatever on to
the base 'icon' alias for the URL. The same should work for widgets as
well.

-erik

Dietrich Streifert wrote:
> Where do you place the defineAlias calls?
> 
> It's working perfectly for me if I do the calls like this:
> 
>     qx.core.Init.defineInitialize(function() {
>        
>        
> qx.manager.object.ImageManager.setIconTheme(qx.theme.icon.CrystalSvgIconTheme);
>        
> qx.manager.object.ImageManager.setWidgetTheme(qx.theme.widget.WindowsWidgetTheme);
> 
>        qx.manager.object.ImageManager.defineAlias("static", 
> "/qooxdoo/resource/static");
>        qx.manager.object.ImageManager.defineAlias("widget", 
> "/qooxdoo/resource/widget/windows")
>        qx.manager.object.ImageManager.defineAlias("icon", 
> "/qooxdoo/resource/icon/crystalsvg")
>     }
> 
> Erik A. Onnen schrieb:
>> I'm experiencing issues with the ImageManager.defineAlias method. I'm
>> fairly convinced it's a bug and I'd be happy to patch but I can't
>> quite understand the intent of the code.
>>
>> The storage of Qooxdoo on my webserver is not in a standard location
>> and cannot be for various reasons. Based on some posts to this list, I
>>  attempted to define icon and widget aliases for the ImageManager
>> using the defineAlias method. After enabling some commented debugging
>> code in ImageManager, it seems that the defineAlias method is working
>> as expected.
>>
>> Unfortunately, my application level settings are being overwritten by
>>  the standard theme classes when they load. The call stack looks
>> something similar to this:
>>
>> CrystalSvgIconTheme.ctor()
>> IconTheme.ctor()
>> IconTheme._register()
>> ImageManager.registerIconTheme()
>> ImageManager.setIconTheme()
>> ImageManager._modifyIconTheme()
>> ImageManager.defineAlias()
>>
>> (Note that the Qooxdoo property idioms make following the call stack
>> to _modifyIconTheme difficult, I can't just grep for calls to this
>> method, I have to understand that it's invoked as a side-effect to
>> setIconTheme()).
>>
>> My application establishes it's aliases after qx.js is loaded but
>> before I use any of the widgets. It appears that the theme instance is
>> loaded on demand so each time an IconTheme is loaded (when I create my
>> first atom), my application-defined aliases are ultimately restored
>> back to the default of ../../resources/[icon|widget]. The enabled
>> debug logging in defineAlias then looks like this:
>>
>> 000391 DEBUG: qx.manager.object.ImageManager(29): defineAlias: static
>> => /qooxdoo/resource/static
>> 000391 DEBUG: qx.manager.object.ImageManager(29): defineAlias: widget
>> => /qooxdoo/resource/widget
>> 000391 DEBUG: qx.manager.object.ImageManager(29): defineAlias: icon =>
>> /qooxdoo/resource/icon/crystalsvg
>> 000438 DEBUG: qx.manager.object.ImageManager(29): defineAlias: icon =>
>> ../../resources/icon/crystalsvg
>> 000438 DEBUG: qx.manager.object.ImageManager(29): defineAlias: widget
>> => ../../resources/widget/windows
>>
>> My code is responsible for lines 1-3, Qooxdoo internally does 4 & 5
>> overwriting my settings.
>>
>> My question is, why does _modifyIconTheme call defineAlias? It seems
>> to me that defineAlias is a separate concern from registering and icon
>> theme and that the two should not be connected. Even if they are
>> connected, IMO Qooxdoo should never override an application-level
>> defined setting as happens in this case and should honor the app
>> setting (i.e., not redefine the alias if it exists). If I'm on the
>> right track here, just say so and I think I can run with a patch.
>>
>> -erik
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> qooxdoo-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>>   
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to