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

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

Introduction

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

Prototype

public GQuery replaceWith(String html) 

Source Link

Document

Replaces all matched elements with the specified HTML.

Usage

From source file:com.dotweblabs.friendscube.app.client.local.LoginPage.java

License:Apache License

private void initAdditionalJS() {
    $("#create-btn").on("click", new Function() {
        public boolean f(Event e) {
            $(".create-icon").toggleClass("uk-icon-spinner uk-icon-spin");
            return true;
        }/* www.j  av a  2s .c o  m*/
    });
    $("#login-btn").on("click", new Function() {
        public boolean f(Event e) {
            $(".login-icon").toggleClass("uk-icon-spinner uk-icon-spin");
            return true;
        }
    });
    $("#cancel").on("click", new Function() {
        public void f() {
            $(".email-modal").val("");
            $("#confirm-pass").val("");
            $("#pass").val("");
        }
    });
    $(".toggle-pass").on("click", new Function() {
        public boolean f(Event e) {
            e.preventDefault();
            if ($("#pass-box").hasClass("showpass")) {
                GQuery oldElem = $("#pass-box");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "text");
                oldElem.replaceWith(newElem);
                $("#pass-box").removeClass("showpass");
                $("#create-pw").text("Hide");
            } else {
                GQuery oldElem = $("#pass-box");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "password");
                oldElem.replaceWith(newElem);
                $("#pass-box").addClass("showpass");
                $("#create-pw").text("Show");
            }
            return true;
        }
    });
    $(".renew-pw").on("click", new Function() {
        public boolean f(Event e) {
            e.preventDefault();
            if ($("#pass").hasClass("showpass")) {
                GQuery oldElem = $("#pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "text");
                oldElem.replaceWith(newElem);
                $("#pass").removeClass("showpass");
                $("#renew-pw").text("Hide");
            } else {
                GQuery oldElem = $("#pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "password");
                oldElem.replaceWith(newElem);
                $("#pass").addClass("showpass");
                $("#renew-pw").text("Show");
            }
            return true;
        }
    });
    $(".logpass").on("click", new Function() {
        public boolean f(Event e) {
            e.preventDefault();
            if ($("#login-pass").hasClass("showpass")) {
                GQuery oldElem = $("#login-pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "text");
                oldElem.replaceWith(newElem);
                $("#login-pass").removeClass("showpass");
                $("#log-pw").text("Hide");
            } else {
                GQuery oldElem = $("#login-pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "password");
                oldElem.replaceWith(newElem);
                $("#login-pass").addClass("showpass");
                $("#log-pw").text("Show");
            }
            return true;
        }
    });
    $(".confirm-pw").on("click", new Function() {
        public boolean f(Event e) {
            e.preventDefault();
            if ($("#confirm-pass").hasClass("showpass")) {
                GQuery oldElem = $("#confirm-pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "text");
                oldElem.replaceWith(newElem);
                $("#confirm-pass").removeClass("showpass");
                $("#confirm-pw").text("Hide");
            } else {
                GQuery oldElem = $("#confirm-pass");
                GQuery newElem = oldElem.clone();
                newElem.attr("type", "password");
                oldElem.replaceWith(newElem);
                $("#confirm-pass").addClass("showpass");
                $("#confirm-pw").text("Show");
            }
            return true;
        }
    });
    //Logger.consoleLog("loaded JS");
}

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();/*from   w  w w  . j  av  a  2s  . co m*/
        } else if (img.length() > 0) {
            img.replaceWith(image.getElement());
        } else {
            link.prepend(image.getElement());
        }
    }
}