Java Code Examples for java.util.Calendar.SATURDAY

The following are Jave code examples for showing how to use SATURDAY of the java.util.Calendar class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: unitimes   File: ExamPeriod.java   View Source Code Vote up 7 votes
public boolean overlap(Assignment assignment, int nrTravelSlots) {
    //check date pattern
    DatePattern dp = assignment.getDatePattern();
    int dpIndex = getDateOffset()-getSession().getExamBeginOffset()-(dp.getOffset()==null?0:dp.getOffset());
    if (dp.getPattern()==null || dpIndex<0 || dpIndex>=dp.getPattern().length() || dp.getPattern().charAt(dpIndex)!='1') return false;
    
    //check day of week
    Calendar cal = Calendar.getInstance(Locale.US);
    cal.setTime(getSession().getExamBeginDate());
    cal.add(Calendar.DAY_OF_YEAR, getDateOffset());
    switch (cal.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY    : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_MON])==0) return false; break;
        case Calendar.TUESDAY   : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_TUE])==0) return false; break;
        case Calendar.WEDNESDAY : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_WED])==0) return false; break;
        case Calendar.THURSDAY  : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_THU])==0) return false; break;
        case Calendar.FRIDAY    : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_FRI])==0) return false; break;
        case Calendar.SATURDAY  : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_SAT])==0) return false; break;
        case Calendar.SUNDAY    : if ((assignment.getDays() & Constants.DAY_CODES[Constants.DAY_SUN])==0) return false; break;
    }
    
    //check time
    return getStartSlot() - nrTravelSlots < assignment.getStartSlot() + assignment.getSlotPerMtg() && assignment.getStartSlot() < getStartSlot() + getLength() + nrTravelSlots;
}
 
Example 2
Project: unitimes   File: MakeAssignmentsForClassEvents.java   View Source Code Vote up 7 votes
public int getDaysCode(Event event) {
    int daysCode = 0;
    for (Iterator i=event.getMeetings().iterator();i.hasNext();) {
        Meeting meeting = (Meeting)i.next();
        Calendar date = Calendar.getInstance(Locale.US);
        date.setTime(meeting.getMeetingDate());
        switch (date.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break;
        case Calendar.TUESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break;
        case Calendar.WEDNESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break;
        case Calendar.THURSDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break;
        case Calendar.FRIDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break;
        case Calendar.SATURDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break;
        case Calendar.SUNDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break;
        }
    }
    return daysCode;
}
 
Example 3
Project: broadlink-java-api   File: DiscoveryPacket.java   View Source Code Vote up 7 votes
private static int dayOfWeekConv(int fieldVal) {
    switch (fieldVal) {
    case Calendar.SUNDAY:
        return 6;
    case Calendar.MONDAY:
        return 0;
    case Calendar.TUESDAY:
        return 1;
    case Calendar.WEDNESDAY:
        return 2;
    case Calendar.THURSDAY:
        return 3;
    case Calendar.FRIDAY:
        return 4;
    case Calendar.SATURDAY:
        return 5;
    }
    return -1;
}
 
Example 4
Project: buildAPKsApps   File: TimeUtil.java   View Source Code Vote up 7 votes
private static boolean dayIsRepeat(int calendarDow, int repeat) {
  switch (calendarDow) {
    case Calendar.SUNDAY:
      return (1 & repeat) != 0;
    case Calendar.MONDAY:
      return (2 & repeat) != 0;
    case Calendar.TUESDAY:
      return (4 & repeat) != 0;
    case Calendar.WEDNESDAY:
      return (8 & repeat) != 0;
    case Calendar.THURSDAY:
      return (16 & repeat) != 0;
    case Calendar.FRIDAY:
      return (32 & repeat) != 0;
    case Calendar.SATURDAY:
      return (64 & repeat) != 0;
  }
  return true;
}
 
Example 5
Project: unitimes   File: Event.java   View Source Code Vote up 7 votes
public String getDays(String[] dayNames, String[] shortDyNames) {
    int nrDays = 0;
    int dayCode = 0;
    for (Meeting meeting : getMeetings()) {
        int dc = 0;
        switch (meeting.getDayOfWeek()) {
           case Calendar.MONDAY    : dc = Constants.DAY_CODES[Constants.DAY_MON]; break;
           case Calendar.TUESDAY   : dc = Constants.DAY_CODES[Constants.DAY_TUE]; break;
           case Calendar.WEDNESDAY : dc = Constants.DAY_CODES[Constants.DAY_WED]; break;
           case Calendar.THURSDAY  : dc = Constants.DAY_CODES[Constants.DAY_THU]; break;
           case Calendar.FRIDAY    : dc = Constants.DAY_CODES[Constants.DAY_FRI]; break;
           case Calendar.SATURDAY  : dc = Constants.DAY_CODES[Constants.DAY_SAT]; break;
           case Calendar.SUNDAY    : dc = Constants.DAY_CODES[Constants.DAY_SUN]; break;
        }
        if ((dayCode & dc)==0) nrDays++;
        dayCode |= dc;
    }
       String ret = "";
    for (int i=0;i<Constants.DAY_CODES.length;i++) {
        if ((dayCode & Constants.DAY_CODES[i])!=0)
            ret += (nrDays==1?dayNames:shortDyNames)[i];
    }
       return ret;
}
 
Example 6
Project: Expert-Android-Programming   File: AppUtils.java   View Source Code Vote up 7 votes
public static int getDay(String day) {

        if(day.equals("Mon"))
            return Calendar.MONDAY;
        if(day.equals("Tue"))
            return Calendar.TUESDAY;
        if(day.equals("Wed"))
            return Calendar.WEDNESDAY;
        if(day.equals("Thu"))
            return Calendar.THURSDAY;
        if(day.equals("Fri"))
            return Calendar.FRIDAY;
        if(day.equals("Sat"))
            return Calendar.SATURDAY;
        if(day.equals("Sun"))
            return Calendar.SUNDAY;

        return Calendar.MONDAY;
    }
 
Example 7
Project: unitimes   File: MinutesPerWeek.java   View Source Code Vote up 7 votes
protected boolean hasDates(DatePattern datePattern, int dayCode) {
	if (datePattern == null) return false;
	Calendar cal = Calendar.getInstance(Locale.US);
	cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
       String pattern = datePattern.getPattern();
       for (int idx = 0; idx < pattern.length(); idx++) {
       	if (pattern.charAt(idx) == '1') {
       		boolean offered = false;
       		switch (cal.get(Calendar.DAY_OF_WEEK)) {
       			case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
       			case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
       			case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
       			case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
       			case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
       			case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
       			case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
       		}
       		if (offered) return true;
       	}
       	cal.add(Calendar.DAY_OF_YEAR, 1);
       }
       return false;
}
 
Example 8
Project: unitimes   File: ClassesAction.java   View Source Code Vote up 7 votes
public int getDaysCode(Set meetings) {
    int daysCode = 0;
    for (Iterator i=meetings.iterator();i.hasNext();) {
        Meeting meeting = (Meeting)i.next();
        Calendar date = Calendar.getInstance(Locale.US);
        date.setTime(meeting.getMeetingDate());
        switch (date.get(Calendar.DAY_OF_WEEK)) {
        case Calendar.MONDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_MON]; break;
        case Calendar.TUESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_TUE]; break;
        case Calendar.WEDNESDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_WED]; break;
        case Calendar.THURSDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_THU]; break;
        case Calendar.FRIDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_FRI]; break;
        case Calendar.SATURDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SAT]; break;
        case Calendar.SUNDAY : daysCode |= Constants.DAY_CODES[Constants.DAY_SUN]; break;
        }
    }
    return daysCode;
}
 
Example 9
Project: unitimes   File: MeetingCountingDuration.java   View Source Code Vote up 7 votes
protected int nbrMeetings(DatePattern datePattern, int dayCode) {
	if (datePattern == null) return 0;
	Calendar cal = Calendar.getInstance(Locale.US);
	cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
       String pattern = datePattern.getPattern();
       int ret = 0;
       for (int idx = 0; idx < pattern.length(); idx++) {
       	if (pattern.charAt(idx) == '1') {
       		boolean offered = false;
       		switch (cal.get(Calendar.DAY_OF_WEEK)) {
       			case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
       			case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
       			case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
       			case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
       			case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
       			case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
       			case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
       		}
       		if (offered) ret++;
       	}
       	cal.add(Calendar.DAY_OF_YEAR, 1);
       }
       return ret;
}
 
Example 10
Project: unitimes   File: MinutesPerWeek.java   View Source Code Vote up 6 votes
/**
 * Return all dates marked yellow in the given date pattern that are matching the selected day code (days of week)
 */
@Override
public List<Date> getDates(int minsPerWeek, DatePattern datePattern, int dayCode, int minutesPerMeeting) {
	List<Date> ret = new ArrayList<Date>();
	if (datePattern == null) return ret;
	Calendar cal = Calendar.getInstance(Locale.US);
	cal.setTime(datePattern.getStartDate()); cal.setLenient(true);
       EventDateMapping.Class2EventDateMap class2eventDates = EventDateMapping.getMapping(datePattern.getSession().getUniqueId());
       String pattern = datePattern.getPattern();
       for (int idx = 0; idx < pattern.length(); idx++) {
       	if (pattern.charAt(idx) == '1') {
       		boolean offered = false;
       		switch (cal.get(Calendar.DAY_OF_WEEK)) {
       			case Calendar.MONDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_MON]) != 0); break;
       			case Calendar.TUESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_TUE]) != 0); break;
       			case Calendar.WEDNESDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_WED]) != 0); break;
       			case Calendar.THURSDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_THU]) != 0); break;
       			case Calendar.FRIDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_FRI]) != 0); break;
       			case Calendar.SATURDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SAT]) != 0); break;
       			case Calendar.SUNDAY : offered = ((dayCode & Constants.DAY_CODES[Constants.DAY_SUN]) != 0); break;
       		}
       		if (offered) ret.add(class2eventDates.getEventDate(cal.getTime()));
       	}
       	cal.add(Calendar.DAY_OF_YEAR, 1);
       }
	return ret;
}
 
Example 11
Project: NeuTV   File: Video.java   View Source Code Vote up 6 votes
private String getWeek(String pTime) {
    String Week = "";
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
    Calendar c = Calendar.getInstance();
    try {
        c.setTime(format.parse(pTime));
    } catch (ParseException e) {
        return null;
    }
    switch (c.get(Calendar.DAY_OF_WEEK)){
        case Calendar.SUNDAY:
            Week = "周日";
            break;
        case Calendar.MONDAY:
            Week = "周一";
            break;
        case Calendar.TUESDAY:
            Week = "周二";
            break;
        case Calendar.WEDNESDAY:
            Week = "周三";
            break;
        case Calendar.THURSDAY:
            Week = "周四";
            break;
        case Calendar.FRIDAY:
            Week = "周五";
            break;
        case Calendar.SATURDAY:
            Week = "周六";
            break;
    }
    return Week;
}
 
Example 12
Project: SER316-Dresden   File: EventsTableMonthly.java   View Source Code Vote up 6 votes
public Object getValueAt(int row, int col) {
	Event ev = getEventAt(row,col);
	if(ev == null) return "";
	Calendar cal = (Calendar)days[col].get(row);
	String res = "";
	switch(cal.get(Calendar.DAY_OF_WEEK)){
		case Calendar.SUNDAY: res += "SU";
			break;
		case Calendar.MONDAY: res += "MO";
			break;
		case Calendar.TUESDAY: res += "TU";
			break;
		case Calendar.WEDNESDAY: res += "WE";
			break;
		case Calendar.THURSDAY: res += "TH";
			break;
		case Calendar.FRIDAY: res += "FR";
			break;
		case Calendar.SATURDAY: res += "SA";
			break;
		default: res += "??";
	}
	String dOM = cal.get(Calendar.DAY_OF_MONTH) + "";
	switch(cal.get(Calendar.DAY_OF_MONTH)%10){
		case 1: dOM += "st";
			break;
		case 2: dOM += "nd";
			break;
		case 3: dOM += "rd";
			break;
		default:dOM+="th";
	}
	res+= " / " + dOM  + ": ";
	if(ev.getText().equals("")) res+= "EVENT";
	else res += ev.getText();
	return res;       		
}
 
Example 13
Project: LucaHome-MediaServer   File: MainService.java   View Source Code Vote up 6 votes
private void checkCurrentTime() {
    Calendar now = Calendar.getInstance();

    int second = now.get(Calendar.SECOND);
    int minute = now.get(Calendar.MINUTE);
    int hour = now.get(Calendar.HOUR_OF_DAY);
    int weekday = now.get(Calendar.DAY_OF_WEEK);

    boolean isWeekend = weekday == Calendar.SUNDAY || weekday == Calendar.SATURDAY;

    _logger.Debug(String.format(Locale.GERMAN,
            "checkCurrentTime at %02d:%02d:%02d on %d",
            hour, minute, second, weekday));

    if ((second >= 0 && second < 5) && minute == 0) {
        for (AutomaticSettings entry : AutomaticSettings.values()) {
            if (entry.GetEnableHour() == hour) {
                if ((entry.IsWeekend() && isWeekend) || (!entry.IsWeekend() && !isWeekend)) {
                    int maxVolume = _mediaVolumeController.GetMaxVolume();
                    double currentVolume = (entry.GetSoundVolumePercentage() / 100) * maxVolume;
                    setSettings(currentVolume, (int) entry.GetScreenBrightnessPercentage());
                    break;
                }
            }
        }
    }
}
 
Example 14
Project: bulbasaur   File: DayUtils.java   View Source Code Vote up 6 votes
public static boolean isRestDay(Calendar cal) {
    if (!initialized) {
        throw new IllegalStateException("need init first");
    }
    int yearIndex = cal.get(Calendar.YEAR) - baseYear;
    if (yearIndex < 0 || yearIndex >= days.length) {
        int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
        return dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY;
    }
    int dayOfYear = cal.get(Calendar.DAY_OF_YEAR) - 1;
    return (days[yearIndex][dayOfYear / 8] & (byte) (1 << dayOfYear % 8)) != 0;
}
 
Example 15
Project: routineKeen   File: HabitListController.java   View Source Code Vote up 6 votes
/**
 * Returns a list of all habits belonging to the current user that are scheduled for the current
 * day of the week.
 * @return  A HabitList containing today's habits
 * @see     HabitList
 */
public static HabitList getTodaysHabits() {
    /*
     Taken from: https://stackoverflow.com/questions/5574673/what-is-the-easiest-way-to-get-
     the-current-day-of-the-week-in-android
     Date: Nov 13, 2017
    */
    String today = "";
    int day = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
    switch (day) {
        case Calendar.SUNDAY:   today = "Sun";  break;
        case Calendar.MONDAY:   today = "Mon";  break;
        case Calendar.TUESDAY:  today = "Tue";  break;
        case Calendar.WEDNESDAY:today = "Wed";  break;
        case Calendar.THURSDAY: today = "Thu";  break;
        case Calendar.FRIDAY:   today = "Fri";  break;
        case Calendar.SATURDAY: today = "Sat";  break;
        default:                today = null;   break;
    }

    HabitList returnList = new HabitList();
    for (Habit x : getHabitList().getHabits()) {
        if (x.getScheduledHabitDays().contains(today)) {
            returnList.addHabit(x);
        }
    }

    return returnList;
}
 
Example 16
Project: GitHub   File: HighlightWeekendsDecorator.java   View Source Code Vote up 5 votes
@Override
public boolean shouldDecorate(CalendarDay day) {
    day.copyTo(calendar);
    int weekDay = calendar.get(Calendar.DAY_OF_WEEK);
    return weekDay == Calendar.SATURDAY || weekDay == Calendar.SUNDAY;
}
 
Example 17
Project: School1-Android   File: DashboardAdapter.java   View Source Code Vote up 5 votes
public DashboardAdapter(Context context) {
    Calendar calendar = Calendar.getInstance();
    int today = calendar.get(Calendar.DAY_OF_WEEK);

    // Today is default
    rowItems.add(new Section(context.getString(R.string.section_title_today), getSectionDate(calendar)));
    calendar.add(Calendar.DAY_OF_YEAR, 1);

    if (today >= Calendar.MONDAY && today <= Calendar.WEDNESDAY) {
        rowItems.add(new Section(context.getString(R.string.section_title_tomorrow), getSectionDate(calendar)));
        calendar.add(Calendar.DAY_OF_YEAR, 1);
        rowItems.add(new Section(context.getString(R.string.section_title_this_week), getSectionDate(calendar)));
    } else if (today == Calendar.THURSDAY) {
        rowItems.add(new Section(context.getString(R.string.section_title_tomorrow), getSectionDate(calendar)));
        calendar.add(Calendar.DAY_OF_YEAR, 1);
        rowItems.add(new Section(context.getString(R.string.section_title_weekend), getSectionDate(calendar)));
    } else if (today == Calendar.FRIDAY)
        rowItems.add(new Section(context.getString(R.string.section_title_weekend), getSectionDate(calendar)));
    else if (today == Calendar.SATURDAY)
        rowItems.add(new Section(context.getString(R.string.section_title_tomorrow), getSectionDate(calendar)));

    calendar = Calendar.getInstance();
    calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);

    if (calendar.getFirstDayOfWeek() != Calendar.SUNDAY || today != Calendar.SUNDAY)
        calendar.add(Calendar.WEEK_OF_YEAR, 1);

    rowItems.add(new Section(context.getString(R.string.section_title_next_week), getSectionDate(calendar)));

    // TODO: Holiday and interval sections (between two holidays, to give a clearer overview over whats happening in the long run)
    calendar.add(Calendar.WEEK_OF_YEAR, 1);
    rowItems.add(new Section("Until the end of the universe", getSectionDate(calendar)));

    // TODO: Listen on login
    UserInfo userInfo = FirebaseAuth.getInstance().getCurrentUser();
    if (userInfo != null) {
        DocumentReference userReference = FirebaseFirestore.getInstance()
                .collection("users")
                .document(userInfo.getUid());

        userReference.collection("groups")
                .addSnapshotListener(this);
        userReference.collection("items")
                .addSnapshotListener(new GroupItemsChangeListener(FirebaseAuth.getInstance().getCurrentUser().getUid()));
    }
}
 
Example 18
Project: TIIEHenry-Android-SDK   File: DateUtils.java   View Source Code Vote up 5 votes
/**
 * 获取某天是星期几
 *
 * @param date
 * @return
 */
public static String getMonthDayWeek(Date date) {
    Calendar c = Calendar.getInstance();
    c.setTime(date);
    int year = c.get(Calendar.YEAR);    //获取年
    int month = c.get(Calendar.MONTH) + 1;   //获取月份,0表示1月份
    int day = c.get(Calendar.DAY_OF_MONTH);    //获取当前天数
    int week = c.get(Calendar.DAY_OF_WEEK);

    String weekStr = null;

    switch (week) {

        case Calendar.SUNDAY:
            weekStr = "周日";
            break;

        case Calendar.MONDAY:
            weekStr = "周一";
            break;

        case Calendar.TUESDAY:
            weekStr = "周二";
            break;

        case Calendar.WEDNESDAY:
            weekStr = "周三";
            break;

        case Calendar.THURSDAY:
            weekStr = "周四";
            break;

        case Calendar.FRIDAY:
            weekStr = "周五";
            break;

        case Calendar.SATURDAY:
            weekStr = "周六";
            break;
    }

    return month + "月" + day + "日" + "(" + weekStr + ")";
}
 
Example 19
Project: unitimes   File: CourseOfferingExport.java   View Source Code Vote up 5 votes
protected void exportEvent(Element classElement, Event event, Session session) {
  	if (event == null) return;
  	List<Meeting> meetings = new ArrayList<Meeting>(event.getMeetings());
  	Collections.sort(meetings, new Comparator<Meeting>() {
	@Override
	public int compare(Meeting m1, Meeting m2) {
		if (m1.equals(m2)) return 0;
		int cmp = m1.getMeetingDate().compareTo(m2.getMeetingDate());
		if (cmp != 0) return cmp;
		cmp = m1.getStartPeriod().compareTo(m2.getStartPeriod());
		if (cmp != 0) return cmp;
		Location l1 = (m1.getLocationPermanentId() == null ? null : iMeetingLocations.get(m1.getLocationPermanentId()));
		Location l2 = (m2.getLocationPermanentId() == null ? null : iMeetingLocations.get(m2.getLocationPermanentId()));
		cmp = (l1 == null ? "" : l1.getLabel()).compareTo(l2 == null ? "" : l2.getLabel());
		if (cmp != 0) return cmp;
		return m1.getUniqueId().compareTo(m2.getUniqueId());
	}
});
      for (Meeting meeting: meetings) {
          if (meeting.getStatus() != Meeting.Status.APPROVED) continue;
          Element meetingElement = classElement.addElement("meeting");
          meetingElement.addAttribute("startDate", sDateFormat.format(meeting.getMeetingDate()));
          meetingElement.addAttribute("endDate", sDateFormat.format(meeting.getMeetingDate()));
          meetingElement.addAttribute("startTime", sTimeFormat.format(meeting.getStartTime()));
          meetingElement.addAttribute("endTime", sTimeFormat.format(meeting.getStopTime()));
          Calendar c = Calendar.getInstance(Locale.US); c.setTime(meeting.getMeetingDate());
          switch (c.get(Calendar.DAY_OF_WEEK)) {
              case Calendar.MONDAY : meetingElement.addAttribute("days","M"); break;
              case Calendar.TUESDAY : meetingElement.addAttribute("days","T"); break;
              case Calendar.WEDNESDAY : meetingElement.addAttribute("days","W"); break;
              case Calendar.THURSDAY : meetingElement.addAttribute("days","R"); break;
              case Calendar.FRIDAY : meetingElement.addAttribute("days","F"); break;
              case Calendar.SATURDAY : meetingElement.addAttribute("days","S"); break;
              case Calendar.SUNDAY : meetingElement.addAttribute("days","U"); break;
          }
          Location location = (meeting.getLocationPermanentId() == null ? null : iMeetingLocations.get(meeting.getLocationPermanentId()));
          if (location==null) {
          } else if (location instanceof Room) {
              meetingElement.addAttribute("building", ((Room)location).getBuildingAbbv());
              meetingElement.addAttribute("room", ((Room)location).getRoomNumber());
          } else {
              meetingElement.addAttribute("location", location.getLabel());
          }
      }
  }
 
Example 20
Project: calendarview2   File: HighlightWeekendsDecorator.java   View Source Code Vote up 5 votes
@Override
public boolean shouldDecorate(CalendarDay day) {
    day.copyTo(calendar);
    int weekDay = calendar.get(Calendar.DAY_OF_WEEK);
    return weekDay == Calendar.SATURDAY || weekDay == Calendar.SUNDAY;
}