Example usage for com.google.gwt.user.client Element getScrollHeight

List of usage examples for com.google.gwt.user.client Element getScrollHeight

Introduction

In this page you can find the example usage for com.google.gwt.user.client Element getScrollHeight.

Prototype

@Override
    public int getScrollHeight() 

Source Link

Usage

From source file:com.gwtm.ui.client.widgets.TextArea.java

License:Apache License

@Override
public void onKeyUp(KeyUpEvent event) {
    Element ele = getElement();
    final int extraLineHeight = 15;
    int scrollHeight = ele.getScrollHeight();
    int clientHeight = ele.getClientHeight();
    Utils.Console(scrollHeight + " " + clientHeight);
    if (clientHeight < scrollHeight) {
        ele.getStyle().setHeight(scrollHeight + extraLineHeight, Unit.PX);
    }/*from  w ww.j  av  a2  s  . co m*/
}

From source file:de.swm.commons.mobile.client.widgets.TextArea.java

License:Apache License

private void resize() {
    Element ele = getElement();
    final int extraLineHeight = 15;

    ele.getStyle().setProperty("height", "auto");

    int scrollHeight = ele.getScrollHeight() + extraLineHeight;

    if (scrollHeight < 3 * extraLineHeight) {
        scrollHeight = 3 * extraLineHeight;
    }/*  w w  w .  j  a va2 s .co m*/

    ele.getStyle().setProperty("height", scrollHeight + "px");

}