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

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

Introduction

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

Prototype

public GQuery attr(String key, Object value) 

Source Link

Document

Set a single property to a value, on all matched elements.

Usage

From source file:com.arcbees.chosen.client.gwt.ChosenListBox.java

License:Apache License

/**
 * Insert a group to the list box.//from w w  w  .j  a  v a 2s  .  co  m
 *
 * @param label the text of the group to be added
 * @param id    the id of the optgroup element
 * @param index the index at which to insert it
 */
public void insertGroup(String label, String id, int index) {
    GQuery optGroup = $("<optgroup></optgroup>").attr("label", label);
    if (id != null) {
        optGroup.attr("id", id);
    }
    GQuery select = $(getElement());

    int itemCount = SelectElement.as(getElement()).getLength();

    if (index < 0 || index > itemCount) {
        select.append(optGroup);
    } else {
        GQuery before = select.children().eq(index);
        before.before(optGroup);
    }
}

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;
        }//from  w  w  w.  jav a  2s .  c om
    });
    $("#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:com.pronoiahealth.olhie.client.pages.AbstractPage.java

License:Open Source License

/**
 * Allows for page background to be set by adding a class to the div with
 * the class center-background. Adjust the style attribute to be empty
 * // w  w w.ja v  a  2s .  co  m
 * @param backgroundClass
 */
protected void setPageBackgroundClass(String backgroundClass) {
    GQuery gObj = AppSelectors.INSTANCE.getCenterBackground();
    if (backgroundClass == null || backgroundClass.length() == 0) {
        gObj.attr("class", "center-background");
        gObj.attr("style", "");
    } else {
        gObj.attr("class", "center-background " + backgroundClass);
        gObj.attr("style", "");
    }
}

From source file:com.pronoiahealth.olhie.client.pages.AbstractPage.java

License:Open Source License

/**
 * Sets a background image by setting the style attribute of the div with
 * the class center-background. Calling the setPageBackgroundClass will
 * remove the style setting./*from ww  w. j a  v a  2 s . c  o m*/
 * 
 * @param backgroundImage
 */
protected void setPageBackgroundStyle(String backgroundImage) {
    GQuery gObj = AppSelectors.INSTANCE.getCenterBackground();
    gObj.attr("style", "background: white; " + "background-image: url(\"" + backgroundImage + "\"); "
            + "background-repeat: repeat;");
}