Universal JavaScript Framework



Resources comprise images, icons, style sheets, Flash files, helper HTML files, and so forth. The framework itself provides many icons and some other useful resources you can use right away in your application without any customization. This article however explains how to specify and use custom resources for your application.

Technical overview

Resources live in the source/resource/<namespace> subtree of each library. You explicitly reference a resource in your application code by just naming the path of the corresponding file under this root (This is also referred to as the resource id).

So if there is a resource in your "myapp" application under the path myapp/source/resource/myapp/icons/tray.png you would refer to it in your application code with myapp/icons/tray.png.

To find the corresponding file during a build, qooxdoo searches all those paths of all the libraries your application is using. The first hit will be regarded as the resource you want to use. (During the generation of a build version of your app, these resource files will be copied to the build folder, so your build version will be self-contained).

The libraries are searched in the order they are declared in your config.json file. This usually means that your own resource folder comes first, then the framework's resource folder, and then the resource folders of all further libraries you have included. This way, you can shadow resources of like names, e.g. by adding a file qx/static/blank.gif under your source/resource folder you will shadow the file of the same resource id in the framework.

Declaring resources in the code

You have to declare the resources you wish to use in your application code in an #asset compiler hint near the top of your source file.

/* ***



This is essential, since these hints are evaluated during the compile step, which searches for the corresponding files, generates appropriate URIs to them and copies them to the build folder.

Instead of adding meta information for each individual resource, you may as well use simple (shell) wildcards to specify a whole set of resources:

/* ***



This is all you need to configure if your application code uses any of the icons in the given folder.

Using resources with widgets

Once you've declared the resource in your code, you can equip any compatible widget with it.

Here's an example:

var button = new qx.ui.form.Button("Button B", "myapp/icons/16/folder-open.png");

Using qooxdoo icons with widgets

If you want to use some of the icons as resources that are part of the icon themes that come with qooxdoo, there are the following three ways to do so:

  1. Copy the icons you are interested in from the original location in the qooxdoo framework to the local resource folder of your application. You are now independent of the qooxdoo icon theme folders and can manage these icons as you would any other custom images.
  2. Use a fully-qualified path that points to the qooxdoo resource folder. This solution would contain the icon theme's name explicitly.
  3. Use a macro to get the icons from the current theme. This would allow for a later change of icon themes at the config file level, without the need to adjust any resource URIs in your application code. The Generator documentation explains how to declare these macros.


var button1 = new qx.ui.form.Button("First Button", "myapp/icons/16/utilities-dictionary.png");
var button2 = new qx.ui.form.Button("Second Button", "qx/icon/Oxygen/16/apps/utilities-dictionary.png");
var button3 = new qx.ui.form.Button("Third Button", "icon/16/apps/utilities-dictionary.png");

When you use the third method above and you do not use the Modern theme, you must edit config.json in order to have the meta theme's icons and the explicitly given icon theme in sync:

  "name"    : "myapp",


  "let" :
    "APPLICATION"  : "myapp",
    "QXTHEME"      : "qx.theme.Classic",
    "QXICONTHEME"  : ["Oxygen"],
    "ROOT"         : "."

Obtaining the URL for a resource

To obtain a URL for a resource, use the ResourceManager:

var iframe = new

Table Of Contents

Previous topic


Next topic

Selection Handling

This Page