Example usage for com.google.gwt.query.client GQuery contains

List of usage examples for com.google.gwt.query.client GQuery contains

Introduction

In this page you can find the example usage for com.google.gwt.query.client GQuery contains.

Prototype

public static boolean contains(Element a, Element b) 

Source Link

Document

Return true if the element b is contained in a.

Usage

From source file:org.bonitasoft.web.toolkit.client.ui.page.PageOnItem.java

License:Open Source License

@Override
protected final void _fillWidget(final Element rootElement) {
    if (this.__pload != null) {
        this.item = this.__pload;
        super._fillWidget(rootElement);
        return;//from   w  ww.  j  ava  2s .com
    }

    new APICaller(itemDefinition).get(this.itemId, defineDeploys(), defineCounters(), new APICallback() {

        @SuppressWarnings("unchecked")
        @Override
        public void onSuccess(final int httpStatusCode, final String response,
                final Map<String, String> headers) {

            // fix for IE. Sometime IE add element evenif not in parent anymore.
            if (!GQuery.contains(PageOnItem.this.getParentElement(), PageOnItem.this.getElement())) {
                return;
            }

            try {
                PageOnItem.this.item = (T) JSonItemReader.parseItem(response, PageOnItem.this.itemDefinition);
            } catch (final Exception e) {
                fail(e.getMessage());
                return;
            }

            $(PageOnItem.this.getParentElement()).children().not(PageOnItem.this.getElement()).remove();
            $(PageOnItem.this.getElement()).show();

            PageOnItem.super._fillWidget(rootElement);

            ViewController.getInstance().triggerLoad();

            ViewController.updateUI(PageOnItem.this.getElement());
        }

        @Override
        public void onError(final String message, final Integer errorCode) {
            if (isNotFoundItem(message, errorCode)) {
                onItemNotFound();
            } else {
                fail(message);
            }
        }

    });

}