Search in sources :

Example 11 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class SearchGridCommandHandlerTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new GridLayerFixture();
    this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 250);
        }
    });
    this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    this.configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
    this.commandHandler = new SearchGridCellsCommandHandler(this.gridLayer.getBodyLayer().getSelectionLayer());
    selectCell(3, 3);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) Shell(org.eclipse.swt.widgets.Shell) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) Rectangle(org.eclipse.swt.graphics.Rectangle) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Before(org.junit.Before)

Example 12 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class MultiColumnReorderEventDiffTest method before.

@Before
public void before() {
    this.dataLayer = new DataLayerFixture(20, 20, 100, 40);
    this.viewportLayer = new ViewportLayer(this.dataLayer);
    this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 800, 400);
        }
    });
    this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(2));
    this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2));
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) DataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture) Rectangle(org.eclipse.swt.graphics.Rectangle) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) Before(org.junit.Before)

Example 13 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class SelectionSearchStrategyTest method setUp.

@Before
public void setUp() {
    this.bodyDataProvider = new IDataProvider() {

        @Override
        public int getColumnCount() {
            return GridLayerFixture.bodyDataProvider.getColumnCount();
        }

        @Override
        public int getRowCount() {
            return GridLayerFixture.bodyDataProvider.getRowCount();
        }

        @Override
        public Object getDataValue(int columnIndex, int rowIndex) {
            if (columnIndex == 0 || columnIndex == 9) {
                return CELL_VALUE;
            }
            return GridLayerFixture.bodyDataProvider.getDataValue(columnIndex, rowIndex);
        }

        @Override
        public void setDataValue(int columnIndex, int rowIndex, Object newValue) {
            throw new UnsupportedOperationException();
        }
    };
    this.gridLayer = new DefaultGridLayer(this.bodyDataProvider, GridLayerFixture.colHeaderDataProvider, GridLayerFixture.rowHeaderDataProvider, GridLayerFixture.cornerDataProvider);
    this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 250);
        }
    });
    this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer();
    this.configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) Shell(org.eclipse.swt.widgets.Shell) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) Rectangle(org.eclipse.swt.graphics.Rectangle) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Before(org.junit.Before)

Example 14 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class ViewportLayerTest2 method setup.

@Before
public void setup() {
    String columnInfo = "0:0;100 | 1:1;100 | 2:2;100 | 3:3;100";
    String rowInfo = "0:0;40  | 1:1;40  | 2:2;40  | 3:3;40";
    String cellInfo = "A0 | B0 | C0 | D0 \n" + "A1 | B1 | C1 | D1 \n" + "A2 | B2 | C2 | D2 \n" + "A3 | B3 | C3 | D3 \n";
    this.dataLayer = new TestLayer(4, 4, columnInfo, rowInfo, cellInfo);
    this.viewportLayer = new ViewportLayer(this.dataLayer);
    this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 200, 400);
        }
    });
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) Rectangle(org.eclipse.swt.graphics.Rectangle) TestLayer(org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) Before(org.junit.Before)

Example 15 with IClientAreaProvider

use of org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider in project nebula.widgets.nattable by eclipse.

the class NatTable method internalSetLayer.

private void internalSetLayer(ILayer layer) {
    if (layer != null) {
        this.underlyingLayer = layer;
        this.underlyingLayer.setClientAreaProvider(new IClientAreaProvider() {

            @Override
            public Rectangle getClientArea() {
                final Rectangle clientArea = new Rectangle(0, 0, 0, 0);
                if (!isDisposed()) {
                    getDisplay().syncExec(new Runnable() {

                        @Override
                        public void run() {
                            Rectangle natClientArea = NatTable.this.getClientArea();
                            clientArea.x = natClientArea.x;
                            clientArea.y = natClientArea.y;
                            clientArea.width = natClientArea.width;
                            clientArea.height = natClientArea.height;
                        }
                    });
                }
                return clientArea;
            }
        });
        this.underlyingLayer.addLayerListener(this);
        // register the DPI scaling
        this.underlyingLayer.doCommand(new ConfigureScalingCommand(new AbstractDpiConverter() {

            @Override
            protected void readDpiFromDisplay() {
                Display.getDefault().syncExec(new Runnable() {

                    @Override
                    public void run() {
                        dpi = Display.getDefault().getDPI().x;
                    }
                });
            }
        }, new AbstractDpiConverter() {

            @Override
            protected void readDpiFromDisplay() {
                Display.getDefault().syncExec(new Runnable() {

                    @Override
                    public void run() {
                        dpi = Display.getDefault().getDPI().y;
                    }
                });
            }
        }));
    }
}
Also used : AbstractDpiConverter(org.eclipse.nebula.widgets.nattable.layer.AbstractDpiConverter) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) Rectangle(org.eclipse.swt.graphics.Rectangle) ConfigureScalingCommand(org.eclipse.nebula.widgets.nattable.layer.command.ConfigureScalingCommand)

Aggregations

IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)31 Rectangle (org.eclipse.swt.graphics.Rectangle)30 Shell (org.eclipse.swt.widgets.Shell)18 ClientAreaResizeCommand (org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand)17 Before (org.junit.Before)17 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)8 Test (org.junit.Test)7 DataLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture)5 GridLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture)5 DefaultGridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)4 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)3 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)3 ColumnHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer)3 TestLayer (org.eclipse.nebula.widgets.nattable.test.fixture.TestLayer)3 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)2 CompositeFreezeLayer (org.eclipse.nebula.widgets.nattable.freeze.CompositeFreezeLayer)2 FreezeLayer (org.eclipse.nebula.widgets.nattable.freeze.FreezeLayer)2 RowHideShowLayer (org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer)2 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)2 DefaultBodyLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack)2