Package org.eclipse.nebula.widgets.nattable.selection.command

Examples of org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand


    @Test
    public void searchShouldWrapAroundColumn() {
        // Select search starting point in composite coordinates
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 3, 4, false, false));

        GridSearchStrategy gridStrategy = new GridSearchStrategy(
                configRegistry, false, true);

        // If we don't specify to wrap the search, it will not find it.
View Full Code Here


    @Test
    public void searchShouldWrapAroundRow() {
        // Select search starting point in composite coordinates
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 3, 4, false, false));

        GridSearchStrategy gridStrategy = new GridSearchStrategy(
                configRegistry, false, true);
        gridStrategy
                .setComparator(new CellValueAsStringComparator<Comparable<String>>());
View Full Code Here

    @Test
    public void searchShouldMoveBackwardsToFindCell() {
        // Select search starting point in composite coordinates
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 3, 4, false, false));

        GridSearchStrategy gridStrategy = new GridSearchStrategy(
                configRegistry, false, ISearchDirection.SEARCH_BACKWARDS, true);
        gridStrategy
                .setComparator(new CellValueAsStringComparator<Comparable<String>>());
View Full Code Here

        Assert.assertEquals(0, searchResult.columnPosition);
        Assert.assertEquals(0, searchResult.rowPosition);

        gridStrategy.setWrapSearch(true);
        // Simulate selecting the search result
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer,
                searchResult.columnPosition, searchResult.rowPosition, false,
                false));
        searchResult = gridStrategy.executeSearch("Body");
        // System.out.println(searchResult);
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer,
                searchResult.columnPosition, searchResult.rowPosition, false,
                false));
        searchResult = gridStrategy.executeSearch("Body");
        // System.out.println(searchResult);
        Assert.assertEquals(3, searchResult.columnPosition);
View Full Code Here

        natTable = new NatTableFixture(layerStack, 1000, 200, true);
    }

    @Test
    public void movingSelectionWithLeftArrow() throws Exception {
        natTable.doCommand(new SelectCellCommand(natTable, 5, 2, NO_SHIFT,
                NO_CTRL));

        // Note: the co-ordinates from this point on are in selection later
        // co-ordinates
View Full Code Here

        assertSelectionAnchorEquals(0, 1);
    }

    @Test
    public void movingSelectionWithRightArrow() throws Exception {
        natTable.doCommand(new SelectCellCommand(natTable, 5, 2, NO_SHIFT,
                NO_CTRL));

        // Note: the co-ordinates from this point on are in selection later
        // co-ordinates
View Full Code Here

        assertSelectionAnchorEquals(9, 1);
    }

    @Test
    public void movingSelectionWithDownArrow() throws Exception {
        natTable.doCommand(new SelectCellCommand(natTable, 5, 2, NO_SHIFT,
                NO_CTRL));

        // Note: the co-ordinates from this point on are in selection later
        // co-ordinates
View Full Code Here

        assertSelectionAnchorEquals(4, lastRow);
    }

    @Test
    public void movingSelectionWithUpArrow() throws Exception {
        natTable.doCommand(new SelectCellCommand(natTable, 5, 4, NO_SHIFT,
                NO_CTRL));

        // Note: the co-ordinates from this point on are in selection later
        // co-ordinates

        SWTUtils.pressKey(SWT.ARROW_UP, natTable);
        assertPositionEquals(4, 2, selectionLayer.getSelectedCellPositions()[0]);
        assertSelectionAnchorEquals(4, 2);

        SWTUtils.pressKey(SWT.ARROW_UP, SWT.SHIFT, natTable);
        SWTUtils.pressKey(SWT.ARROW_UP, SWT.SHIFT, natTable);
        assertSelectCellsCount(3);
        assertCellSelected(4, 0);
        assertCellSelected(4, 1);
        assertCellSelected(4, 2);
        assertSelectionAnchorEquals(4, 2);

        natTable.doCommand(new SelectCellCommand(natTable, 5, 4, NO_SHIFT,
                NO_CTRL));
        assertSelectCellsCount(1);

        SWTUtils.pressKey(SWT.ARROW_UP, SWT.MOD1, natTable);
        assertSelectCellsCount(1);
View Full Code Here

        assertSelectionAnchorEquals(4, lastRow);
    }

    @Test
    public void selectingRectangularAreasWithShiftKey() throws Exception {
        natTable.doCommand(new SelectCellCommand(natTable, 2, 1, NO_SHIFT,
                NO_CTRL));
        natTable.doCommand(new SelectCellCommand(natTable, 2, 3, SHIFT, NO_CTRL));

        assertSelectCellsCount(3);
        assertSelectionAnchorEquals(1, 0);
        assertCellSelected(1, 0);
        assertCellSelected(1, 1);
View Full Code Here

    @Test
    public void willSelectBodyCellAndShouldHaveColumnHeaderSelected() {
        // Select body cell
        // The cell position is a grid layer position
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 2, 2, false, false));

        // Get body layer cell corresponding to the selected body cell
        ILayer bodyLayer = gridLayer.getBodyLayer();
        // The column position is 1 because it takes into account the offset of
        // the row header
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.