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

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


public class SelectRowAction extends AbstractMouseSelectionAction {

    @Override
    public void run(NatTable natTable, MouseEvent event) {
        super.run(natTable, event);
        natTable.doCommand(new SelectRowsCommand(natTable,
                getGridColumnPosition(), getGridRowPosition(),
                isWithShiftMask(), isWithControlMask()));
    }
View Full Code Here


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

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

        Collection<PositionCoordinate> cells = ArrayUtil
                .asCollection(selectionLayer.getSelectedCellPositions());
        assertEquals(1, cells.size());
        assertEquals(1, selectionLayer.getSelectedRowPositions().size());
        assertEquals(1, selectionLayer.getSelectedRowCount());

        // select another row with control mask
        selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 1, 2,
                false, true));

        cells = ArrayUtil.asCollection(selectionLayer
                .getSelectedCellPositions());
        assertEquals(1, cells.size());
        assertEquals(1, selectionLayer.getSelectedRowPositions().size());
        assertEquals(1, selectionLayer.getSelectedRowCount());

        // select additional rows with shift mask
        selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 1, 5,
                true, false));

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

        return ViewportSelectRowCommand.class;
    }

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

TOP

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

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.