Search in sources :

Example 6 with NodeImpl

use of org.kie.workbench.common.stunner.core.graph.impl.NodeImpl in project kie-wb-common by kiegroup.

the class FormsContainerTest method testRenderExistingNode.

@Test
public void testRenderExistingNode() {
    NodeImpl firstNode = getNode(FIRST_ELEMENT_UID);
    FormDisplayer firstDisplayer = testRender(firstNode, 1, 1);
    NodeImpl secondNode = getNode(SECOND_ELEMENT_UID);
    FormDisplayer secondDisplayer = testRender(secondNode, 2, 1);
    formsContainer.render(GRAPH_UID, firstNode, path, fieldChangeHandler);
    verify(displayersInstance, times(2)).get();
    verify(secondDisplayer, times(2)).hide();
    verify(firstDisplayer, times(2)).show();
    verify(firstDisplayer, times(2)).render(firstNode, path, fieldChangeHandler);
}
Also used : FormDisplayer(org.kie.workbench.common.stunner.forms.client.widgets.container.displayer.FormDisplayer) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Test(org.junit.Test)

Example 7 with NodeImpl

use of org.kie.workbench.common.stunner.core.graph.impl.NodeImpl in project kie-wb-common by kiegroup.

the class ProjectDiagramImplTest method testProjectDiagramEquals.

@Test
public void testProjectDiagramEquals() {
    ProjectDiagramImpl a = new ProjectDiagramImpl("Diagram", new GraphImpl("Graph", new GraphNodeStoreImpl()), new ProjectMetadataImpl());
    ProjectDiagramImpl b = new ProjectDiagramImpl("AnotherDiagram", new GraphImpl("Graph", new GraphNodeStoreImpl()), new ProjectMetadataImpl());
    assertNotEquals(a, b);
    b = new ProjectDiagramImpl("Diagram", new GraphImpl("Graph", new GraphNodeStoreImpl()), new ProjectMetadataImpl());
    assertEquals(a, b);
    a.setGraph(new GraphImpl("Graph", new GraphNodeStoreImpl()));
    b.setGraph(new GraphImpl("Graph", new GraphNodeStoreImpl()));
    assertEquals(a, b);
    a.getGraph().addNode(new NodeImpl("Node1"));
    b.getGraph().addNode(new NodeImpl("Node2"));
    assertNotEquals(a, b);
    b.getGraph().removeNode("Node2");
    b.getGraph().addNode(new NodeImpl("Node1"));
    assertEquals(a, b);
    assertEquals(a, a);
}
Also used : GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) Test(org.junit.Test)

Example 8 with NodeImpl

use of org.kie.workbench.common.stunner.core.graph.impl.NodeImpl in project kie-wb-common by kiegroup.

the class DiagramImplTest method testDiagramEquals.

@Test
public void testDiagramEquals() {
    DiagramImpl a = new DiagramImpl("Diagram", new MetadataImpl());
    DiagramImpl b = new DiagramImpl("AnotherDiagram", new MetadataImpl());
    assertNotEquals(a, b);
    b = new DiagramImpl("Diagram", new MetadataImpl());
    assertEquals(a, b);
    a.setGraph(new GraphImpl("Graph", new GraphNodeStoreImpl()));
    assertNotEquals(a, b);
    b.setGraph(new GraphImpl("Graph", new GraphNodeStoreImpl()));
    assertEquals(a, b);
    a.getGraph().addNode(new NodeImpl("Node1"));
    b.getGraph().addNode(new NodeImpl("Node2"));
    assertNotEquals(a, b);
    b.getGraph().removeNode("Node2");
    b.getGraph().addNode(new NodeImpl("Node1"));
    assertEquals(a, b);
    assertEquals(a, a);
}
Also used : GraphNodeStoreImpl(org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl) NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) GraphImpl(org.kie.workbench.common.stunner.core.graph.impl.GraphImpl) Test(org.junit.Test)

Example 9 with NodeImpl

use of org.kie.workbench.common.stunner.core.graph.impl.NodeImpl in project kie-wb-common by kiegroup.

the class DMNCommonActionsToolboxFactoryTest method testBuildToolboxForBusinessKnowledgeModelType.

@Test
@SuppressWarnings("unchecked")
public void testBuildToolboxForBusinessKnowledgeModelType() {
    final Node<View<BusinessKnowledgeModel>, Edge> bkmNode = new NodeImpl<>("bkmNode1");
    final BusinessKnowledgeModel bkm = new BusinessKnowledgeModel();
    final Bounds bounds = new BoundsImpl(new BoundImpl(0d, 0d), new BoundImpl(100d, 150d));
    final View<BusinessKnowledgeModel> nodeContent = new ViewImpl<>(bkm, bounds);
    bkmNode.setContent(nodeContent);
    final Optional<Toolbox<?>> _toolbox = tested.build(canvasHandler, bkmNode);
    assertTrue(_toolbox.isPresent());
    Toolbox<?> toolbox = _toolbox.get();
    assertTrue(toolbox instanceof ActionsToolbox);
    final ActionsToolbox actionsToolbox = (ActionsToolbox) toolbox;
    assertEquals("bkmNode1", actionsToolbox.getElementUUID());
    assertEquals(2, actionsToolbox.size());
    final Iterator<ToolboxAction> actionsIt = actionsToolbox.iterator();
    assertEquals(deleteNodeAction, actionsIt.next());
    assertEquals(editBusinessKnowledgeModelToolboxAction, actionsIt.next());
    assertFalse(actionsIt.hasNext());
    verify(view, times(1)).init(eq(actionsToolbox));
    verify(view, times(2)).addButton(any(Glyph.class), anyString(), any(Consumer.class));
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) ActionsToolboxView(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolboxView) Consumer(java.util.function.Consumer) ToolboxAction(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ToolboxAction) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.v1_1.BusinessKnowledgeModel) ActionsToolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.actions.ActionsToolbox) Toolbox(org.kie.workbench.common.stunner.core.client.components.toolbox.Toolbox) Glyph(org.kie.workbench.common.stunner.core.definition.shape.Glyph) ViewImpl(org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) Edge(org.kie.workbench.common.stunner.core.graph.Edge) Test(org.junit.Test)

Example 10 with NodeImpl

use of org.kie.workbench.common.stunner.core.graph.impl.NodeImpl in project kie-wb-common by kiegroup.

the class CommandTestUtils method makeNode.

public static Node<View<?>, Edge> makeNode(final String uuid, final String content, final double x, final double y, final double w, final double h) {
    final Bounds bounds = new BoundsImpl(new BoundImpl(x, y), new BoundImpl(x + w, y + h));
    final Node<View<?>, Edge> node = new NodeImpl<>(uuid);
    node.setContent(new ViewImpl<>(content, bounds));
    return node;
}
Also used : NodeImpl(org.kie.workbench.common.stunner.core.graph.impl.NodeImpl) Bounds(org.kie.workbench.common.stunner.core.graph.content.Bounds) BoundImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl) BoundsImpl(org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Edge(org.kie.workbench.common.stunner.core.graph.Edge)

Aggregations

NodeImpl (org.kie.workbench.common.stunner.core.graph.impl.NodeImpl)22 Test (org.junit.Test)18 Edge (org.kie.workbench.common.stunner.core.graph.Edge)9 GraphImpl (org.kie.workbench.common.stunner.core.graph.impl.GraphImpl)7 GraphNodeStoreImpl (org.kie.workbench.common.stunner.core.graph.store.GraphNodeStoreImpl)7 Node (org.kie.workbench.common.stunner.core.graph.Node)6 View (org.kie.workbench.common.stunner.core.graph.content.view.View)6 Bounds (org.kie.workbench.common.stunner.core.graph.content.Bounds)4 BoundImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundImpl)4 BoundsImpl (org.kie.workbench.common.stunner.core.graph.content.view.BoundsImpl)4 ViewImpl (org.kie.workbench.common.stunner.core.graph.content.view.ViewImpl)4 EdgeImpl (org.kie.workbench.common.stunner.core.graph.impl.EdgeImpl)4 Graph (org.kie.workbench.common.stunner.core.graph.Graph)3 RuleViolations (org.kie.workbench.common.stunner.core.rule.RuleViolations)3 Consumer (java.util.function.Consumer)2 FlowElement (org.eclipse.bpmn2.FlowElement)2 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)2 RootElement (org.eclipse.bpmn2.RootElement)2 ExclusiveGateway (org.kie.workbench.common.stunner.bpmn.definition.ExclusiveGateway)2 SequenceFlow (org.kie.workbench.common.stunner.bpmn.definition.SequenceFlow)2