Web ADF TocControl


The TOC control—or table of contents control—displays the contents of a map and allows an end user to turn layers on and off. The TOC control functions in the same manner as the table of contents in ArcMap: it presents a hierarchical list of data frames, layers, and symbols displayed on the map.

The TocControl works with WebToc object which is the business object which uses the TocFunctionality objects configured with the GISResource. The TocRenderer class renders the control to the appropriate markup by generating a XML representation of the control using XSLT to transform it to the required markup, and the TocTag class exposes the control as a JSP custom tag named toc.
WORKING WITH THE TOC TREE

The TOC is made up of a collection of TocNode objects. A TocNode stores content, maintains hierarchical relationships, and responds to an event that occurs at that node. To store content, a TocNode requires a TocNodeContent object to encapsulate the content at that node. A TocNode handles its own expand or collapse event and delegates the check box event—for layer visibility—and the node operation—when node content is clicked—to the TocNodeContent’s event handling methods:

 
[Java]
public void handleCheckedEvent(TocEvent args)public void handleNodeEvent(TocEvent
    args)
Interacting with the TOC Control
The TocRenderer controls how the TocControl is displayed on the page and manages the events for the table of contents. The TocRenderer decodes the following request parameters from the FacesContext:
  • tocId + _nodeKey — The key of the node responsible for the operation
  • tocId + _nodeOperation — The operation to be performed, which is either click or expandCollapse