Example usage for com.vaadin.client ComputedStyle getDoubleProperty

List of usage examples for com.vaadin.client ComputedStyle getDoubleProperty

Introduction

In this page you can find the example usage for com.vaadin.client ComputedStyle getDoubleProperty.

Prototype

public final double getDoubleProperty(String name) 

Source Link

Document

Retrieves the given computed property as a double.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.resizabletextarea.CubaResizableTextAreaWrapperWidget.java

License:Apache License

protected void handleResize(Event event) {
    //calculate and set the new size
    if (dragDrop) {
        int mouseX = event.getClientX();
        int mouseY = event.getClientY();
        int absoluteLeft = getAbsoluteLeft();
        int absoluteTop = getAbsoluteTop();

        ComputedStyle cs = new ComputedStyle(getElement().getFirstChildElement());

        //do not allow mirror-functionality
        if (mouseY > absoluteTop + cs.getDoubleProperty("min-height")
                && mouseX > absoluteLeft + MINIMAL_WIDTH) {
            int width = mouseX - absoluteLeft + 2;
            int height = mouseY - absoluteTop + 2;

            switch (resizableDirection) {
            case BOTH:
                setHeight(height + "px");
                setWidth(width + "px");
                break;
            case VERTICAL:
                setHeight(height + "px");
                break;
            case HORIZONTAL:
                setWidth(width + "px");
                break;
            }/*from  w w w  . j  ava  2  s  .  c  o  m*/

            if (resizeHandler != null) {
                resizeHandler.handleResize();
            }
        }
    }
}