use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class ExpressionContainerUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
uiModel = new BaseGridData();
uiModel.appendRow(new DMNGridRow());
uiModel.appendColumn(uiExpressionColumn);
doReturn(0).when(uiExpressionColumn).getIndex();
doReturn(MINIMUM_COLUMN_WIDTH).when(uiExpressionColumn).getMinimumWidth();
parent = new GridCellTuple(0, 0, expressionContainerGrid);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression();
doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
doReturn(Optional.empty()).when(undefinedExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(undefinedExpressionEditor)).when(undefinedExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
mapper = new ExpressionContainerUIModelMapper(parent, () -> uiModel, () -> Optional.ofNullable(expression), () -> NODE_UUID, () -> hasExpression, () -> Optional.of(hasName), expressionEditorDefinitionsSupplier, listSelector);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class UndefinedExpressionColumnTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.column = spy(new UndefinedExpressionColumn(headerMetaData, gridWidget, cellEditorControls, expressionEditorDefinitionsSupplier));
doReturn(parent).when(gridWidget).getParentInformation();
doReturn(parentGridWidget).when(parent).getGridWidget();
doReturn(parentGridData).when(parentGridWidget).getModel();
doReturn(Collections.singletonList(parentGridColumn)).when(parentGridData).getColumns();
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
doReturn(ExpressionType.LITERAL_EXPRESSION).when(literalExpressionEditorDefinition).getType();
doReturn(LiteralExpression.class.getSimpleName()).when(literalExpressionEditorDefinition).getName();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
when(context.getRowIndex()).thenReturn(ROW_INDEX);
when(context.getColumnIndex()).thenReturn(COLUMN_INDEX);
when(context.getRelativeLocation()).thenReturn(Optional.of(relativeLocation));
when(context.getAbsoluteCellX()).thenReturn(ABSOLUTE_CELL_X);
when(context.getAbsoluteCellY()).thenReturn(ABSOLUTE_CELL_Y);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class UndefinedExpressionGridTest method testGetItemsEmpty.
@Test
public void testGetItemsEmpty() {
setupGrid(0);
reset(expressionEditorDefinitionsSupplier);
doReturn(new ExpressionEditorDefinitions()).when(expressionEditorDefinitionsSupplier).get();
final List<HasListSelectorControl.ListSelectorItem> items = grid.getItems(0, 0);
assertThat(items.size()).isEqualTo(0);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class UndefinedExpressionGridTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
definition = new UndefinedExpressionEditorDefinition(gridPanel, gridLayer, definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, cellEditorControls, listSelector, translationService, expressionEditorDefinitionsSupplier);
expression = definition.getModelClass();
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(definition);
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doReturn(ExpressionType.LITERAL_EXPRESSION).when(literalExpressionEditorDefinition).getType();
doReturn(LiteralExpression.class.getSimpleName()).when(literalExpressionEditorDefinition).getName();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
doReturn(0).when(parent).getRowIndex();
doReturn(0).when(parent).getColumnIndex();
doReturn(parentGridWidget).when(parent).getGridWidget();
doReturn(mock(GridData.class)).when(parentGridWidget).getModel();
doReturn(session).when(sessionManager).getCurrentSession();
doReturn(handler).when(session).getCanvasHandler();
when(parentGridWidget.getModel()).thenReturn(parentGridUiModel);
when(parent.getGridWidget()).thenReturn(parentGridWidget);
when(parent.getRowIndex()).thenReturn(0);
when(parent.getColumnIndex()).thenReturn(1);
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class BaseContextUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiNameColumn);
this.uiModel.appendColumn(uiExpressionEditorColumn);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiNameColumn).getIndex();
doReturn(2).when(uiExpressionEditorColumn).getIndex();
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(literalExpression)).when(literalExpressionEditor).getExpression();
doReturn(Optional.of(literalExpressionEditor)).when(literalExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
doReturn(Optional.empty()).when(undefinedExpressionEditorDefinition).getModelClass();
doReturn(Optional.of(undefinedExpressionEditor)).when(undefinedExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
this.context = new Context();
this.context.getContextEntry().add(new ContextEntry() {
{
setVariable(new InformationItem() {
{
setName(new Name("ii1"));
}
});
}
});
this.context.getContextEntry().add(new ContextEntry() {
{
setExpression(new LiteralExpression());
}
});
this.mapper = getMapper();
this.cellValueSupplier = Optional::empty;
}
Aggregations