Package org.zkoss.calendar.impl
Class SimpleCalendarModel
- java.lang.Object
-
- org.zkoss.calendar.impl.AbstractCalendarModel
-
- org.zkoss.calendar.impl.SimpleCalendarModel
-
- All Implemented Interfaces:
Serializable,CalendarModel
public class SimpleCalendarModel extends AbstractCalendarModel implements Serializable
A simple implementation ofCalendarModel.- Author:
- jumperchen,jimmy
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected List<CalendarItem>_list
-
Constructor Summary
Constructors Constructor Description SimpleCalendarModel()Constructor.SimpleCalendarModel(int initialCapacity)Constructor.SimpleCalendarModel(Collection<CalendarItem> c)Constructor.SimpleCalendarModel(List<CalendarItem> list, boolean live)ConstructorSimpleCalendarModel(CalendarItem[] array)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(int index, CalendarItem e)Adds the calendar item to the specified index of the list.booleanadd(CalendarItem e)Adds the calendar item to the list.voidclear()Removes all of the elements from this list (optional operation).List<CalendarItem>get(LocalDateTime beginDate, LocalDateTime endDate, RenderContext context)List<CalendarItem>get(Date beginDate, Date endDate, RenderContext rc)Deprecated.3.2.0intindexOf(CalendarItem elem)Returns the index of the first occurrence of the specified element in this list.static booleanisTimeOverlapping(Date begin1, Date end1, Date begin2, Date end2)CalendarItemremove(int index)Removes the calendar item from the specified index.booleanremove(CalendarItem e)Removes from the specified calendar item.intsize()Returns the number of elements in this list.booleanupdate(CalendarItem e)Update the calendar item to the list.-
Methods inherited from class org.zkoss.calendar.impl.AbstractCalendarModel
addCalendarDataListener, fireEvent, fireEvent, fireEvent, fireEvent, removeCalendarDataListener
-
-
-
-
Field Detail
-
_list
protected List<CalendarItem> _list
-
-
Constructor Detail
-
SimpleCalendarModel
public SimpleCalendarModel(List<CalendarItem> list, boolean live)
Constructor- Parameters:
list- the list to representlive- whether to have a 'live'CalendarModelon top of the specified list. If false, the content of the specified list is copied. If true, this object is a 'facade' of the specified list, i.e., when you add or remove items from this SimpleCalendarModel, the inner "live" list would be changed accordingly. However, it is not a good idea to modifylistif it is passed to this method with live is true, sinceCalendarsis not smart enough to handle it. Instead, modify it thru this object.
-
SimpleCalendarModel
public SimpleCalendarModel()
Constructor.
-
SimpleCalendarModel
public SimpleCalendarModel(Collection<CalendarItem> c)
Constructor. It makes a copy of the specified collection (i.e., not live).
-
SimpleCalendarModel
public SimpleCalendarModel(CalendarItem[] array)
Constructor. It makes a copy of the specified array (i.e., not live).
-
SimpleCalendarModel
public SimpleCalendarModel(int initialCapacity)
Constructor.- Parameters:
initialCapacity- the initial capacity for this SimpleCalendarModel.
-
-
Method Detail
-
add
public void add(int index, CalendarItem e)Adds the calendar item to the specified index of the list.
-
add
public boolean add(CalendarItem e)
Adds the calendar item to the list.
-
update
public boolean update(CalendarItem e)
Update the calendar item to the list.
-
remove
public CalendarItem remove(int index)
Removes the calendar item from the specified index.
-
indexOf
public int indexOf(CalendarItem elem)
Returns the index of the first occurrence of the specified element in this list.
-
remove
public boolean remove(CalendarItem e)
Removes from the specified calendar item.
-
clear
public void clear()
Removes all of the elements from this list (optional operation). The list will be empty after this call returns.
-
size
public int size()
Returns the number of elements in this list.
-
get
public List<CalendarItem> get(Date beginDate, Date endDate, RenderContext rc)
Deprecated.3.2.0Retrieves a list ofCalendarItemthat overlap with the specified time range.- Specified by:
getin interfaceCalendarModel- Parameters:
beginDate- the begin dateendDate- the end daterc- a RenderContext encapsulates the information needed for Calendars.- See Also:
get(LocalDateTime, LocalDateTime, RenderContext)
-
get
public List<CalendarItem> get(LocalDateTime beginDate, LocalDateTime endDate, RenderContext context)
- Specified by:
getin interfaceCalendarModel- Since:
- 3.2.0
- See Also:
get(Date, Date, RenderContext)
-
-