/** * Compact timezones. * @param calendar The calendar. */ private void compactTimezones(Calendar calendar) { if (calendar==null) { return; } // Get list of timezones in master calendar and remove all timezone // definitions that are in the registry. The idea is to not store // extra data. Instead, the timezones will be added to the calendar // by the getCalendar() api. ComponentList<VTimeZone> timezones = calendar.getComponents(Component.VTIMEZONE); List<VTimeZone> toRemove = new ArrayList<>(); for(VTimeZone vtz : timezones) { String tzid = vtz.getTimeZoneId().getValue(); TimeZone tz = TIMEZONE_REGISTRY.getTimeZone(tzid); // Remove timezone iff it matches the one in the registry if(tz!=null && vtz.equals(tz.getVTimeZone())) { toRemove.add(vtz); } } // remove known timezones from master calendar calendar.getComponents().removeAll(toRemove); }
/** * Compact timezones. * @param calendar The calendar. */ private void compactTimezones(Calendar calendar) { if (calendar==null) { return; } // Get list of timezones in master calendar and remove all timezone // definitions that are in the registry. The idea is to not store // extra data. Instead, the timezones will be added to the calendar // by the getCalendar() api. ComponentList<VTimeZone> timezones = calendar.getComponents(Component.VTIMEZONE); List<VTimeZone> toRemove = new ArrayList<>(); for(VTimeZone vtz : timezones) { String tzid = vtz.getTimeZoneId().getValue(); TimeZone tz = TIMEZONE_REGISTRY.getTimeZone(tzid); // Remove timezone iff it matches the one in the registry if(tz!=null && vtz.equals(tz.getVTimeZone())) { toRemove.add(vtz); } } // remove known timezones from master calendar calendar.getComponents().removeAll(toRemove); }
public void setExceptionEvent(VEvent event) { if(getEventCalendar()==null) { createCalendar(); } // remove all events getEventCalendar().getComponents().removeAll( getEventCalendar().getComponents().getComponents(Component.VEVENT)); // add event exception getEventCalendar().getComponents().add(event); }
public void setExceptionEvent(VEvent event) { if(getEventCalendar()==null) { createCalendar(); } // remove all events getEventCalendar().getComponents().removeAll( getEventCalendar().getComponents().getComponents(Component.VEVENT)); // add event exception getEventCalendar().getComponents().add(event); }