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

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


    private void updateColumnWidth(ILayer natLayer, MouseEvent e) {
        int dragWidth = e.x - this.startX;
        int newColumnWidth = this.originalColumnWidth + dragWidth;
        if (newColumnWidth < getColumnWidthMinimum())
            newColumnWidth = getColumnWidthMinimum();
        natLayer.doCommand(new ColumnResizeCommand(natLayer,
                this.columnPositionToResize, newColumnWidth));
    }
View Full Code Here


        int contentWidth = (fontHeight * numberOfNewLines) + (spacing * 2);
        int contentToCellDiff = (cell.getBounds().width - rectangle.width);

        if ((contentWidth > rectangle.width) && calculateByTextHeight) {
            ILayer layer = cell.getLayer();
            layer.doCommand(new ColumnResizeCommand(layer, cell
                    .getColumnPosition(), contentWidth + contentToCellDiff));
        }

        if (text != null && text.length() > 0) {
            if (numberOfNewLines == 1) {
View Full Code Here

    protected void setNewMinLength(ILayerCell cell, int contentWidth) {
        int cellLength = cell.getBounds().width;
        if (cellLength < contentWidth) {
            // execute ColumnResizeCommand
            ILayer layer = cell.getLayer();
            layer.doCommand(new ColumnResizeCommand(layer, cell
                    .getColumnPosition(), contentWidth));
        }
    }
View Full Code Here

            int contentHeight = (fontHeight * numberOfNewLines) + (spacing * 2);
            int contentToCellDiff = (cell.getBounds().width - rectangle.width);

            if ((contentHeight > rectangle.width) && calculateByTextHeight) {
                ILayer layer = cell.getLayer();
                layer.doCommand(new ColumnResizeCommand(layer, cell
                        .getColumnPosition(), contentHeight + contentToCellDiff));
            }

            if (text != null && text.length() > 0) {

View Full Code Here

            int contentWidth = imageBounds.width;
            if (this.calculateByWidth && (contentWidth > bounds.width)) {
                int contentToCellDiff = (cell.getBounds().width - bounds.width);
                ILayer layer = cell.getLayer();
                layer.doCommand(new ColumnResizeCommand(
                        layer,
                        cell.getColumnPosition(),
                        contentWidth + contentToCellDiff));
            }
View Full Code Here

    public void testHandleColumnResizeCommand() {
        Assert.assertEquals(100, dataLayer.getColumnWidthByPosition(3));

        int columnPosition = 3;
        int newWidth = 150;
        ColumnResizeCommand columnResizeCommand = new ColumnResizeCommand(
                dataLayer, columnPosition, newWidth);

        dataLayer.doCommand(columnResizeCommand);

        Assert.assertEquals(150, dataLayer.getColumnWidthByPosition(3));
View Full Code Here

        natTable.doCommand(new EditCellCommand(natTable, natTable
                .getConfigRegistry(), cell));
        assertEquals(new Rectangle(340, 80, 99, 19), natTable
                .getActiveCellEditor().getEditorControl().getBounds());

        natTable.doCommand(new ColumnResizeCommand(natTable, 2, 110));
        assertEquals(new Rectangle(340, 80, 99, 19), natTable
                .getActiveCellEditor().getEditorControl().getBounds());

        natTable.getActiveCellEditor().getEditorControl()
                .notifyListeners(SWT.FocusOut, null);
View Full Code Here

    public void resizeAColumnAndHideIt() throws Exception {
        assertEquals(10, layerStack.getColumnCount());
        assertEquals(1000, layerStack.getWidth());

        // Resize 2
        layerStack.doCommand(new ColumnResizeCommand(layerStack, 2, 500));
        assertEquals(1400, layerStack.getWidth());

        assertEquals(1, layerStack.getColumnIndexByPosition(1));
        assertEquals(100, layerStack.getColumnWidthByPosition(1));
        assertEquals(100, layerStack.getStartXOfColumnPosition(1));
View Full Code Here

    public void resizeAColumnAndReorderIt() throws Exception {
        assertEquals(10, layerStack.getColumnCount());
        assertEquals(1000, layerStack.getWidth());

        // Resize 2
        layerStack.doCommand(new ColumnResizeCommand(layerStack, 2, 500));
        assertEquals(1400, layerStack.getWidth());

        // Reorder 2 -> 4
        layerStack.doCommand(new ColumnReorderCommand(layerStack, 2, 4));
View Full Code Here

    }

    public void saveStateToPropeties() throws Exception {
        // Resize column 2 to 200px
        assertEquals(100, natTableFixture.getColumnWidthByPosition(2));
        natTableFixture.doCommand(new ColumnResizeCommand(natTableFixture, 2,
                200));
        assertEquals(200, natTableFixture.getColumnWidthByPosition(2));

        // Resize row 2 to 100px
        assertEquals(20, natTableFixture.getRowHeightByPosition(2));
View Full Code Here

TOP

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

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.