Example usage for com.google.gwt.user.client.ui UIObject getElement

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

Introduction

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

Prototype

public Element getElement() 

Source Link

Document

Gets a handle to the object's underlying DOM element.

Usage

From source file:gwt.material.design.client.MaterialWidgetTestCase.java

License:Apache License

public void checkFieldErrorSuccess(AbstractValueWidget widget, UIObject errorLabel, UIObject target,
        UIObject placeholder) {/*w  w w .  ja va2  s .c  o  m*/
    if (errorLabel != null) {
        widget.setErrorText("error");
        assertTrue(errorLabel.getElement().hasClassName(CssName.FIELD_ERROR_LABEL));
        assertFalse(errorLabel.getElement().hasClassName(CssName.FIELD_HELPER_LABEL));
        assertFalse(errorLabel.getElement().hasClassName(CssName.FIELD_SUCCESS_LABEL));
        errorLabel.setVisible(true);

        widget.setSuccessText("success");
        assertFalse(errorLabel.getElement().hasClassName(CssName.FIELD_ERROR_LABEL));
        assertFalse(errorLabel.getElement().hasClassName(CssName.FIELD_HELPER_LABEL));
        assertTrue(errorLabel.getElement().hasClassName(CssName.FIELD_SUCCESS_LABEL));

        widget.setHelperText("helper");
        assertFalse(errorLabel.getElement().hasClassName(CssName.FIELD_ERROR_LABEL));
        assertTrue(errorLabel.getElement().hasClassName(CssName.FIELD_HELPER_LABEL));
        assertFalse(errorLabel.getElement().hasClassName(CssName.FIELD_SUCCESS_LABEL));
    }
    if (target != null) {
        widget.setErrorText("error");
        assertTrue(target.getElement().hasClassName(CssName.FIELD_ERROR));
        assertFalse(target.getElement().hasClassName(CssName.FIELD_SUCCESS));

        widget.setSuccessText("success");
        assertFalse(target.getElement().hasClassName(CssName.FIELD_ERROR));
        assertTrue(target.getElement().hasClassName(CssName.FIELD_SUCCESS));

        widget.setHelperText("helper");
        assertFalse(target.getElement().hasClassName(CssName.FIELD_ERROR));
        assertFalse(target.getElement().hasClassName(CssName.FIELD_SUCCESS));
    }
    if (placeholder != null) {
        widget.setErrorText("error");
        assertFalse(placeholder.getElement().hasClassName("green-text"));
        assertTrue(placeholder.getElement().hasClassName("red-text"));

        widget.setSuccessText("success");
        assertTrue(placeholder.getElement().hasClassName("green-text"));
        assertFalse(placeholder.getElement().hasClassName("red-text"));

        widget.setHelperText("helper");
        assertFalse(placeholder.getElement().hasClassName("green-text"));
        assertFalse(placeholder.getElement().hasClassName("red-text"));
    }
}

From source file:gwt.material.design.client.ui.MaterialDropDown.java

License:Apache License

public MaterialDropDown(UIObject activator) {
    this(activator.getElement());
}

From source file:gwt.material.design.components.client.jquery.api.JQuery.java

License:Apache License

@JsOverlay
public static <T extends UIObject> JQueryElement $(T uiObject, UIObject context) {
    return $(uiObject.getElement(), context.getElement());
}

From source file:gwt.material.design.components.client.utils.helper.StyleHelper.java

License:Apache License

public final static void addStyle(final UIObject uiObject, final Style.HasCssName style) {
    addStyle(uiObject.getElement(), style == null ? null : style.getCssName());
}

From source file:gwt.material.design.components.client.utils.helper.StyleHelper.java

License:Apache License

public final static void addStyle(final UIObject uiObject, final String style) {
    addStyle(uiObject.getElement(), style);
}

From source file:gwt.material.design.components.client.utils.helper.StyleHelper.java

License:Apache License

public final static void removeStyle(final UIObject uiObject, final Style.HasCssName style) {
    removeStyle(uiObject.getElement(), style == null ? null : style.getCssName());
}

From source file:gwt.material.design.components.client.utils.helper.StyleHelper.java

License:Apache License

public final static void removeStyle(final UIObject uiObject, final String style) {
    removeStyle(uiObject.getElement(), style);
}

From source file:gwt.material.design.components.client.utils.helper.StyleHelper.java

License:Apache License

public final static boolean hasStyle(final UIObject uiObject, final Style.HasCssName style) {
    return hasStyle(uiObject.getElement(), style == null ? null : style.getCssName());
}

From source file:gwt.material.design.components.client.utils.helper.StyleHelper.java

License:Apache License

public final static boolean hasStyle(final UIObject uiObject, final String style) {
    return hasStyle(uiObject.getElement(), style);
}

From source file:gwt.material.design.components.client.utils.helper.StyleHelper.java

License:Apache License

public final static void setCssProperty(final UIObject uiObject, final String property,
        final Style.HasCssName value) {
    setCssProperty(uiObject.getElement(), property, value == null ? null : value.getCssName());
}