📄 weboutline.java
字号:
* LinkView listeners */ private Vector listeners = new Vector (); /** * Add a listener for LinkViewEvents. A LinkViewEvent is sent every time a * node or edge in the graph is double-clicked. * @param listener Object that wants to receive LinkViewEvents */ public void addLinkViewListener (LinkViewListener listener) { if (!listeners.contains (listener)) listeners.addElement (listener); } /** * Removes a listener from the set of LinkViewEvent listeners. If it is not found in the set, * does nothing. * * @param listen a listener */ public void removeLinkViewListener (CrawlListener listener) { listeners.removeElement (listener); } void fireEvent (Link link) { LinkViewEvent event = new LinkViewEvent (this, link); for (int j=0, len=listeners.size(); j<len; ++j) { LinkViewListener listen = (LinkViewListener)listeners.elementAt(j); listen.viewLink (event); } } public boolean handleEvent (Event event) { if (event.id == Event.ACTION_EVENT) { TreeNode n = (TreeNode)getSelectedNode(); if (n != null) fireEvent ((Link)n.getDataObject()); } else if (event.id == Event.MOUSE_DOWN && event.metaDown()) showControlPanel (); else return super.handleEvent (event); return true; } public Link getSelectedLink () { TreeNode n = getSelectedNode(); if (n != null) return (Link)n.getDataObject(); return null; } /** * Create a new Frame containing a WebOutline connected to a crawler. */ public static Frame monitor (Crawler crawler) { Frame win = new ClosableFrame ("Outline: " + crawler.getName ()); WebOutline g = new WebOutline (); crawler.addCrawlListener (g); crawler.addLinkListener (g); win.add ("Center", g); win.pack (); win.show (); return win; } Hashtable icons = new Hashtable (); // maps String (CrawlEvent name or user-defined icon name) to Image Image pageIcon; Image linkIcon; Image retrievingIcon; Image errorIcon; /** * Get a named icon. * @param name Name of icon. * @return icon associated with the name, or null if name unknown. */ public Image getIcon (String name) { return (Image)icons.get (name); } /** * Map a name to an icon. * @param name Name of icon. * @param icon Icon image. If null, mapping is deleted. */ public void setIcon (String name, Image icon) { if (icon != null) icons.put (name, icon); else icons.remove (name); } /** * Set the default icon used for pages. * @param icon Icon image. If null, mapping is deleted. */ public void setPageIcon (Image icon) { pageIcon = icon; setIcon (LinkEvent.eventName[LinkEvent.VISITED], icon); } /** * Set the default icon used for links. * @param icon Icon image. If null, mapping is deleted. */ public void setLinkIcon (Image icon) { linkIcon = icon; setIcon (LinkEvent.eventName[LinkEvent.QUEUED], icon); setIcon (LinkEvent.eventName[LinkEvent.ALREADY_VISITED], icon); setIcon (LinkEvent.eventName[LinkEvent.SKIPPED], icon); } /** * Set the default icon used for requests in progress. * @param icon Icon image. If null, mapping is deleted. */ public void setRetrievingIcon (Image icon) { retrievingIcon = icon; setIcon (LinkEvent.eventName[LinkEvent.RETRIEVING], icon); setIcon (LinkEvent.eventName[LinkEvent.DOWNLOADED], icon); } /** * Set the default icon used for failed requests. * @param icon Icon image. If null, mapping is deleted. */ public void setErrorIcon (Image icon) { errorIcon = icon; setIcon (LinkEvent.eventName[LinkEvent.ERROR], icon); } public static Image defaultPageIcon; public static Image defaultLinkIcon; public static Image defaultRetrievingIcon; public static Image defaultErrorIcon; static int errorWidth = 16; static int errorHeight = 16; static int[] errorData = { 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xfffc0404, 0xfffc0404, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff }; static int linkWidth = 16; static int linkHeight = 16; static int[] linkData = { 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff343464, 0xffd4d4fc, 0xffc4c4c4, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff343464, 0xff343464, 0xff343464, 0xffd4d4fc, 0xffd4d4fc, 0xffc4c4c4, 0xff6464cc, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xffccccfc, 0xff848484, 0xff343464, 0xffd4d4fc, 0xff848484, 0xff848484, 0xff6464cc, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff343464, 0xffd4d4fc, 0xffc4c4c4, 0xff343464, 0xffd4d4fc, 0xffc4c4c4, 0xff6464cc, 0xff6464cc, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff343464, 0xffd4d4fc, 0xffc4c4c4, 0xff343464, 0xffd4d4fc, 0xffc4c4c4, 0xff6464cc, 0xff6464cc, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xffccccfc, 0xffd4d4fc, 0xffc4c4c4, 0xff343464, 0xff343464, 0xff6464cc, 0xff6464cc, 0xff343464, 0xff343464, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xffd4d4fc, 0xffc4c4c4, 0xffc4c4c4, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff343464, 0xffd4d4fc, 0xffccccfc, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xffccccfc, 0xffc4c4c4, 0xff343464, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xff040404, 0xff343464, 0xffccccfc, 0xffc4c4c4, 0xffc4c4c4, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff040404, 0xff343464, 0xff343464, 0xff343464, 0xfcfcfc, 0xff040404, 0xff343464, 0xffccccfc, 0xffc4c4c4, 0xff343464, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff343464, 0xffd4d4fc, 0xffc4c4c4, 0xffc4c4c4, 0xff343464, 0xff343464, 0xffccccfc, 0xffc4c4c4, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xffccccfc, 0xff040404, 0xff6464cc, 0xff6464cc, 0xff343464, 0xffccccfc, 0xff040404, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xffccccfc, 0xff040404, 0xff6464cc, 0xff6464cc, 0xff343464, 0xffccccfc, 0xff040404, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xffccccfc, 0xffc4c4c4, 0xff6464cc, 0xff343464, 0xff343464, 0xffccccfc, 0xffc4c4c4, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff040404, 0xff6464cc, 0xff343464, 0xff343464, 0xff343464, 0xff343464, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xff343464, 0xff343464, 0xff343464, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc, 0xfcfcfc };static int retrieveWidth = 16;static int retrieveHeight = 16;static int[] retrieveData = {0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xff008000, 0xff008000, 0xff008000, 0xff008000, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff};static int pageWidth = 16;static int pageHeight = 16;static int[] pageData = {0xffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xff343434, 0xffffffff, 0xff000000, 0xffff, 0xffff, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xff343434, 0xff343434, 0xff343434, 0xff343434, 0xff343434, 0xfffcfcfc, 0xfffcfcfc, 0xff343434, 0xffffffff, 0xffffffff, 0xff343434, 0xffff, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xff343434, 0xfffccc34, 0xfffccc34, 0xff64ccfc, 0xff64ccfc, 0xfffcfcfc, 0xfffcfcfc, 0xff343434, 0xffffffff, 0xffffffff, 0xffffffff, 0xff343434, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xff343434, 0xff64ccfc, 0xff64ccfc, 0xff64ccfc, 0xff64ccfc, 0xfffcfcfc, 0xfffcfcfc, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xff343434, 0xff9c6434, 0xff9c6434, 0xff9c6434, 0xff9c6434, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xffffffff, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xff343434, 0xff9c6434, 0xff9c6434, 0xff9c6434, 0xff9c6434, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xfffcfcfc, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff343434, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xfffc3434, 0xfffcfcfc, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xff040404, 0xfffcfcfc, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xfffcfcfc, 0xfffcfcfc, 0xfffc3434, 0xfffcfcfc, 0xff000000, 0xff000000, 0xff040404, 0xff040404, 0xff040404, 0xfffcfcfc, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff343434, 0xfffcfcfc, 0xfffcfcfc, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xfffcfcfc, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff9c9c9c, 0xffff, 0xffff, 0xffff, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xff9c9c9c, 0xffff, 0xffff}; static { Toolkit tkit = Toolkit.getDefaultToolkit (); defaultPageIcon = tkit.createImage ( new MemoryImageSource (pageWidth, pageHeight, pageData, 0, pageWidth)); defaultLinkIcon = tkit.createImage ( new MemoryImageSource (linkWidth, linkHeight, linkData, 0, linkWidth)); defaultRetrievingIcon = tkit.createImage ( new MemoryImageSource (retrieveWidth, retrieveHeight, retrieveData, 0, retrieveWidth)); defaultErrorIcon = tkit.createImage ( new MemoryImageSource (errorWidth, errorHeight, errorData, 0, errorWidth)); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -