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

Examples of org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand


            public Rectangle getClientArea() {
                return new Rectangle(0, 0, 1050, 1050);
            }
        });
        gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display
                .getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
        rowHeaderLayer = gridLayer.getRowHeaderLayer();
        columnHeaderLayer = gridLayer.getColumnHeaderLayer();
        selectionLayer = gridLayer.getBodyLayer().getSelectionLayer();
View Full Code Here


            if (this.processingClientAreaResizeCommand)
                return false;

            this.processingClientAreaResizeCommand = true;

            ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;

            // remember the difference from client area to body region area
            // needed because the scrollbar will be removed and therefore the
            // client area will become bigger
            Scrollable scrollable = clientAreaResizeCommand.getScrollable();
            Rectangle clientArea = scrollable.getClientArea();
            Rectangle calcArea = clientAreaResizeCommand.getCalcArea();
            int widthDiff = clientArea.width - calcArea.width;
            int heightDiff = clientArea.height - calcArea.height;

            if (this.hBarListener == null && this.horizontalScrollbarEnabled) {
                ScrollBar hBar = scrollable.getHorizontalBar();

                if (this.horizontalScroller != null) {
                    hBar.setEnabled(false);
                    hBar.setVisible(false);
                } else {
                    this.horizontalScroller = new ScrollBarScroller(hBar);
                }

                this.hBarListener = new HorizontalScrollBarHandler(this, this.horizontalScroller);

                if (scrollable instanceof NatTable) {
                    this.hBarListener.setTable((NatTable) scrollable);
                }
            }

            if (this.vBarListener == null && this.verticalScrollbarEnabled) {
                ScrollBar vBar = scrollable.getVerticalBar();

                if (this.verticalScroller != null) {
                    vBar.setEnabled(false);
                    vBar.setVisible(false);
                } else {
                    this.verticalScroller = new ScrollBarScroller(vBar);
                }

                this.vBarListener = new VerticalScrollBarHandler(this, this.verticalScroller);

                if (scrollable instanceof NatTable) {
                    this.vBarListener.setTable((NatTable) scrollable);
                }
            }

            handleGridResize();

            // after handling the scrollbars recalculate the area to use for
            // percentage calculation
            Rectangle possibleArea = clientArea;
            possibleArea.width = possibleArea.width - widthDiff;
            possibleArea.height = possibleArea.height - heightDiff;
            clientAreaResizeCommand.setCalcArea(possibleArea);

            this.processingClientAreaResizeCommand = false;
            // we don't return true here because the ClientAreaResizeCommand
            // needs to be handled
            // by the DataLayer in case percentage sizing is enabled
View Full Code Here

        });

        addListener(SWT.Resize, new Listener() {
            @Override
            public void handleEvent(final Event e) {
                doCommand(new ClientAreaResizeCommand(NatTable.this));
                redraw();
            }
        });
    }
View Full Code Here

                return new Rectangle(0, 0, 600, 400);
            }
        });

        // Shoot this command so that the viewport can be initialized
        compositeFreezeLayer.doCommand(new ClientAreaResizeCommand(new Shell(
                Display.getDefault(), SWT.H_SCROLL | SWT.V_SCROLL)));
    }
View Full Code Here

    @Override
    public boolean doCommand(ILayerCommand command) {
        if (command instanceof ClientAreaResizeCommand
                && command.convertToTargetLayer(this)) {
            ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;
            Rectangle possibleArea = clientAreaResizeCommand.getScrollable()
                    .getClientArea();

            // remove the column header height and the row header width from the
            // client area to
            // ensure that only the body region is used for percentage
            // calculation
            Rectangle rowLayerArea = getRowHeaderLayer()
                    .getClientAreaProvider().getClientArea();
            Rectangle columnLayerArea = getColumnHeaderLayer()
                    .getClientAreaProvider().getClientArea();
            possibleArea.width = possibleArea.width - rowLayerArea.width;
            possibleArea.height = possibleArea.height - columnLayerArea.height;

            clientAreaResizeCommand.setCalcArea(possibleArea);
        }
        return super.doCommand(command);
    }
View Full Code Here

    @Override
    public boolean doCommand(ILayerCommand command) {
        if (command instanceof ClientAreaResizeCommand
                && command.convertToTargetLayer(this)) {
            ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command;

            boolean refresh = false;
            if (isColumnPercentageSizing()) {
                this.columnWidthConfig.calculatePercentages(
                        clientAreaResizeCommand.getCalcArea().width,
                        getColumnCount());
                refresh = true;
            }
            if (isRowPercentageSizing()) {
                this.rowHeightConfig.calculatePercentages(
                        clientAreaResizeCommand.getCalcArea().height,
                        getRowCount());
                refresh = true;
            }

            if (refresh) {
View Full Code Here

        layerStack.setClientAreaProvider(new IClientAreaProvider() {
            public Rectangle getClientArea() {
                return new Rectangle(0, 0, 2000, 250);
            }
        });
        layerStack.doCommand(new ClientAreaResizeCommand(new Shell(Display
                .getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    }
View Full Code Here

            public Rectangle getClientArea() {
                return new Rectangle(0, 0, 1050, 250);
            }

        });
        gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display
                .getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    }
View Full Code Here

            public Rectangle getClientArea() {
                return new Rectangle(0, 0, 1050, 250);
            }

        });
        gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display
                .getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    }
View Full Code Here

            public Rectangle getClientArea() {
                return new Rectangle(0, 0, 1050, 250);
            }

        });
        gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display
                .getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));

        configRegistry = new ConfigRegistry();
        new DefaultNatTableStyleConfiguration()
                .configureRegistry(configRegistry);
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand

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.