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

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


        Assert.assertEquals(1, selectionLayer.getColumnPositionByIndex(1));
    }

    @Test
    public void shouldUngroupFirstAndLastSelectedColumn() {
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 2, 0,
                false, true));

        final String columnGroupName = "Test Group 3";
        handler.loadSelectedColumnsIndexesWithPositions();
        handler.handleGroupColumnsCommand(columnGroupName);

        // Test ungrouping first column
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 2, 0,
                false, true));
        handler.handleUngroupCommand();

        Assert.assertEquals(1, getColumnIndexesInGroup(1).size());
        Assert.assertEquals(1, getColumnIndexesInGroup(1).get(0).intValue());
View Full Code Here


        Assert.assertEquals(1, selectionLayer.getColumnPositionByIndex(1));
    }

    @Test
    public void shouldRemoveAllColumnsInGroup() {
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 2, 0,
                false, true));

        final String columnGroupName = "Test Group 3";
        handler.loadSelectedColumnsIndexesWithPositions();
        handler.handleGroupColumnsCommand(columnGroupName);

        // Test ungrouping first column
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 2, 0,
                false, true));
        handler.handleUngroupCommand();

        Assert.assertFalse(model.isPartOfAGroup(0));
        Assert.assertFalse(model.isPartOfAGroup(1));
View Full Code Here

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

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

        Collection<PositionCoordinate> cells = ArrayUtil
                .asCollection(selectionLayer.getSelectedCellPositions());
        assertEquals(1, cells.size());
        assertEquals(1, selectionLayer.getSelectedColumnPositions().length);
        assertEquals(1, selectionLayer.getSelectedColumnPositions()[0]);
        assertEquals(1, selectionLayer.getSelectedRowCount());

        // select another column with control mask
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 2, 0,
                false, true));

        cells = ArrayUtil.asCollection(selectionLayer
                .getSelectedCellPositions());
        assertEquals(1, cells.size());
        assertEquals(1, selectionLayer.getSelectedColumnPositions().length);
        assertEquals(2, selectionLayer.getSelectedColumnPositions()[0]);
        assertEquals(1, selectionLayer.getSelectedRowCount());

        // select additional columns with shift mask
        // only the last column should be selected afterwards
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 5, 0,
                true, false));

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

        return ViewportSelectColumnCommand.class;
    }

    @Override
    protected boolean doCommand(ViewportSelectColumnCommand command) {
        viewportLayer.doCommand(new SelectColumnCommand(viewportLayer, command
                .getColumnPosition(), 0, command.isWithShiftMask(), command
                .isWithControlMask()));
        return true;
    }
View Full Code Here

        assertEquals(10, gridLayer.getColumnWidthByPosition(2));

        // Fully select columns 1, 2
        SelectionLayer selectionLayer = ((DefaultBodyLayerStack) gridLayer
                .getBodyLayer()).getSelectionLayer();
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, false));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                true, false));
        assertEquals(2, selectionLayer.getFullySelectedColumnPositions().length);

        // Resize grid column 5
        gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 5, 10));
View Full Code Here

TOP

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

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.