org.apache.myfaces.custom.schedule.model
Class PlannerModel

java.lang.Object
  extended byorg.apache.myfaces.custom.schedule.model.PlannerModel
All Implemented Interfaces:
java.io.Serializable

public class PlannerModel
extends java.lang.Object
implements java.io.Serializable

The model of a Planner component

TODO this should be an interface, with a DefaultPlannerModel implementation

Version:
$Revision$
Author:
Jurgen Lust (latest modification by $Author$)
See Also:
Serialized Form

Constructor Summary
PlannerModel()
          Creates a new PlannerModel object.
 
Method Summary
 Day add(java.util.Date date)
           Add a day to the planner
 Day add(java.util.Date date, boolean isWorkingDay, java.lang.String specialDayName)
           Add a day to the planner
 Day add(Day day)
           Add a day to the planner
 boolean add(PlannerEntity entity)
           Add an entity to the planner
 PlannerEntity add(java.lang.String id, java.lang.String name)
           Add an entity to the planner
 boolean addEntry(java.lang.String entityId, ScheduleEntry entry)
           Add a schedule entry to the planner
 void clear()
           Remove all days and all entities
 boolean containsDate(java.util.Date date)
           Check if the planner contains the specified date
 java.util.Iterator dayIterator()
           
 java.util.Iterator entityIterator()
           
 Day getDay(int index)
           Get the day at position index
 PlannerEntity getEntity(java.lang.String id)
           Get the entity at position index
 int numberOfDays()
           
 int numberOfEntities()
           
 boolean setDay(java.util.Date date)
           Set the day
 boolean setSpecialDay(java.util.Date date, boolean isWorkingDay, java.lang.String specialDayName)
           Assign a special status to a day, e.g. a holiday
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlannerModel

public PlannerModel()
Creates a new PlannerModel object.

Method Detail

setDay

public boolean setDay(java.util.Date date)

Set the day

Parameters:
date - the new day
Returns:
true if successful

getDay

public Day getDay(int index)

Get the day at position index

Parameters:
index - the index
Returns:
the day

getEntity

public PlannerEntity getEntity(java.lang.String id)

Get the entity at position index

Parameters:
id - the index
Returns:
the entity

setSpecialDay

public boolean setSpecialDay(java.util.Date date,
                             boolean isWorkingDay,
                             java.lang.String specialDayName)

Assign a special status to a day, e.g. a holiday

Parameters:
date - the date
isWorkingDay - whether the day is a normal working day
specialDayName - the name of the holiday
Returns:
true if successful

add

public Day add(java.util.Date date,
               boolean isWorkingDay,
               java.lang.String specialDayName)

Add a day to the planner

Parameters:
date - the date that should be added
isWorkingDay - whether the day is a normal working day
specialDayName - the name of the holiday, if any
Returns:
the day that was added

add

public boolean add(PlannerEntity entity)

Add an entity to the planner

Parameters:
entity - the entity to add
Returns:
true if successful

add

public PlannerEntity add(java.lang.String id,
                         java.lang.String name)

Add an entity to the planner

Parameters:
id - the id of the entity
name - the name of the entity
Returns:
the entity that was added

add

public Day add(Day day)

Add a day to the planner

Parameters:
day - the day to add
Returns:
the day that was added

add

public Day add(java.util.Date date)

Add a day to the planner

Parameters:
date - the day to add
Returns:
the day that was added

addEntry

public boolean addEntry(java.lang.String entityId,
                        ScheduleEntry entry)

Add a schedule entry to the planner

Parameters:
entityId - the id of the entity to which the entry applies
entry - the entry to add
Returns:
true if successful

clear

public void clear()

Remove all days and all entities


containsDate

public boolean containsDate(java.util.Date date)

Check if the planner contains the specified date

Parameters:
date - the date to check
Returns:
true if successful

dayIterator

public java.util.Iterator dayIterator()
Returns:
an iterator for the days of the planner

entityIterator

public java.util.Iterator entityIterator()
Returns:
an iterator for the entities of the planner

numberOfDays

public int numberOfDays()
Returns:
the number of days that are shown in the planner

numberOfEntities

public int numberOfEntities()
Returns:
the number of entities that are shown in the planner