use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class MultiColumnReorderEventDiffTest method before.
@Before
public void before() {
this.dataLayer = new DataLayerFixture(20, 20, 100, 40);
this.viewportLayer = new ViewportLayer(this.dataLayer);
this.viewportLayer.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 800, 400);
}
});
this.viewportLayer.setOriginX(this.viewportLayer.getStartXOfColumnPosition(2));
this.viewportLayer.setOriginY(this.viewportLayer.getStartYOfRowPosition(2));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class SortStatePersistorTest method setup.
@Before
public void setup() {
this.properties = new Properties();
this.sortModel = new SortModelFixture();
this.sortHeaderLayer = new SortHeaderLayer<RowDataFixture>(new DataLayerFixture(10, 20, 100, 20), this.sortModel);
this.sortStatePersistor = new SortStatePersistor<RowDataFixture>(this.sortModel);
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class SortStatePersistorTest method loadStateFromProperties.
/**
* Save string format: column index : sort direction : sort order |
*/
@Test
public void loadStateFromProperties() throws Exception {
this.properties.put(KEY, "0:DESC:3|3:ASC:2|5:DESC:1|6:ASC:0|");
this.sortModel = SortModelFixture.getEmptyModel();
this.sortHeaderLayer = new SortHeaderLayer<RowDataFixture>(new DataLayerFixture(10, 20, 100, 20), this.sortModel);
this.sortStatePersistor = new SortStatePersistor<RowDataFixture>(this.sortModel);
this.sortStatePersistor.loadState(TEST_PREFIX, this.properties);
ISortModel sortModel = this.sortHeaderLayer.getSortModel();
// Sort direction
assertEquals(SortDirectionEnum.DESC, sortModel.getSortDirection(0));
assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(3));
assertEquals(SortDirectionEnum.DESC, sortModel.getSortDirection(5));
assertEquals(SortDirectionEnum.ASC, sortModel.getSortDirection(6));
// Sort order
assertEquals(3, sortModel.getSortOrder(0));
assertEquals(2, sortModel.getSortOrder(3));
assertEquals(1, sortModel.getSortOrder(5));
assertEquals(0, sortModel.getSortOrder(6));
// No other columns should be flagged as sorted
assertEquals(-1, sortModel.getSortOrder(4));
assertFalse(sortModel.isColumnIndexSorted(4));
assertEquals(SortDirectionEnum.NONE, sortModel.getSortDirection(4));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class TickUpdateCommandHandlerTest method setup.
@Before
public void setup() {
DataLayerFixture bodyDataLayer = new DataLayerFixture();
this.selectionLayer = new SelectionLayer(bodyDataLayer);
this.selectionLayer.setSelectedCell(1, 1);
this.testConfigRegistry = new ConfigRegistry();
this.testConfigRegistry.registerConfigAttribute(TickUpdateConfigAttributes.UPDATE_HANDLER, new TickUpdateHandlerFixture());
this.testConfigRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE);
registerCellStyleAccumulators(bodyDataLayer);
this.commandHandler = new TickUpdateCommandHandler(this.selectionLayer);
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class TickUpdateCommandHandlerTest method registerCellStyleAccumulators.
private void registerCellStyleAccumulators(DataLayer bodyDataLayer) {
AggregateConfigLabelAccumulator aggregrateConfigLabelAccumulator = new AggregateConfigLabelAccumulator();
this.columnLabelAccumulator = new ColumnOverrideLabelAccumulator(new DataLayerFixture());
aggregrateConfigLabelAccumulator.add(this.columnLabelAccumulator, new AlternatingRowConfigLabelAccumulator());
bodyDataLayer.setConfigLabelAccumulator(aggregrateConfigLabelAccumulator);
}
Aggregations