Java Code Examples for com.vaadin.client.WidgetUtil#getNativeScrollbarSize()
The following examples show how to use
com.vaadin.client.WidgetUtil#getNativeScrollbarSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WeekGrid.java From calendar-component with Apache License 2.0 | 6 votes |
public void setWidthPX(int width) { if (isHorizontalScrollable()) { updateCellWidths(); // Otherwise the scroll wrapper is somehow too narrow = horizontal // scroll wrapper.setWidth(content.getOffsetWidth() + WidgetUtil.getNativeScrollbarSize() + "px"); this.width = content.getOffsetWidth() - timebar.getOffsetWidth(); } else { this.width = (width == -1) ? width : width - timebar.getOffsetWidth(); if (isVerticalScrollable() && width != -1) { this.width = this.width - WidgetUtil.getNativeScrollbarSize(); } updateCellWidths(); } }
Example 2
Source File: GanttConnector.java From gantt with Apache License 2.0 | 5 votes |
private void updateScrollDelegateScrollContainerHeight() { boolean tableHorScrollbarVisible = GanttUtil .isHorizontalScrollbarVisible(delegateScrollGridTarget.getEscalator()); int headerHeight = getWidget().getTimelineHeight(); // Adjust table's scroll container height to match the Gantt widget's // scroll container height. int newTableScrollContainerHeight = getWidget().getScrollContainerHeight(); if (getWidget().isContentOverflowingHorizontally()) { getWidget().hideHorizontalScrollbarSpacer(); if (tableHorScrollbarVisible) { newTableScrollContainerHeight += WidgetUtil.getNativeScrollbarSize(); } } else { if (tableHorScrollbarVisible) { getWidget().showHorizontalScrollbarSpacer(); } else { getWidget().hideHorizontalScrollbarSpacer(); } } GanttUtil.getTableWrapper(delegateScrollGridTarget.getEscalator()).getStyle().setProperty("height", Math.max(0, headerHeight + newTableScrollContainerHeight) + "px"); delegateScrollGridTarget.getEscalator().getBody().getElement().getStyle().setProperty("height", Math.max(0, newTableScrollContainerHeight) + "px"); delegateScrollGridTarget.getEscalator() .setHeight(Math.max(0, headerHeight + newTableScrollContainerHeight) + "px"); getLayoutManager().setNeedsMeasure((ComponentConnector) getState().verticalScrollDelegateTarget); }
Example 3
Source File: CubaTreeTableWidget.java From cuba with Apache License 2.0 | 4 votes |
/** * Adds right padding for header and aggregation row (if visible) to compensate * table body vertical scroll bar. * * @param willHaveScrollbar defines whether table body will have scroll bar */ @SuppressWarnings("ConstantConditions") protected void toggleScrollBarSpacer(boolean willHaveScrollbar) { com.google.gwt.user.client.Element headerWrapper = tHead.getElement(); Element header = headerWrapper.getFirstChildElement(); com.google.gwt.user.client.Element aggregationRowWrapper = null; Element aggregationRow = null; if (_delegate.isAggregationVisible()) { aggregationRowWrapper = _delegate.aggregationRow.getElement(); aggregationRow = aggregationRowWrapper.getFirstChildElement(); } if (willHaveScrollbar) { String scrollBarWidth = WidgetUtil.getNativeScrollbarSize() + "px"; String borderColor = new ComputedStyle(headerWrapper) .getProperty("borderRightColor"); String borderRightStyle = "1px solid " + borderColor; headerWrapper.getStyle() .setProperty("paddingRight", scrollBarWidth); header.getStyle() .setProperty("borderRight", borderRightStyle); if (_delegate.isAggregationVisible()) { aggregationRowWrapper.getStyle() .setProperty("paddingRight", scrollBarWidth); aggregationRow.getStyle() .setProperty("borderRight", borderRightStyle); } } else { headerWrapper.getStyle() .setProperty("paddingRight", "0px"); header.getStyle() .setProperty("borderRight", "0px"); if (_delegate.isAggregationVisible()) { aggregationRowWrapper.getStyle() .setProperty("paddingRight", "0px"); aggregationRow.getStyle() .setProperty("borderRight", "0px"); } } }