Interface ScheduleModel
- All Known Implementing Classes:
AbstractScheduleModel, CalendarScheduleModel, DefaultScheduleModel
What a Scheduler shows and edits.
A view asks for the items of the range on screen every time it paints, so
getItems has to be cheap: a model that loads from a server answers from
what it has and fires a change when more arrives. setVisibleRange is how
it learns what to load.
DefaultScheduleModel holds items in memory, and CalendarScheduleModel
reads a calendar source. Extend AbstractScheduleModel for one of your own.
-
Method Summary
Modifier and TypeMethodDescriptionvoidcreateItem(long start, long end, String resourceId) Creates an item for a range the user dragged out on empty space.voidgetItems(long from, long to, List<ScheduleItem> out) Adds every item with any part inside[from, to)toout.The resources, in the order they are shown.voidbooleanremoveItem(ScheduleItem item) Removes an item.voidsetVisibleRange(long from, long to) Told by a view whenever the range it shows changes, with a margin around it.booleanupdateItem(ScheduleItem item, long start, long end, String resourceId) Moves or resizes an item, and gives it to another resource whenresourceIddiffers from the one it has.
-
Method Details
-
getResources
List<ScheduleResource> getResources()The resources, in the order they are shown. Empty for a schedule that is one person's. -
getItems
Adds every item with any part inside[from, to)toout. -
setVisibleRange
void setVisibleRange(long from, long to) Told by a view whenever the range it shows changes, with a margin around it. A model that keeps everything in memory ignores it. -
updateItem
Moves or resizes an item, and gives it to another resource when
resourceIddiffers from the one it has.Returns
false when the model refuses the change; the view puts the item back
-
createItem
Creates an item for a range the user dragged out on empty space.
Returns
the new item, or null when the model does not create items this way
-
removeItem
Removes an item.
Returns
false when the model refuses
-
addChangeListener
-
removeChangeListener
-