List of usage examples for java.util Calendar MONDAY
int MONDAY
To view the source code for java.util Calendar MONDAY.
Click Source Link
From source file:org.apache.jsp.html.taglib.ui.calendar.page_jsp.java
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null;/*from w w w . ja v a2 s. com*/ HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; /** * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ out.write('\n'); out.write('\n'); /** * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ out.write('\n'); out.write('\n'); /** * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); out.write("\n"); // liferay-theme:defineObjects com.liferay.taglib.theme.DefineObjectsTag _jspx_th_liferay_002dtheme_005fdefineObjects_005f0 = (com.liferay.taglib.theme.DefineObjectsTag) _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody .get(com.liferay.taglib.theme.DefineObjectsTag.class); _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setPageContext(_jspx_page_context); _jspx_th_liferay_002dtheme_005fdefineObjects_005f0.setParent(null); int _jspx_eval_liferay_002dtheme_005fdefineObjects_005f0 = _jspx_th_liferay_002dtheme_005fdefineObjects_005f0 .doStartTag(); if (_jspx_th_liferay_002dtheme_005fdefineObjects_005f0 .doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0); return; } _005fjspx_005ftagPool_005fliferay_002dtheme_005fdefineObjects_005fnobody .reuse(_jspx_th_liferay_002dtheme_005fdefineObjects_005f0); com.liferay.portal.theme.ThemeDisplay themeDisplay = null; com.liferay.portal.model.Company company = null; com.liferay.portal.model.Account account = null; com.liferay.portal.model.User user = null; com.liferay.portal.model.User realUser = null; com.liferay.portal.model.Contact contact = null; com.liferay.portal.model.Layout layout = null; java.util.List layouts = null; java.lang.Long plid = null; com.liferay.portal.model.LayoutTypePortlet layoutTypePortlet = null; java.lang.Long scopeGroupId = null; com.liferay.portal.security.permission.PermissionChecker permissionChecker = null; java.util.Locale locale = null; java.util.TimeZone timeZone = null; com.liferay.portal.model.Theme theme = null; com.liferay.portal.model.ColorScheme colorScheme = null; com.liferay.portal.theme.PortletDisplay portletDisplay = null; java.lang.Long portletGroupId = null; themeDisplay = (com.liferay.portal.theme.ThemeDisplay) _jspx_page_context.findAttribute("themeDisplay"); company = (com.liferay.portal.model.Company) _jspx_page_context.findAttribute("company"); account = (com.liferay.portal.model.Account) _jspx_page_context.findAttribute("account"); user = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("user"); realUser = (com.liferay.portal.model.User) _jspx_page_context.findAttribute("realUser"); contact = (com.liferay.portal.model.Contact) _jspx_page_context.findAttribute("contact"); layout = (com.liferay.portal.model.Layout) _jspx_page_context.findAttribute("layout"); layouts = (java.util.List) _jspx_page_context.findAttribute("layouts"); plid = (java.lang.Long) _jspx_page_context.findAttribute("plid"); layoutTypePortlet = (com.liferay.portal.model.LayoutTypePortlet) _jspx_page_context .findAttribute("layoutTypePortlet"); scopeGroupId = (java.lang.Long) _jspx_page_context.findAttribute("scopeGroupId"); permissionChecker = (com.liferay.portal.security.permission.PermissionChecker) _jspx_page_context .findAttribute("permissionChecker"); locale = (java.util.Locale) _jspx_page_context.findAttribute("locale"); timeZone = (java.util.TimeZone) _jspx_page_context.findAttribute("timeZone"); theme = (com.liferay.portal.model.Theme) _jspx_page_context.findAttribute("theme"); colorScheme = (com.liferay.portal.model.ColorScheme) _jspx_page_context.findAttribute("colorScheme"); portletDisplay = (com.liferay.portal.theme.PortletDisplay) _jspx_page_context .findAttribute("portletDisplay"); portletGroupId = (java.lang.Long) _jspx_page_context.findAttribute("portletGroupId"); out.write('\n'); out.write('\n'); /** * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ out.write('\n'); out.write('\n'); PortletRequest portletRequest = (PortletRequest) request .getAttribute(JavaConstants.JAVAX_PORTLET_REQUEST); PortletResponse portletResponse = (PortletResponse) request .getAttribute(JavaConstants.JAVAX_PORTLET_RESPONSE); String namespace = StringPool.BLANK; boolean useNamespace = GetterUtil.getBoolean((String) request.getAttribute("aui:form:useNamespace"), true); if ((portletResponse != null) && useNamespace) { namespace = portletResponse.getNamespace(); } String currentURL = PortalUtil.getCurrentURL(request); out.write('\n'); out.write('\n'); /** * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ out.write('\n'); out.write('\n'); out.write('\n'); out.write('\n'); int month = GetterUtil.getInteger((String) request.getAttribute("liferay-ui:calendar:month")); int day = GetterUtil.getInteger((String) request.getAttribute("liferay-ui:calendar:day")); int year = GetterUtil.getInteger((String) request.getAttribute("liferay-ui:calendar:year")); String headerPattern = (String) request.getAttribute("liferay-ui:calendar:headerPattern"); Format headerFormat = (Format) request.getAttribute("liferay-ui:calendar:headerFormat"); Set data = (Set) request.getAttribute("liferay-ui:calendar:data"); boolean showAllPotentialWeeks = GetterUtil .getBoolean((String) request.getAttribute("liferay-ui:calendar:showAllPotentialWeeks")); Calendar selCal = CalendarFactoryUtil.getCalendar(timeZone, locale); selCal.set(Calendar.MONTH, month); selCal.set(Calendar.DATE, day); selCal.set(Calendar.YEAR, year); int selMonth = selCal.get(Calendar.MONTH); int selDay = selCal.get(Calendar.DATE); int selYear = selCal.get(Calendar.YEAR); int maxDayOfMonth = selCal.getActualMaximum(Calendar.DATE); selCal.set(Calendar.DATE, 1); int dayOfWeek = selCal.get(Calendar.DAY_OF_WEEK); selCal.set(Calendar.DATE, selDay); Calendar curCal = CalendarFactoryUtil.getCalendar(timeZone, locale); int curMonth = curCal.get(Calendar.MONTH); int curDay = curCal.get(Calendar.DATE); int curYear = curCal.get(Calendar.YEAR); Calendar prevCal = (Calendar) selCal.clone(); prevCal.add(Calendar.MONTH, -1); int maxDayOfPrevMonth = prevCal.getActualMaximum(Calendar.DATE); int weekNumber = 1; out.write("\n"); out.write("\n"); out.write("<div class=\"taglib-calendar\">\n"); out.write("\t<table class=\"lfr-table calendar-panel\">\n"); out.write("\n"); out.write("\t"); // c:if org.apache.taglibs.standard.tag.rt.core.IfTag _jspx_th_c_005fif_005f0 = (org.apache.taglibs.standard.tag.rt.core.IfTag) _005fjspx_005ftagPool_005fc_005fif_0026_005ftest .get(org.apache.taglibs.standard.tag.rt.core.IfTag.class); _jspx_th_c_005fif_005f0.setPageContext(_jspx_page_context); _jspx_th_c_005fif_005f0.setParent(null); // /html/taglib/ui/calendar/page.jsp(61,1) name = test type = boolean reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null _jspx_th_c_005fif_005f0.setTest(Validator.isNotNull(headerPattern) || (headerFormat != null)); int _jspx_eval_c_005fif_005f0 = _jspx_th_c_005fif_005f0.doStartTag(); if (_jspx_eval_c_005fif_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) { do { out.write("\n"); out.write("\n"); out.write("\t\t"); Format dateFormat = headerFormat; if (Validator.isNotNull(headerPattern)) { dateFormat = FastDateFormatFactoryUtil.getSimpleDateFormat(headerPattern, locale); } out.write("\n"); out.write("\n"); out.write("\t\t<tr class=\"calendar-header\">\n"); out.write("\t\t\t<th colspan=\"7\">\n"); out.write("\t\t\t\t"); out.print(dateFormat.format(selCal.getTime())); out.write("\n"); out.write("\t\t\t</th>\n"); out.write("\t\t</tr>\n"); out.write("\t"); int evalDoAfterBody = _jspx_th_c_005fif_005f0.doAfterBody(); if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break; } while (true); } if (_jspx_th_c_005fif_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) { _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0); return; } _005fjspx_005ftagPool_005fc_005fif_0026_005ftest.reuse(_jspx_th_c_005fif_005f0); out.write("\n"); out.write("\n"); out.write("\t<tr class=\"portlet-section-header results-header\">\n"); out.write("\n"); out.write("\t\t"); for (int i = 0; i < 7; i++) { int daysIndex = (selCal.getFirstDayOfWeek() + i - 1) % 7; String className = StringPool.BLANK; if (i == 0) { className = "first"; } else if (i == 6) { className = "last"; } out.write("\n"); out.write("\n"); out.write("\t\t\t<th class=\""); out.print(className); out.write("\">\n"); out.write("\t\t\t\t"); out.print(LanguageUtil.get(pageContext, CalendarUtil.DAYS_ABBREVIATION[daysIndex])); out.write("\n"); out.write("\t\t\t</th>\n"); out.write("\n"); out.write("\t\t"); } out.write("\n"); out.write("\n"); out.write("\t</tr>\n"); out.write("\t<tr>\n"); out.write("\n"); out.write("\t\t"); if (((selCal.getFirstDayOfWeek()) == Calendar.MONDAY)) { if (dayOfWeek == 1) { dayOfWeek += 6; } else { dayOfWeek--; } } maxDayOfPrevMonth = (maxDayOfPrevMonth - dayOfWeek) + 1; for (int i = 1; i < dayOfWeek; i++) { String className = "calendar-inactive calendar-previous-month"; if (i == 1) { className += " first"; } else if (i == 7) { className += " last"; } out.write("\n"); out.write("\n"); out.write("\t\t\t<td class=\""); out.print(className); out.write('"'); out.write('>'); out.print(maxDayOfPrevMonth + i); out.write("</td>\n"); out.write("\n"); out.write("\t\t"); } for (int i = 1; i <= maxDayOfMonth; i++) { if (dayOfWeek > 7) { out.write("\n"); out.write("\n"); out.write("\t\t\t\t</tr>\n"); out.write("\t\t\t\t<tr>\n"); out.write("\n"); out.write("\t\t"); dayOfWeek = 1; weekNumber++; } Calendar tempCal = (Calendar) selCal.clone(); tempCal.set(Calendar.MONTH, selMonth); tempCal.set(Calendar.DATE, i); tempCal.set(Calendar.YEAR, selYear); boolean hasData = (data != null) && data.contains(new Integer(i)); String className = ""; if ((selMonth == curMonth) && (i == curDay) && (selYear == curYear)) { className = "calendar-current-day portlet-section-selected"; } if (hasData) { className += " has-events"; } if (dayOfWeek == 1) { className += " first"; } else if (dayOfWeek == 7) { className += " last"; } dayOfWeek++; out.write("\n"); out.write("\n"); out.write("\t\t\t<td class=\""); out.print(className); out.write("\">\n"); out.write("\t\t\t\t<a href=\"javascript:"); out.print(namespace); out.write("updateCalendar("); out.print(selMonth); out.write(','); out.write(' '); out.print(i); out.write(','); out.write(' '); out.print(selYear); out.write(");\"><span>"); out.print(i); out.write("</span></a>\n"); out.write("\t\t\t</td>\n"); out.write("\n"); out.write("\t\t"); } int dayOfNextMonth = 1; for (int i = 7; i >= dayOfWeek; i--) { String className = "calendar-inactive calendar-next-month"; if (dayOfWeek == 1) { className += " first"; } else if (i == dayOfWeek) { className += " last"; } out.write("\n"); out.write("\n"); out.write("\t\t\t<td class=\""); out.print(className); out.write('"'); out.write('>'); out.print(dayOfNextMonth++); out.write("</td>\n"); out.write("\n"); out.write("\t\t"); } if (showAllPotentialWeeks && weekNumber < 6) { out.write("\n"); out.write("\n"); out.write("\t\t\t<tr>\n"); out.write("\n"); out.write("\t\t\t\t"); for (int i = 1; i <= 7; i++) { String className = "calendar-inactive calendar-next-month"; if (i == 1) { className += " first"; } else if (i == 7) { className += " last"; } out.write("\n"); out.write("\n"); out.write("\t\t\t\t\t<td class=\""); out.print(className); out.write('"'); out.write('>'); out.print(dayOfNextMonth++); out.write("</td>\n"); out.write("\n"); out.write("\t\t\t\t"); } out.write("\n"); out.write("\n"); out.write("\t\t\t</tr>\n"); out.write("\n"); out.write("\t\t"); } out.write("\n"); out.write("\n"); out.write("\t</tr>\n"); out.write("\t</table>\n"); out.write("</div>"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }
From source file:net.sourceforge.fenixedu.presentationTier.TagLib.sop.examsMapNew.ExamsMapRenderer.java
private void renderLabelsForRowOfDays(StringBuilder strBuffer, int week, PageContext pageContext) { for (int slot = 0; slot < daysOfWeek.length; slot++) { ExamsMapSlot examsMapSlot = (ExamsMapSlot) examsMap.getDays().get(week * daysOfWeek.length + slot); String classCSS = "exam_cell_day"; if (examsMapSlot.getDay().get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) { classCSS += "_first"; }//from ww w. ja v a 2 s . c o m strBuffer.append("<td ").append("class='").append(classCSS).append("'>"); examsMapSlotContentRenderer.renderDayLabel(examsMapSlot, examsMap, user, pageContext); strBuffer.append(examsMapSlotContentRenderer.renderDayLabel(examsMapSlot, examsMap, user, pageContext)); strBuffer.append("</td>"); } }
From source file:com.saulcintero.moveon.fragments.History.java
private void getWeek() { Calendar c1 = Calendar.getInstance(); // first day of week c1.setFirstDayOfWeek(Calendar.MONDAY); c1.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); int y = c1.get(Calendar.YEAR); int m = c1.get(Calendar.MONTH) + 1; int d = c1.get(Calendar.DAY_OF_MONTH); mYear1 = String.valueOf(y);/*from w w w . j a v a 2 s . c om*/ mMonth1 = String.valueOf(m); if (m < 10) mMonth1 = "0" + mMonth1; mDay1 = String.valueOf(d); if (d < 10) mDay1 = "0" + mDay1; // last day of week c1.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); int y2 = c1.get(Calendar.YEAR); int m2 = c1.get(Calendar.MONTH) + 1; int d2 = c1.get(Calendar.DAY_OF_MONTH); mYear2 = String.valueOf(y2); mMonth2 = String.valueOf(m2); if (m2 < 10) mMonth2 = "0" + mMonth2; mDay2 = String.valueOf(d2); if (d2 < 10) mDay2 = "0" + mDay2; }
From source file:org.exist.xquery.modules.mail.SendEmailFunction.java
/** * Returns the current date and time in an RFC822 format, suitable for an email Date Header * * @return RFC822 formated date and time as a String *//* w ww .ja v a 2s .co m*/ private String getDateRFC822() { String dateString = new String(); final Calendar rightNow = Calendar.getInstance(); //Day of the week switch (rightNow.get(Calendar.DAY_OF_WEEK)) { case Calendar.MONDAY: dateString = "Mon"; break; case Calendar.TUESDAY: dateString = "Tue"; break; case Calendar.WEDNESDAY: dateString = "Wed"; break; case Calendar.THURSDAY: dateString = "Thu"; break; case Calendar.FRIDAY: dateString = "Fri"; break; case Calendar.SATURDAY: dateString = "Sat"; break; case Calendar.SUNDAY: dateString = "Sun"; break; } dateString += ", "; //Date dateString += rightNow.get(Calendar.DAY_OF_MONTH); dateString += " "; //Month switch (rightNow.get(Calendar.MONTH)) { case Calendar.JANUARY: dateString += "Jan"; break; case Calendar.FEBRUARY: dateString += "Feb"; break; case Calendar.MARCH: dateString += "Mar"; break; case Calendar.APRIL: dateString += "Apr"; break; case Calendar.MAY: dateString += "May"; break; case Calendar.JUNE: dateString += "Jun"; break; case Calendar.JULY: dateString += "Jul"; break; case Calendar.AUGUST: dateString += "Aug"; break; case Calendar.SEPTEMBER: dateString += "Sep"; break; case Calendar.OCTOBER: dateString += "Oct"; break; case Calendar.NOVEMBER: dateString += "Nov"; break; case Calendar.DECEMBER: dateString += "Dec"; break; } dateString += " "; //Year dateString += rightNow.get(Calendar.YEAR); dateString += " "; //Time String tHour = Integer.toString(rightNow.get(Calendar.HOUR_OF_DAY)); if (tHour.length() == 1) { tHour = "0" + tHour; } String tMinute = Integer.toString(rightNow.get(Calendar.MINUTE)); if (tMinute.length() == 1) { tMinute = "0" + tMinute; } String tSecond = Integer.toString(rightNow.get(Calendar.SECOND)); if (tSecond.length() == 1) { tSecond = "0" + tSecond; } dateString += tHour + ":" + tMinute + ":" + tSecond + " "; //TimeZone Correction String tzSign = new String(); String tzHours = new String(); String tzMinutes = new String(); final TimeZone thisTZ = rightNow.getTimeZone(); int tzOffset = thisTZ.getOffset(rightNow.getTime().getTime()); //get timezone offset in milliseconds tzOffset = (tzOffset / 1000); //convert to seconds tzOffset = (tzOffset / 60); //convert to minutes //Sign if (tzOffset > 1) { tzSign = "+"; } else { tzSign = "-"; tzOffset *= -1; } //Calc Hours and Minutes? if (tzOffset >= 60) { //Minutes and Hours tzHours += (tzOffset / 60); //hours // do we need to prepend a 0 if (tzHours.length() == 1) { tzHours = "0" + tzHours; } tzMinutes += (tzOffset % 60); //minutes // do we need to prepend a 0 if (tzMinutes.length() == 1) { tzMinutes = "0" + tzMinutes; } } else { //Just Minutes tzHours = "00"; tzMinutes += tzOffset; // do we need to prepend a 0 if (tzMinutes.length() == 1) { tzMinutes = "0" + tzMinutes; } } dateString += tzSign + tzHours + tzMinutes; return dateString; }
From source file:com.alkacon.opencms.v8.calendar.CmsSerialDateWidget.java
/** * Returns the macro resolver with initialized macros to generate the serial date input form.<p> * /*from ww w . j a v a 2s.co m*/ * @param cms an initialized instance of a CmsObject * @param widgetDialog the dialog where the widget is used on * @param param the widget parameter to generate the widget for * @return the macro resolver with initialized macros */ protected CmsMacroResolver getMacroResolverForForm(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param) { CmsMacroResolver resolver = CmsMacroResolver.newInstance(); // set cms object and localized messages in resolver resolver.setCmsObject(cms); CmsMessages messages = new CmsMessages(CmsSerialDateWidget.class.getPackage().getName() + ".messages", widgetDialog.getLocale()); resolver.setMessages(messages); // delete empty macros which were not replaced resolver.setKeepEmptyMacros(false); // create the serial entry date object String paramValue = param.getStringValue(cms); Map<String, String> params = CmsStringUtil.splitAsMap(paramValue, String.valueOf(CmsProperty.VALUE_LIST_DELIMITER), String.valueOf(CmsProperty.VALUE_MAP_DELIMITER)); // create the entry date from the field values CmsCalendarEntryDateSerial entryDate = CmsCalendarSerialDateFactory.getSerialDate(params, widgetDialog.getLocale()); if (entryDate == null) { // no entry date created yet, build an empty default date Calendar start = new GregorianCalendar(widgetDialog.getLocale()); Calendar end = (Calendar) start.clone(); entryDate = new CmsCalendarEntryDateSerial(start, end); entryDate.setSerialEndType(I_CmsCalendarSerialDateOptions.END_TYPE_NEVER); } // vars for daily options String dayDailyInterval = "1"; boolean dayEveryWorkingDay = false; // vars for weekly options String weekWeeklyInterval = "1"; // vars for monthly options int monthSelectedIndexWeekDayOfMonth = 0; int monthSelectedWeekDay = -1; String monthDayOfMonth = "1"; String monthMonthlyInterval = "1"; String monthMonthlyIntervalWeekDay = "1"; boolean monthUseWeekday = false; // vars for yearly options String yearDayOfMonth = "1"; boolean yearUseWeekday = false; int yearSelectedIndexMonth = 0; int yearSelectedIndexWeekDayOfMonth = 0; int yearSelectedWeekDayDay = -1; int yearSelectedIndexWeekDayMonth = 0; if (entryDate.getSerialOptions() != null) { // fill the variables depending on the selected serial date type String serialTypeMacroPrefix = MACRO_PREFIX_PARAMVALUE + PARAM_SERIALTYPE + "."; // set serial type radio selection resolver.addMacro(serialTypeMacroPrefix + entryDate.getSerialOptions().getSerialType(), ATTR_CHECKED); switch (entryDate.getSerialOptions().getSerialType()) { // set values for the selected serial type case I_CmsCalendarSerialDateOptions.TYPE_DAILY: CmsCalendarSerialDateDailyOptions dailyOptions = (CmsCalendarSerialDateDailyOptions) entryDate .getSerialOptions(); dayEveryWorkingDay = dailyOptions.isEveryWorkingDay(); dayDailyInterval = String.valueOf(dailyOptions.getDailyInterval()); break; case I_CmsCalendarSerialDateOptions.TYPE_WEEKLY: CmsCalendarSerialDateWeeklyOptions weeklyOptions = (CmsCalendarSerialDateWeeklyOptions) entryDate .getSerialOptions(); weekWeeklyInterval = String.valueOf(weeklyOptions.getWeeklyInterval()); // check the chosen week day checkboxes serialTypeMacroPrefix = MACRO_PREFIX_PARAMVALUE + PARAM_WEEK_WEEKDAY + "."; if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.MONDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.MONDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.TUESDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.TUESDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.WEDNESDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.WEDNESDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.THURSDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.THURSDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.FRIDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.FRIDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.SATURDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.SATURDAY, ATTR_CHECKED); } if (weeklyOptions.getWeekDays().contains(new Integer(Calendar.SUNDAY))) { resolver.addMacro(serialTypeMacroPrefix + Calendar.SUNDAY, ATTR_CHECKED); } break; case I_CmsCalendarSerialDateOptions.TYPE_MONTHLY: CmsCalendarSerialDateMonthlyOptions monthlyOptions = (CmsCalendarSerialDateMonthlyOptions) entryDate .getSerialOptions(); monthUseWeekday = monthlyOptions.isUseWeekDay(); if (!monthlyOptions.isUseWeekDay()) { monthDayOfMonth = String.valueOf(monthlyOptions.getDayOfMonth()); monthMonthlyInterval = String.valueOf(monthlyOptions.getMonthlyInterval()); } else { // set selected index of select boxes monthSelectedIndexWeekDayOfMonth = monthlyOptions.getDayOfMonth() - 1; monthSelectedWeekDay = monthlyOptions.getWeekDay(); monthMonthlyIntervalWeekDay = String.valueOf(monthlyOptions.getMonthlyInterval()); } break; case I_CmsCalendarSerialDateOptions.TYPE_YEARLY: CmsCalendarSerialDateYearlyOptions yearlyOptions = (CmsCalendarSerialDateYearlyOptions) entryDate .getSerialOptions(); yearUseWeekday = yearlyOptions.isUseWeekDay(); if (!yearlyOptions.isUseWeekDay()) { yearDayOfMonth = String.valueOf(yearlyOptions.getDayOfMonth()); yearSelectedIndexMonth = yearlyOptions.getMonth(); } else { yearSelectedIndexWeekDayOfMonth = yearlyOptions.getDayOfMonth() - 1; yearSelectedWeekDayDay = yearlyOptions.getWeekDay(); yearSelectedIndexWeekDayMonth = yearlyOptions.getMonth(); } break; default: // nothing do do here, should never happen } } else { // no serial entry created yet, add some defaults resolver.addMacro( MACRO_PREFIX_PARAMVALUE + PARAM_SERIALTYPE + "." + I_CmsCalendarSerialDateOptions.TYPE_DAILY, ATTR_CHECKED); resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_WEEK_WEEKDAY + "." + Calendar.MONDAY, ATTR_CHECKED); } // set time settings String startTime = getCalendarLocalizedTime(widgetDialog.getLocale(), widgetDialog.getMessages(), entryDate.getStartDate().getTimeInMillis(), false, true); resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_STARTTIME, startTime); String endTime = ""; if (!entryDate.getStartDate().equals(entryDate.getEndDate())) { // end time is different from start time, get localized value endTime = getCalendarLocalizedTime(widgetDialog.getLocale(), widgetDialog.getMessages(), entryDate.getEndDate().getTimeInMillis(), false, true); } resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_ENDTIME, endTime); resolver.addMacro("select.durationdays", buildSelectDurationDays(PARAM_DURATIONDAYS, messages, entryDate.getDuration())); // set found values to serial option tabs // daily options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_DAY_DAILYINTERVAL, dayDailyInterval); resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_DAY_EVERYWORKINGDAY + "." + dayEveryWorkingDay, ATTR_CHECKED); // weekly options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_WEEK_WEEKLYINTERVAL, weekWeeklyInterval); // monthly options // mark the correct radio resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_MONTH_SERIALMONTHDAY + "." + monthUseWeekday, ATTR_CHECKED); // set the macros for the day of month options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_MONTH_DAYOFMONTH, monthDayOfMonth); resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_MONTH_MONTHLYINTERVAL, monthMonthlyInterval); // set the macros for the week day of month options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_MONTH_MONTHLYINTERVALWEEKDAY, monthMonthlyIntervalWeekDay); // build the select boxes resolver.addMacro("select.monthnumberofweekday", buildSelectNumberOfWeekDayOfMonth( PARAM_MONTH_NUMBEROFWEEKDAYOFMONTH, "onfocus=\"document.getElementById('" + PARAM_MONTH_SERIALMONTHDAY + ".true').checked = true;\"", messages, monthSelectedIndexWeekDayOfMonth)); resolver.addMacro("select.monthweekday", buildSelectWeekDay(PARAM_MONTH_WEEKDAY, "onfocus=\"document.getElementById('" + PARAM_MONTH_SERIALMONTHDAY + ".true').checked = true;\"", messages, monthSelectedWeekDay)); // yearly options // mark the correct radio resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_YEAR_SERIALYEARDAY + "." + yearUseWeekday, ATTR_CHECKED); // set the macros for the day of month options resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_YEAR_DAYOFMONTH, yearDayOfMonth); resolver.addMacro("select.yearmonth", buildSelectMonth(PARAM_YEAR_MONTH, "onfocus=\"document.getElementById('" + PARAM_YEAR_SERIALYEARDAY + ".false').checked = true;\"", messages, yearSelectedIndexMonth)); // set the macros for the week day of month options resolver.addMacro("select.yearnumberofweekday", buildSelectNumberOfWeekDayOfMonth(PARAM_YEAR_WEEKDAYOFMONTH, "onfocus=\"document.getElementById('" + PARAM_YEAR_SERIALYEARDAY + ".true').checked = true;\"", messages, yearSelectedIndexWeekDayOfMonth)); resolver.addMacro("select.yearweekday", buildSelectWeekDay(PARAM_YEAR_WEEKDAY, "onfocus=\"document.getElementById('" + PARAM_YEAR_SERIALYEARDAY + ".true').checked = true;\"", messages, yearSelectedWeekDayDay)); resolver.addMacro("select.yearmonthweekday", buildSelectMonth(PARAM_YEAR_WEEKDAYMONTH, "onfocus=\"document.getElementById('" + PARAM_YEAR_SERIALYEARDAY + ".true').checked = true;\"", messages, yearSelectedIndexWeekDayMonth)); // set serial duration values // set start date resolver.addMacro("calendar.startdate", buildDateInput("startdate", widgetDialog, entryDate.getStartDate())); Calendar serialEndDate = entryDate.getSerialEndDate(); if (serialEndDate == null) { serialEndDate = entryDate.getStartDate(); } resolver.addMacro("calendar.serialenddate", buildDateInput("serialenddate", widgetDialog, serialEndDate)); // set occurences int occurences = 10; if (entryDate.getSerialEndType() == I_CmsCalendarSerialDateOptions.END_TYPE_TIMES) { occurences = entryDate.getOccurences(); } resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_OCCURENCES, String.valueOf(occurences)); // set the end type radio buttons resolver.addMacro(MACRO_PREFIX_PARAMVALUE + PARAM_ENDTYPE + "." + entryDate.getSerialEndType(), ATTR_CHECKED); return resolver; }
From source file:com.s3d.webapps.util.time.DateUtils.java
/** * <p>This constructs an <code>Iterator</code> over each day in a date * range defined by a focus date and range style.</p> * * <p>For instance, passing Thursday, July 4, 2002 and a * <code>RANGE_MONTH_SUNDAY</code> will return an <code>Iterator</code> * that starts with Sunday, June 30, 2002 and ends with Saturday, August 3, * 2002, returning a Calendar instance for each intermediate day.</p> * * <p>This method provides an iterator that returns Calendar objects. * The days are progressed using {@link Calendar#add(int, int)}.</p> * * @param focus the date to work with//w w w . jav a 2 s .co m * @param rangeStyle the style constant to use. Must be one of * {@link DateUtils#RANGE_MONTH_SUNDAY}, * {@link DateUtils#RANGE_MONTH_MONDAY}, * {@link DateUtils#RANGE_WEEK_SUNDAY}, * {@link DateUtils#RANGE_WEEK_MONDAY}, * {@link DateUtils#RANGE_WEEK_RELATIVE}, * {@link DateUtils#RANGE_WEEK_CENTER} * @return the date iterator * @throws IllegalArgumentException if the date is <code>null</code> * @throws IllegalArgumentException if the rangeStyle is invalid */ @SuppressWarnings("rawtypes") public static Iterator iterator(Calendar focus, int rangeStyle) { if (focus == null) { throw new IllegalArgumentException("The date must not be null"); } Calendar start = null; Calendar end = null; int startCutoff = Calendar.SUNDAY; int endCutoff = Calendar.SATURDAY; switch (rangeStyle) { case RANGE_MONTH_SUNDAY: case RANGE_MONTH_MONDAY: //Set start to the first of the month start = truncate(focus, Calendar.MONTH); //Set end to the last of the month end = (Calendar) start.clone(); end.add(Calendar.MONTH, 1); end.add(Calendar.DATE, -1); //Loop start back to the previous sunday or monday if (rangeStyle == RANGE_MONTH_MONDAY) { startCutoff = Calendar.MONDAY; endCutoff = Calendar.SUNDAY; } break; case RANGE_WEEK_SUNDAY: case RANGE_WEEK_MONDAY: case RANGE_WEEK_RELATIVE: case RANGE_WEEK_CENTER: //Set start and end to the current date start = truncate(focus, Calendar.DATE); end = truncate(focus, Calendar.DATE); switch (rangeStyle) { case RANGE_WEEK_SUNDAY: //already set by default break; case RANGE_WEEK_MONDAY: startCutoff = Calendar.MONDAY; endCutoff = Calendar.SUNDAY; break; case RANGE_WEEK_RELATIVE: startCutoff = focus.get(Calendar.DAY_OF_WEEK); endCutoff = startCutoff - 1; break; case RANGE_WEEK_CENTER: startCutoff = focus.get(Calendar.DAY_OF_WEEK) - 3; endCutoff = focus.get(Calendar.DAY_OF_WEEK) + 3; break; } break; default: throw new IllegalArgumentException("The range style " + rangeStyle + " is not valid."); } if (startCutoff < Calendar.SUNDAY) { startCutoff += 7; } if (startCutoff > Calendar.SATURDAY) { startCutoff -= 7; } if (endCutoff < Calendar.SUNDAY) { endCutoff += 7; } if (endCutoff > Calendar.SATURDAY) { endCutoff -= 7; } while (start.get(Calendar.DAY_OF_WEEK) != startCutoff) { start.add(Calendar.DATE, -1); } while (end.get(Calendar.DAY_OF_WEEK) != endCutoff) { end.add(Calendar.DATE, 1); } return new DateIterator(start, end); }
From source file:org.pentaho.di.core.row.ValueDataUtil.java
public static Object weekOfYearISO8601(ValueMetaInterface metaA, Object dataA) throws KettleValueException { if (dataA == null) { return null; }/* w ww .ja v a2 s . co m*/ Calendar calendar = Calendar.getInstance(Locale.ENGLISH); calendar.setMinimalDaysInFirstWeek(4); calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.setTime(metaA.getDate(dataA)); return new Long(calendar.get(Calendar.WEEK_OF_YEAR)); }
From source file:org.pentaho.di.core.row.ValueDataUtil.java
public static Object yearOfDateISO8601(ValueMetaInterface metaA, Object dataA) throws KettleValueException { if (dataA == null) { return null; }//w ww . j a v a2 s . c om Calendar calendar = Calendar.getInstance(Locale.ENGLISH); calendar.setMinimalDaysInFirstWeek(4); calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.setTime(metaA.getDate(dataA)); int week = calendar.get(Calendar.WEEK_OF_YEAR); int month = calendar.get(Calendar.MONTH); int year = calendar.get(Calendar.YEAR); // fix up for the year taking into account ISO8601 weeks if (week >= 52 && month == 0) { year--; } if (week <= 2 && month == 11) { year++; } return new Long(year); }
From source file:saphion.services.ForegroundService.java
public String setNotText(String subtext, String mainText, int choice) { switch (choice) { case 0:/* w ww . jav a 2s. com*/ return level + "% remaining"; case 1: return "Temperature: " + temperature; case 2: return health + ", " + "Temperature: " + temperature; case 3: return subtext; case 4: Calendar cal = Calendar.getInstance(); cal.setTime(new Date(System.currentTimeMillis() + (reqTime * 1000))); String day1 = ""; switch (cal.get(Calendar.DAY_OF_WEEK)) { case Calendar.MONDAY: day1 = "Monday"; break; case Calendar.TUESDAY: day1 = "Tuesday"; break; case Calendar.WEDNESDAY: day1 = "Wednesday"; break; case Calendar.THURSDAY: day1 = "Thursday"; break; case Calendar.FRIDAY: day1 = "Friday"; break; case Calendar.SATURDAY: day1 = "Saturday"; break; case Calendar.SUNDAY: day1 = "Sunday"; break; } String str = ""; if (isconnected) { str = "Full Charge at "; } else { str = "Empty at "; } if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) { return str + ((cal.get(Calendar.HOUR) == 0) ? 12 : cal.get(Calendar.HOUR)) + ":" + ((cal.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + cal.get(Calendar.MINUTE)) : cal.get(Calendar.MINUTE)) + (cal.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM"); } else { int d = Calendar.getInstance().get(Calendar.DAY_OF_WEEK) + 1; if (d == 8) d = 1; if (cal.get(Calendar.DAY_OF_WEEK) == d) day1 = "Tomorrow"; return str + ((cal.get(Calendar.HOUR) == 0) ? 12 : cal.get(Calendar.HOUR)) + ":" + ((cal.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + cal.get(Calendar.MINUTE)) : cal.get(Calendar.MINUTE)) + (cal.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM") + ", " + day1; } case 5: Date mydate = TimeFuncs .GetItemDate(mPref.getString(PreferenceHelper.LAST_CHARGED, TimeFuncs.getCurrentTimeStamp())); Calendar c = Calendar.getInstance(); c.setTime(mydate); String day = ""; switch (c.get(Calendar.DAY_OF_WEEK)) { case Calendar.MONDAY: day = "Monday"; break; case Calendar.TUESDAY: day = "Tuesday"; break; case Calendar.WEDNESDAY: day = "Wednesday"; break; case Calendar.THURSDAY: day = "Thursday"; break; case Calendar.FRIDAY: day = "Friday"; break; case Calendar.SATURDAY: day = "Saturday"; break; case Calendar.SUNDAY: day = "Sunday"; break; } if (c.get(Calendar.DAY_OF_WEEK) == Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) { if (isconnected) return "Plugged at " + ((c.get(Calendar.HOUR) == 0) ? 12 : c.get(Calendar.HOUR)) + ":" + ((c.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + c.get(Calendar.MINUTE)) : c.get(Calendar.MINUTE)) + (c.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM"); else return "Unplugged at " + ((c.get(Calendar.HOUR) == 0) ? 12 : c.get(Calendar.HOUR)) + ":" + ((c.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + c.get(Calendar.MINUTE)) : c.get(Calendar.MINUTE)) + (c.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM"); } else { int d = Calendar.getInstance().get(Calendar.DAY_OF_WEEK) - 1; if (d == 0) d = 7; if (c.get(Calendar.DAY_OF_WEEK) == d) day = "Yesterday"; if (isconnected) return "Plugged at " + ((c.get(Calendar.HOUR) == 0) ? 12 : c.get(Calendar.HOUR)) + ":" + ((c.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + c.get(Calendar.MINUTE)) : c.get(Calendar.MINUTE)) + (c.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM") + ", " + day; else return "Unplugged at " + ((c.get(Calendar.HOUR) == 0) ? 12 : c.get(Calendar.HOUR)) + ":" + ((c.get(Calendar.MINUTE) + "").length() == 1 ? ("0" + c.get(Calendar.MINUTE)) : c.get(Calendar.MINUTE)) + (c.get(Calendar.AM_PM) == Calendar.AM ? " AM" : " PM") + ", " + day; } case 6: return mainText; } return mainText; }
From source file:com.sonyericsson.hudson.plugins.gerrit.trigger.GerritServer.java
/** * Generates a list of helper objects for the jelly view. * * @return a list of helper objects./*from w w w . j av a 2 s . c o m*/ */ public List<ExceptionDataHelper> generateHelper() { WatchTimeExceptionData data = config.getExceptionData(); List<ExceptionDataHelper> list = new LinkedList<ExceptionDataHelper>(); list.add(new ExceptionDataHelper(Messages.MondayDisplayName(), Calendar.MONDAY, data)); list.add(new ExceptionDataHelper(Messages.TuesdayDisplayName(), Calendar.TUESDAY, data)); list.add(new ExceptionDataHelper(Messages.WednesdayDisplayName(), Calendar.WEDNESDAY, data)); list.add(new ExceptionDataHelper(Messages.ThursdayDisplayName(), Calendar.THURSDAY, data)); list.add(new ExceptionDataHelper(Messages.FridayDisplayName(), Calendar.FRIDAY, data)); list.add(new ExceptionDataHelper(Messages.SaturdayDisplayName(), Calendar.SATURDAY, data)); list.add(new ExceptionDataHelper(Messages.SundayDisplayName(), Calendar.SUNDAY, data)); return list; }