Search in sources :

Example 41 with ListDataProvider

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

the class DataChangeLayerTempStorageTest method setup.

@Before
public void setup() {
    this.dataModel = PersonService.getFixedPersons();
    this.dataLayer = new DataLayer(new ListDataProvider<>(this.dataModel, new ReflectiveColumnPropertyAccessor<>(new String[] { "firstName", "lastName", "gender", "married", "birthday" })));
    this.dataChangeLayer = new DataChangeLayer(this.dataLayer, new PointKeyHandler(), true);
    this.listener = new LayerListenerFixture();
    this.dataLayer.addLayerListener(this.listener);
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) LayerListenerFixture(org.eclipse.nebula.widgets.nattable.test.fixture.layer.LayerListenerFixture) Before(org.junit.Before)

Example 42 with ListDataProvider

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

the class ColumnHideShowLayerStructuralChangeEventTest method setUp.

@Before
public void setUp() {
    this.contents = new ArrayList<List<String>>();
    this.contents.add(new ArrayList<String>(Arrays.asList("one", "two", "three", "four", "five")));
    this.underlyingLayer = new DataLayer(new ListDataProvider<List<String>>(this.contents, new IColumnAccessor<List<String>>() {

        @Override
        public Object getDataValue(List<String> rowObject, int columnIndex) {
            return rowObject.get(columnIndex);
        }

        @Override
        public void setDataValue(List<String> rowObject, int columnIndex, Object newValue) {
        // ignore
        }

        @Override
        public int getColumnCount() {
            return ColumnHideShowLayerStructuralChangeEventTest.this.contents.get(0).size();
        }
    }));
    this.columnHideShowLayer = new ColumnHideShowLayer(this.underlyingLayer);
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ArrayList(java.util.ArrayList) List(java.util.List) Before(org.junit.Before)

Example 43 with ListDataProvider

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

the class RowReorderLayerStructuralChangeEventTest method setUp.

@Before
public void setUp() {
    this.contents = new ArrayList<String>(Arrays.asList("one", "two", "three", "four"));
    this.underlyingLayer = new DataLayer(new ListDataProvider<String>(this.contents, new IColumnAccessor<String>() {

        @Override
        public Object getDataValue(String rowObject, int columnIndex) {
            return rowObject;
        }

        @Override
        public void setDataValue(String rowObject, int columnIndex, Object newValue) {
        // ignore
        }

        @Override
        public int getColumnCount() {
            return 1;
        }
    }));
    this.rowReorderLayer = new RowReorderLayer(this.underlyingLayer);
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) Before(org.junit.Before)

Example 44 with ListDataProvider

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

the class ColumnReorderLayerStructuralChangeEventTest method setUp.

@Before
public void setUp() {
    this.contents = new ArrayList<List<String>>();
    this.contents.add(new ArrayList<String>(Arrays.asList("one", "two", "three", "four")));
    this.underlyingLayer = new DataLayer(new ListDataProvider<List<String>>(this.contents, new IColumnAccessor<List<String>>() {

        @Override
        public Object getDataValue(List<String> rowObject, int columnIndex) {
            return rowObject.get(columnIndex);
        }

        @Override
        public void setDataValue(List<String> rowObject, int columnIndex, Object newValue) {
        // ignore
        }

        @Override
        public int getColumnCount() {
            return ColumnReorderLayerStructuralChangeEventTest.this.contents.get(0).size();
        }
    }));
    this.columnReorderLayer = new ColumnReorderLayer(this.underlyingLayer);
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) ArrayList(java.util.ArrayList) List(java.util.List) Before(org.junit.Before)

Example 45 with ListDataProvider

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

the class RowHideShowLayerStructuralChangeEventTest method setUp.

@Before
public void setUp() {
    this.contents = new ArrayList<String>(Arrays.asList("one", "two", "three", "four", "five"));
    this.underlyingLayer = new DataLayer(new ListDataProvider<String>(this.contents, new IColumnAccessor<String>() {

        @Override
        public Object getDataValue(String rowObject, int columnIndex) {
            return rowObject;
        }

        @Override
        public void setDataValue(String rowObject, int columnIndex, Object newValue) {
        // ignore
        }

        @Override
        public int getColumnCount() {
            return 1;
        }
    }));
    this.rowHideShowLayer = new RowHideShowLayer(this.underlyingLayer);
}
Also used : ListDataProvider(org.eclipse.nebula.widgets.nattable.data.ListDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) Before(org.junit.Before)

Aggregations

ListDataProvider (org.eclipse.nebula.widgets.nattable.data.ListDataProvider)73 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)64 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)57 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)46 ViewportLayer (org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer)34 HashMap (java.util.HashMap)31 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)31 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)31 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)30 ReflectiveColumnPropertyAccessor (org.eclipse.nebula.widgets.nattable.data.ReflectiveColumnPropertyAccessor)30 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)29 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)27 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)25 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)25 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)24 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)24 DefaultRowHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider)23 Person (org.eclipse.nebula.widgets.nattable.dataset.person.Person)21 DefaultRowHeaderDataLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer)21 GridLayout (org.eclipse.swt.layout.GridLayout)19