Search in sources :

Example 1 with VerticalScrollBarHandler

use of org.eclipse.nebula.widgets.nattable.viewport.VerticalScrollBarHandler in project nebula.widgets.nattable by eclipse.

the class VerticalScrollBarHandlerTest method verticalScrollbarThumbSizeCalcNoScrollingNeeded.

@Test
public void verticalScrollbarThumbSizeCalcNoScrollingNeeded() throws Exception {
    this.viewport = new ViewportLayerFixture(new Rectangle(0, 0, 500, 500));
    this.scrollHandler = new VerticalScrollBarHandler(this.viewport, this.scrollBar);
    assertEquals(465, this.viewport.getWidth());
    assertEquals(465, this.viewport.getWidth());
    this.scrollHandler.recalculateScrollBarSize();
    assertEquals(365, this.scrollHandler.scroller.getThumb());
    assertFalse(this.scrollBar.isEnabled());
    assertFalse(this.scrollBar.isVisible());
}
Also used : ViewportLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture) Rectangle(org.eclipse.swt.graphics.Rectangle) VerticalScrollBarHandler(org.eclipse.nebula.widgets.nattable.viewport.VerticalScrollBarHandler) Test(org.junit.Test)

Example 2 with VerticalScrollBarHandler

use of org.eclipse.nebula.widgets.nattable.viewport.VerticalScrollBarHandler in project nebula.widgets.nattable by eclipse.

the class VerticalScrollBarHandlerTest method verticalScrollbarThumbSize.

@Test
public void verticalScrollbarThumbSize() throws Exception {
    this.viewport = new ViewportLayerFixture(new Rectangle(0, 0, 250, 100));
    this.scrollHandler = new VerticalScrollBarHandler(this.viewport, this.scrollBar);
    assertEquals(250, this.viewport.getWidth());
    this.scrollHandler.recalculateScrollBarSize();
    // Fixture data - viewport height (100px), scrollable height (365px)
    // No overhang
    assertEquals(100, this.scrollHandler.scroller.getThumb());
    this.viewport.moveRowPositionIntoViewport(5);
    assertEquals(100, this.scrollHandler.scroller.getThumb());
}
Also used : ViewportLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture) Rectangle(org.eclipse.swt.graphics.Rectangle) VerticalScrollBarHandler(org.eclipse.nebula.widgets.nattable.viewport.VerticalScrollBarHandler) Test(org.junit.Test)

Example 3 with VerticalScrollBarHandler

use of org.eclipse.nebula.widgets.nattable.viewport.VerticalScrollBarHandler in project nebula.widgets.nattable by eclipse.

the class VerticalScrollBarHandlerTest method init.

@Before
public void init() {
    this.viewport = new ViewportLayerFixture();
    this.scrollBar = ViewportLayerFixture.DEFAULT_SCROLLABLE.getVerticalBar();
    this.scrollHandler = new VerticalScrollBarHandler(this.viewport, this.scrollBar);
    assertEquals(0, this.viewport.getRowIndexByPosition(0));
    assertEquals(1, this.viewport.getRowIndexByPosition(1));
}
Also used : ViewportLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture) VerticalScrollBarHandler(org.eclipse.nebula.widgets.nattable.viewport.VerticalScrollBarHandler) Before(org.junit.Before)

Aggregations

ViewportLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.ViewportLayerFixture)3 VerticalScrollBarHandler (org.eclipse.nebula.widgets.nattable.viewport.VerticalScrollBarHandler)3 Rectangle (org.eclipse.swt.graphics.Rectangle)2 Test (org.junit.Test)2 Before (org.junit.Before)1