Search in sources :

Example 1 with BaseGridCell

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell in project kie-wb-common by kiegroup.

the class ExpressionContainerGridTest method testGetBaseExpressionGrid.

@Test
public void testGetBaseExpressionGrid() {
    final Optional<BaseExpressionGrid<? extends Expression, ? extends GridData, ? extends BaseUIModelMapper>> expectedBaseExpressionGrid = Optional.of(mock(LiteralExpressionGrid.class));
    final ExpressionCellValue value = mock(ExpressionCellValue.class);
    final GridCell<?> cell = new BaseGridCell<>(value);
    final Supplier<GridCell<?>> cellSupplier = () -> cell;
    when(value.getValue()).thenReturn(expectedBaseExpressionGrid);
    grid.getModel().setCell(0, 0, cellSupplier);
    assertEquals(expectedBaseExpressionGrid, grid.getBaseExpressionGrid());
}
Also used : BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) BaseExpressionGrid(org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) Expression(org.kie.workbench.common.dmn.api.definition.model.Expression) BaseUIModelMapper(org.kie.workbench.common.dmn.client.widgets.grid.model.BaseUIModelMapper) DMNGridData(org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData) GridData(org.uberfire.ext.wires.core.grids.client.model.GridData) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) LiteralExpressionGrid(org.kie.workbench.common.dmn.client.editors.expressions.types.literal.LiteralExpressionGrid) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) Test(org.junit.Test)

Example 2 with BaseGridCell

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell 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);
}
Also used : Maps(org.kie.soup.commons.util.Maps) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) Test(org.junit.Test)

Example 3 with BaseGridCell

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell 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);
}
Also used : BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) Maps(org.kie.soup.commons.util.Maps) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) Test(org.junit.Test)

Example 4 with BaseGridCell

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell in project kie-wb-common by kiegroup.

the class NameColumnTest method checkEditLastRow.

@Test
@SuppressWarnings("unchecked")
public void checkEditLastRow() {
    doReturn(0).when(context).getRowIndex();
    model.appendRow(new BaseGridRow());
    final GridCell<String> cell = new BaseGridCell<>(new BaseGridCellValue<>("value"));
    column.edit(cell, context, result -> {
    /*Nothing*/
    });
    verify(factory, never()).attachDomElement(any(GridBodyCellRenderContext.class), any(Callback.class), any(Callback.class));
}
Also used : BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) Callback(org.uberfire.client.callbacks.Callback) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) GridBodyCellRenderContext(org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext) Test(org.junit.Test) BaseDOMElementSingletonColumnTest(org.kie.workbench.common.dmn.client.widgets.grid.columns.BaseDOMElementSingletonColumnTest)

Example 5 with BaseGridCell

use of org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell in project kie-wb-common by kiegroup.

the class ExpressionEditorGridRowTest method testRowHigherThanDefault.

@Test
@SuppressWarnings("unchecked")
public void testRowHigherThanDefault() {
    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)))).build();
    when(row.getCells()).thenReturn(cells);
    assertThat(row.getHeight()).isGreaterThan(DEFAULT_HEIGHT);
}
Also used : BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) GridRow(org.uberfire.ext.wires.core.grids.client.model.GridRow) GridCell(org.uberfire.ext.wires.core.grids.client.model.GridCell) BaseGridCell(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)8 BaseGridCell (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell)8 GridCell (org.uberfire.ext.wires.core.grids.client.model.GridCell)7 GridRow (org.uberfire.ext.wires.core.grids.client.model.GridRow)6 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)5 HashMap (java.util.HashMap)2 Maps (org.kie.soup.commons.util.Maps)2 BaseGridCellValue (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue)2 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)1 Expression (org.kie.workbench.common.dmn.api.definition.model.Expression)1 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)1 LiteralExpressionGrid (org.kie.workbench.common.dmn.client.editors.expressions.types.literal.LiteralExpressionGrid)1 BaseExpressionGrid (org.kie.workbench.common.dmn.client.widgets.grid.BaseExpressionGrid)1 BaseDOMElementSingletonColumnTest (org.kie.workbench.common.dmn.client.widgets.grid.columns.BaseDOMElementSingletonColumnTest)1 BaseUIModelMapper (org.kie.workbench.common.dmn.client.widgets.grid.model.BaseUIModelMapper)1 DMNGridData (org.kie.workbench.common.dmn.client.widgets.grid.model.DMNGridData)1 Callback (org.uberfire.client.callbacks.Callback)1 GridData (org.uberfire.ext.wires.core.grids.client.model.GridData)1 BaseGridData (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData)1 BaseGridRow (org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow)1