| |
PDF
|
ICEfaces Online Reference |
Modifying TimeZoneWrapper.java
Each row in the dataTable is populated by a TimeZoneWrapper bean. Each cell in the dataTable is then populated by properties of the TimeZoneWrapper beans. So, we have to modify TimeZoneWrapper to add the requisite properties and accessor methods.
import java.util.TimeZone; import java.util.Calendar; import java.text.DateFormat;private String checkboxId;private DateFormat dateFormat;/** * @param id id used to identify the time zone. * @param mapId map button component id in web page * @param checkId checkbox component id in web page */ public TimeZoneWrapper(String id, String mapId, String checkId) { this.id = id; this.mapCommandButtonId = mapId; this.checkboxId = checkId; this.dateFormat = TimeZoneBean.buildDateFormatForTimeZone( TimeZone.getTimeZone(id) ); }5. Add getter accessor methods for the displayName, time, useDaylightTime, inDaylightTime, location properties.
public String getDisplayName() { TimeZone timeZone = TimeZone.getTimeZone(id); return TimeZoneBean.displayNameTokenizer( timeZone.getDisplayName() ); } ... public String getTime() { return TimeZoneBean.formatCurrentTime( dateFormat ); } ... public String getUseDaylightTime() { TimeZone timeZone = TimeZone.getTimeZone(id); if( timeZone.useDaylightTime() ) return "Yes"; return "No"; } ... public String getInDaylightTime() { TimeZone timeZone = TimeZone.getTimeZone(id); Calendar cal = Calendar.getInstance(timeZone); if( timeZone.inDaylightTime(cal.getTime()) ) return "Yes"; return "No"; } ... public String getLocation() { return id; }public boolean isRelevantComponentId(String componentId) { boolean relevant = ( componentId.endsWith(mapCommandButtonId) || componentId.endsWith(checkboxId) ); return relevant; }public String getCheckboxId() { return checkboxId; }
|
Copyright 2005-2006. ICEsoft Technologies, Inc. http://www.icesoft.com |