List of usage examples for java.util Calendar getFirstDayOfWeek
public int getFirstDayOfWeek()
SUNDAY
in the U.S., MONDAY
in France. From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java
public void encodeEnd(FacesContext facesContext, UIComponent component) throws IOException { RendererUtils.checkParamValidity(facesContext, component, HtmlInputCalendar.class); HtmlInputCalendar inputCalendar = (HtmlInputCalendar) component; Locale currentLocale = facesContext.getViewRoot().getLocale(); Map<String, List<ClientBehavior>> behaviors = inputCalendar.getClientBehaviors(); if (!behaviors.isEmpty()) { ResourceUtils.renderDefaultJsfJsInlineIfNecessary(facesContext, facesContext.getResponseWriter()); }//from w w w. j a va 2 s .com log.debug("current locale:" + currentLocale.toString()); String textValue; Converter converter = inputCalendar.getConverter(); Object submittedValue = inputCalendar.getSubmittedValue(); Date value; if (submittedValue != null) { //Don't need to convert anything, the textValue is the same as the submittedValue textValue = (String) submittedValue; if (textValue == null || textValue.trim().length() == 0 || textValue.equals(getHelperString(inputCalendar))) { value = null; } else { try { String formatStr = CalendarDateTimeConverter.createJSPopupFormat(facesContext, inputCalendar.getPopupDateFormat()); Calendar timeKeeper = Calendar.getInstance(currentLocale); int firstDayOfWeek = timeKeeper.getFirstDayOfWeek() - 1; org.apache.myfaces.dateformat.DateFormatSymbols symbols = new org.apache.myfaces.dateformat.DateFormatSymbols( currentLocale); SimpleDateFormatter dateFormat = new SimpleDateFormatter(formatStr, symbols, firstDayOfWeek); value = dateFormat.parse(textValue); } catch (IllegalArgumentException illegalArgumentException) { value = null; } } } else { if (converter == null) { CalendarDateTimeConverter defaultConverter = new CalendarDateTimeConverter(); value = (Date) getDateBusinessConverter(inputCalendar).getDateValue(facesContext, component, inputCalendar.getValue()); textValue = defaultConverter.getAsString(facesContext, inputCalendar, value); } else { Object componentValue = null; boolean usedComponentValue = false; //Use converter to retrieve the value. if (converter instanceof DateConverter) { value = ((DateConverter) converter).getAsDate(facesContext, inputCalendar); } else { componentValue = inputCalendar.getValue(); if (componentValue instanceof Date) { value = (Date) componentValue; } else { usedComponentValue = true; value = null; } } textValue = converter.getAsString(facesContext, inputCalendar, usedComponentValue ? componentValue : value); } } /* try { // value = RendererUtils.getDateValue(inputCalendar); Converter converter = getConverter(inputCalendar); if (converter instanceof DateConverter) { value = ((DateConverter) converter).getAsDate(facesContext, component); } else { //value = RendererUtils.getDateValue(inputCalendar); Object objectValue = RendererUtils.getObjectValue(component); if (objectValue == null || objectValue instanceof Date) { value = (Date) objectValue; } else { //Use Converter.getAsString and convert to date using String stringValue = converter.getAsString(facesContext, component, objectValue); if(stringValue ==null || stringValue.trim().length()==0 ||stringValue.equals(getHelperString(inputCalendar))) { value = null; } else { String formatStr = CalendarDateTimeConverter.createJSPopupFormat(facesContext, inputCalendar.getPopupDateFormat()); Calendar timeKeeper = Calendar.getInstance(currentLocale); int firstDayOfWeek = timeKeeper.getFirstDayOfWeek() - 1; org.apache.myfaces.dateformat.DateFormatSymbols symbols = new org.apache.myfaces.dateformat.DateFormatSymbols(currentLocale); SimpleDateFormatter dateFormat = new SimpleDateFormatter(formatStr, symbols, firstDayOfWeek); value = dateFormat.parse(stringValue); } } } } catch (IllegalArgumentException illegalArgumentException) { value = null; } */ Calendar timeKeeper = Calendar.getInstance(currentLocale); timeKeeper.setTime(value != null ? value : new Date()); DateFormatSymbols symbols = new DateFormatSymbols(currentLocale); if (inputCalendar.isRenderAsPopup()) { renderPopup(facesContext, inputCalendar, textValue, timeKeeper, symbols); } else { renderInline(facesContext, inputCalendar, timeKeeper, symbols); } component.getChildren().removeAll(component.getChildren()); }
From source file:com.concursive.connect.web.modules.calendar.utils.CalendarView.java
/** * Returns the cell representing the first day of the month in the 42 cell * grid Creation date: (5/2/2000 2:51:35 AM) * * @param tmp Description of Parameter/*from w ww. j a va2 s .com*/ * @return int */ public int getStartCell(Calendar tmp) { Calendar beginOfMonth = Calendar.getInstance(locale); beginOfMonth.set(tmp.get(Calendar.YEAR), tmp.get(Calendar.MONTH), 0); beginOfMonth.set(Calendar.HOUR, 0); beginOfMonth.set(Calendar.MINUTE, 0); beginOfMonth.set(Calendar.SECOND, 0); beginOfMonth.set(Calendar.MILLISECOND, 0); int baseDay = beginOfMonth.get(Calendar.DAY_OF_WEEK) - tmp.getFirstDayOfWeek() + 1; if (baseDay < 1) { baseDay = 7 + baseDay; } return baseDay; }
From source file:org.apache.cocoon.generation.CalendarGenerator.java
/** * Generate XML data.//from ww w. j a v a 2 s .c o m * * @throws SAXException if an error occurs while outputting the document */ public void generate() throws SAXException, ProcessingException { Calendar start = Calendar.getInstance(locale); start.clear(); start.set(Calendar.YEAR, this.year); start.set(Calendar.MONTH, this.month); start.set(Calendar.DAY_OF_MONTH, 1); Calendar end = (Calendar) start.clone(); end.add(Calendar.MONTH, 1); // Determine previous and next months Calendar prevMonth = (Calendar) start.clone(); prevMonth.add(Calendar.MONTH, -1); this.contentHandler.startDocument(); this.contentHandler.startPrefixMapping(PREFIX, URI); attributes.clear(); attributes.addAttribute("", YEAR_ATTR_NAME, YEAR_ATTR_NAME, "CDATA", String.valueOf(year)); attributes.addAttribute("", MONTH_ATTR_NAME, MONTH_ATTR_NAME, "CDATA", monthFormatter.format(start.getTime())); // Add previous and next month attributes.addAttribute("", PREV_YEAR_ATTR_NAME, PREV_YEAR_ATTR_NAME, "CDATA", String.valueOf(prevMonth.get(Calendar.YEAR))); attributes.addAttribute("", PREV_MONTH_ATTR_NAME, PREV_MONTH_ATTR_NAME, "CDATA", monthNumberFormatter.format(prevMonth.get(Calendar.MONTH) + 1)); attributes.addAttribute("", NEXT_YEAR_ATTR_NAME, NEXT_YEAR_ATTR_NAME, "CDATA", String.valueOf(end.get(Calendar.YEAR))); attributes.addAttribute("", NEXT_MONTH_ATTR_NAME, NEXT_MONTH_ATTR_NAME, "CDATA", monthNumberFormatter.format(end.get(Calendar.MONTH) + 1)); this.contentHandler.startElement(URI, CALENDAR_NODE_NAME, PREFIX + ':' + CALENDAR_NODE_NAME, attributes); int weekNo = start.get(Calendar.WEEK_OF_MONTH); int firstDay = start.getFirstDayOfWeek(); if (start.get(Calendar.DAY_OF_WEEK) != firstDay) { attributes.clear(); attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA", String.valueOf(weekNo)); this.contentHandler.startElement(URI, WEEK_NODE_NAME, PREFIX + ':' + WEEK_NODE_NAME, attributes); if (padWeeks) { Calendar previous = (Calendar) start.clone(); while (previous.get(Calendar.DAY_OF_WEEK) != firstDay) { previous.add(Calendar.DAY_OF_MONTH, -1); } while (previous.before(start)) { attributes.clear(); attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA", String.valueOf(previous.get(Calendar.DAY_OF_MONTH))); attributes.addAttribute("", WEEKDAY_ATTR_NAME, WEEKDAY_ATTR_NAME, "CDATA", weekdays[previous.get(Calendar.DAY_OF_WEEK)]); attributes.addAttribute("", DATE_ATTR_NAME, DATE_ATTR_NAME, "CDATA", dateFormatter.format(previous.getTime())); this.contentHandler.startElement(URI, DAY_NODE_NAME, PREFIX + ':' + DAY_NODE_NAME, attributes); addContent(previous, locale); this.contentHandler.endElement(URI, DAY_NODE_NAME, PREFIX + ':' + DAY_NODE_NAME); previous.add(Calendar.DAY_OF_MONTH, 1); } } } while (start.before(end)) { if (start.get(Calendar.DAY_OF_WEEK) == firstDay) { weekNo = start.get(Calendar.WEEK_OF_MONTH); attributes.clear(); attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA", String.valueOf(weekNo)); this.contentHandler.startElement(URI, WEEK_NODE_NAME, PREFIX + ':' + WEEK_NODE_NAME, attributes); } attributes.clear(); attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA", String.valueOf(start.get(Calendar.DAY_OF_MONTH))); attributes.addAttribute("", WEEKDAY_ATTR_NAME, WEEKDAY_ATTR_NAME, "CDATA", weekdays[start.get(Calendar.DAY_OF_WEEK)]); attributes.addAttribute("", DATE_ATTR_NAME, DATE_ATTR_NAME, "CDATA", dateFormatter.format(start.getTime())); this.contentHandler.startElement(URI, DAY_NODE_NAME, PREFIX + ':' + DAY_NODE_NAME, attributes); addContent(start, locale); this.contentHandler.endElement(URI, DAY_NODE_NAME, PREFIX + ':' + DAY_NODE_NAME); start.add(Calendar.DAY_OF_MONTH, 1); if (start.get(Calendar.DAY_OF_WEEK) == firstDay || (!padWeeks && !start.before(end))) { this.contentHandler.endElement(URI, WEEK_NODE_NAME, PREFIX + ':' + WEEK_NODE_NAME); } } if (padWeeks) { while (firstDay != end.get(Calendar.DAY_OF_WEEK)) { attributes.clear(); attributes.addAttribute("", NUMBER_ATTR_NAME, NUMBER_ATTR_NAME, "CDATA", String.valueOf(end.get(Calendar.DAY_OF_MONTH))); attributes.addAttribute("", WEEKDAY_ATTR_NAME, WEEKDAY_ATTR_NAME, "CDATA", weekdays[end.get(Calendar.DAY_OF_WEEK)]); attributes.addAttribute("", DATE_ATTR_NAME, DATE_ATTR_NAME, "CDATA", dateFormatter.format(end.getTime())); this.contentHandler.startElement(URI, DAY_NODE_NAME, PREFIX + ':' + DAY_NODE_NAME, attributes); addContent(end, locale); this.contentHandler.endElement(URI, DAY_NODE_NAME, PREFIX + ':' + DAY_NODE_NAME); end.add(Calendar.DAY_OF_MONTH, 1); if (firstDay == end.get(Calendar.DAY_OF_WEEK)) { this.contentHandler.endElement(URI, WEEK_NODE_NAME, PREFIX + ':' + WEEK_NODE_NAME); } } } this.contentHandler.endElement(URI, CALENDAR_NODE_NAME, PREFIX + ':' + CALENDAR_NODE_NAME); this.contentHandler.endPrefixMapping(PREFIX); this.contentHandler.endDocument(); }
From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java
private void renderInline(FacesContext facesContext, HtmlInputCalendar inputCalendar, Calendar timeKeeper, DateFormatSymbols symbols) throws IOException { String[] weekdays = mapShortWeekdays(symbols); String[] months = mapMonths(symbols); int lastDayInMonth = timeKeeper.getActualMaximum(Calendar.DAY_OF_MONTH); int currentDay = timeKeeper.get(Calendar.DAY_OF_MONTH); if (currentDay > lastDayInMonth) currentDay = lastDayInMonth;//w w w.jav a 2 s . c o m timeKeeper.set(Calendar.DAY_OF_MONTH, 1); int weekDayOfFirstDayOfMonth = mapCalendarDayToCommonDay(timeKeeper.get(Calendar.DAY_OF_WEEK)); int weekStartsAtDayIndex = mapCalendarDayToCommonDay(timeKeeper.getFirstDayOfWeek()); ResponseWriter writer = facesContext.getResponseWriter(); HtmlRendererUtils.writePrettyLineSeparator(facesContext); HtmlRendererUtils.writePrettyLineSeparator(facesContext); writer.startElement(HTML.TABLE_ELEM, inputCalendar); HtmlRendererUtils.renderHTMLAttributes(writer, inputCalendar, HTML.UNIVERSAL_ATTRIBUTES); Map<String, List<ClientBehavior>> behaviors = inputCalendar.getClientBehaviors(); if (behaviors != null && !behaviors.isEmpty()) { writer.writeAttribute(HTML.ID_ATTR, inputCalendar.getClientId(facesContext), null); HtmlRendererUtils.renderBehaviorizedEventHandlers(facesContext, writer, inputCalendar, behaviors); HtmlRendererUtils.renderBehaviorizedFieldEventHandlersWithoutOnchangeAndOnselect(facesContext, writer, inputCalendar, behaviors); } else { HtmlRendererUtils.writeIdIfNecessary(writer, inputCalendar, facesContext); HtmlRendererUtils.renderHTMLAttributes(writer, inputCalendar, HTML.EVENT_HANDLER_ATTRIBUTES); HtmlRendererUtils.renderHTMLAttributes(writer, inputCalendar, HTML.COMMON_FIELD_EVENT_ATTRIBUTES_WITHOUT_ONSELECT_AND_ONCHANGE); } writer.flush(); HtmlRendererUtils.writePrettyLineSeparator(facesContext); writer.startElement(HTML.TR_ELEM, inputCalendar); if (inputCalendar.getMonthYearRowClass() != null) writer.writeAttribute(HTML.CLASS_ATTR, inputCalendar.getMonthYearRowClass(), null); writeMonthYearHeader(facesContext, writer, inputCalendar, timeKeeper, currentDay, weekdays, months); writer.endElement(HTML.TR_ELEM); HtmlRendererUtils.writePrettyLineSeparator(facesContext); writer.startElement(HTML.TR_ELEM, inputCalendar); if (inputCalendar.getWeekRowClass() != null) writer.writeAttribute(HTML.CLASS_ATTR, inputCalendar.getWeekRowClass(), null); writeWeekDayNameHeader(weekStartsAtDayIndex, weekdays, facesContext, writer, inputCalendar); writer.endElement(HTML.TR_ELEM); HtmlRendererUtils.writePrettyLineSeparator(facesContext); writeDays(facesContext, writer, inputCalendar, timeKeeper, currentDay, weekStartsAtDayIndex, weekDayOfFirstDayOfMonth, lastDayInMonth, weekdays); writer.endElement(HTML.TABLE_ELEM); }
From source file:org.everit.jira.timetracker.plugin.JiraTimetrackerWebAction.java
/** * Make summary today, this week and this month. * * @throws GenericEntityException// w ww . j a v a 2 s .c o m * GenericEntityException. */ public void makeSummary() throws GenericEntityException { ApplicationProperties applicationProperties = ComponentAccessor.getApplicationProperties(); boolean useISO8601 = applicationProperties.getOption(APKeys.JIRA_DATE_TIME_PICKER_USE_ISO8601); Calendar startCalendar = Calendar.getInstance(); if (useISO8601) { startCalendar.setFirstDayOfWeek(Calendar.MONDAY); } startCalendar.setTime(date); startCalendar.set(Calendar.HOUR_OF_DAY, 0); startCalendar.set(Calendar.MINUTE, 0); startCalendar.set(Calendar.SECOND, 0); startCalendar.set(Calendar.MILLISECOND, 0); Calendar originalStartcalendar = (Calendar) startCalendar.clone(); Date start = startCalendar.getTime(); Calendar endCalendar = (Calendar) startCalendar.clone(); endCalendar.add(Calendar.DAY_OF_MONTH, 1); Date end = endCalendar.getTime(); daySummary = jiraTimetrackerPlugin.summary(selectedUser, start, end, null); if ((issuesRegex != null) && !issuesRegex.isEmpty()) { dayFilteredSummary = jiraTimetrackerPlugin.summary(selectedUser, start, end, issuesRegex); } startCalendar = (Calendar) originalStartcalendar.clone(); while (startCalendar.get(Calendar.DAY_OF_WEEK) != startCalendar.getFirstDayOfWeek()) { startCalendar.add(Calendar.DATE, -1); // Substract 1 day until first day of week. } start = startCalendar.getTime(); endCalendar = (Calendar) startCalendar.clone(); endCalendar.add(Calendar.DATE, DateTimeConverterUtil.DAYS_PER_WEEK); end = endCalendar.getTime(); weekSummary = jiraTimetrackerPlugin.summary(selectedUser, start, end, null); if ((issuesRegex != null) && !issuesRegex.isEmpty()) { weekFilteredSummary = jiraTimetrackerPlugin.summary(selectedUser, start, end, issuesRegex); } startCalendar = (Calendar) originalStartcalendar.clone(); startCalendar.set(Calendar.DAY_OF_MONTH, 1); start = startCalendar.getTime(); endCalendar = (Calendar) originalStartcalendar.clone(); endCalendar.set(Calendar.DAY_OF_MONTH, endCalendar.getActualMaximum(Calendar.DAY_OF_MONTH)); endCalendar.add(Calendar.DAY_OF_MONTH, 1); end = endCalendar.getTime(); monthSummary = jiraTimetrackerPlugin.summary(selectedUser, start, end, null); if ((issuesRegex != null) && !issuesRegex.isEmpty()) { monthFilteredSummary = jiraTimetrackerPlugin.summary(selectedUser, start, end, issuesRegex); } }
From source file:org.apache.roller.weblogger.ui.core.tags.calendar.CalendarTag.java
/** * Write to a PrintWriter so that tag may be used from Velocity *//*www . ja v a 2s . c o m*/ public int doStartTag(PrintWriter pw) throws JspException { try { // build week day names this.buildDayNames(); Date day = null; // day to be displayed Calendar dayCal; // set to day to be displayed Calendar cal; // for iterating through days of month Calendar todayCal; // for iterating through days of month CalendarModel model; // the calendar model // --------------------------------- // --- initialize date variables --- // --------------------------------- // check for parameter map and target url StringTokenizer toker = new StringTokenizer(mModelName, "."); String tok1 = toker.nextToken(); if (toker.hasMoreTokens()) { String tok2 = toker.nextToken(); Object bean = pageContext.findAttribute(tok1); model = (CalendarModel) PropertyUtils.getProperty(bean, tok2); } else { model = (CalendarModel) pageContext.findAttribute(mModelName); } // no model specified, nothing to generate if (model == null) { return SKIP_BODY; } day = model.getDay(); // ceate object to represent today todayCal = model.getCalendar(); todayCal.setTime(new Date()); // formatter Month-Year title of calendar SimpleDateFormat formatTitle = new SimpleDateFormat("MMMM yyyy", mLocale); HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); // get Resource Bundle ResourceBundle bundle = ResourceBundle.getBundle("ApplicationResources", mLocale); // go back to first day in month cal = model.getCalendar(); day = DateUtil.getNoonOfDay(day, cal); cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DAY_OF_MONTH)); // Go back to first day of week before that (Sunday in US, Monday in France, e.g.) // in the calendar while (cal.get(Calendar.DAY_OF_WEEK) != cal.getFirstDayOfWeek()) { cal.add(Calendar.DATE, -1); } // create table of 5 weeks, 7 days per row dayCal = model.getCalendar(); dayCal.setTime(day); // ------------------------- // --- draw the calendar --- // ------------------------- pw.print("<table cellspacing=\"0\" border=\"0\" "); pw.print(" summary=\"" + bundle.getString("calendar.summary") + "\" class=\"hCalendarTable" + mClassSuffix + "\">"); pw.print("<tr>"); pw.print( "<td colspan=\"7\" align=\"center\" " + "class=\"hCalendarMonthYearRow" + mClassSuffix + "\">"); if (model.getPrevMonth() != null) { pw.print("<a href=\"" + model.computePrevMonthUrl() + "\" title=\"" + bundle.getString("calendar.prev") + "\" class=\"hCalendarNavBar\">«</a> "); } pw.print(formatTitle.format(day)); if (model.getNextMonth() != null) { pw.print(" <a href=\"" + model.computeNextMonthUrl() + "\" title=\"" + bundle.getString("calendar.next") + "\" class=\"hCalendarNavBar\">»</a>"); } pw.print("</td></tr>"); // emit the HTML calendar for (int w = -1; w < 6; w++) { pw.print("<tr>"); for (int d = 0; d < 7; d++) { if (w == -1) { pw.print("<th class=\"hCalendarDayNameRow" + mClassSuffix + "\" align=\"center\">"); pw.print(mDayNames[d]); pw.print("</th>"); continue; } // determine URL for this calendar day Date tddate = cal.getTime(); String url = model.computeUrl(tddate, false, false); String content = model.getContent(tddate); if // day is in calendar month ((cal.get(Calendar.MONTH) == dayCal.get(Calendar.MONTH)) && (cal.get(Calendar.YEAR) == dayCal.get(Calendar.YEAR))) { if // day is today then use today style ((cal.get(Calendar.DAY_OF_MONTH) == todayCal.get(Calendar.DAY_OF_MONTH)) && (cal.get(Calendar.MONTH) == todayCal.get(Calendar.MONTH)) && (cal.get(Calendar.YEAR) == todayCal.get(Calendar.YEAR))) { printToday(pw, cal, url, content); } else { printDayInThisMonth(pw, cal, url, content); } } else // apply day-not-in-month style ;-) { printDayNotInMonth(pw, cal); } // increment calendar by one day cal.add(Calendar.DATE, 1); } pw.print("</tr>"); } pw.print("<tr class=\"hCalendarNextPrev" + mClassSuffix + "\">"); pw.print("<td colspan=\"7\" align=\"center\">"); pw.print("<a href=\"" + model.computeTodayMonthUrl() + "\" class=\"hCalendarNavBar\">" + bundle.getString("calendar.today") + "</a>"); pw.print("</td>"); pw.print("</tr>"); pw.print("</table>"); } catch (Exception e) { pw.print("<span class=\"error\">"); pw.print("<p><b>An ERROR has occured CalendarTag</b></p>"); pw.print("</span>"); mLogger.error("Calendar tag exception", e); } return Tag.SKIP_BODY; }
From source file:com.ut.healthelink.service.impl.transactionOutManagerImpl.java
/** * The 'generateSystemOutboundSummary' function will return the summary object for outbound system batches * * @return This function will return a systemSummary object *//*from ww w .j a va2s . co m*/ @Override public systemSummary generateSystemOutboundSummary() { systemSummary systemSummary = new systemSummary(); try { /* Get batches submitted this hour */ Calendar thishour = new GregorianCalendar(); thishour.set(Calendar.MINUTE, 0); thishour.set(Calendar.SECOND, 0); thishour.set(Calendar.MILLISECOND, 0); Calendar nexthour = new GregorianCalendar(); nexthour.set(Calendar.MINUTE, 0); nexthour.set(Calendar.SECOND, 0); nexthour.set(Calendar.MILLISECOND, 0); nexthour.add(Calendar.HOUR_OF_DAY, 1); Integer batchesThisHour = transactionOutDAO.getAllBatches(thishour.getTime(), nexthour.getTime()) .size(); /* Get batches submitted today */ Calendar starttoday = new GregorianCalendar(); starttoday.set(Calendar.HOUR_OF_DAY, 0); starttoday.set(Calendar.MINUTE, 0); starttoday.set(Calendar.SECOND, 0); starttoday.set(Calendar.MILLISECOND, 0); Calendar starttomorrow = new GregorianCalendar(); starttomorrow.set(Calendar.HOUR_OF_DAY, 0); starttomorrow.set(Calendar.MINUTE, 0); starttomorrow.set(Calendar.SECOND, 0); starttomorrow.set(Calendar.MILLISECOND, 0); starttomorrow.add(Calendar.DAY_OF_MONTH, 1); Integer batchesToday = transactionOutDAO.getAllBatches(starttoday.getTime(), starttomorrow.getTime()) .size(); /* Get batches submitted this week */ Calendar thisweek = new GregorianCalendar(); thisweek.set(Calendar.HOUR_OF_DAY, 0); thisweek.set(Calendar.MINUTE, 0); thisweek.set(Calendar.SECOND, 0); thisweek.set(Calendar.MILLISECOND, 0); thisweek.set(Calendar.DAY_OF_WEEK, thisweek.getFirstDayOfWeek()); Calendar nextweek = new GregorianCalendar(); nextweek.set(Calendar.HOUR_OF_DAY, 0); nextweek.set(Calendar.MINUTE, 0); nextweek.set(Calendar.SECOND, 0); nextweek.set(Calendar.MILLISECOND, 0); nextweek.set(Calendar.DAY_OF_WEEK, thisweek.getFirstDayOfWeek()); nextweek.add(Calendar.WEEK_OF_YEAR, 1); Integer batchesThisWeek = transactionOutDAO.getAllBatches(thisweek.getTime(), nextweek.getTime()) .size(); systemSummary.setBatchesPastHour(batchesThisHour); systemSummary.setBatchesToday(batchesToday); systemSummary.setBatchesThisWeek(batchesThisWeek); /* Get batches submitted yesterday */ } catch (Exception ex) { Logger.getLogger(transactionInManagerImpl.class.getName()).log(Level.SEVERE, null, ex); } return systemSummary; }
From source file:com.ut.healthelink.service.impl.transactionInManagerImpl.java
@Override public systemSummary generateSystemInboundSummary() { systemSummary systemSummary = new systemSummary(); try {//from w ww . j a v a 2 s. c o m /* Get batches submitted this hour */ Calendar thishour = new GregorianCalendar(); thishour.set(Calendar.MINUTE, 0); thishour.set(Calendar.SECOND, 0); thishour.set(Calendar.MILLISECOND, 0); Calendar nexthour = new GregorianCalendar(); nexthour.set(Calendar.MINUTE, 0); nexthour.set(Calendar.SECOND, 0); nexthour.set(Calendar.MILLISECOND, 0); nexthour.add(Calendar.HOUR_OF_DAY, 1); //System.out.println("This Hour: " + thishour.getTime() + " Next Hour: " + nexthour.getTime()); Integer batchesThisHour = transactionInDAO.getAllUploadedBatches(thishour.getTime(), nexthour.getTime()) .size(); /* Get batches submitted today */ Calendar starttoday = new GregorianCalendar(); starttoday.set(Calendar.HOUR_OF_DAY, 0); starttoday.set(Calendar.MINUTE, 0); starttoday.set(Calendar.SECOND, 0); starttoday.set(Calendar.MILLISECOND, 0); Calendar starttomorrow = new GregorianCalendar(); starttomorrow.set(Calendar.HOUR_OF_DAY, 0); starttomorrow.set(Calendar.MINUTE, 0); starttomorrow.set(Calendar.SECOND, 0); starttomorrow.set(Calendar.MILLISECOND, 0); starttomorrow.add(Calendar.DAY_OF_MONTH, 1); //System.out.println("Today: " + starttoday.getTime() + " Tomorrow: " + starttomorrow.getTime()); Integer batchesToday = transactionInDAO .getAllUploadedBatches(starttoday.getTime(), starttomorrow.getTime()).size(); /* Get batches submitted this week */ Calendar thisweek = new GregorianCalendar(); thisweek.set(Calendar.HOUR_OF_DAY, 0); thisweek.set(Calendar.MINUTE, 0); thisweek.set(Calendar.SECOND, 0); thisweek.set(Calendar.MILLISECOND, 0); thisweek.set(Calendar.DAY_OF_WEEK, thisweek.getFirstDayOfWeek()); Calendar nextweek = new GregorianCalendar(); nextweek.set(Calendar.HOUR_OF_DAY, 0); nextweek.set(Calendar.MINUTE, 0); nextweek.set(Calendar.SECOND, 0); nextweek.set(Calendar.MILLISECOND, 0); nextweek.set(Calendar.DAY_OF_WEEK, thisweek.getFirstDayOfWeek()); nextweek.add(Calendar.WEEK_OF_YEAR, 1); //System.out.println("This Week: " + thisweek.getTime() + " Next Week: " + nextweek.getTime()); Integer batchesThisWeek = transactionInDAO.getAllUploadedBatches(thisweek.getTime(), nextweek.getTime()) .size(); systemSummary.setBatchesPastHour(batchesThisHour); systemSummary.setBatchesToday(batchesToday); systemSummary.setBatchesThisWeek(batchesThisWeek); /* Get batches submitted yesterday */ } catch (Exception ex) { Logger.getLogger(transactionInManagerImpl.class.getName()).log(Level.SEVERE, null, ex); } return systemSummary; }
From source file:org.apache.myfaces.custom.calendar.HtmlCalendarRenderer.java
private void renderPopup(FacesContext facesContext, HtmlInputCalendar inputCalendar, String value, Calendar timeKeeper, DateFormatSymbols symbols) throws IOException { if (inputCalendar.isAddResources()) addScriptAndCSSResources(facesContext, inputCalendar); // Check for an enclosed converter: UIInput uiInput = (UIInput) inputCalendar; Converter converter = uiInput.getConverter(); String dateFormat = null;/*from w w w . jav a 2s . com*/ if (converter != null && converter instanceof DateTimeConverter) { dateFormat = ((DateTimeConverter) converter).getPattern(); } if (dateFormat == null) { dateFormat = CalendarDateTimeConverter.createJSPopupFormat(facesContext, inputCalendar.getPopupDateFormat()); } Application application = facesContext.getApplication(); HtmlInputTextHelp inputText = getOrCreateInputTextChild(inputCalendar, application); RendererUtils.copyHtmlInputTextAttributes(inputCalendar, inputText); inputText.setId(inputCalendar.getId() + "_input"); boolean forceId = RendererUtils.getBooleanValue(JSFAttr.FORCE_ID_ATTR, inputCalendar.getAttributes().get(JSFAttr.FORCE_ID_ATTR), false); if (forceId) { inputText.getAttributes().put(JSFAttr.FORCE_ID_ATTR, Boolean.TRUE); } inputText.setConverter(null); // value for this transient component will already be converted inputText.setTransient(true); inputText.setHelpText(inputCalendar.getHelpText()); inputText.setSelectText(true); inputText.setValue(value); /* if (value == null && inputCalendar.getSubmittedValue() != null) { inputText.setValue(inputCalendar.getSubmittedValue()); } else { inputText.setValue(getConverter(inputCalendar).getAsString( facesContext,inputCalendar,value)); }*/ inputText.setDisabled(inputCalendar.isDisabled()); inputText.setReadonly(inputCalendar.isReadonly()); inputText.setEnabledOnUserRole(inputCalendar.getEnabledOnUserRole()); inputText.setVisibleOnUserRole(inputCalendar.getVisibleOnUserRole()); //This is where two components with the same id are in the tree, //so make sure that during the rendering the id is unique. //inputCalendar.setId(inputCalendar.getId()+"tempId"); inputCalendar.getChildren().add(inputText); //Reset client id to ensure proper operation inputText.setId(inputText.getId()); inputText.setName(inputCalendar.getClientId(facesContext)); inputText.setTargetClientId(inputCalendar.getClientId(facesContext)); ResponseWriter writer = facesContext.getResponseWriter(); writer.startElement(HTML.SPAN_ELEM, inputCalendar); writer.writeAttribute(HTML.ID_ATTR, inputCalendar.getClientId(facesContext), null); RendererUtils.renderChild(facesContext, inputText); // Remove inputText moved to the end of this method. // inputCalendar.getChildren().remove(inputText); //Set back the correct id to the input calendar //inputCalendar.setId(inputText.getId()); writer.startElement(HTML.SPAN_ELEM, inputCalendar); writer.writeAttribute(HTML.ID_ATTR, inputCalendar.getClientId(facesContext) + "Span", JSFAttr.ID_ATTR); writer.endElement(HTML.SPAN_ELEM); if (!isDisabled(facesContext, inputCalendar) && !inputCalendar.isReadonly()) { writer.startElement(HTML.SCRIPT_ELEM, inputCalendar); writer.writeAttribute(HTML.SCRIPT_TYPE_ATTR, HTML.SCRIPT_TYPE_TEXT_JAVASCRIPT, null); String calendarVar = JavascriptUtils .getValidJavascriptName(inputCalendar.getClientId(facesContext) + "CalendarVar", false); writer.writeText(calendarVar + "=new org.apache.myfaces.PopupCalendar();\n", null); writer.writeText(getLocalizedLanguageScript(facesContext, symbols, timeKeeper.getFirstDayOfWeek(), inputCalendar, calendarVar) + "\n", null); // pass the selectMode attribute StringBuffer script = new StringBuffer(); setStringVariable(script, calendarVar + ".initData.selectMode", inputCalendar.getPopupSelectMode()); writer.writeText(script.toString(), null); writer.writeText(calendarVar + ".init(document.getElementById('" + inputCalendar.getClientId(facesContext) + "Span" + "'));\n", null); writer.endElement(HTML.SCRIPT_ELEM); if (!inputCalendar.isDisplayValueOnly()) { getScriptBtn(writer, facesContext, inputCalendar, dateFormat, inputCalendar.getPopupButtonString(), new FunctionCallProvider() { public String getFunctionCall(FacesContext facesContext, UIComponent uiComponent, String dateFormat) { String clientId = uiComponent.getClientId(facesContext); String inputClientId = null; if (Boolean.TRUE.equals(uiComponent.getAttributes().get(JSFAttr.FORCE_ID_ATTR))) { if (uiComponent.getChildCount() > 0) { for (int i = 0, size = uiComponent.getChildCount(); i < size; i++) { UIComponent child = uiComponent.getChildren().get(i); if (child instanceof HtmlInputTextHelp && child.getId() != null && child.getId().endsWith("_input")) { inputClientId = child.getClientId(); } } } if (inputClientId == null) { String oldId = uiComponent.getId(); uiComponent.setId(uiComponent.getId() + "_input"); inputClientId = uiComponent.getClientId(); uiComponent.setId(oldId); } } else { inputClientId = clientId + "_input"; } String clientVar = JavascriptUtils.getValidJavascriptName(clientId + "CalendarVar", true); return clientVar + "._popUpCalendar(this,document.getElementById('" + inputClientId + "'),'" + dateFormat + "')"; } }); } } writer.endElement(HTML.SPAN_ELEM); inputCalendar.getChildren().remove(inputText); }
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;/* w w w.j a v a 2s . c o m*/ 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); } }