Search in sources :

Example 1 with ReflectiveColumnPropertyAccessor

use of org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor in project nebula.widgets.nattable by eclipse.

the class BlinkLayerTest method setUp.

@Before
public void setUp() {
    this.display = Display.getDefault();
    this.dataList = new LinkedList<BlinkingRowDataFixture>();
    IColumnPropertyAccessor<BlinkingRowDataFixture> columnPropertyAccessor = new ReflectiveColumnPropertyAccessor<BlinkingRowDataFixture>(RowDataListFixture.getPropertyNames());
    this.listDataProvider = new ListDataProvider<BlinkingRowDataFixture>(this.dataList, columnPropertyAccessor);
    this.propertyChangeListener = getPropertyChangeListener();
    this.dataLayer = new DataLayer(this.listDataProvider);
    this.layerUnderTest = new BlinkLayer<BlinkingRowDataFixture>(this.dataLayer, this.listDataProvider, new IRowIdAccessor<BlinkingRowDataFixture>() {

        @Override
        public Serializable getRowId(BlinkingRowDataFixture rowObject) {
            return rowObject.getSecurity_id();
        }
    }, columnPropertyAccessor, this.configRegistry);
    this.layerUnderTest.blinkingEnabled = true;
    registerBlinkConfigTypes();
    load10Rows();
}
Also used : BlinkingRowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.BlinkingRowDataFixture) IRowIdAccessor(org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) Before(org.junit.Before)

Example 2 with ReflectiveColumnPropertyAccessor

use of org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor in project nebula.widgets.nattable by eclipse.

the class DataChangeLayerIdIndexTest method setup.

@Before
public void setup() {
    this.dataModel = PersonService.getFixedPersons();
    this.dataProvider = new ListDataProvider<>(this.dataModel, new ReflectiveColumnPropertyAccessor<>(new String[] { "firstName", "lastName", "gender", "married", "birthday" }));
    this.dataLayer = new DataLayer(this.dataProvider);
    this.dataChangeLayer = new DataChangeLayer(this.dataLayer, new IdIndexKeyHandler<>(this.dataProvider, new IRowIdAccessor<Person>() {

        @Override
        public Serializable getRowId(Person rowObject) {
            return rowObject.getId();
        }
    }), false);
}
Also used : DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) Serializable(java.io.Serializable) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) Before(org.junit.Before)

Example 3 with ReflectiveColumnPropertyAccessor

use of org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor in project nebula.widgets.nattable by eclipse.

the class ColumnGroupHeaderLayerSelectionTest method setup.

@Before
public void setup() {
    this.dataProvider = new ListDataProvider<>(getNumberValues(), new ReflectiveColumnPropertyAccessor<>("columnOneNumber", "columnTwoNumber", "columnThreeNumber", "columnFourNumber", "columnFiveNumber", "columnSixNumber", "columnSevenNumber", "columnEightNumber", "columnNineNumber", "columnTenNumber"));
    this.gridLayer = new GridLayerFixture(this.dataProvider);
    this.model = new ColumnGroupModel();
    // 10 columns in header
    this.columnGroupLayer = new ColumnGroupHeaderLayer(this.gridLayer.getColumnHeaderLayer(), this.gridLayer.getBodyLayer().getSelectionLayer(), this.model, false);
    this.columnGroupLayer.addConfiguration(new DefaultColumnGroupHeaderLayerConfiguration(this.model, true));
    this.gridLayer.getBodyLayer().getViewportLayer().registerCommandHandler(new ViewportSelectColumnGroupCommandHandler(this.gridLayer.getBodyLayer().getViewportLayer(), this.columnGroupLayer));
    this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_1, 0, 1, 2);
    this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_2, 5, 6);
    this.columnGroupLayer.addColumnsIndexesToGroup(TEST_GROUP_NAME_3, 8, 9);
    this.gridLayer.setClientAreaProvider(new IClientAreaProvider() {

        @Override
        public Rectangle getClientArea() {
            return new Rectangle(0, 0, 1050, 200);
        }
    });
    this.gridLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
    this.layerListener = new LayerListenerFixture();
    this.gridLayer.getBodyLayer().addLayerListener(this.layerListener);
}
Also used : IClientAreaProvider(org.eclipse.nebula.widgets.nattable.util.IClientAreaProvider) ClientAreaResizeCommand(org.eclipse.nebula.widgets.nattable.grid.command.ClientAreaResizeCommand) Rectangle(org.eclipse.swt.graphics.Rectangle) DefaultColumnGroupHeaderLayerConfiguration(org.eclipse.nebula.widgets.nattable.group.config.DefaultColumnGroupHeaderLayerConfiguration) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) Shell(org.eclipse.swt.widgets.Shell) ViewportSelectColumnGroupCommandHandler(org.eclipse.nebula.widgets.nattable.group.command.ViewportSelectColumnGroupCommandHandler) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) GridLayerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.GridLayerFixture) Before(org.junit.Before)

Example 4 with ReflectiveColumnPropertyAccessor

use of org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor 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 5 with ReflectiveColumnPropertyAccessor

use of org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor in project nebula.widgets.nattable by eclipse.

the class SummaryRowIntegrationTest method initLayerStackWithSummaryRow.

@Before
public void initLayerStackWithSummaryRow() {
    this.dataList = RowDataListFixture.getList().subList(0, 4);
    // Rows 0, 1, 2, 3; Summary row would be position 4
    assertEquals(4, this.dataList.size());
    this.dataProvider = new ListDataProvider<RowDataFixture>(this.dataList, new ReflectiveColumnPropertyAccessor<RowDataFixture>(RowDataListFixture.getPropertyNames()));
    IConfigRegistry configRegistry = new ConfigRegistry();
    this.dataLayer = new DataLayer(this.dataProvider);
    this.summaryRowLayer = new SummaryRowLayer(this.dataLayer, configRegistry);
    IUniqueIndexLayer columnReorderLayer = new ColumnReorderLayer(this.summaryRowLayer);
    IUniqueIndexLayer columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer);
    IUniqueIndexLayer selectionLayer = new SelectionLayer(columnHideShowLayer);
    this.layerStackWithSummary = new ViewportLayer(selectionLayer);
    // NatTableFixture initializes the client area
    this.natTable = new NatTableFixture(this.layerStackWithSummary, false);
    this.natTable.setConfigRegistry(configRegistry);
    this.natTable.addConfiguration(new TestSummaryRowConfiguration());
    this.natTable.configure();
}
Also used : NatTableFixture(org.eclipse.nebula.widgets.nattable.test.fixture.NatTableFixture) ColumnReorderLayer(org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer) ColumnHideShowLayer(org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) RowDataFixture(org.eclipse.nebula.widgets.nattable.dataset.fixture.data.RowDataFixture) ReflectiveColumnPropertyAccessor(org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor) ConfigRegistry(org.eclipse.nebula.widgets.nattable.config.ConfigRegistry) IConfigRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) IConfigRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry) IUniqueIndexLayer(org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer) Before(org.junit.Before)

Aggregations

ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)47 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)39 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)36 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)32 ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)30 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)26 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)26 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)25 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)24 HashMap (java.util.HashMap)23 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)23 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)22 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)22 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)22 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)22 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)21 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)21 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)20 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)20 Person (org.eclipse.nebula.widgets.nattable.dataset.person.Person)19