| |
PDF
|
ICEfaces Online Reference |
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:
private void init() { ... // Entries in this list determine what will be generated in // the timezone web file, so should be modifiable, // but all ids must be unique to each other allTimeZoneList = new ArrayList(6); allTimeZoneList.add(new TimeZoneWrapper( "Pacific/Honolulu", "images/hawaii.jpg", "GMTminus10", "Cminus10")); allTimeZoneList.add(new TimeZoneWrapper( "America/Anchorage", "images/alaska.jpg", "GMTminus9", "Cminus9")); allTimeZoneList.add(new TimeZoneWrapper( "America/Los_Angeles", "images/pacific.jpg", "GMTminus8", "Cminus8")); allTimeZoneList.add(new TimeZoneWrapper( "America/Phoenix", "images/mountain.jpg", "GMTminus7", "Cminus7")); allTimeZoneList.add(new TimeZoneWrapper( "America/Chicago", "images/central.jpg", "GMTminus6", "Cminus6")); allTimeZoneList.add(new TimeZoneWrapper( "America/New_York", "images/eastern.jpg", "GMTminus5", "Cminus5")); ... }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-2006. ICEsoft Technologies, Inc. http://www.icesoft.com |