@Test public void testRepeatGroup() { Table t = new Table(); Graph g = new Graph(); try { m_vis.add("t", t); Assert.fail("Should not allow duplicate groups"); } catch (Exception e) { } try { m_vis.addFocusGroup(Visualization.FOCUS_ITEMS, t); Assert.fail("Should not allow duplicate groups"); } catch (Exception e) { } try { m_vis.add("g", g); Assert.fail("Should not allow duplicate groups"); } catch (Exception e) { } m_vis.removeGroup("t"); try { m_vis.add("t", t); } catch (Exception e) { Assert.fail("Should be able to re-use group name after removal"); } m_vis.removeGroup("g"); try { m_vis.add("g", t); } catch (Exception e) { Assert.fail("Should be able to re-use group name after removal"); } }
public void mouseClicked(MouseEvent e) { if (!(e.getSource().getClass().getName()).equalsIgnoreCase("VisualItem") && !UILib.isButtonPressed(e, button1)) { if (gv.getDisplay().getCursor().getType() == (Cursor.DEFAULT_CURSOR)) { // release all focus and neighbour highlight TupleSet ts = vis.getGroup(Visualization.FOCUS_ITEMS); if (gv.getRecStatus() == 2 && gv.fromIndirect && (ts.getTupleCount() == 0) && !gv.fromAll) gv.showDirectGraph(); ts.clear(); vis.removeGroup("depthEdge"); gv.releaseSearchFocus(); } } if (UILib.isButtonPressed(e, button1) && e.getClickCount() == 1) { if (gv.getDisplay().getCursor().getName().equals("zoom")) admin.toggleZoom(); else if (gv.getDisplay().getCursor().getName().equals("zoomout")) admin.toggleZoomOut(); else if (gv.getDisplay().getCursor().getName().equals("zoomin")) admin.toggleZoomIn(); else if (gv.getDisplay().getCursor().getName().equals("zoomout1")) admin.toggleZoomOut1(); else if (gv.getDisplay().getCursor().getName().equals("zoomin1")) admin.toggleZoomIn1(); else if (gv.getDisplay().getCursor().getName().equals("pan")) admin.togglePan(); } }
/* * Test method for 'prefuse.Visualization.removeGroup(String)' */ @Test public void testRemoveGroup() { m_vis.removeGroup("g"); Assert.assertEquals(null, m_vis.getGroup("g")); Assert.assertEquals(null, m_vis.getGroup("g.nodes")); Assert.assertEquals(null, m_vis.getGroup("g.edges")); Assert.assertEquals(null, m_vis.getSourceData("g")); Assert.assertEquals(null, m_vis.getSourceData("g.nodes")); Assert.assertEquals(null, m_vis.getSourceData("g.edges")); Assert.assertEquals(false, m_vis.getFocusGroup("_focus_").containsTuple(m_n0)); }