Example usage for com.google.gwt.user.client.ui LoadListener LoadListener

List of usage examples for com.google.gwt.user.client.ui LoadListener LoadListener

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui LoadListener LoadListener.

Prototype

LoadListener

Source Link

Usage

From source file:com.totsp.gwittir.client.fx.ui.ReflectedImage.java

License:Open Source License

/** Creates a new instance of ReflectedImage */
public ReflectedImage(String url, final int baseWidth, final int baseHeight, final double reflectHeight,
        final double opacity) {
    this.value = url;
    this.base = new Image(url);

    this.base.addLoadListener(new LoadListener() {
        public void onLoad(Widget sender) {
            reflect.paint(base, baseWidth, baseHeight, reflectHeight, opacity);
            v.setWidget(1, 0, reflect);/*ww  w .j a va  2  s .c o  m*/
        }

        public void onError(Widget sender) {
        }
    });
    this.base.setPixelSize(baseWidth, baseHeight);
    this.baseWidth = baseWidth;
    this.baseHeight = baseHeight;
    this.reflectHeight = reflectHeight;
    this.opacity = opacity;
    DOM.setStyleAttribute(this.base.getElement(), "display", "block");
    this.v.setCellSpacing(0);
    this.v.setCellPadding(0);
    this.v.setWidget(0, 0, this.base);
    this.v.getCellFormatter().setWordWrap(0, 0, false);
    this.v.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_BOTTOM);
    this.v.getRowFormatter().setVerticalAlign(1, HasVerticalAlignment.ALIGN_TOP);
    super.initWidget(v);
}

From source file:com.totsp.gwittir.client.fx.ui.ReflectedImage.java

License:Open Source License

public ReflectedImage(final int baseWidth, final int baseHeight, final double reflectHeight,
        final double opacity) {
    this.base = new Image();
    this.base.addLoadListener(new LoadListener() {
        public void onLoad(Widget sender) {
            reflect.paint(base, baseWidth, baseHeight, reflectHeight, opacity);
            v.setWidget(1, 0, reflect);//from ww  w.  j a  v a2s  . c  o  m
        }

        public void onError(Widget sender) {
        }
    });
    this.base.setPixelSize(baseWidth, baseHeight);
    this.baseWidth = baseWidth;
    this.baseHeight = baseHeight;
    this.reflectHeight = reflectHeight;
    this.opacity = opacity;
    DOM.setStyleAttribute(this.base.getElement(), "display", "block");
    this.v.setCellSpacing(0);
    this.v.setCellPadding(0);
    this.v.getCellFormatter().setWordWrap(0, 0, false);
    this.v.setWidget(0, 0, this.base);
    this.v.getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_BOTTOM);
    this.v.getRowFormatter().setVerticalAlign(1, HasVerticalAlignment.ALIGN_TOP);

    super.initWidget(v);
}