Changeset 27
- Timestamp:
- 01/24/06 13:43:10
- Files:
-
- trunk/calendar3 (modified) (1 prop)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/CalendarInfo.java (modified) (3 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/DayView.java (modified) (2 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/EventFormatter.java (modified) (7 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/FormattedEvents.java (modified) (3 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/MonthView.java (modified) (2 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeView.java (modified) (10 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeViewDailyInfo.java (modified) (3 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/WeekView.java (modified) (2 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/YearView.java (modified) (2 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java (modified) (2 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalTimezonesImpl.java (modified) (3 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java (modified) (2 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeUtil.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/CalTimezones.java (modified) (1 diff)
- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/Restore.java (modified) (1 diff)
- trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/TimezonesImpl.java (modified) (2 diffs)
- trunk/calendar3/webadmin/src/org/bedework/webadmin/event/PEGetFormattedEventsAction.java (modified) (1 diff)
- trunk/calendar3/webclient/src/org/bedework/webclient/BwEventAction.java (modified) (1 diff)
- trunk/calendar3/webclient/war/docs/footer.jsp (modified) (2 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java (modified) (4 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/EntityDates.java (modified) (5 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/EventDates.java (modified) (3 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/TimeDateComponents.java (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3
- Property svn:ignore set to dist
trunk/calendar3/appcommon/src/org/bedework/appcommon/CalendarInfo.java
r2 r27 60 60 private int numberDaysInWeek; 61 61 62 /** labels for the dates in a month */ 63 private String[] dayLabels; 64 /** internal values for the dates in a month */ 65 private String[] dayVals; 66 62 67 /** Constructor 63 68 * … … 119 124 shortDayNamesAdjusted = shortDayNames; 120 125 } 126 127 dayLabels = new String[getRangeSize(c, Calendar.DAY_OF_MONTH)]; 128 dayVals = new String[getRangeSize(c, Calendar.DAY_OF_MONTH)]; 129 130 int dom = c.getMinimum(Calendar.DAY_OF_MONTH); 131 for (int i = 0; i < dayLabels.length; i++) { 132 dayLabels[i] = String.valueOf(dom); 133 dayVals[i] = twoDigit(dom); 134 dom++; 135 } 121 136 } 122 137 … … 193 208 return lastDayOfWeek; 194 209 } 210 211 /** 212 * @return labels 213 */ 214 public String[] getDayLabels() { 215 return dayLabels; 216 } 217 218 /** 219 * @return vals 220 */ 221 public String[] getDayVals() { 222 return dayVals; 223 } 224 225 /** Return the size of the range for a given unit of time 226 * 227 * @param unit value defined in java.util.Calendar 228 * @return int size of range 229 */ 230 private int getRangeSize(Calendar cal, int unit) { 231 return cal.getMaximum(unit) - cal.getMinimum(unit) + 1; 232 } 233 234 private static String twoDigit(int val) { 235 if (val > 9) { 236 return String.valueOf(val); 237 } 238 239 return "0" + String.valueOf(val); 240 } 241 242 private static String fourDigit(int val) { 243 if (val > 999) { 244 return String.valueOf(val); 245 } 246 247 String strVal = String.valueOf(val); 248 249 return "0000".substring(strVal.length()) + strVal; 250 } 195 251 } trunk/calendar3/appcommon/src/org/bedework/appcommon/DayView.java
r2 r27 66 66 /** Constructor: 67 67 * 68 * @param calInfo Object providing calendaring information 68 69 * @param curDay MyCalendarVO representing current day. 69 70 * @param cal CalSvcI calendar service interface … … 71 72 * @throws CalFacadeException 72 73 */ 73 public DayView(MyCalendarVO curDay, 74 public DayView(CalendarInfo calInfo, 75 MyCalendarVO curDay, 74 76 CalSvcI cal, 75 77 boolean debug) throws CalFacadeException { 76 super(c urDay, "Day", cal,78 super(calInfo, curDay, "Day", cal, 77 79 curDay, 78 80 curDay.getTomorrow(), trunk/calendar3/appcommon/src/org/bedework/appcommon/EventFormatter.java
r2 r27 63 63 import org.apache.log4j.Logger; 64 64 65 /** Object to provide formatting services for a n EventVO.65 /** Object to provide formatting services for a BwEvent. 66 66 * 67 67 * @author Mike Douglass douglm@rpi.edu … … 72 72 private EventInfo eventInfo; 73 73 74 private CalendarInfo calInfo; 75 74 76 private CalTimezones ctz; 75 77 … … 90 92 * 91 93 * @param eventInfo 94 * @param calInfo 92 95 * @param view 93 96 * @param ctz 94 97 */ 95 98 public EventFormatter(EventInfo eventInfo, TimeView view, 96 Cal Timezones ctz) {99 CalendarInfo calInfo, CalTimezones ctz) { 97 100 this.eventInfo = eventInfo; 101 this.calInfo = calInfo; 98 102 this.ctz= ctz; 99 103 } … … 108 112 public EventInfo getEventInfo() { 109 113 return eventInfo; 114 } 115 116 /** 117 * @return CalendarInfo 118 */ 119 public CalendarInfo getCalInfo() { 120 return calInfo; 110 121 } 111 122 … … 132 143 public MyCalendarVO getToday() { 133 144 if (today == null) { 145 // XXX Locale? 134 146 today = new MyCalendarVO(); 135 147 } … … 146 158 try { 147 159 if (start == null) { 148 start = new DateTimeFormatter(get Today().getCalInfo(),160 start = new DateTimeFormatter(getCalInfo(), 149 161 getEvent().getDtstart(), ctz); 150 162 } … … 169 181 try { 170 182 if (end == null) { 171 end = new DateTimeFormatter(get Today().getCalInfo(),183 end = new DateTimeFormatter(getCalInfo(), 172 184 getEvent().getDtend(), 173 185 ctz); trunk/calendar3/appcommon/src/org/bedework/appcommon/FormattedEvents.java
r2 r27 68 68 public class FormattedEvents extends AbstractCollection { 69 69 private Collection events; 70 private CalendarInfo calInfo; 70 71 private CalTimezones ctz; 71 72 … … 73 74 * 74 75 * @param events 76 * @param calInfo 75 77 * @param ctz 76 78 */ 77 79 public FormattedEvents(Collection events, 78 Cal Timezones ctz) {80 CalendarInfo calInfo, CalTimezones ctz) { 79 81 this.events = events; 82 this.calInfo = calInfo; 80 83 this.ctz = ctz; 81 84 } … … 103 106 EventInfo ev = (EventInfo)it.next(); 104 107 105 return new EventFormatter(ev, null, c tz);108 return new EventFormatter(ev, null, calInfo, ctz); 106 109 } 107 110 trunk/calendar3/appcommon/src/org/bedework/appcommon/MonthView.java
r2 r27 66 66 /** Constructor: 67 67 * 68 * @param calInfo Object providing calendaring information 68 69 * @param curDay MyCalendarVO representing current day. 69 70 * @param cal CalSvcI calendar service interface … … 71 72 * @throws CalFacadeException 72 73 */ 73 public MonthView(MyCalendarVO curDay, 74 public MonthView(CalendarInfo calInfo, 75 MyCalendarVO curDay, 74 76 CalSvcI cal, 75 77 boolean debug) throws CalFacadeException { 76 super(c urDay, "Month", cal,78 super(calInfo, curDay, "Month", cal, 77 79 curDay.getFirstDayOfThisMonth(), 78 80 curDay.getLastDayOfThisMonth(), trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeView.java
r2 r27 88 88 public class TimeView implements Serializable { 89 89 protected boolean debug; 90 protected CalendarInfo calInfo; 90 91 protected MyCalendarVO curDay; 91 92 protected CalSvcI cal; … … 107 108 /** Constructor: 108 109 * 110 * @param calInfo Object providing calendaring information 109 111 * @param curDay MyCalendarVO representing current day. 110 112 * @param periodName Name of period, capitalized, e.g. Week … … 121 123 * @throws CalFacadeException 122 124 */ 123 public TimeView(MyCalendarVO curDay, 125 public TimeView(CalendarInfo calInfo, 126 MyCalendarVO curDay, 124 127 String periodName, 125 128 CalSvcI cal, … … 130 133 boolean showData, 131 134 boolean debug) throws CalFacadeException { 135 this.calInfo = calInfo; 132 136 this.curDay = curDay; 133 137 this.periodName = periodName; … … 423 427 424 428 /* Our month entry */ 425 TimeViewDailyInfo monthTvdi = new TimeViewDailyInfo( );429 TimeViewDailyInfo monthTvdi = new TimeViewDailyInfo(calInfo); 426 430 initTvdi(monthTvdi, gtpi); 427 431 428 432 /* Create a year entry */ 429 TimeViewDailyInfo yearTvdi = new TimeViewDailyInfo( );433 TimeViewDailyInfo yearTvdi = new TimeViewDailyInfo(calInfo); 430 434 yearTvdi.setCal(gtpi.currentDay); 431 435 yearTvdi.setYear(gtpi.year); … … 435 439 436 440 for (;;) { 437 TimeViewDailyInfo weekTvdi = new TimeViewDailyInfo( );441 TimeViewDailyInfo weekTvdi = new TimeViewDailyInfo(calInfo); 438 442 439 443 initTvdi(weekTvdi, gtpi); … … 468 472 initGtpiForMonth(gtpi); 469 473 470 monthTvdi = new TimeViewDailyInfo( );474 monthTvdi = new TimeViewDailyInfo(calInfo); 471 475 initTvdi(monthTvdi, gtpi); 472 476 weeks = new Vector(); … … 532 536 533 537 while (dayNum != dayOfWeek) { 534 tvdi = new TimeViewDailyInfo( );538 tvdi = new TimeViewDailyInfo(calInfo); 535 539 tvdi.setFiller(true); 536 540 … … 563 567 564 568 /* Create a day entry */ 565 tvdi = new TimeViewDailyInfo( );569 tvdi = new TimeViewDailyInfo(calInfo); 566 570 567 571 initTvdi(tvdi, gtpi); … … 603 607 */ 604 608 while (days.size() < 7) { 605 tvdi = new TimeViewDailyInfo( );609 tvdi = new TimeViewDailyInfo(calInfo); 606 610 tvdi.setFiller(true); 607 611 trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeViewDailyInfo.java
r2 r27 72 72 */ 73 73 public class TimeViewDailyInfo implements Serializable { 74 private CalendarInfo calInfo; 75 74 76 /** The view that created this. 75 77 */ … … 177 179 */ 178 180 private Collection eventFormatters; 181 182 /** Constructor: 183 * 184 * @param calInfo Object providing calendaring information 185 */ 186 public TimeViewDailyInfo(CalendarInfo calInfo) { 187 this.calInfo = calInfo; 188 } 179 189 180 190 /** The view that created this. … … 555 565 while (it.hasNext()) { 556 566 eventFormatters.add(new EventFormatter((EventInfo)it.next(), view, 557 view.getTimezones()));567 calInfo, view.getTimezones())); 558 568 } 559 569 } trunk/calendar3/appcommon/src/org/bedework/appcommon/WeekView.java
r2 r27 66 66 /** Constructor: 67 67 * 68 * @param calInfo Object providing calendaring information 68 69 * @param curDay MyCalendarVO representing current day. 69 70 * @param cal CalSvcI calendar service interface … … 71 72 * @throws CalFacadeException 72 73 */ 73 public WeekView(MyCalendarVO curDay, 74 public WeekView(CalendarInfo calInfo, 75 MyCalendarVO curDay, 74 76 CalSvcI cal, 75 77 boolean debug) throws CalFacadeException { 76 super(c urDay, "Week", cal,78 super(calInfo, curDay, "Week", cal, 77 79 curDay.getFirstDayOfThisWeek(), 78 80 curDay.getLastDayOfThisWeek(), trunk/calendar3/appcommon/src/org/bedework/appcommon/YearView.java
r2 r27 66 66 /** Constructor: 67 67 * 68 * @param calInfo Object providing calendaring information 68 69 * @param curDay MyCalendarVO representing current day. 69 70 * @param cal CalSvcI calendar service interface … … 75 76 * @throws CalFacadeException 76 77 */ 77 public YearView(MyCalendarVO curDay, 78 public YearView(CalendarInfo calInfo, 79 MyCalendarVO curDay, 78 80 CalSvcI cal, 79 81 boolean showData, 80 82 boolean debug) throws CalFacadeException { 81 super(c urDay, "Year", cal,83 super(calInfo, curDay, "Year", cal, 82 84 curDay.getFirstDayOfThisYear(), 83 85 curDay.getLastDayOfThisYear(), trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java
r2 r27 71 71 import org.apache.log4j.Logger; 72 72 73 import java.io.Serializable; 73 74 import java.util.Collection; 74 75 import java.util.HashMap; … … 95 96 /* Information created and saved about access on a given path. 96 97 */ 97 private class PathInfo {98 private class PathInfo implements Serializable { 98 99 String path; // The key 99 100 Acl pathAcl; // Merged acl for the path. trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalTimezonesImpl.java
r2 r27 92 92 private boolean debug; 93 93 94 private String defaultTimeZoneId; 95 private transient TimeZone defaultTimeZone; 96 94 97 private static class TimezoneInfo { 95 98 TimeZone tz; … … 161 164 162 165 public TimeZone getTimeZone(final String id) throws CalFacadeException { 166 if ((defaultTimeZone != null) && id.equals(defaultTimeZoneId)) { 167 return defaultTimeZone; 168 } 169 163 170 stats.incTzFetches(); 164 171 TimezoneInfo tzinfo = lookup(id); … … 181 188 } 182 189 190 if ((defaultTimeZone == null) && id.equals(defaultTimeZoneId)) { 191 defaultTimeZone = tzinfo.tz; 192 } 193 183 194 return tzinfo.tz; 195 } 196 197 public TimeZone getDefaultTimeZone() throws CalFacadeException { 198 if ((defaultTimeZone == null) && (defaultTimeZoneId != null)) { 199 defaultTimeZone = getTimeZone(defaultTimeZoneId); 200 } 201 202 return defaultTimeZone; 203 } 204 205 public void setDefaultTimeZoneId(String id) throws CalFacadeException { 206 defaultTimeZone = null; 207 defaultTimeZoneId = id; 208 } 209 210 public String getDefaultTimeZoneId() throws CalFacadeException { 211 return defaultTimeZoneId; 184 212 } 185 213 trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java
r18 r27 348 348 349 349 timezones = new CalTimezonesImpl(this, getStats(), publicAdmin, debug); 350 timezones.setDefaultTimeZoneId(getSyspars().getTzid()); 350 351 351 352 return userCreated; … … 375 376 throw new CalFacadeException("No system parameters with name " + name); 376 377 } 377 378 378 379 if (debug) { 379 trace("Read system parameters: " + syspars);380 trace("Read system parameters: " + syspars); 380 381 } 381 382 } trunk/calendar3/calFacade/src/org/bedework/calfacade/CalFacadeUtil.java
r18 r27 267 267 } 268 268 269 dtm.init(dateOnly, date, null, timezones);269 dtm.init(dateOnly, date, timezones.getDefaultTimeZoneId(), timezones); 270 270 271 271 return dtm; trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/CalTimezones.java
r2 r27 100 100 public TimeZone getTimeZone(final String id) throws CalFacadeException; 101 101 102 /** Get the default timezone for this system. 103 * 104 * @return default TimeZone or null for none set. 105 * @throws CalFacadeException 106 */ 107 public TimeZone getDefaultTimeZone() throws CalFacadeException; 108 109 /** Set the default timezone id for this system. 110 * 111 * @param id 112 * @throws CalFacadeException 113 */ 114 public void setDefaultTimeZoneId(String id) throws CalFacadeException; 115 116 /** Get the default timezone id for this system. 117 * 118 * @return String id 119 * @throws CalFacadeException 120 */ 121 public String getDefaultTimeZoneId() throws CalFacadeException; 122 102 123 /** Find a timezone object in the database given the id. 103 124 * trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/Restore.java
r18 r27 133 133 globals.getPublicUser(), 134 134 globals.rintf); 135 globals.timezones.setDefaultTimeZoneId(globals.syspars.getTzid()); 135 136 136 137 if (globals.from2p3px) { trunk/calendar3/tools/src/org/bedework/tools/dumprestore/restore/TimezonesImpl.java
r18 r27 92 92 private BwUser user; 93 93 94 private String defaultTimeZoneId; 95 private transient TimeZone defaultTimeZone; 96 94 97 private RestoreIntf ri; 95 98 … … 212 215 213 216 return tzinfo.tz; 217 } 218 219 public TimeZone getDefaultTimeZone() throws CalFacadeException { 220 if ((defaultTimeZone == null) && (defaultTimeZoneId != null)) { 221 defaultTimeZone = getTimeZone(defaultTimeZoneId); 222 } 223 224 return defaultTimeZone; 225 } 226 227 public void setDefaultTimeZoneId(String id) throws CalFacadeException { 228 defaultTimeZone = null; 229 defaultTimeZoneId = id; 230 } 231 232 public String getDefaultTimeZoneId() throws CalFacadeException { 233 return defaultTimeZoneId; 214 234 } 215 235 trunk/calendar3/webadmin/src/org/bedework/webadmin/event/PEGetFormattedEventsAction.java
r2 r27 97 97 98 98 form.setFormattedEvents(new FormattedEvents(getEvents(false, form), 99 form.getCalInfo(), 99 100 form.getCalSvcI().getTimezones())); 100 101 trunk/calendar3/webclient/src/org/bedework/webclient/BwEventAction.java
r2 r27 88 88 EventFormatter ef = new EventFormatter(ev, 89 89 form.getCurTimeView(), 90 form.getCalInfo(), 90 91 form.getCalSvcI().getTimezones()); 91 92 trunk/calendar3/webclient/war/docs/footer.jsp
r2 r27 9 9 10 10 <bean:define id="forLabels" name="calForm" property="forLabels" /> 11 <bean:define id="calInfo" name="calForm" property="today.calInfo" /> 11 12 13 <%-- 12 14 <daylabels> 13 15 <logic:iterate id="dayLabels" name="calForm" property="forLabels.dayLabels"> … … 21 23 <start><bean:write name="calForm" property="viewStartDate.day"/></start> 22 24 </dayvalues> 25 --%> 26 <daylabels> 27 <logic:iterate id="dayLabel" name="calInfo" property="dayLabels"> 28 <val><bean:write name="dayLabel"/></val> 29 </logic:iterate> 30 </daylabels> 31 <dayvalues> 32 <logic:iterate id="dayVal" name="calInfo" property="dayVals"> 33 <val><bean:write name="dayVal"/></val> 34 </logic:iterate> 35 <start><bean:write name="calForm" property="viewStartDate.day"/></start> 36 </dayvalues> 23 37 <daynames> 24 <logic:iterate id="dayName" name="cal Form" property="today.calInfo.dayNamesAdjusted">38 <logic:iterate id="dayName" name="calInfo" property="dayNamesAdjusted"> 25 39 <val><bean:write name="dayName"/></val> 26 40 </logic:iterate> 27 41 </daynames> 28 42 <shortdaynames> 29 <logic:iterate id="shortDayName" name="cal Form" property="today.calInfo.shortDayNamesAdjusted">43 <logic:iterate id="shortDayName" name="calInfo" property="shortDayNamesAdjusted"> 30 44 <val><bean:write name="shortDayName"/></val> 31 45 </logic:iterate> trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
r17 r27 56 56 57 57 import org.bedework.appcommon.BedeworkDefs; 58 import org.bedework.appcommon.CalendarInfo; 58 59 import org.bedework.appcommon.DayView; 59 60 import org.bedework.appcommon.MonthView; … … 767 768 public MyCalendarVO getToday() { 768 769 if (today == null) { 770 // XXX locale 769 771 today = new MyCalendarVO(); 770 772 } 771 773 return today; 774 } 775 776 /** 777 * @return calendar info 778 */ 779 public CalendarInfo getCalInfo() { 780 return getToday().getCalInfo(); 772 781 } 773 782 … … 1098 1107 switch (curViewPeriod) { 1099 1108 case BedeworkDefs.dayView: 1100 setCurTimeView(new DayView( viewMcDate, getCalSvcI(), debug));1109 setCurTimeView(new DayView(getCalInfo(), viewMcDate, getCalSvcI(), debug)); 1101 1110 break; 1102 1111 case BedeworkDefs.weekView: 1103 setCurTimeView(new WeekView( viewMcDate, getCalSvcI(), debug));1112 setCurTimeView(new WeekView(getCalInfo(), viewMcDate, getCalSvcI(), debug)); 1104 1113 break; 1105 1114 case BedeworkDefs.monthView: 1106 setCurTimeView(new MonthView( viewMcDate, getCalSvcI(), debug));1115 setCurTimeView(new MonthView(getCalInfo(), viewMcDate, getCalSvcI(), debug)); 1107 1116 break; 1108 1117 case BedeworkDefs.yearView: 1109 setCurTimeView(new YearView( viewMcDate, getCalSvcI(),1118 setCurTimeView(new YearView(getCalInfo(), viewMcDate, getCalSvcI(), 1110 1119 getShowYearData(), debug)); 1111 1120 break; … … 1782 1791 public EventDates getEventDates() { 1783 1792 if (eventDates == null) { 1784 eventDates = new EventDates(getCalSvcI(), hour24, minIncrement, err, debug); 1793 eventDates = new EventDates(getCalSvcI(), getCalInfo(), 1794 hour24, minIncrement, err, debug); 1785 1795 } 1786 1796 trunk/calendar3/webcommon/src/org/bedework/webcommon/EntityDates.java
r2 r27 55 55 package org.bedework.webcommon; 56 56 57 import org.bedework.appcommon.CalendarInfo; 57 58 import org.bedework.calsvci.CalSvcI; 58 59 … … 69 70 70 71 protected CalSvcI svci; 72 private CalendarInfo calInfo; 71 73 72 74 protected boolean hour24; … … 83 85 * 84 86 * @param svci 87 * @param calInfo 85 88 * @param hour24 86 89 * @param minIncrement … … 88 91 * @param debug 89 92 */ 90 public EntityDates(CalSvcI svci, boolean hour24, int minIncrement, 93 public EntityDates(CalSvcI svci, CalendarInfo calInfo, 94 boolean hour24, int minIncrement, 91 95 MessageEmit err, boolean debug) { 92 96 this.svci = svci; 97 this.calInfo = calInfo; 93 98 this.hour24 = hour24; 94 99 this.minIncrement = minIncrement; … … 114 119 public TimeDateComponents getNowTimeComponents() { 115 120 try { 116 TimeDateComponents tc = new TimeDateComponents(svci, minIncrement,121 TimeDateComponents tc = new TimeDateComponents(svci, calInfo, minIncrement, 117 122 hour24, 118 123 debug); trunk/calendar3/webcommon/src/org/bedework/webcommon/EventDates.java
r2 r27 55 55 package org.bedework.webcommon; 56 56 57 import org.bedework.appcommon.CalendarInfo; 57 58 import org.bedework.calfacade.BwDateTime; 58 59 import org.bedework.calfacade.BwEvent; … … 85 86 /** 86 87 * @param svci 88 * @param calInfo 87 89 * @param hour24 88 90 * @param minIncrement … … 90 92 * @param debug 91 93 */ 92 public EventDates(CalSvcI svci, boolean hour24, int minIncrement, 94 public EventDates(CalSvcI svci, CalendarInfo calInfo, 95 boolean hour24, int minIncrement, 93 96 MessageEmit err, boolean debug) { 94 super(svci, hour24, minIncrement, err, debug);97 super(svci, calInfo, hour24, minIncrement, err, debug); 95 98 } 96 99 trunk/calendar3/webcommon/src/org/bedework/webcommon/TimeDateComponents.java
r2 r27 55 55 package org.bedework.webcommon; 56 56 57 import org.bedework.appcommon.CalendarInfo; 57 58 import org.bedework.calfacade.BwDateTime; 58 59 import org.bedework.calfacade.CalFacadeException; … … 97 98 private static final String[] DEFAULT_AMPM_LABELS = {"am", "pm"}; 98 99 99 /* * default labels for the dates in a month */100 private static String[] defaultDayLabels =101 new String[maximumValues(Calendar.DAY_OF_MONTH)];102 / ** default internal values for the dates in a month */103 private static String[] defaultDayVals =104 new String[maximumValues(Calendar.DAY_OF_MONTH)];100 /* * default labels for the dates in a month */ 101 //private static String[] defaultDayLabels = 102 // new String[maximumValues(Calendar.DAY_OF_MONTH)]; 103 //** default internal values for the dates in a month */ 104 //private static String[] defaultDayVals = 105 // new String[maximumValues(Calendar.DAY_OF_MONTH)]; 105 106 106 107 /** default labels for the months of the year */ … … 150 151 Calendar cal = Calendar.getInstance(/* XXX locale?????*/); 151 152 153 /* 152 154 for (int i = 0, dateOfMonth = cal.getMinimum(Calendar.DAY_OF_MONTH); 153 155 i < defaultDayLabels.length; i++, dateOfMonth++) { … … 157 159 defaultDayVals[i] = twoDigit(dateOfMonth); 158 160 } 161 */ 159 162 160 163 cal.set(Calendar.MONTH, cal.getMinimum(Calendar.MONTH)); … … 211 214 212 215 private CalSvcI svci; 216 private CalendarInfo calInfo; 213 217 214 218 /** Holds time and date information */ 215 219 private Calendar cal; 216 220 217 private String[] dayLabels;218 private String[] dayVals;221 //private String[] dayLabels; 222 //private String[] dayVals; 219 223 private String[] monthLabels; 220 224 private String[] monthVals; … … 256 260 * 257 261 * @param svci 262 * @param calInfo 258 263 * @param minuteIncrement increment for minutes: ≤ 1 is all, 259 264 * 5 is every 5 minutes, etc … … 263 268 * arrays 264 269 */ 265 public TimeDateComponents(CalSvcI svci, int minuteIncrement, 270 public TimeDateComponents(CalSvcI svci, 271 CalendarInfo calInfo, 272 int minuteIncrement, 266 273 boolean hour24, 267 274 boolean debug) throws TimeDateException { … … 270 277 } 271 278 this.svci = svci; 272 273 init(defaultDayLabels, 274 defaultDayVals, 275 defaultMonthLabels, 276 defaultMonthVals, 277 hour24 ? defaultHour24Labels : defaultHourLabels, 278 hour24 ? defaultHour24Vals : defaultHourVals, 279 defaultMinuteLabels, 280 defaultMinuteVals, 281 minuteIncrement, 282 DEFAULT_AMPM_LABELS, 283 hour24, 284 debug); 285 } 286 287 /* See XXX note below before getter/setter methods if you want to 288 make this constructor non-private. 289 * / 290 / * * Set up instance of this class. 291 * 292 * @param dayLabels external array of labels used for timedate 293 * @param dayVals internal array of values used for timedate 294 * @param monthLabels external array of labels used for timedate 295 * @param monthVals internal array of values used for timedate 296 * @param hourLabels external array of labels used for timedate 297 * @param hourVals internal array of values used for timedate 298 * @param minuteLabels external array of labels used for timedate 299 * @param minuteVals internal array of values used for timedate 300 * @param minuteIncrement increment for minutes, 0, 1 is all, 301 * 5 is every 5 inutes etc. 302 * @param ampmLabels internal array of values used for timedate 303 * @param hour24 true if we ignore am/pm and use 24hr clock 304 * @exception TimeDateException if there is a problem with one of the 305 * minutes arrays 306 * / 307 private TimeDateComponents(String[] dayLabels, 308 String[] dayVals, 309 String[] monthLabels, 310 String[] monthVals, 311 String[] hourLabels, 312 String[] hourVals, 313 String[] minuteLabels, 314 String[] minuteVals, 315 int minuteIncrement, 316 String[] ampmLabels, 317 boolean hour24, 318 boolean debug) throws TimeDateException { 319 init(dayLabels, 320 dayVals, 321 monthLabels, 322 monthVals, 323 hourLabels, 324 hourVals, 325 minuteLabels, 326 minuteVals, 327 minuteIncrement, 328 ampmLabels, 329 hour24, 330 debug); 331 } */ 332 333 /** Set up instance of this class 334 * 335 * @param dayLabels external array of labels used for timedate 336 * @param dayVals internal array of values used for timedate 337 * @param monthLabels external array of labels used for timedate 338 * @param monthVals internal array of values used for timedate 339 * @param hourLabels external array of labels used for timedate 340 * @param hourVals internal array of values used for timedate 341 * @param minuteLabels external array of labels used for timedate 342 * @param minuteVals internal array of values used for timedate 343 * @param minuteIncrement increment for minutes, ≤ 1 is all, 344 * 5 is every 5 minutes etc. 345 * @param ampmLabels internal array of values used for timedate 346 * @param hour24 true if we ignore am/pm and use 24hr clock 347 * @exception TimeDateException if there is a problem with one of the 348 * minutes arrays 349 */ 350 private void init(String[] dayLabels, 351 String[] dayVals, 352 String[] monthLabels, 353 String[] monthVals, 354 String[] hourLabels, 355 String[] hourVals, 356 String[] minuteLabels, 357 String[] minuteVals, 358 int minuteIncrement, 359 String[] ampmLabels, 360 boolean hour24, 361 boolean debug) throws TimeDateException { 362 this.dayLabels = dayLabels; 363 this.dayVals = dayVals; 364 this.monthLabels = monthLabels; 365 this.monthVals = monthVals; 366 this.hourLabels = hourLabels; 367 this.hourVals = hourVals; 368 369 setMinutes(minuteLabels, minuteVals, minuteIncrement); 370 371 this.ampmLabels = ampmLabels; 279 this.calInfo = calInfo; 372 280 this.hour24 = hour24; 373 281 //this.debug = debug; 282 283 //dayLabels = defaultDayLabels; 284 //dayVals = defaultDayVals; 285 monthLabels = defaultMonthLabels; 286 monthVals = defaultMonthVals; 287 if (hour24) { 288 hourLabels = defaultHour24Labels; 289 hourVals = defaultHour24Vals; 290 } else { 291 hourLabels = defaultHourLabels; 292 hourVals = defaultHourVals; 293 } 294 295 setMinutes(defaultMinuteLabels, defaultMinuteVals, minuteIncrement); 296 297 this.ampmLabels = DEFAULT_AMPM_LABELS; 374 298 } 375 299 … … 414 338 415 339 /** 340 * @return CalendarInfo 341 */ 342 public CalendarInfo getCalInfo() { 343 return calInfo; 344 } 345 346 /** 416 347 * 417 348 */ … … 431 362 */ 432 363 public String[] getDayLabels() { 433 return this.dayLabels;364 return getCalInfo().getDayLabels(); 434 365 } 435 366 … … 438 369 */ 439 370 public String[] getDayVals() { 440 return this.dayVals;371 return getCalInfo().getDayVals(); 441 372 } 442 373 … … 626 557 public String getDay() { 627 558 // Calendar.DAY_OF_MONTH returns 1-31 628 return dayVals[getCal().get(Calendar.DAY_OF_MONTH) - 1];559 return getDayVals()[getCal().get(Calendar.DAY_OF_MONTH) - 1]; 629 560 } 630 561
