Class UrlTocPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, TocTree, UrlTocTree

public class UrlTocPane extends ObjTocPane implements UrlTocTree
UrlTocPane provides a table of contents that associates each entry in a table of contents with a URL. An instance of the class can be initialized in the same way as an instance of ObjTocPane and in addition can be initialized from an InputStream containing an XML file. When an XML file is used, the following DTD should be used:
 <!ELEMENT toc (node) >
 <!ELEMENT node (node)*>
 <!ATTLIST node title CDATA #IMPLIED
              uri CDATA #IMPLIED
              href CDATA #IMPLIED
 >
 
A DOCTYPE directive is not necessary. For the attributes of each node, the title attribute provides the title the GUI will display. The uri attribute provides the URI, which must also be a URL, that will be selected. The attribute href is ignored. The href attribute is provided for cases in which the XML file will used by a web server and represents the URL that the web server will see after the XML file is converted to HTML (e.g., by an XSTL style sheet). This class ignores the href field. One may wish to call the method ObjTocPane.setSelectionWithAction(int) in order to set an initial selection and to notify any previously configured action listeners of the selection. The documentation for the class ObjTocPane contains details regarding action events.

To configure a table of contents programatically, use the method addEntry(String,URL) or addEntry(String,String) and related methods defined in the class ObjTocPane. To replace the entries with a new set, use one of the setToc methods or call ObjTocPane.clearToc() and then programatically add the new entries. The method ObjTocPane.setSelectionWithAction(int) calls ObjTocPane.clearToc() so an explicit call is not necessary in this case. Finally the method Handlers.enable() should be called before this class is used so that the DTD can be read from a JAR file.

See Also: