background image

Summary of the Application Classes

<< Configuring Model Data | Steps for Creating a Custom Component >>
<< Configuring Model Data | Steps for Creating a Custom Component >>

Summary of the Application Classes

The value attributes of the area tags refer to the beans in the application scope, as shown in this
area
tag from chooselocale.jsp:
<bookstore:area id=
"NAmerica"
value=
"#{NA}"
onmouseover=
"/template/world_namer.jpg"
onmouseout=
"/template/world.jpg" />
To reference the ImageArea model object bean values from the component class, you
implement a getValue method in the component class. This method calls super.getValue.
The superclass of
tut-install/javaeetutorial5/examples/web/bookstore6/src/java/com/sun/bookstore6/components/AreaComponen
UIOutput
, has a getValue method that does the work of finding the ImageArea object
associated with AreaComponent. The AreaRenderer class, which needs to render the alt, shape,
and coords values from the ImageArea object, calls the getValue method of AreaComponent to
retrieve the ImageArea object.
ImageArea iarea = (ImageArea) area.getValue();
ImageArea
is only a simple bean, so you can access the shape, coordinates, and alternative text
values by calling the appropriate accessor methods of ImageArea.
"Creating the Renderer Class"
on page 427
explains how to do this in the AreaRenderer class.
Summary of the Application Classes
Table 13­2
summarizes all the classes needed to implement the image map component.
TABLE 13­2
Image Map Classes
Class
Function
AreaSelectedEvent
The ActionEvent indicating that an AreaComponent from the MapComponent has been
selected.
AreaTag
The tag handler that implements the area custom tag.
MapTag
The tag handler that implements the map custom tag.
AreaComponent
The class that defines AreaComponent, which corresponds to the area custom tag.
MapComponent
The class that defines MapComponent, which corresponds to the map custom tag.
AreaRenderer
This Renderer performs the delegated rendering for AreaComponent.
ImageArea
The bean that stores the shape and coordinates of the hotspots.
LocaleBean
The backing bean for the chooselocale.jsp page.
Understanding the Image Map Example
Chapter 13 · Creating Custom UI Components
417