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

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


        natTable.enableEditingOnAllCells();

        assertEquals("Col: 1, Row: 1", natTable.getDataValueByPosition(1, 1));

        // Select cell, press A
        natTable.doCommand(new SelectCellCommand(natTable, 1, 1, false, false));
        SWTUtils.pressCharKey('A', natTable);

        // Verify edit mode
        assertNotNull(natTable.getActiveCellEditor());
        assertEquals("A", natTable.getActiveCellEditor().getCanonicalValue());
View Full Code Here


            }
        });

        natTable.configure();

        natTable.doCommand(new SelectCellCommand(natTable, 1, 1, false, false));
        natTable.notifyListeners(SWT.KeyDown, SWTUtils.keyEvent(SWT.F2));

        // Verify edit mode
        assertNotNull(natTable.getActiveCellEditor());
        assertEquals("Col: 1, Row: 1", natTable.getActiveCellEditor()
View Full Code Here

        assertEquals("Col: 1, Row: 1", dataProvider.getDataValue(0, 0));
        assertEquals("Col: 1, Row: 2", dataProvider.getDataValue(0, 1));
        assertEquals("Col: 2, Row: 1", dataProvider.getDataValue(1, 0));
        assertEquals("Col: 2, Row: 2", dataProvider.getDataValue(1, 1));

        natTable.doCommand(new SelectCellCommand(natTable, 1, 1, false, false));
        natTable.notifyListeners(SWT.KeyDown, SWTUtils.keyEventWithChar('C'));

        assertNotNull(natTable.getActiveCellEditor());

        natTable.getActiveCellEditor().getEditorControl()
View Full Code Here

     * Selected cells are (col,row): (2,3),(4,1),(1,0),(9,9)
     */
    @Test
    public void shouldReturnTheCorrectCountOfSelectedCells() {
        this.selectionLayer.clear();
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 3,
                false, true));
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 4, 1,
                false, true));
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 0,
                false, true));
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 9, 9,
                false, true));

        PositionCoordinate[] cells = this.selectionLayer.getSelectedCellPositions();
        Assert.assertEquals(4, cells.length);
        // (1, 0)
View Full Code Here

    }

    @Test
    public void shouldReturnSixCells() {
        this.selectionLayer.clear();
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 0,
                false, true));
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 0,
                false, true));
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 1,
                false, true));
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 1,
                false, true));
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 2,
                false, true));
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 2,
                false, true));

        Collection<PositionCoordinate> cells = ArrayUtil
                .asCollection(this.selectionLayer.getSelectedCellPositions());
View Full Code Here

    @Test
    public void onlyOneCellSelectedAtAnyTime() {
        this.selectionLayer.getSelectionModel().setMultipleSelectionAllowed(false);

        this.selectionLayer.clear();
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 1, 0,
                false, true));

        Collection<PositionCoordinate> cells = ArrayUtil
                .asCollection(this.selectionLayer.getSelectedCellPositions());
        Assert.assertEquals(1, cells.size());
        Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer,
                1, 0)));

        // select another cell with control mask
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 0,
                false, true));

        cells = ArrayUtil.asCollection(this.selectionLayer
                .getSelectedCellPositions());
        Assert.assertEquals(1, cells.size());
        Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer,
                2, 0)));

        // select additional cells with shift mask
        // only the first cell should be selected afterwards
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 10,
                true, false));

        cells = ArrayUtil.asCollection(this.selectionLayer
                .getSelectedCellPositions());
        Assert.assertEquals(1, cells.size());
        Assert.assertTrue(cells.contains(new PositionCoordinate(this.selectionLayer,
                2, 0)));

        // select additional cells with shift mask
        // only the first cell should be selected afterwards
        this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 10, 0,
                true, false));

        cells = ArrayUtil.asCollection(this.selectionLayer
                .getSelectedCellPositions());
        Assert.assertEquals(1, cells.size());
View Full Code Here

        final int lastColumn = 7;
        final int lastRow = 5;

        for (int columnPosition = startColumnPosition; columnPosition < lastColumn; columnPosition++) {
            for (int rowPosition = startRowPosition; rowPosition < lastRow; rowPosition++) {
                gridLayer.doCommand(new SelectCellCommand(gridLayer,
                        columnPosition, rowPosition, false, true));
            }
        }

        // We should get 20 Cells from the body
View Full Code Here

    }

    @Test
    public void shouldOnlySearchWhatIsSelected() {
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 1, 4, false, true));
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 2, 2, false, true));
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 3, 4, false, true));
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 5, 4, false, true));
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 6, 2, false, true));

        Assert.assertEquals(5, gridLayer.getBodyLayer().getSelectionLayer()
                .getSelectedCellPositions().length);

        final SelectionLayer selectionLayer = gridLayer.getBodyLayer()
View Full Code Here

    @Test
    public void shouldSearchSelectionBackwards() {
        // Select entire grid
        gridLayer
                .doCommand(new SelectCellCommand(gridLayer, 1, 1, false, false));
        gridLayer.doCommand(new SelectAllCommand());

        // Should find the first cell in grid
        final SelectionLayer selectionLayer = gridLayer.getBodyLayer()
                .getSelectionLayer();
View Full Code Here

                .getBodyLayer().getSelectionLayer());
        selectCell(3, 3);
    }

    private boolean selectCell(int columnPosition, int rowPosition) {
        return gridLayer.doCommand(new SelectCellCommand(gridLayer,
                columnPosition, rowPosition, false, false));
    }
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.