Search in sources :

Example 16 with DefaultGridLayer

use of org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer in project nebula.widgets.nattable by eclipse.

the class ListDataProviderPerformanceTest method performanceOfGlazedListDataProvider.

// Bench marked ~ 45 milliseconds. Intel 2GHZ, 2GB Ram
@Test
public void performanceOfGlazedListDataProvider() throws Exception {
    String[] propertyNames = RowDataListFixture.getPropertyNames();
    Map<String, String> propertyToLabelMap = RowDataListFixture.getPropertyToLabelMap();
    List<RowDataFixture> largeList = RowDataListFixture.getList(26000);
    Assert.assertTrue(largeList.size() > 25000);
    IDataProvider glazedListsDataProvider = new GlazedListsDataProvider<RowDataFixture>(GlazedLists.eventList(largeList), new ReflectiveColumnPropertyAccessor<RowDataFixture>(propertyNames));
    IDataProvider columnHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap);
    this.layer = new DefaultGridLayer(glazedListsDataProvider, columnHeaderDataProvider);
}
Also used : IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) GlazedListsDataProvider(org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsDataProvider) DefaultColumnHeaderDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Test(org.junit.Test)

Example 17 with DefaultGridLayer

use of org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer in project nebula.widgets.nattable by eclipse.

the class GridLayerTest method setup.

@Before
public void setup() {
    this.bodyDataLayer = new BaseDataLayerFixture();
    this.columnHeaderDataLayer = new BaseDataLayerFixture();
    this.rowHeaderDataLayer = new BaseDataLayerFixture();
    this.cornerDataLayer = new BaseDataLayerFixture();
    this.gridLayerUnderTest = new DefaultGridLayer(this.bodyDataLayer, this.columnHeaderDataLayer, this.rowHeaderDataLayer, this.cornerDataLayer);
}
Also used : BaseDataLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.BaseDataLayerFixture) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Before(org.junit.Before)

Example 18 with DefaultGridLayer

use of org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer in project nebula.widgets.nattable by eclipse.

the class GridLayerTest method initBodyLayer.

// **** New tests using fixtures ****
/**
 * @see ViewportLayerFixture#DEFAULT_CLIENT_AREA
 */
@Test
public void initBodyLayer() throws Exception {
    DefaultGridLayer gridLayer = new GridLayerFixture();
    ViewportLayer viewport = gridLayer.getBodyLayer().getViewportLayer();
    viewport.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 160, 80);
        }
    });
    // Client area gets init when this command is fired
    gridLayer.doCommand(new InitializeClientAreaCommandFixture());
    Assert.assertEquals(160, viewport.getClientAreaWidth());
    Assert.assertEquals(80, viewport.getClientAreaHeight());
    Assert.assertEquals(160, viewport.getWidth());
    Assert.assertEquals(80, viewport.getHeight());
}
Also used : InitializeClientAreaCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) Rectangle(org.eclipse.swt.graphics.Rectangle) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Test(org.junit.Test)

Example 19 with DefaultGridLayer

use of org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer in project nebula.widgets.nattable by eclipse.

the class CopyDataCommandHandlerTest method setUp.

@Before
public void setUp() {
    final IDataProvider bodyDataProvider = new DataProviderFixture(10, 10);
    this.gridLayer = new DefaultGridLayer(bodyDataProvider, getColumnHeaderDataProvider(bodyDataProvider), getRowHeaderDataProvider(bodyDataProvider));
    this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 1050);
        }
    });
    this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    this.rowHeaderLayer = this.gridLayer.getRowHeaderLayer();
    this.columnHeaderLayer = this.gridLayer.getColumnHeaderLayer();
    this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer();
    this.commandHandler = new CopyDataCommandHandler(this.selectionLayer, this.columnHeaderLayer, this.rowHeaderLayer);
}
Also used : Shell(org.eclipse.swt.widgets.Shell) IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) IDataProvider(org.eclipse.nebula.widgets.nattable.data.IDataProvider) DataProviderFixture(org.eclipse.nebula.widgets.nattable.test.fixture.data.DataProviderFixture) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Before(org.junit.Before)

Example 20 with DefaultGridLayer

use of org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer in project nebula.widgets.nattable by eclipse.

the class GridSearchStrategyTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new DefaultGridLayer(getBodyDataProvider(), GridLayerFixture.colHeaderDataProvider);
    this.selectionLayer = this.gridLayer.getBodyLayer().getSelectionLayer();
    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);
}
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) DefaultGridLayer(org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer) Before(org.junit.Before)

Aggregations

DefaultGridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)29 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)17 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)17 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)16 HashMap (java.util.HashMap)11 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)10 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)10 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)9 ColumnOverrideLabelAccumulator (org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator)9 Test (org.junit.Test)8 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)7 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)7 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)5 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)4 ExtendedPersonWithAddress (org.eclipse.nebula.widgets.nattable.dataset.person.ExtendedPersonWithAddress)4 ArrayList (java.util.ArrayList)3 IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)3 Rectangle (org.eclipse.swt.graphics.Rectangle)3 Before (org.junit.Before)3 ObservableElementList (ca.odell.glazedlists.ObservableElementList)2