Search in sources :

Example 1 with ListUIModelMapper

use of org.kie.workbench.common.dmn.client.editors.expressions.types.list.ListUIModelMapper in project kie-wb-common by kiegroup.

the class AddListRowCommandTest method setup.

@Before
@SuppressWarnings("unchecked")
public void setup() {
    this.list = new List();
    this.hasExpression = HasExpression.wrap(list, new LiteralExpression());
    this.uiModel = new BaseGridData();
    this.uiModelRow = new BaseGridRow();
    this.uiModel.appendColumn(uiRowNumberColumn);
    this.uiModel.appendColumn(uiExpressionEditorColumn);
    when(gridWidget.getModel()).thenReturn(uiModel);
    when(handler.getRuleManager()).thenReturn(ruleManager);
    when(uiRowNumberColumn.getIndex()).thenReturn(0);
    when(uiExpressionEditorColumn.getIndex()).thenReturn(1);
    this.uiModel.setCellValue(0, EXPRESSION_COLUMN_INDEX, new ExpressionCellValue(Optional.of(literalExpressionEditor)));
    final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
    expressionEditorDefinitions.add(literalExpressionEditorDefinition);
    when(literalExpressionEditor.getParentInformation()).thenReturn(parent);
    when(literalExpressionEditorDefinition.getModelClass()).thenReturn(Optional.of(new LiteralExpression()));
    when(literalExpressionEditorDefinition.getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), anyBoolean(), anyInt())).thenReturn(Optional.of(literalExpressionEditor));
    this.uiModelMapper = spy(new ListUIModelMapper(gridWidget, () -> uiModel, () -> Optional.of(list), () -> false, () -> expressionEditorDefinitions, listSelector, 0));
}
Also used : ExpressionEditorDefinitions(org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions) HasExpression(org.kie.workbench.common.dmn.api.definition.HasExpression) GridCellTuple(org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple) BaseGridRow(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow) Optional(java.util.Optional) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) ListUIModelMapper(org.kie.workbench.common.dmn.client.editors.expressions.types.list.ListUIModelMapper) List(org.kie.workbench.common.dmn.api.definition.model.List) ExpressionCellValue(org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue) BaseGridData(org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData) Before(org.junit.Before)

Aggregations

Optional (java.util.Optional)1 Before (org.junit.Before)1 HasExpression (org.kie.workbench.common.dmn.api.definition.HasExpression)1 List (org.kie.workbench.common.dmn.api.definition.model.List)1 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)1 ExpressionEditorDefinitions (org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions)1 ExpressionCellValue (org.kie.workbench.common.dmn.client.editors.expressions.types.context.ExpressionCellValue)1 ListUIModelMapper (org.kie.workbench.common.dmn.client.editors.expressions.types.list.ListUIModelMapper)1 GridCellTuple (org.kie.workbench.common.dmn.client.widgets.grid.model.GridCellTuple)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