use of org.eclipse.nebula.widgets.nattable.layer.DataLayer 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.layer.DataLayer 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.layer.DataLayer in project nebula.widgets.nattable by eclipse.
the class ColumnChooserUtilsTest method getVisibleColumnEntries.
@Test
public void getVisibleColumnEntries() throws Exception {
DefaultGridLayer gridLayer = new DefaultGridLayer(RowDataListFixture.getList(), RowDataListFixture.getPropertyNames(), RowDataListFixture.getPropertyToLabelMap());
ColumnHideShowLayer columnHideShowLayer = gridLayer.getBodyLayer().getColumnHideShowLayer();
ColumnHeaderLayer columnHeaderLayer = gridLayer.getColumnHeaderLayer();
DataLayer columnHeaderDataLayer = (DataLayer) gridLayer.getColumnHeaderDataLayer();
List<ColumnEntry> visibleEntries = ColumnChooserUtils.getVisibleColumnsEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer);
// All columns shown
assertEquals(RowDataListFixture.getPropertyNames().length, visibleEntries.size());
// Hide a few columns
gridLayer.getBodyLayer().getColumnHideShowLayer().hideColumnPositions(Arrays.asList(1, 2, 3));
visibleEntries = ColumnChooserUtils.getVisibleColumnsEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer);
assertEquals(RowDataListFixture.getPropertyNames().length - 3, visibleEntries.size());
// Check the hidden entries
List<ColumnEntry> hiddenEntries = ColumnChooserUtils.getHiddenColumnEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer);
assertEquals(3, hiddenEntries.size());
}
use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method setup.
@Before
public void setup() {
this.dataLayer = new DataLayer(this.testDataProvider);
this.reorderLayer = new ColumnReorderLayer(this.dataLayer);
this.rowHideShowLayer = new RowHideShowLayer(this.reorderLayer);
this.columnHideShowLayer = new ColumnHideShowLayer(this.rowHideShowLayer);
this.selectionLayer = new SelectionLayer(this.columnHideShowLayer);
this.viewportLayer = new ViewportLayer(this.selectionLayer);
this.freezeLayer = new FreezeLayer(this.selectionLayer);
this.compositeFreezeLayer = new CompositeFreezeLayer(this.freezeLayer, this.viewportLayer, this.selectionLayer);
this.compositeFreezeLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 600, 150);
}
});
}
use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.
the class FreezeHandlerTest method setUp.
@Before
public void setUp() {
final DataLayer bodyDataLayer = new DataLayer(new DummyBodyDataProvider(10, 10));
final DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(bodyDataLayer);
this.selectionLayer = bodyLayer.getSelectionLayer();
this.freezeLayer = new FreezeLayer(this.selectionLayer);
this.compositeFreezeLayer = new CompositeFreezeLayer(this.freezeLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer());
this.viewportLayer = bodyLayer.getViewportLayer();
this.commandHandler = new FreezeCommandHandler(this.freezeLayer, this.viewportLayer, this.selectionLayer);
this.compositeFreezeLayer.registerCommandHandler(this.commandHandler);
this.compositeFreezeLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 600, 400);
}
});
// Shoot this command so that the viewport can be initialized
this.compositeFreezeLayer.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.H_SCROLL | SWT.V_SCROLL)));
}
Aggregations