use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext in project kie-wb-common by kiegroup.
the class EditableHeaderUtilitiesTest method testMakeRenderContextNoBlock.
@Test
public void testMakeRenderContextNoBlock() {
final List<GridColumn<?>> allColumns = new ArrayList<>();
final GridColumn<?> uiColumn = mockGridColumn(100.0);
allColumns.add(uiColumn);
doReturn(allColumns).when(ri).getAllColumns();
doReturn(uiColumn).when(ci).getColumn();
doReturn(0.0).when(ci).getOffsetX();
doReturn(0).when(ci).getUiColumnIndex();
final GridBodyCellRenderContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, rp, 0);
assertNotNull(context);
assertEquals(0.0, context.getAbsoluteCellX(), 0.0);
assertEquals(100.0, context.getCellWidth(), 0.0);
}
use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext in project kie-wb-common by kiegroup.
the class EditableHeaderUtilitiesTest method testMakeRenderContextLeadBlockWithExtraLeadNonBlockColumn.
@Test
public void testMakeRenderContextLeadBlockWithExtraLeadNonBlockColumn() {
final List<GridColumn<?>> allColumns = new ArrayList<>();
final GridColumn<?> uiColumn1 = mockGridColumn(25.0);
final GridColumn<?> uiColumn2 = mockGridColumn(50.0);
final GridColumn<?> uiColumn3 = mockGridColumn(75.0, uiColumn2.getHeaderMetaData());
allColumns.add(uiColumn1);
allColumns.add(uiColumn2);
allColumns.add(uiColumn3);
doReturn(allColumns).when(ri).getAllColumns();
doReturn(uiColumn3).when(ci).getColumn();
doReturn(75.0).when(ci).getOffsetX();
doReturn(2).when(ci).getUiColumnIndex();
final GridBodyCellRenderContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, rp, 0);
assertNotNull(context);
assertEquals(25.0, context.getAbsoluteCellX(), 0.0);
assertEquals(125.0, context.getCellWidth(), 0.0);
}
use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext in project kie-wb-common by kiegroup.
the class EditableHeaderUtilitiesTest method testMakeRenderContextNoBlockMultipleColumns.
@Test
public void testMakeRenderContextNoBlockMultipleColumns() {
final List<GridColumn<?>> allColumns = new ArrayList<>();
final GridColumn<?> uiColumn1 = mockGridColumn(25.0);
final GridColumn<?> uiColumn2 = mockGridColumn(50.0);
final GridColumn<?> uiColumn3 = mockGridColumn(100.0);
allColumns.add(uiColumn1);
allColumns.add(uiColumn2);
allColumns.add(uiColumn3);
doReturn(allColumns).when(ri).getAllColumns();
doReturn(uiColumn2).when(ci).getColumn();
doReturn(25.0).when(ci).getOffsetX();
doReturn(1).when(ci).getUiColumnIndex();
final GridBodyCellRenderContext context = EditableHeaderUtilities.makeRenderContext(gridWidget, ri, ci, rp, 0);
assertNotNull(context);
assertEquals(25.0, context.getAbsoluteCellX(), 0.0);
assertEquals(50.0, context.getCellWidth(), 0.0);
}
use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext in project kie-wb-common by kiegroup.
the class BaseNameAndDataTypeColumnRendererTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.renderer = getColumnRenderer();
this.headerContext = new GridHeaderColumnRenderContext(0, Collections.singletonList(uiColumn), Collections.singletonList(uiColumn), 0, uiModel, gridRenderer);
this.bodyContext = new GridBodyCellRenderContext(0, 0, BLOCK_WIDTH, ROW_HEIGHT, 0, 0, 0, 0, false, transform, gridRenderer);
when(gridRenderer.getTheme()).thenReturn(gridRendererTheme);
when(gridRendererTheme.getHeaderText()).thenReturn(text1, text2);
when(gridRendererTheme.getBodyText()).thenReturn(text1);
when(gridRendererTheme.getPlaceholderText()).thenReturn(text1);
when(text1.asNode()).thenReturn(mock(Node.class));
when(text2.asNode()).thenReturn(mock(Node.class));
}
use of org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext in project kie-wb-common by kiegroup.
the class RendererUtilsTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
text = spy(new Text(""));
headerContext = new GridHeaderColumnRenderContext(0, Collections.singletonList(uiColumn), Collections.singletonList(uiColumn), 0, uiModel, gridRenderer);
bodyContext = new GridBodyCellRenderContext(0, 0, BLOCK_WIDTH, ROW_HEIGHT, 0, 0, 0, 0, false, transform, gridRenderer);
when(cellContext.getRenderer()).thenReturn(gridRenderer);
when(gridRenderer.getTheme()).thenReturn(gridTheme);
when(gridTheme.getBodyText()).thenReturn(text);
when(cellContext.getCellWidth()).thenReturn(WIDTH);
when(cellContext.getCellHeight()).thenReturn(HEIGHT);
when(gridTheme.getHeaderText()).thenReturn(headerText1, headerText2);
when(gridTheme.getPlaceholderText()).thenReturn(placeHolderText);
when(headerText1.asNode()).thenReturn(mock(Node.class));
when(headerText2.asNode()).thenReturn(mock(Node.class));
when(placeHolderText.asNode()).thenReturn(mock(Node.class));
}
Aggregations