use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class InvocationEditorDefinitionTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.definition = new InvocationEditorDefinition(gridPanel, gridLayer, definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, cellEditorControls, listSelector, translationService, expressionEditorDefinitionsSupplier);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add((ExpressionEditorDefinition) definition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).format(anyString());
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class InvocationGridTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
tupleWithoutValue = new GridCellTuple(0, 1, gridWidget);
tupleWithValue = new GridCellValueTuple<>(0, 1, gridWidget, new BaseGridCellValue<>("value"));
definition = new InvocationEditorDefinition(gridPanel, gridLayer, definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, cellEditorControls, listSelector, translationService, expressionEditorDefinitionsSupplier);
expression = definition.getModelClass();
expression.ifPresent(invocation -> ((LiteralExpression) invocation.getExpression()).setText("invocation-expression"));
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add((ExpressionEditorDefinition) definition);
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
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(parent).when(undefinedExpressionEditor).getParentInformation();
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());
doReturn(session).when(sessionManager).getCurrentSession();
doReturn(canvasHandler).when(session).getCanvasHandler();
doReturn(graphContext).when(canvasHandler).getGraphExecutionContext();
final Decision decision = new Decision();
decision.setName(new Name("name"));
hasName = Optional.of(decision);
when(gridWidget.getModel()).thenReturn(new BaseGridData(false));
when(canvasHandler.getGraphIndex()).thenReturn(index);
when(index.get(anyString())).thenReturn(element);
when(element.getContent()).thenReturn(mock(Definition.class));
when(definitionUtils.getNameIdentifier(any())).thenReturn("name");
when(canvasCommandFactory.updatePropertyValue(any(Element.class), anyString(), any())).thenReturn(mock(UpdateElementPropertyCommand.class));
doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).format(anyString());
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class ExpressionContainerGridTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.grid = new ExpressionContainerGrid(gridPanel, gridLayer, cellEditorControls, translationService, listSelector, sessionManager, sessionCommandManager, expressionEditorDefinitionsSupplier, onHasNameChanged);
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doReturn(parent).when(literalExpressionEditor).getParentInformation();
doReturn(new BaseGridData()).when(literalExpressionEditor).getModel();
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(parent).when(undefinedExpressionEditor).getParentInformation();
doReturn(new BaseGridData()).when(undefinedExpressionEditor).getModel();
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());
doReturn(session).when(sessionManager).getCurrentSession();
doReturn(canvasHandler).when(session).getCanvasHandler();
doReturn(graphExecutionContext).when(canvasHandler).getGraphExecutionContext();
doReturn(mock(Bounds.class)).when(gridLayer).getVisibleBounds();
doAnswer((i) -> i.getArguments()[0].toString()).when(translationService).format(anyString());
}
use of org.kie.workbench.common.dmn.client.editors.expressions.types.ExpressionEditorDefinitions in project kie-wb-common by kiegroup.
the class ExpressionEditorViewImplTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
doReturn(viewport).when(gridPanel).getViewport();
doReturn(viewportMediators).when(viewport).getMediators();
doReturn(gridPanelElement).when(gridPanel).getElement();
doReturn(Optional.of(editor)).when(editorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
doReturn(new BaseGridData()).when(editor).getModel();
this.view = spy(new ExpressionEditorViewImpl(returnToDRG, gridPanel, gridLayer, mousePanMediator, cellEditorControls, translationService, listSelector, sessionManager, sessionCommandManager, expressionEditorDefinitionsSupplier));
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doReturn(Optional.empty()).when(undefinedExpressionEditorDefinition).getModelClass();
doReturn(new BaseGridData()).when(undefinedExpressionEditor).getModel();
doReturn(Optional.of(undefinedExpressionEditor)).when(undefinedExpressionEditorDefinition).getEditor(any(GridCellTuple.class), any(Optional.class), any(HasExpression.class), any(Optional.class), any(Optional.class), anyInt());
doAnswer((i) -> i.getArguments()[1]).when(translationService).format(anyString(), anyObject());
}
Aggregations