use of org.eclipse.nebula.widgets.nattable.style.StyleProxy in project nebula.widgets.nattable by eclipse.
the class CellStyleProxyTest method proxyShouldRetreiveConfigAttributeUsingTheDisplayModeOrdering.
@Test
public void proxyShouldRetreiveConfigAttributeUsingTheDisplayModeOrdering() throws Exception {
ConfigRegistry configRegistry = new ConfigRegistry();
Style testCellStyle1 = new Style();
testCellStyle1.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.RIGHT);
Style testCellStyle2 = new Style();
testCellStyle2.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER);
testCellStyle2.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, VerticalAlignmentEnum.MIDDLE);
// NORMAL mode has an horizontal align attribute registered
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, testCellStyle1, DisplayMode.NORMAL, TEST_CONFIG_LABEL1);
// SELECT mode has a 'default' horizontal align attribute registered
configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, testCellStyle2, DisplayMode.SELECT);
// The 'default' from SELECT gets picked up
StyleProxy cellStyleProxy = new CellStyleProxy(configRegistry, DisplayMode.SELECT, Arrays.asList(TEST_CONFIG_LABEL1));
HorizontalAlignmentEnum alignmentFromProxy = cellStyleProxy.getAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT);
Assert.assertEquals(HorizontalAlignmentEnum.CENTER, alignmentFromProxy);
}
Aggregations