Interface ScheduleModel

All Known Implementing Classes:
AbstractScheduleModel, CalendarScheduleModel, DefaultScheduleModel

public interface ScheduleModel

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 Details

    • getResources

      List<ScheduleResource> getResources()
      The resources, in the order they are shown. Empty for a schedule that is one person's.
    • getItems

      void getItems(long from, long to, List<ScheduleItem> out)
      Adds every item with any part inside [from, to) to out.
    • 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

      boolean updateItem(ScheduleItem item, long start, long end, String resourceId)

      Moves or resizes an item, and gives it to another resource when resourceId differs from the one it has.

      Returns

      false when the model refuses the change; the view puts the item back

    • createItem

      ScheduleItem createItem(long start, long end, String resourceId)

      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

      boolean removeItem(ScheduleItem item)

      Removes an item.

      Returns

      false when the model refuses

    • addChangeListener

      void addChangeListener(ScheduleChangeListener l)
    • removeChangeListener

      void removeChangeListener(ScheduleChangeListener l)