use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class CaseManagementCanvasHandlerTest method makeNode.
@SuppressWarnings("unchecked")
private Node<View<BPMNViewDefinition>, Edge> makeNode(final String uuid, final AbstractElementShape shape) {
final Node<View<BPMNViewDefinition>, Edge> node = new NodeImpl<>(uuid);
node.setContent(new ViewImpl(shape.getShapeDefinition(), new BoundsImpl(new BoundImpl(0.0, 0.0), new BoundImpl(10.0, 20.0))));
when(canvas.getShape(eq(uuid))).thenReturn(shape);
when(clientDefinitionManager.adapters()).thenReturn(adapterManager);
when(adapterManager.forDefinition()).thenReturn(definitionAdapter);
when(adapterManager.forProperty()).thenReturn(propertyAdapter);
when(definitionAdapter.getMetaProperty(eq(PropertyMetaTypes.NAME), anyObject())).thenReturn(PropertyMetaTypes.NAME);
when(propertyAdapter.getValue(eq(PropertyMetaTypes.NAME))).thenReturn("name");
return node;
}
use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class NodeFactoryImpl method build.
@Override
@SuppressWarnings("unchecked")
public Node<Definition<Object>, Edge> build(final String uuid, final Object definition) {
final NodeImpl node = new NodeImpl<>(uuid);
final Bounds bounds = definitionUtils.buildBounds(definition, 0d, 0d);
View<Object> content = new ViewImpl<>(definition, bounds);
node.setContent(content);
addLabels(node.getLabels(), definition);
return node;
}
use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForDecisionType.
@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForDecisionType() {
final Node<View<Decision>, Edge> decisionNode = new NodeImpl<>("decisionNode1");
final Decision decision = new Decision();
final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
final View<Decision> nodeContent = new ViewImpl<>(decision, bounds);
decisionNode.setContent(nodeContent);
final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, decisionNode);
assertTrue(_toolbox.isPresent());
Toolbox<?> toolbox = _toolbox.get();
assertTrue(toolbox instanceof ActionsToolbox);
final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
assertEquals("decisionNode1", actionsToolbox.getElementUUID());
assertEquals(2, actionsToolbox.size());
final Iterator<ToolboxAction> actionsIt = actionsToolbox.iterator();
assertEquals(deleteNodeAction, actionsIt.next());
assertEquals(editDecisionToolboxAction, actionsIt.next());
assertFalse(actionsIt.hasNext());
verify(view, times(1)).init(eq(actionsToolbox));
verify(view, times(2)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
use of org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl in project kie-wb-common by kiegroup.
the class DMNEditDecisionToolboxActionTest method setup.
@Before
public void setup() throws Exception {
decisionNode = new NodeImpl<>(E_UUID);
decision = new Decision();
final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
final View<Decision> nodeContent = new ViewImpl<>(decision, bounds);
decisionNode.setContent(nodeContent);
when(canvasHandler.getGraphIndex()).thenReturn(graphIndex);
when(graphIndex.get(eq(E_UUID))).thenReturn(decisionNode);
when(sessionManager.getCurrentSession()).thenReturn(session);
this.tested = new DMNEditDecisionToolboxAction(sessionManager, translationService, editExpressionEvent);
}
Aggregations