|
Updating TimeZoneBean.java
Finally, update TimeZoneBean.java to initialize and access the newer more dynamic data structures.
1. Create the master list of all time zones in the application, along with their images, and the component IDs:
allTimeZoneList.add(new TimeZoneWrapper("Pacific/Honolulu", "GMTminus10", "HADT", hawaiiXCoords, hawaiiYCoords, hawaiiXCoords.length)); allTimeZoneList.add(new TimeZoneWrapper("America/Anchorage", "GMTminus9", "AKST", alaskaXCoords, alaskaYCoords, alaskaXCoords.length)); allTimeZoneList.add(new TimeZoneWrapper("America/Los_Angeles", "GMTminus8", "PST", pacificXCoords, pacificYCoords, pacificXCoords.length)); allTimeZoneList.add(new TimeZoneWrapper("America/Denver", "GMTminus7", "MDT", mountainXCoords, mountainYCoords, mountainXCoords.length)); allTimeZoneList.add(new TimeZoneWrapper("America/Chicago", "GMTminus6", "CDT", centralXCoords, centralYCoords, centralXCoords.length)); allTimeZoneList.add(new TimeZoneWrapper("America/New_York", "GMTminus5", "EST", easternXCoords, easternYCoords, easternXCoords.length)); allTimeZoneList.add(new TimeZoneWrapper("Canada/Newfoundland", "GMTminus4", "NST", nfldXCoords, nfldYCoords, nfldXCoords.length));public ArrayList getAllTimeZoneList(){ return allTimeZoneList; }public void timeZoneChanged(ValueChangeEvent event){ UIComponent comp = event.getComponent(); FacesContext context = FacesContext.getCurrentInstance(); String componentId = comp.getClientId(context); TimeZoneWrapper tzw = getTimeZoneWrapperByComponentId( componentId ); if( tzw != null ) { boolean checked = ((Boolean)event.getNewValue()).booleanValue(); // If checkbox is checked, then add tzw to checkedTimeZoneList if( checked ) { tzw.setCurrentlyShowing( true ); if( !checkedTimeZoneList.contains(tzw) ) checkedTimeZoneList.add( tzw ); } // Otherwise, if checkbox is unchecked, then remove tzw from // checkedTimeZoneList else { tzw.setCurrentlyShowing( false ); checkedTimeZoneList.remove( tzw ); } } }
Copyright 2005-2009. ICEsoft Technologies, Inc. |