Java Reference
In-Depth Information
The Duke's Bookstore image map example has two component classes:
AreaCompon-
ent
and
MapComponent
. The
MapComponent
class extends
UICommand
and there-
fore implements
ActionSource2
, which means it can fire action events when a user
clicks on the map. The
AreaComponent
class extends the standard component
UIOut-
put
. The
@FacesComponent
annotation registers the components with the JavaServer
Faces implementation:
@FacesComponent("DemoMap")
public class MapComponent extends UICommand {...}
@FacesComponent("DemoArea")
public class AreaComponent extends UIOutput {...}
The
MapComponent
class represents the component corresponding to the
book-
store:map
tag:
<bookstore:map id="bookMap"
current="map1"
immediate="true"
action="bookstore">
...
</bookstore:map>
The
AreaComponent
class represents the component corresponding to the
book-
store:area
tag:
<bookstore:area id="map1" value="#{Book201}"
onmouseover="resources/images/book_201.jpg"
onmouseout="resources/images/book_all.jpg"
targetImage="mapImage"/>
MapComponent
has one or more
AreaComponent
instances as children. Its behavior
consists of the following actions:
• Retrieving the value of the currently selected area
• Defining the properties corresponding to the component's values
• Generating an event when the user clicks on the image map
• Queuing the event
• Saving its state