List of usage examples for java.util TimeZone getDisplayName
public final String getDisplayName(boolean daylight, int style)
From source file:org.sakaiproject.calendar.tool.CalendarAction.java
public String buildMainPanelContext(VelocityPortlet portlet, Context context, RunData runData, SessionState sstate) {/* w ww.j av a2 s . c o m*/ CalendarActionState state = (CalendarActionState) getState(portlet, runData, CalendarActionState.class); String template = (String) getContext(runData).get("template"); // get current state (view); if not set use tool default or default to week view String stateName = state.getState(); if (stateName == null) { stateName = portlet.getPortletConfig().getInitParameter(PORTLET_CONFIG_DEFAULT_VIEW); if (stateName == null) stateName = ServerConfigurationService.getString("calendar.default.view", "week"); state.setState(stateName); } if (stateName.equals(STATE_SCHEDULE_IMPORT)) { buildImportContext(portlet, context, runData, state, getSessionState(runData)); } else if (stateName.equals(STATE_MERGE_CALENDARS)) { // build the context to display the options panel mergedCalendarPage.buildContext(portlet, context, runData, state, getSessionState(runData)); } else if (stateName.equals(STATE_CALENDAR_SUBSCRIPTIONS)) { // build the context to display the options panel calendarSubscriptionsPage.buildContext(portlet, context, runData, state, getSessionState(runData)); } else if (stateName.equals(STATE_CUSTOMIZE_CALENDAR)) { // build the context to display the options panel //needed to track when user clicks 'Save' or 'Cancel' String sstatepage = ""; Object statepageAttribute = sstate.getAttribute(SSTATE_ATTRIBUTE_ADDFIELDS_PAGE); if (statepageAttribute != null) { sstatepage = statepageAttribute.toString(); } if (!sstatepage.equals(PAGE_ADDFIELDS)) { sstate.setAttribute(SSTATE_ATTRIBUTE_ADDFIELDS_PAGE, PAGE_MAIN); } customizeCalendarPage.buildContext(portlet, context, runData, state, getSessionState(runData)); } else if ((stateName.equals("revise")) || (stateName.equals("goToReviseCalendar"))) { // build the context for the normal view show buildReviseContext(portlet, context, runData, state); } else if (stateName.equals("description")) { // build the context for the basic step of adding file buildDescriptionContext(portlet, context, runData, state); } else if (stateName.equals("year")) { // build the context for the advanced step of adding file buildYearContext(portlet, context, runData, state); } else if (stateName.equals("month")) { // build the context for the basic step of adding folder buildMonthContext(portlet, context, runData, state); } else if (stateName.equals("day")) { // build the context for the basic step of adding simple text buildDayContext(portlet, context, runData, state); } else if (stateName.equals("week")) { // build the context for the basic step of delete confirm page buildWeekContext(portlet, context, runData, state); } else if (stateName.equals("new")) { // build the context to display the property list buildNewContext(portlet, context, runData, state); } else if (stateName.equals("icalEx")) { buildIcalExportPanelContext(portlet, context, runData, state); } else if (stateName.equals("opaqueUrlClean")) { buildOpaqueUrlCleanContext(portlet, context, runData, state); } else if (stateName.equals("opaqueUrlExisting")) { buildOpaqueUrlExistingContext(portlet, context, runData, state); } else if (stateName.equals("delete")) { // build the context to display the property list buildDeleteContext(portlet, context, runData, state); } else if (stateName.equals("list")) { // build the context to display the list view buildListContext(portlet, context, runData, state); } else if (stateName.equals(STATE_SET_FREQUENCY)) { buildFrequencyContext(portlet, context, runData, state); } if (stateName.equals("description") || stateName.equals("year") || stateName.equals("month") || stateName.equals("day") || stateName.equals("week") || stateName.equals("list")) { // SAK-23566 capture the view calendar events EventTrackingService ets = (EventTrackingService) ComponentManager.get(EventTrackingService.class); String calendarRef = state.getPrimaryCalendarReference(); if (ets != null && calendarRef != null) { // need to cleanup the cal references which look like /calendar/calendar/4ea74c4d-3f9e-4c32-b03f-15e7915e6051/main String eventRef = StringUtils.replace(calendarRef, "/main", "/" + stateName); String calendarEventId = state.getCalendarEventId(); if (StringUtils.isNotBlank(calendarEventId)) { eventRef += "/" + calendarEventId; } ets.post(ets.newEvent("calendar.read", eventRef, false)); } } TimeZone timeZone = TimeService.getLocalTimeZone(); context.put("timezone", timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), TimeZone.SHORT)); //the AM/PM strings context.put("amString", CalendarUtil.getLocalAMString()); context.put("pmString", CalendarUtil.getLocalPMString()); // group realted variables context.put("siteAccess", CalendarEvent.EventAccess.SITE); context.put("groupAccess", CalendarEvent.EventAccess.GROUPED); context.put("message", state.getState()); context.put("state", state.getKey()); context.put("tlang", rb); context.put("config", configProps); context.put("dateFormat", getDateFormatString()); context.put("timeFormat", getTimeFormatString()); return template; }