Example usage for com.vaadin.client WidgetUtil measureVerticalBorder

List of usage examples for com.vaadin.client WidgetUtil measureVerticalBorder

Introduction

In this page you can find the example usage for com.vaadin.client WidgetUtil measureVerticalBorder.

Prototype

public static int measureVerticalBorder(Element element) 

Source Link

Usage

From source file:org.tltv.gantt.client.GanttConnector.java

License:Apache License

void updateDelegateTargetHeight() {
    if (delegateScrollTableTarget == null) {
        return;//from w w w.ja va  2 s . c  o  m
    }

    int headerHeight = 0;
    if (delegateScrollTableTarget.tHead != null) {
        // update table header height to match the Gantt widget's header
        // height
        int border = WidgetUtil.measureVerticalBorder(delegateScrollTableTarget.tHead.getElement());
        headerHeight = getWidget().getTimelineHeight();

        delegateScrollTableTarget.tHead.setHeight(Math.max(0, headerHeight - border) + "px");
    }

    int border = WidgetUtil.measureVerticalBorder(delegateScrollPanelTarget.getElement());
    // Adjust table's scroll container height to match the Gantt widget's
    // scroll container height.
    int newTableScrollContainerHeight = getWidget().getScrollContainerHeight();
    boolean tableHorScrollbarVisible = border >= WidgetUtil.getNativeScrollbarSize();
    if (getWidget().isContentOverflowingHorizontally()) {
        getWidget().hideHorizontalScrollbarSpacer();
        if (tableHorScrollbarVisible) {
            newTableScrollContainerHeight += WidgetUtil.getNativeScrollbarSize();
        }
    } else {
        if (tableHorScrollbarVisible) {
            getWidget().showHorizontalScrollbarSpacer();
        } else {
            getWidget().hideHorizontalScrollbarSpacer();
        }
    }

    delegateScrollPanelTarget.setHeight(Math.max(0, newTableScrollContainerHeight) + "px");

    getLayoutManager().setNeedsMeasure((ComponentConnector) getState().verticalScrollDelegateTarget);
}