Adding New Properties
Each section in the map, and each check box, and each row in the bottom table, are populated by properties from a TimeZoneWrapper object. We will change TimeZoneWrapper.java to add the new properties that timezone.xhtml uses JSF expression language bindings to access:
1. Add a new property to hold the time zone abbreviated name for the time zone being represented by this TimeZoneWrapper:
private String abbreviation;
2. Add another property for managing both the current state of the check box for this time zone, and the visibility of the corresponding row in the bottom table:
private boolean currentlyShowing;
3. Initialize the new properties:
/**
* @param id id used to identify the time zone.
* @param mapId map button component id in web page
* @param abbreviation timezone abbreviated label
* @param xCoords array of X-coordinates for the image map object.
* @param yCoords array of Y-coordinates for the image map object.
* @param coords number of coordinates in the image map object.
*/
public TimeZoneWrapper(String id, String mapId,
String abbreviation, int[] xCoords, int[] yCoords, int coords) {
this.id = id;
this.mapCommandButtonId = mapId;
this.abbreviation = abbreviation;
this.currentlyShowing = false;
this.dateFormat = TimeZoneBean.buildDateFormatForTimeZone(
TimeZone.getTimeZone(id));
mapPolygon = new Polygon(xCoords, yCoords, coords);
4. Add accessor methods for the new properties:
public String getAbbreviation(){
return abbreviation;
}
...
public boolean getCurrentlyShowing() {
return currentlyShowing;
}
...
public void setCurrentlyShowing(boolean showing) {
currentlyShowing = showing;
}