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

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


        assertEquals(8, event.getRowPositionRanges().iterator().next().end);
    }

    @Test
    public void shouldFireColumnSelectionEvent() throws Exception {
        nattable.doCommand(new SelectColumnCommand(nattable, 5, 5, NO_SHIFT,
                NO_CTRL));

        assertEquals(2, listener.getEventsCount());
        assertTrue(listener.containsInstanceOf(ColumnSelectionEvent.class));
        assertTrue(listener
View Full Code Here


                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 4, 8,
                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 7, 9,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 8, 0,
                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 9, 9,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 5, 0,
                false, true));

        ILayerCell[] bodyCells = commandHandler.assembleBody(0);
        assertEquals(8, bodyCells.length);
        assertEquals("[5,0]", bodyCells[4].getDataValue());
View Full Code Here

                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 4, 8,
                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 7, 9,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 8, 0,
                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 9, 9,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 5, 0,
                false, true));

        ILayerCell[][] copiedGrid = commandHandler
                .assembleCopiedDataStructure();
View Full Code Here

                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 4, 8,
                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 7, 9,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 8, 0,
                false, true));
        selectionLayer.doCommand(new SelectCellCommand(selectionLayer, 9, 9,
                false, true));
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 5, 0,
                false, true));

        commandHandler = new CopyDataCommandHandler(selectionLayer);
        ILayerCell[][] copiedGrid = commandHandler
                .assembleCopiedDataStructure();
View Full Code Here

                    }
                });

        // first execute column selection with default configuration to see that
        // all rows get selected
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                false, false));

        assertEquals(10, selectedObjects.size());

        // now clear set the flag for column selection processing to false and
        // fire the event again
        selectedObjects.clear();
        selectionProvider.setProcessColumnSelection(false);
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                false, false));
        assertEquals(0, selectedObjects.size());

        // now select a cell to verify that other selections are still processed
        selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 1, 1,
View Full Code Here

    }

    @Test
    public void shouldCreateColumnGroupFromSelectedColumns() {

        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, false));
        Assert.assertTrue(selectionLayer.isColumnPositionFullySelected(0));
        Assert.assertTrue(model.isEmpty());

        final String columnGroupName = "Test Group";
View Full Code Here

    public void shouldCreateColumnGroupAfterReordering() {
        // Reorder column to first position
        selectionLayer
                .doCommand(new ColumnReorderCommand(selectionLayer, 9, 0));
        // Select first column position
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, false));

        final String columnGroupName = "Test Group";
        handler.loadSelectedColumnsIndexesWithPositions();
        handler.handleGroupColumnsCommand(columnGroupName);
View Full Code Here

        Assert.assertEquals(9, getColumnIndexesInGroup(9).get(0).intValue());
    }

    @Test
    public void shouldUngroupMiddleSelectedColumns() {
        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);

        Assert.assertEquals(3, getColumnIndexesInGroup(0).size());
        Assert.assertEquals(0, getColumnIndexesInGroup(0).get(0).intValue());
        Assert.assertEquals(1, getColumnIndexesInGroup(0).get(1).intValue());
        Assert.assertEquals(2, getColumnIndexesInGroup(0).get(2).intValue());

        // Test ungrouping column in middle
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                false, false));
        handler.handleUngroupCommand();

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

    public void shouldNotUngroupColumnsInUnbreakableGroups() throws Exception {
        model.addColumnsIndexesToGroup("Test group 1", 0, 1, 2);
        model.getColumnGroupByIndex(0).setUnbreakable(true);

        // Ungroup column in the middle
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0,
                false, false));
        handler.handleUngroupCommand();

        Assert.assertEquals(3, getColumnIndexesInGroup(0).size());
        Assert.assertTrue(getColumnIndexesInGroup(0).contains(0));
        Assert.assertTrue(getColumnIndexesInGroup(0).contains(1));
        Assert.assertTrue(getColumnIndexesInGroup(0).contains(2));

        // Ungroup first column
        selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0,
                false, false));
        handler.handleUngroupCommand();

        Assert.assertEquals(3, getColumnIndexesInGroup(0).size());
        Assert.assertTrue(getColumnIndexesInGroup(0).contains(0));
View Full Code Here

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

    @Test
    public void shouldUngroupFirstSelectedColumn() {
        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, false));
        handler.handleUngroupCommand();

        Assert.assertEquals(2, getColumnIndexesInGroup(2).size());
        Assert.assertEquals(1, getColumnIndexesInGroup(2).get(0).intValue());
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.