Search in sources :

Example 6 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture in project nebula.widgets.nattable by eclipse.

the class RowSelectionModelStructuralChangeEventHandlerTest method setup.

@Before
public void setup() {
    this.listFixture = RowDataListFixture.getList(10);
    this.bodyDataProvider = new ListDataProvider<RowDataFixture>(this.listFixture, new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()));
    GridLayerFixture gridLayer = new GridLayerFixture(this.bodyDataProvider);
    this.nattable = new NatTableFixture(gridLayer, false);
    this.bodyDataLayer = (DataLayer) gridLayer.getBodyDataLayer();
    this.selectionLayer = gridLayer.getBodyLayer().getSelectionLayer();
    this.selectionLayer.setSelectionModel(new RowSelectionModel<RowDataFixture>(this.selectionLayer, this.bodyDataProvider, new IRowIdAccessor<RowDataFixture>() {

        @Override
        public Serializable getRowId(RowDataFixture rowObject) {
            return rowObject.getSecurity_id();
        }
    }));
    this.listener = new LayerListenerFixture();
    // we register the listener to the SelectionLayer because for some cases
    // like clearing a collection, the selection change is not propagated
    // the layer stack upwards as it gets stopped on layer conversion
    this.selectionLayer.addLayerListener(this.listener);
}
Also used : IRowIdAccessor(org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor) NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) Before(org.junit.Before)

Example 7 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture 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 8 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture in project nebula.widgets.nattable by eclipse.

the class ColumnSearchStrategyTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new GridLayerFixture();
    this.layer = this.gridLayer.getBodyLayer().getSelectionLayer();
    this.configRegistry = new ConfigRegistry();
    this.configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter());
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) DefaultDisplayConverter(org.eclipse.nebula.widgets.nattable.data.convert.DefaultDisplayConverter) Before(org.junit.Before)

Example 9 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture in project nebula.widgets.nattable by eclipse.

the class RowSearchStrategyTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new GridLayerFixture();
    this.layer = this.gridLayer.getBodyLayer().getSelectionLayer();
    this.configRegistry = new ConfigRegistry();
    new DefaultNatTableStyleConfiguration().configureRegistry(this.configRegistry);
}
Also used : ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) DefaultNatTableStyleConfiguration(org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Before(org.junit.Before)

Example 10 with GridLayerFixture

use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture in project nebula.widgets.nattable by eclipse.

the class CellSelectionTest method setUp.

@Before
public void setUp() {
    this.gridLayer = new GridLayerFixture();
    this.gridLayer.doCommand(new InitializeClientAreaCommandFixture());
}
Also used : InitializeClientAreaCommandFixture(org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Before(org.junit.Before)

Aggregations

GridLayerFixture (org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture)18 Before (org.junit.Before)12 RowDataFixture (org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture)6 NatTableFixture (org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture)6 Test (org.junit.Test)6 InitializeClientAreaCommandFixture (org.eclipse.nebula.widgets.nattable.test.fixture.InitializeClientAreaCommandFixture)5 IClientAreaProvider (org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider)5 Rectangle (org.eclipse.swt.graphics.Rectangle)5 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)4 ClientAreaResizeCommand (org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand)4 Shell (org.eclipse.swt.widgets.Shell)4 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)3 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)3 Range (org.eclipse.nebula.widgets.nattable.coordinate.Range)3 IRowIdAccessor (org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor)3 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)3 DefaultGridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)3 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)3 RowStructuralRefreshEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent)3 SelectRowsCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand)3