} });  _clearPath.setToolTipText("Clear any highlighted paths."); _clearPath.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Iterator i = _registry.getNodeItems(); while(i.hasNext()) { PNode pnode = (PNode) ((VisualItem) i.next()).getEntity(); pnode.setPathElement(false); pnode.setStartPoint(false); pnode.setEndPoint(false); }  i = _registry.getEdgeItems(); while(i.hasNext()) { PEdge pedge = (PEdge) ((VisualItem) i.next()).getEntity(); pedge.setPathElement(false); }
		public PopupMenu() {			_apspSource = null;			_centerDegreeFilter.setToolTipText("Set this vertex as the center vertex for the degree filter");			_centerDegreeFilter.addActionListener(new ActionListener() {				public void actionPerformed(ActionEvent e) {					// the current graph does not point to the same (i.e. filter runs					// on _originalGraph while we are grabbing a node from _g					String id = ((PNode) _lastItemClicked.getEntity()).v().id();					Object [] fargs = new Object[2];					fargs[0] = _ctl.getModel().findVertex(id);					fargs[1] = new Integer(1);					// this menu item is only shown when a degreefilter is active					// so this next line is safe					_ctl.runFilter(fargs);				}			});			_setStartPoint.setToolTipText("Set the starting point for a shortest path calculation.");			_setStartPoint.addActionListener(new ActionListener() {				public void actionPerformed(ActionEvent e) {					Vertex v = ((PNode) _lastItemClicked.getEntity()).v();					_apspSource = v;				}			});			_setEndPoint.setToolTipText("Calculate and highlight the all-pairs shortest path from the start vertex to this vertex.");			_setEndPoint.addActionListener(new ActionListener() {				public void actionPerformed(ActionEvent e) {					Vertex v = ((PNode) _lastItemClicked.getEntity()).v();					if(v.equals(_apspSource)) {						JOptionPane.showMessageDialog(null,							"You picked the same node " + _apspSource.id() + " to be the source and destination.",							"Path Error",							JOptionPane.ERROR_MESSAGE);						return;					}					Path p = _g.shortestPath(_apspSource, v);					if(p == null) {						JOptionPane.showMessageDialog(null,							"There is no path from " + _apspSource.id() + " to " + v.id() + ".",							"Path Error",							JOptionPane.ERROR_MESSAGE);						return;					}					// run through all the visible nodes					Iterator i = _registry.getNodeItems();					PNode pnode = null;					while(i.hasNext()) {						pnode = (PNode) ((VisualItem) i.next()).getEntity();						pnode.setPathElement(p.contains(pnode.v()) ? true : false);						pnode.setStartPoint(pnode.v().equals(p.start()) ? true : false);						pnode.setEndPoint(false);					}					pnode.setEndPoint(true);					i = _registry.getEdgeItems();					while(i.hasNext()) {						PEdge pedge = (PEdge) ((VisualItem) i.next()).getEntity();						if(p.contains(pedge.e())) {							pedge.setPathElement(true);						} else {							pedge.setPathElement(false);						}					}				}			});		}