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

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


    }

    @Test
    public void shouldFireRowSelectionEvent() throws Exception {
        // Select single row
        nattable.doCommand(new SelectRowsCommand(nattable, 5, 5, NO_SHIFT,
                NO_CTRL));

        assertEquals(1, listener.getEventsCount());
        assertTrue(listener.containsInstanceOf(RowSelectionEvent.class));

        RowSelectionEvent event = (RowSelectionEvent) listener
                .getReceivedEvents().get(0);
        assertEquals(5, event.getRowPositionRanges().iterator().next().start);
        assertEquals(6, event.getRowPositionRanges().iterator().next().end);

        // Select additional rows with shift
        nattable.doCommand(new SelectRowsCommand(nattable, 5, 7, WITH_SHIFT,
                NO_CTRL));
        assertEquals(2, listener.getEventsCount());
        assertTrue(listener.containsInstanceOf(RowSelectionEvent.class));

        event = (RowSelectionEvent) listener.getReceivedEvents().get(1);
View Full Code Here


    @Test
    public void shouldClearSelectionOnDataUpdates() throws Exception {
        // test SelectionModel updates
        assertEquals(0, selectionLayer.getFullySelectedRowPositions().length);

        nattable.doCommand(new SelectRowsCommand(nattable, 1, 1, false, false));
        assertEquals(1, selectionLayer.getFullySelectedRowPositions().length);

        // Ford motor at top and selected
        assertEquals("B Ford Motor", nattable.getDataValueByPosition(2, 1)
                .toString());
View Full Code Here

                }));

        assertEquals(0, selectionLayer.getFullySelectedRowPositions().length);

        nattable.doCommand(new SelectRowsCommand(nattable, 1, 1, false, false));
        assertEquals(1, selectionLayer.getFullySelectedRowPositions().length);

        // Ford motor at top and selected
        assertEquals("B Ford Motor", nattable.getDataValueByPosition(2, 1)
                .toString());
View Full Code Here

                        }));

        assertEquals(0, selectionLayer.getFullySelectedRowPositions().length);

        nattable.doCommand(new SelectRowsCommand(nattable, 1, 1, false, false));
        assertEquals(1, selectionLayer.getFullySelectedRowPositions().length);

        // Ford motor at top and selected
        assertEquals("B Ford Motor", nattable.getDataValueByPosition(2, 1)
                .toString());
View Full Code Here

                if (!rowPositions.isEmpty()) {
                    Integer max = Collections.max(rowPositions);
                    intValue = max.intValue();
                }
                if (intValue >= 0) {
                    selectionLayer.doCommand(new SelectRowsCommand(
                            selectionLayer, 0, ObjectUtils
                                    .asIntArray(rowPositions), false, true,
                            intValue));
                }
            }
View Full Code Here

    @Test
    public void shouldPreserveRowSelectionOnDataUpdates() throws Exception {
        assertEquals(0, selectionLayer.getFullySelectedRowPositions().length);

        nattable.doCommand(new SelectRowsCommand(nattable, 1, 1, false, false));
        assertEquals(1, selectionLayer.getFullySelectedRowPositions().length);

        // Ford motor at top and selected
        assertEquals("B Ford Motor", nattable.getDataValueByPosition(2, 1)
                .toString());
View Full Code Here

                .toString());
        assertEquals("C General Electric Co",
                nattable.getDataValueByPosition(2, 3).toString());

        // Select 'Ford Motor'
        nattable.doCommand(new SelectRowsCommand(nattable, 1, 1, false, false));
        assertEquals("B Ford Motor", getSelected().getSecurity_description());

        // Sort
        nattable.doCommand(new SortColumnCommand(nattable, 2, false));
View Full Code Here

                    fail("CellSelectionEvent fired for row selection");
                }
            }
        });

        nattable.doCommand(new SelectRowsCommand(selectionLayer, 0, 0, false,
                false));
        // the second call first clears the selection and then applies the new
        // one
        // clearing by default also fires a CellSelectionEvent with negative
        // values
        nattable.doCommand(new SelectRowsCommand(selectionLayer, 0, 3, false,
                false));
    }
View Full Code Here

        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,
                false, false));
        assertEquals(1, selectedObjects.size());
    }
View Full Code Here

public class RowSelectionDragMode extends CellSelectionDragMode {

    @Override
    public void fireSelectionCommand(NatTable natTable, int columnPosition,
            int rowPosition, boolean shiftMask, boolean controlMask) {
        natTable.doCommand(new SelectRowsCommand(natTable, columnPosition,
                rowPosition, shiftMask, controlMask));
    }
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.