1 package com.icesoft.openajax.beans; 2 3 import java.text.DateFormat ; 4 import java.util.Calendar ; 5 import java.util.TimeZone ; 6 7 12 public class TimeZoneWrapper 13 { 14 15 20 private String id; 21 22 26 private String mapCommandButtonId; 27 28 32 private String checkboxId; 33 34 35 39 private DateFormat dateFormat; 40 41 42 47 public TimeZoneWrapper(String id, String mapId, String checkId) { 48 this.id = id; 49 this.mapCommandButtonId = mapId; 50 this.checkboxId = checkId; 51 this.dateFormat = TimeZoneBean.buildDateFormatForTimeZone( 52 TimeZone.getTimeZone(id)); 53 } 54 55 56 61 public String getDisplayName() { 62 String displayName = null; 63 TimeZone timeZone = TimeZone.getTimeZone(id); 64 synchronized (TimeZone .class) { 65 displayName = TimeZoneBean.displayNameTokenizer( 66 timeZone.getDisplayName()); 67 } 68 return displayName; 69 } 70 71 77 public String getId() { 78 return id; 79 } 80 81 87 public String getTime() { 88 return TimeZoneBean.formatCurrentTime(dateFormat); 89 } 90 91 96 public String getUseDaylightTime() { 97 TimeZone timeZone = TimeZone.getTimeZone(id); 98 if (timeZone.useDaylightTime()) { 99 return "Yes"; 100 } 101 102 return "No"; 103 } 104 105 110 public String getInDaylightTime() { 111 TimeZone timeZone = TimeZone.getTimeZone(id); 112 Calendar cal = Calendar.getInstance(timeZone); 113 if (timeZone.inDaylightTime(cal.getTime())) { 114 return "Yes"; 115 } 116 117 return "No"; 118 } 119 120 125 public String getLocation() { 126 return id; 127 } 128 129 130 138 public boolean isRelevantComponentId(String componentId) { 139 boolean relevant = (componentId.endsWith(mapCommandButtonId) || 140 componentId.endsWith(checkboxId)); 141 return relevant; 142 } 143 144 148 public String getMapCommandButtonId() { 149 return mapCommandButtonId; 150 } 151 152 156 public String getCheckboxId() { 157 return checkboxId; 158 } 159 } 160 | Popular Tags |