Class WeekendCalendar

All Implemented Interfaces:
ActivityRepository<WeekendCalendarActivity>, Calendar<WeekendCalendarActivity>, EventTarget

public class WeekendCalendar
extends CalendarBase<WeekendCalendarActivity>
A calendar specialized on returning activities that represent weekend days (default: saturday, sunday). The days that are considered weekend days can be configured by calling setWeekendDays(DayOfWeek...).
Since:
1.0
  • Constructor Details

    • WeekendCalendar

      public WeekendCalendar()
      Constructs a new weekend calendar.
      Since:
      1.0
  • Method Details

    • setWeekendDays

      public void setWeekendDays​(DayOfWeek... days)
      Sets the days of the week that are considered to be a weekend day. By default DayOfWeek.SATURDAY and DayOfWeek.SUNDAY are considered weekend days.
      Parameters:
      days - the days of the week that are to be considered weekend days
      Since:
      1.0
    • getWeekendDays

      public DayOfWeek[] getWeekendDays()
      Returns the days of the week that are to be considered weekend days. By default DayOfWeek.SATURDAY and DayOfWeek.SUNDAY are considered weekend days.
      Returns:
      the days of the week used as weekend days
      Since:
      1.0
    • getActivities

      public Iterator<WeekendCalendarActivity> getActivities​(Layer layer, Instant startTime, Instant endTime, TemporalUnit temporalUnit, ZoneId zoneId)
      Description copied from interface: ActivityRepository
      Returns an iterator for iterating over all activities found for the given layer and time interval. This method has to return very fast as it gets called many times during rendering of the chart. A slow implementation will have a direct impact on scrolling / rendering performance.
      Parameters:
      layer - the layer for which to return the activities
      startTime - the start time of the time interval for which to return the activities
      endTime - the end time of the time interval for which to return the activities
      temporalUnit - the temporal unit currently displayed in the dateline
      zoneId - the timezone currently displayed in the dateline
      Returns:
      the activities on the given layer and in the given time interval
    • isSupportedUnit

      protected boolean isSupportedUnit​(TemporalUnit unit)
      Determines if weekends will be shown for the given temporal unit. By default we only show weekends for ChronoUnit.DAYS and ChronoUnit.WEEKS. To support more units simply override this method in a subclass.
      Parameters:
      unit - the unit to check
      Returns:
      true if weekend information will be shown in the Gantt chart
      Since:
      1.0