use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class TextAnnotationTextPropertyProviderImplTest method checkSupportsTextAnnotationElements.
@Test
@SuppressWarnings("unchecked")
public void checkSupportsTextAnnotationElements() {
assertTrue(provider.supports(element));
final Element other = mock(Element.class);
final Definition otherContent = mock(Definition.class);
final InputData otherDefinition = mock(InputData.class);
when(other.getContent()).thenReturn(otherContent);
when(otherContent.getDefinition()).thenReturn(otherDefinition);
assertFalse(provider.supports(other));
}
use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class ContextGridTest 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 ContextEditorDefinition(gridPanel, gridLayer, definitionUtils, sessionManager, sessionCommandManager, canvasCommandFactory, cellEditorControls, listSelector, translationService, expressionEditorDefinitionsSupplier);
expression = definition.getModelClass();
final ExpressionEditorDefinitions expressionEditorDefinitions = new ExpressionEditorDefinitions();
expressionEditorDefinitions.add((ExpressionEditorDefinition) definition);
expressionEditorDefinitions.add(literalExpressionEditorDefinition);
expressionEditorDefinitions.add(undefinedExpressionEditorDefinition);
doReturn(expressionEditorDefinitions).when(expressionEditorDefinitionsSupplier).get();
doReturn(parent).when(literalExpressionEditor).getParentInformation();
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();
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.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class AssignmentsEditorWidget method getProcessVariables.
protected String getProcessVariables() {
Diagram diagram = canvasSessionManager.getCurrentSession().getCanvasHandler().getDiagram();
Iterator<Element> it = diagram.getGraph().nodes().iterator();
while (it.hasNext()) {
Element element = it.next();
if (element.getContent() instanceof View) {
Object oDefinition = ((View) element.getContent()).getDefinition();
if (oDefinition instanceof BPMNDiagramImpl) {
BPMNDiagramImpl bpmnDiagram = (BPMNDiagramImpl) oDefinition;
ProcessVariables variables = bpmnDiagram.getProcessData().getProcessVariables();
if (variables != null) {
return variables.getValue();
}
break;
}
}
}
return null;
}
use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class AbstractProcessFilteredNodeProviderBaseTest method testGetSelectorDataWithNoValues.
@Test
public void testGetSelectorDataWithNoValues() {
@SuppressWarnings("unchecked") Iterable<Element> nodes = mock(Iterable.class);
when(graph.nodes()).thenReturn(nodes);
when(nodes.spliterator()).thenReturn(Spliterators.emptySpliterator());
SelectorData selectorData = provider.getSelectorData(renderingContext);
Map values = selectorData.getValues();
assertTrue(values.isEmpty());
}
use of org.kie.workbench.common.stunner.core.graph.Element in project kie-wb-common by kiegroup.
the class DefaultRouteFormProviderTest method testGetSelectorDataWithValues.
@Test
public void testGetSelectorDataWithValues() {
List<Element> nodes = mockModes();
when(graph.nodes()).thenReturn(nodes);
// add the desired edges to the selected node.
when(selectedNode.getOutEdges()).thenReturn(outEdges);
SelectorData selectorData = provider.getSelectorData(renderingContext);
Map values = selectorData.getValues();
verifyValues(values);
}
Aggregations