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);
}
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);
}
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);
}
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));
}
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;
}
Aggregations