com.bradrydzewski.gwt.calendar.client.monthview
Class AppointmentStackingManager

java.lang.Object
  extended by com.bradrydzewski.gwt.calendar.client.monthview.AppointmentStackingManager

public class AppointmentStackingManager
extends Object

Manages the AppointmentLayoutDescription in a stack-like structure arranged in layers. Layers are 0-based (1nd. layer has an index of 0, 2nd. has an index of 1).

Author:
Carlos D. Morales

Constructor Summary
AppointmentStackingManager()
           
 
Method Summary
 boolean areThereAppointmentsOn(int day)
          Indicates whether there are any appointments that encompass the specified day.
 void assignLayer(AppointmentLayoutDescription description)
          Associates the provided description to the first available layer in the collection administered by this manager.
 ArrayList<AppointmentLayoutDescription> getDescriptionsInLayer(int layerIndex)
          Returns all the AppointmentLayoutDescriptions in the specified layer.
 int lowestLayerIndex(int day)
          Returns the lowest layer index that is available on the specified day.
 int multidayAppointmentsOverLimitOn(int day)
          Returns the number of appointments (multi-day or all-day, as that's the type of appointment that the stacking manager deals with only) that exceeded the layerOverflowLimit value when they were stacked.
 int nextLowestLayerIndex(int day, int fromLayer)
          Returns the lowest layer index higher than fromLayer that is available on the specified day.
 void setLayerOverflowLimit(int layerOverflowLimit)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AppointmentStackingManager

public AppointmentStackingManager()
Method Detail

setLayerOverflowLimit

public void setLayerOverflowLimit(int layerOverflowLimit)

assignLayer

public void assignLayer(AppointmentLayoutDescription description)
Associates the provided description to the first available layer in the collection administered by this manager. This manager will look up in the stack of layers (from lowest index to highest index) until a layer that does not have any AppointmentLayoutDescriptions that overlap with the days that the description's appointment spans.

Parameters:
description - An appointment description object that can be laid on a layer

lowestLayerIndex

public int lowestLayerIndex(int day)
Returns the lowest layer index that is available on the specified day.

Parameters:
day - The day index for which the lowest layer index will be attempted to identify
Returns:
An integer representing the index of the layer (zero-based) for which an single day Appointment can be displayed on.

nextLowestLayerIndex

public int nextLowestLayerIndex(int day,
                                int fromLayer)
Returns the lowest layer index higher than fromLayer that is available on the specified day.

Parameters:
day - The day index for which the lowest layer index will be attempted to identify found
fromLayer - The layer index after which the search for next available layer should be started from
Returns:
An integer representing the index of the layer (zero-based) for which an single day Appointment can be displayed on.

getDescriptionsInLayer

public ArrayList<AppointmentLayoutDescription> getDescriptionsInLayer(int layerIndex)
Returns all the AppointmentLayoutDescriptions in the specified layer.

Parameters:
layerIndex - The index of a layer for which descriptions will be returned
Returns:
The collection of appointment descriptions in the layer, null if no appointment has been allocated for the layer at all

multidayAppointmentsOverLimitOn

public int multidayAppointmentsOverLimitOn(int day)
Returns the number of appointments (multi-day or all-day, as that's the type of appointment that the stacking manager deals with only) that exceeded the layerOverflowLimit value when they were stacked.

Parameters:
day - The day to perform the count
Returns:
The number of days that got a layer higher than the configured layerOverflowLimit layer, if there were any

areThereAppointmentsOn

public boolean areThereAppointmentsOn(int day)
Indicates whether there are any appointments that encompass the specified day.

Parameters:
day - The day to test for appointments
Returns:
true if there are any descriptions in any layer for the specified day.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.