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();
}
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);
}
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);
}
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);
}
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();
}
Aggregations