Adding a legend

A legend displays and controls the visibility of the layers that compose the map. The legend is connected with the view in the usual way by using an identifier.
Connecting a legend to a view
<jvmf:mapView id="map" [...] />
<jvmf:layerTool viewId="map" [...]  enabled="true" />
You can use the legend tool in read only mode (to display which layers are visible) by setting its enabled property to false.
Note
For performance related reasons tiles are often cached on the client and/or server side. Therefore, if you are using a view in tiled mode, you cannot control the background layer visibility because the layer images would be inconsistent with the cached tiles.
The legend tool is based on an HTML TABLE element. You can style the various elements of the legend using CSS styling mechanisms. For example, if you declare your legend as follows:
<jvmf:layerTool styleClass="legendStyle" viewId="map"/> 
Then you can create the following style rules to choose the appearance of the table header, background, cells, and so on.
. legendStyle {background: #d0d0d0; }
table.legendStyle {border-collapse: collapse; border: thin solid gray}
td.legendStyle {background: #d0d0d0; font-weight: normal ;}
thead.legendStyle {background: #d00000; font-weight: bold ;}