public void flagDates() {
		try {
			Date[] flagDates = DateManager.getDateRange(monthView.getFirstDisplayedDay(), monthView.getLastDisplayedDay());
			List<Date> dateList = new ArrayList<Date>(Arrays.asList(flagDates));
			Day dayCheckingBean;
			boolean jobsExist = false;
			Date dateToCheck = new Date();
			int i = 0;
			int endCond = dateList.size();
			while (i < endCond) {
//				log.debug("i is " + i);
//				log.debug("endCond is " + endCond);
				dateToCheck = dateList.get(i);
//				log.debug("Checking date: " + dateToCheck.toString());
				dayCheckingBean = DayManager.getRow(LocalDate.fromDateFields(dateToCheck));
//				log.debug("dayCheckingBean: " + dayCheckingBean);
				// If the day exists in the Day table, then it might have jobs and further checking is necessary.
				if (dayCheckingBean != null)
				{
//					log.debug("dayCheckingBean is NOT null, so its completed date is: " + dayCheckingBean.getDayCompleted());
					// Check to see if the the day has a completion date. If not, then there is one more condition
					// necessary to check.
					if (dayCheckingBean.getDayCompleted() == null)
					{
						jobsExist = JobManager.jobsExist(LocalDate.fromDateFields(dateToCheck));
//						log.debug("Jobs exist? " + jobsExist);
						// Last check. If the day exists but the completion date does not, then we have to check
						// to see whether or not any jobs exist for the day. If they do, then take the day
						// out of the array.
						if (jobsExist)
						{
//							log.debug("Do not flag this date!");
							dateList.remove(dateToCheck);
							endCond--;
						}
						// If the day exists, the completion date does not, and no jobs exist for the day,
						// then we want the day flagged. Keep it in the array for flagging.
						// (This is usually for weekends and such.)
						else
							i++;
					}
					// If it does have a completion date, then it MUST have jobs, AND they are all completed.
					// Thus, keep the day in the 'to be flagged' array and move to the next day.
					else
						i++;
				}
				// If the dayCheckingBean is null, then the day doesn't exist in the Day table,
				// thus, it must clearly have no jobs in it, so keep it in the table to be flagged
				// and move to the next day.
				else
					i++;
			}
			flagDates = dateList.toArray(EMPTY_DATE_ARRAY);
			monthView.setFlaggedDates(flagDates);
		} catch (Exception e) {
			log.error("Exception thrown when flagging dates.", e);
		}
	}