Example usage for org.eclipse.swt.widgets ScrollBar getVisible

List of usage examples for org.eclipse.swt.widgets ScrollBar getVisible

Introduction

In this page you can find the example usage for org.eclipse.swt.widgets ScrollBar getVisible.

Prototype

public boolean getVisible() 

Source Link

Document

Returns true if the receiver is visible, and false otherwise.

Usage

From source file:org.eclipse.swt.examples.accessibility.CTable.java

void onResize(Event event) {
    clientArea = getClientArea();//from ww w.  j  a  va  2s  .  com
    /* vertical scrollbar */
    ScrollBar vBar = getVerticalBar();
    if (vBar != null) {
        int clientHeight = (clientArea.height - getHeaderHeight()) / itemHeight;
        int thumb = Math.min(clientHeight, itemsCount);
        vBar.setThumb(thumb);
        vBar.setPageIncrement(thumb);
        int index = vBar.getSelection();
        if (index != topIndex) {
            topIndex = index;
            redraw();
        }
        boolean visible = clientHeight < itemsCount;
        if (visible != vBar.getVisible()) {
            vBar.setVisible(visible);
            clientArea = getClientArea();
        }
    }

    /* horizontal scrollbar */
    ScrollBar hBar = getHorizontalBar();
    if (hBar != null) {
        int hBarMaximum = hBar.getMaximum();
        int thumb = Math.min(clientArea.width, hBarMaximum);
        hBar.setThumb(thumb);
        hBar.setPageIncrement(thumb);
        horizontalOffset = hBar.getSelection();
        boolean visible = clientArea.width < hBarMaximum;
        if (visible != hBar.getVisible()) {
            hBar.setVisible(visible);
            clientArea = getClientArea();
        }
    }

    /* header */
    int headerHeight = Math.max(fontHeight, headerImageHeight) + 2 * getHeaderPadding();
    header.setSize(clientArea.width, headerHeight);

    /* if this is the focus control but there are no items then the boundary focus ring must be repainted */
    if (itemsCount == 0 && isFocusControl())
        redraw();
}