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

Examples of org.eclipse.nebula.widgets.nattable.resize.command.MultiColumnResizeCommand


     * @return <code>true</code> if the command has been handled,
     *         <code>false</code> otherwise
     */
    protected boolean handleColumnResizeCommand(ColumnResizeCommand command) {
        if (isColumnPositionFullySelected(command.getColumnPosition())) {
            return super.doCommand(new MultiColumnResizeCommand(this,
                    selectionModel
                            .getFullySelectedColumnPositions(getRowCount()),
                    command.getNewColumnWidth()));
        } else {
            return super.doCommand(command);
View Full Code Here


        int[] gridColumnWidths = MaxCellBoundsHelper.getPreferredColumnWidths(
                command.getConfigRegistry(), command.getGCFactory(),
                commandLayer, gridColumnPositions);

        commandLayer.doCommand(new MultiColumnResizeCommand(commandLayer,
                gridColumnPositions, gridColumnWidths));
        targetLayer.doCommand(new TurnViewportOnCommand());

        return true;
    }
View Full Code Here

public class MultiColumnResizeCommandTest {

    @Test
    public void getColumnWidth() throws Exception {
        MultiColumnResizeCommand resizeCommand = new MultiColumnResizeCommand(
                new DataLayerFixture(), new int[] { 5, 9 },
                new int[] { 12, 20 });

        Assert.assertEquals(12, resizeCommand.getColumnWidth(5));
        Assert.assertEquals(20, resizeCommand.getColumnWidth(9));

        Assert.assertEquals(-1, resizeCommand.getColumnWidth(10)); // Error case
    }
View Full Code Here

        Assert.assertEquals(-1, resizeCommand.getColumnWidth(10)); // Error case
    }

    @Test
    public void getCommonColumnWidth() throws Exception {
        MultiColumnResizeCommand resizeCommand = new MultiColumnResizeCommand(
                new DataLayerFixture(), new int[] { 1, 2 }, 100);

        Assert.assertEquals(100, resizeCommand.getCommonColumnWidth());
        Assert.assertEquals(100, resizeCommand.getColumnWidth(1));
    }
View Full Code Here

        DataLayerFixture dataLayer = new DataLayerFixture();
        // Indexes re-ordered: 4 1 0 2 3
        ColumnReorderLayer reorderLayerFixture = new ColumnReorderLayerFixture(
                dataLayer);

        MultiColumnResizeCommand resizeCommand = new MultiColumnResizeCommand(
                reorderLayerFixture, new int[] { 1, 2 }, new int[] { 100, 150 });
        reorderLayerFixture.doCommand(resizeCommand);

        // As the Commands goes down the stack - positions might get converted
        // to entirely different values.
        Assert.assertEquals(-1, resizeCommand.getCommonColumnWidth());
        Assert.assertEquals(-1, resizeCommand.getColumnWidth(5));
        Assert.assertEquals(-1, resizeCommand.getColumnWidth(12));

        Assert.assertEquals(100, resizeCommand.getColumnWidth(1));
        Assert.assertEquals(150, resizeCommand.getColumnWidth(0));
    }
View Full Code Here

    @Test
    public void shouldResizeAllSelectedColumns() {
        int columnPositions[] = new int[] { 3, 2, 4 };
        int newWidth = 250;
        MultiColumnResizeCommand columnResizeCommand = new MultiColumnResizeCommand(
                dataLayer, columnPositions, newWidth);

        dataLayer.doCommand(columnResizeCommand);

        for (int columnPosition : columnPositions) {
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.resize.command.MultiColumnResizeCommand

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.