use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class GridCellTuple method getRequiredParentColumnWidth.
private double getRequiredParentColumnWidth(final double proposedWidth, final Function<BaseExpressionGrid, Double> requiredWidthSupplier) {
double width = proposedWidth;
final GridData uiModel = gridWidget.getModel();
for (GridRow row : uiModel.getRows()) {
final GridCell<?> cell = row.getCells().get(columnIndex);
if (cell != null) {
final GridCellValue<?> value = cell.getValue();
if (value instanceof ExpressionCellValue) {
final ExpressionCellValue ecv = (ExpressionCellValue) value;
final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> editor = ecv.getValue();
if (editor.isPresent()) {
final BaseExpressionGrid beg = editor.get();
width = Math.max(width, requiredWidthSupplier.apply(beg));
}
}
}
}
return width;
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class DMNGridHelperTest method testHighlightHelper.
@Test
public void testHighlightHelper() {
final int row = 1;
final int column = 1;
final GridColumn<?> headerColumn = mock(GridColumn.class);
final GridColumn<?> currentColumn = mock(GridColumn.class);
final GridRow headerRow = mock(GridRow.class);
final GridRow currentRow = mock(GridRow.class);
final double headerColumnWidth = 2d;
final double currentColumnWidth = 4d;
final double headerRowWidth = 8d;
final double currentRowWidth = 16d;
doReturn(highlightHelper).when(helper).highlightHelper(gridWidget1);
when(gridWidget1.getModel()).thenReturn(model);
when(model.getColumns()).thenReturn(asList(headerColumn, currentColumn));
when(model.getRows()).thenReturn(asList(headerRow, currentRow));
when(headerColumn.getWidth()).thenReturn(headerColumnWidth);
when(currentColumn.getWidth()).thenReturn(currentColumnWidth);
when(headerRow.getHeight()).thenReturn(headerRowWidth);
when(currentRow.getHeight()).thenReturn(currentRowWidth);
when(highlightHelper.withPaddingX(headerColumnWidth + currentColumnWidth)).thenReturn(highlightHelper);
when(highlightHelper.withPaddingY(headerRowWidth + currentRowWidth)).thenReturn(highlightHelper);
when(highlightHelper.withPinnedGrid()).thenReturn(highlightHelper);
helper.highlightCell(row, column, gridWidget1);
verify(highlightHelper).highlight(row, column);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testRowHigherThanDefaultWithNullCell.
@Test
@SuppressWarnings("unchecked")
public void testRowHigherThanDefaultWithNullCell() {
when(view.getHeight()).thenReturn(DEFAULT_HEIGHT + 1);
final GridRow row = spy(ExpressionEditorGridRow.class);
final Map<Integer, GridCell<?>> cells = new Maps.Builder<Integer, GridCell<?>>().put(0, new BaseGridCell<>(new ExpressionCellValue(Optional.of(view)))).put(1, null).build();
when(row.getCells()).thenReturn(cells);
assertThat(row.getHeight()).isGreaterThan(DEFAULT_HEIGHT);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testEmptyRow.
@Test
public void testEmptyRow() {
final GridRow row = new ExpressionEditorGridRow();
assertThat(row.getHeight()).isEqualTo(DEFAULT_HEIGHT);
}
use of org.uberfire.ext.wires.core.grids.client.model.GridRow in project kie-wb-common by kiegroup.
the class ExpressionEditorGridRowTest method testRowHigherThanDefaultWithNullCellValue.
@Test
@SuppressWarnings("unchecked")
public void testRowHigherThanDefaultWithNullCellValue() {
when(view.getHeight()).thenReturn(DEFAULT_HEIGHT + 1);
final GridRow row = spy(ExpressionEditorGridRow.class);
final Map<Integer, GridCell<?>> cells = new Maps.Builder<Integer, GridCell<?>>().put(0, new BaseGridCell<>(new ExpressionCellValue(Optional.of(view)))).put(1, new BaseGridCell<>(null)).build();
when(row.getCells()).thenReturn(cells);
assertThat(row.getHeight()).isGreaterThan(DEFAULT_HEIGHT);
}
Aggregations