@Test public void testTopologyComponentGraphUpdate() throws PaintException { PaintTarget target = EasyMock.createMock(PaintTarget.class); mockInitialSetup(target); mockGraphTagStart(target); mockVertex(target); mockVertex(target); mockVertex(target); mockEdge(target); mockGraphTagEnd(target); SelectionManager selectionManager = EasyMock.createMock(SelectionManager.class); SelectionListener listener = EasyMock.anyObject(); selectionManager.addSelectionListener(listener); EasyMock.expect(selectionManager.getSelectedVertexRefs()).andReturn(new ArrayList<VertexRef>()).anyTimes(); EasyMock.expect(selectionManager.isVertexRefSelected(EasyMock.anyObject(VertexRef.class))).andReturn(false).anyTimes(); EasyMock.expect(selectionManager.isEdgeRefSelected(EasyMock.anyObject(EdgeRef.class))).andReturn(false).anyTimes(); EasyMock.replay(target, selectionManager); TestTopologyProvider topoProvider = new TestTopologyProvider("test"); assertEquals(2, topoProvider.getVertices().size()); assertEquals(1, topoProvider.getEdges().size()); GraphContainer graphContainer = new VEProviderGraphContainer(topoProvider, new ProviderManager()); TopologyComponent topoComponent = getTopologyComponent(graphContainer, selectionManager); AbstractVertex newVertex = topoProvider.addVertex(0, 0); newVertex.setLabel("New Vertex"); assertEquals(3, topoProvider.getVertices().size()); assertEquals(1, topoProvider.getEdges().size()); graphContainer.redoLayout(); topoComponent.paintContent(target); EasyMock.verify(target); }
@Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); target.addAttribute("activeTool", m_activeTool); BoundingBox boundingBox = getBoundingBox(); target.addAttribute("boundX", boundingBox.getX()); target.addAttribute("boundY", boundingBox.getY()); target.addAttribute("boundWidth", boundingBox.getWidth()); target.addAttribute("boundHeight", boundingBox.getHeight()); Graph graph = getGraph(); GraphVisitor painter = new GraphPainter(m_graphContainer, graph.getLayout(), m_iconRepoManager, m_selectionManager, target, m_graphContainer.getStatusProvider()); try { graph.visit(painter); } catch(PaintException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
TopologyComponent extends AbstractComponent implements ChangeListener, ValueChangeListener, MapViewManagerListener { @Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); target.addAttribute("activeTool", m_activeTool); BoundingBox boundingBox = getBoundingBox(); target.addAttribute("boundX", boundingBox.getX()); target.addAttribute("boundY", boundingBox.getY()); target.addAttribute("boundWidth", boundingBox.getWidth()); target.addAttribute("boundHeight", boundingBox.getHeight()); Graph graph = getGraph(); GraphVisitor painter = new GraphPainter(m_graphContainer, graph.getLayout(), m_iconRepoManager, m_selectionManager, target, m_graphContainer.getStatusProvider()); try { graph.visit(painter); } catch(PaintException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } }
TopologyComponent extends AbstractComponent implements ChangeListener, ValueChangeListener, MapViewManagerListener { @Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); target.addAttribute("activeTool", m_activeTool); BoundingBox boundingBox = getBoundingBox(); target.addAttribute("boundX", boundingBox.getX()); target.addAttribute("boundY", boundingBox.getY()); target.addAttribute("boundWidth", boundingBox.getWidth()); target.addAttribute("boundHeight", boundingBox.getHeight()); Graph graph = getGraph(); GraphVisitor painter = new GraphPainter(m_graphContainer, graph.getLayout(), m_iconRepoManager, m_selectionManager, target, m_graphContainer.getStatusProvider()); try { graph.visit(painter); } catch(PaintException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } TopologyComponent(GraphContainer dataSource, IconRepositoryManager iconRepositoryManager, SelectionManager selectionManager, ContextMenuHandler contextMenuHandler); }
TopologyComponent extends AbstractComponent implements ChangeListener, ValueChangeListener, MapViewManagerListener { @Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); target.addAttribute("activeTool", m_activeTool); BoundingBox boundingBox = getBoundingBox(); target.addAttribute("boundX", boundingBox.getX()); target.addAttribute("boundY", boundingBox.getY()); target.addAttribute("boundWidth", boundingBox.getWidth()); target.addAttribute("boundHeight", boundingBox.getHeight()); Graph graph = getGraph(); GraphVisitor painter = new GraphPainter(m_graphContainer, graph.getLayout(), m_iconRepoManager, m_selectionManager, target, m_graphContainer.getStatusProvider()); try { graph.visit(painter); } catch(PaintException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } TopologyComponent(GraphContainer dataSource, IconRepositoryManager iconRepositoryManager, SelectionManager selectionManager, ContextMenuHandler contextMenuHandler); @Override void paintContent(PaintTarget target); @SuppressWarnings("unchecked") @Override void changeVariables(Object source, Map<String, Object> variables); void addMenuItemStateListener(MenuItemUpdateListener listener); void removeMenuItemStateListener(MenuItemUpdateListener listener); void graphChanged(GraphContainer container); void valueChange(ValueChangeEvent event); void setActiveTool(String toolname); @Override void boundingBoxChanged(MapViewManager viewManager); MapViewManager getViewManager(); void addVertexUpdateListener(VertexUpdateListener listener); }
TopologyComponent extends AbstractComponent implements ChangeListener, ValueChangeListener, MapViewManagerListener { @Override public void paintContent(PaintTarget target) throws PaintException { super.paintContent(target); target.addAttribute("activeTool", m_activeTool); BoundingBox boundingBox = getBoundingBox(); target.addAttribute("boundX", boundingBox.getX()); target.addAttribute("boundY", boundingBox.getY()); target.addAttribute("boundWidth", boundingBox.getWidth()); target.addAttribute("boundHeight", boundingBox.getHeight()); Graph graph = getGraph(); GraphVisitor painter = new GraphPainter(m_graphContainer, graph.getLayout(), m_iconRepoManager, m_selectionManager, target, m_graphContainer.getStatusProvider()); try { graph.visit(painter); } catch(PaintException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } } TopologyComponent(GraphContainer dataSource, IconRepositoryManager iconRepositoryManager, SelectionManager selectionManager, ContextMenuHandler contextMenuHandler); @Override void paintContent(PaintTarget target); @SuppressWarnings("unchecked") @Override void changeVariables(Object source, Map<String, Object> variables); void addMenuItemStateListener(MenuItemUpdateListener listener); void removeMenuItemStateListener(MenuItemUpdateListener listener); void graphChanged(GraphContainer container); void valueChange(ValueChangeEvent event); void setActiveTool(String toolname); @Override void boundingBoxChanged(MapViewManager viewManager); MapViewManager getViewManager(); void addVertexUpdateListener(VertexUpdateListener listener);  }