Search in sources :

Example 1 with BodyElement

use of com.google.gwt.dom.client.BodyElement in project gwt-test-utils by gwt-test-utils.

the class BodyElementTest method as.

@Test
public void as() {
    // When
    BodyElement asElement = BodyElement.as(b);
    // Then
    assertThat(asElement).isEqualTo(b);
}
Also used : BodyElement(com.google.gwt.dom.client.BodyElement) GwtTestTest(com.googlecode.gwt.test.GwtTestTest) Test(org.junit.Test)

Example 2 with BodyElement

use of com.google.gwt.dom.client.BodyElement in project gwt-test-utils by gwt-test-utils.

the class RootPanelPatcher method isElementChildOfWidget.

@PatchMethod
static boolean isElementChildOfWidget(Element element) {
    // Walk up the DOM hierarchy, looking for any widget with an event
    // listener
    // set. Though it is not dependable in the general case that a widget will
    // have set its element's event listener at all times, it *is* dependable
    // if the widget is attached. Which it will be in this case.
    element = element.getParentElement();
    BodyElement body = Document.get().getBody();
    while (element != null && body != element) {
        if (Event.getEventListener(element) != null) {
            return true;
        }
        element = element.getParentElement();
    }
    return false;
}
Also used : BodyElement(com.google.gwt.dom.client.BodyElement) PatchMethod(com.googlecode.gwt.test.patchers.PatchMethod)

Example 3 with BodyElement

use of com.google.gwt.dom.client.BodyElement in project rstudio by rstudio.

the class FontSizer method setNormalFontSize.

public static void setNormalFontSize(Document document, double size) {
    // our resource class
    if (document == null || styles == null)
        return;
    size = size + BrowseCap.getFontSkew();
    final String STYLE_EL_ID = "__rstudio_normal_size";
    Element oldStyle = document.getElementById(STYLE_EL_ID);
    StyleElement style = document.createStyleElement();
    if (style == null)
        return;
    style.setAttribute("type", "text/css");
    style.setInnerText("." + styles.normalSize() + ", " + "." + styles.normalSize() + " td, " + "." + styles.normalSize() + " pre" + " {font-size:" + size + "pt !important;}");
    BodyElement body = document.getBody();
    if (body == null)
        return;
    body.appendChild(style);
    if (oldStyle != null)
        oldStyle.removeFromParent();
    style.setId(STYLE_EL_ID);
}
Also used : StyleElement(com.google.gwt.dom.client.StyleElement) Element(com.google.gwt.dom.client.Element) BodyElement(com.google.gwt.dom.client.BodyElement) BodyElement(com.google.gwt.dom.client.BodyElement) StyleElement(com.google.gwt.dom.client.StyleElement)

Aggregations

BodyElement (com.google.gwt.dom.client.BodyElement)3 Element (com.google.gwt.dom.client.Element)1 StyleElement (com.google.gwt.dom.client.StyleElement)1 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)1 PatchMethod (com.googlecode.gwt.test.patchers.PatchMethod)1 Test (org.junit.Test)1