org.sakaiproject.component.legacy.calendar
Class BaseCalendarService.SingleDayLayoutTable

java.lang.Object
  extended byorg.sakaiproject.component.legacy.calendar.BaseCalendarService.SingleDayLayoutTable
Enclosing class:
BaseCalendarService

protected class BaseCalendarService.SingleDayLayoutTable
extends Object

Table used to layout a single day, with potentially overlapping events.


Field Summary
protected  long millisecondsPerTimeslot
           
protected  int numCols
           
protected  int numRows
           
protected  ArrayList rows
           
protected  TimeRange timeRange
           
 
Constructor Summary
BaseCalendarService.SingleDayLayoutTable(TimeRange timeRange, int maxNumberOverlappingEvents, int timeslotInMinutes)
          Constructor for SingleDayLayoutTable
 
Method Summary
 void addEvent(CalendarEvent calendarEvent)
          Adds an event to the SingleDayLayoutTable
protected  TimeRange adjustTimeRangeToLayoutTable(TimeRange eventTimeRange)
          Convert the time range to fall entirely within the time range of the layout table.
protected  boolean cellHasOverlappingEvents(int rowNum, int colNum)
          Returns true if there are any events in this or other rows that overlap the event associated with this cell.
protected  BaseCalendarService.LayoutTableCell getCell(int rowNum, int colNum)
          Get a particular cell.
protected  BaseCalendarService.LayoutTableCell getFirstCell(int rowNum, int colNum)
          Gets the first cell associated with the event that's stored at this row/column
protected  int getFreeColumn(int rowNum, int numberColumnsNeeded)
          Looks for a column where the whole event can be placed.
 List getLayoutRows()
          Creates a list of lists of lists.
protected  int getNumberOfRowsNeeded(TimeRange eventTimeRange)
           
protected  int getNumberRowsInEventGroup(int rowNum)
          Gets the number of rows in an event group.
 int getNumCols()
          Gets the total number of columns in the layout table.
 int getNumRows()
          Gets the total number of rows in the layout table.
protected  int getStartingRow(TimeRange eventTimeRange)
          Given a time range, returns the starting row number in the layout table.
 TimeRange getTimeRangeForEventGroup(int rowNum, int numRowsInThisEventGroup)
          Returns the earliest/latest times for events in this group.
protected  boolean isEmptyRow(int rowNum)
          Returns true if this row has only empty cells.
protected  boolean isStartingRowOfGroup(int rowNum)
          Returns true if this row has only starting cells and no continuation cells.
 boolean rowHasOverlappingEvents(int rowNum)
          Returns true if there are any cells in this row associated with events which overlap each other in this row or any other row.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

millisecondsPerTimeslot

protected long millisecondsPerTimeslot

numCols

protected int numCols

numRows

protected int numRows

rows

protected ArrayList rows

timeRange

protected TimeRange timeRange
Constructor Detail

BaseCalendarService.SingleDayLayoutTable

public BaseCalendarService.SingleDayLayoutTable(TimeRange timeRange,
                                                int maxNumberOverlappingEvents,
                                                int timeslotInMinutes)
Constructor for SingleDayLayoutTable

Method Detail

addEvent

public void addEvent(CalendarEvent calendarEvent)
Adds an event to the SingleDayLayoutTable


adjustTimeRangeToLayoutTable

protected TimeRange adjustTimeRangeToLayoutTable(TimeRange eventTimeRange)
Convert the time range to fall entirely within the time range of the layout table.


cellHasOverlappingEvents

protected boolean cellHasOverlappingEvents(int rowNum,
                                           int colNum)
Returns true if there are any events in this or other rows that overlap the event associated with this cell.


getCell

protected BaseCalendarService.LayoutTableCell getCell(int rowNum,
                                                      int colNum)
Get a particular cell. Returns a reference to the actual cell and not a copy.


getFirstCell

protected BaseCalendarService.LayoutTableCell getFirstCell(int rowNum,
                                                           int colNum)
Gets the first cell associated with the event that's stored at this row/column


getFreeColumn

protected int getFreeColumn(int rowNum,
                            int numberColumnsNeeded)
Looks for a column where the whole event can be placed.


getLayoutRows

public List getLayoutRows()
Creates a list of lists of lists. The outer list is a list of rows. Each row is a list of columns. Each column is a list of column values.


getNumberOfRowsNeeded

protected int getNumberOfRowsNeeded(TimeRange eventTimeRange)

getNumberRowsInEventGroup

protected int getNumberRowsInEventGroup(int rowNum)
Gets the number of rows in an event group. This function assumes that the row that it starts on is the starting row of the group.


getNumCols

public int getNumCols()
Gets the total number of columns in the layout table.


getNumRows

public int getNumRows()
Gets the total number of rows in the layout table.


getStartingRow

protected int getStartingRow(TimeRange eventTimeRange)
Given a time range, returns the starting row number in the layout table.


getTimeRangeForEventGroup

public TimeRange getTimeRangeForEventGroup(int rowNum,
                                           int numRowsInThisEventGroup)
Returns the earliest/latest times for events in this group. This function assumes that the row that it starts on is the starting row of the group.


isEmptyRow

protected boolean isEmptyRow(int rowNum)
Returns true if this row has only empty cells.


isStartingRowOfGroup

protected boolean isStartingRowOfGroup(int rowNum)
Returns true if this row has only starting cells and no continuation cells.


rowHasOverlappingEvents

public boolean rowHasOverlappingEvents(int rowNum)
Returns true if there are any cells in this row associated with events which overlap each other in this row or any other row.