Search in sources :

Example 1 with ImageLoader

use of com.ait.lienzo.client.core.image.ImageLoader in project lienzo-core by ahome-it.

the class Sprite method load.

Sprite load() {
    if (isLoaded()) {
        if (null != m_loaded) {
            m_loaded.onSpriteLoaded(this);
        }
    } else {
        final String url = getURL();
        new ImageLoader(url) {

            @Override
            public void onImageElementLoad(final ImageElement elem) {
                m_sprite = elem;
                if (null != m_loaded) {
                    m_loaded.onSpriteLoaded(Sprite.this);
                }
            }

            @Override
            public void onImageElementError(final String message) {
                LienzoCore.get().error("Sprite could not load URL " + url + " " + message);
            }
        };
    }
    return this;
}
Also used : ImageElement(com.google.gwt.dom.client.ImageElement) JSONString(com.google.gwt.json.client.JSONString) ImageLoader(com.ait.lienzo.client.core.image.ImageLoader)

Aggregations

ImageLoader (com.ait.lienzo.client.core.image.ImageLoader)1 ImageElement (com.google.gwt.dom.client.ImageElement)1 JSONString (com.google.gwt.json.client.JSONString)1