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

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

Introduction

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

Prototype

public GQuery prepend(String html) 

Source Link

Document

Prepend content to the inside of every matched element.

Usage

From source file:org.bonitasoft.web.toolkit.client.ui.component.menu.MenuFolder.java

License:Open Source License

@Override
protected Element makeElement() {
    this.items.setRootTagName("ul");
    this.items.setWrapTag(null, null);

    final GQuery root = $("<li>");
    root.addClass("menuitem");
    if (getJsId() != null) {
        root.addClass(getJsId().toString("menuitem"));
    }//from  ww  w.j av a2 s  . c  om

    GQuery link = null;
    ;
    if (this.image != null || this.label != null && this.label.length() > 0) {
        link = $("<a href=\"#\">" + this.label + "</a>");
        root.append(link);

        if (this.label != null && this.label.length() > 0) {
            link.text(this.label);
        }

        if (this.image != null) {
            link.prepend(this.image.getElement());
        }

    }

    appendComponentToHtml((Element) root.get(0), this.items);

    return (Element) root.get(0);
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.menu.MenuFolder.java

License:Open Source License

public void setLabel(final String label) {
    this.label = label;

    if (isGenerated()) {
        final GQuery link = $(this.element).children("a");
        final GQuery image = link.find("img");

        link.text(label);/*from  ww w .  j  av a  2  s.  co m*/
        if (image.length() > 0) {
            link.prepend(image);
        }
    }
}

From source file:org.bonitasoft.web.toolkit.client.ui.component.menu.MenuFolder.java

License:Open Source License

public void setImage(final Image image) {
    this.image = image;

    if (isGenerated()) {

        final GQuery link = $(this.element).children("a");
        final GQuery img = link.find("img");

        if (image == null) {
            img.remove();/*  w ww  .j a  v a 2 s  . c o  m*/
        } else if (img.length() > 0) {
            img.replaceWith(image.getElement());
        } else {
            link.prepend(image.getElement());
        }
    }
}