Module com.flexganttfx.model
Package com.flexganttfx.model
Interface ActivityRepository<A extends Activity>
- Type Parameters:
A
- the type of activities stored in the repository
- All Superinterfaces:
EventTarget
- All Known Subinterfaces:
Calendar<A>
,MutableActivityRepository<A>
- All Known Implementing Classes:
ActivityRepositoryBase
,CalendarBase
,IntervalTreeActivityRepository
,ListActivityRepository
,MutableActivityRepositoryBase
,WeekendCalendar
public interface ActivityRepository<A extends Activity> extends EventTarget
Activity repositories are used by rows to store and lookup activities. Each
row by default owns an
IntervalTreeActivityRepository
. This default
repository can be replaced with a custom one, for example if your application
requires a lazy loading strategy.- Since:
- 1.0
- See Also:
Row.setRepository(ActivityRepository)
-
Method Summary
Modifier and Type Method Description void
addEventHandler(EventHandler<RepositoryEvent> handler)
Adds an event handler for receiving repository events.Iterator<A>
getActivities(Layer layer, Instant startTime, Instant endTime, TemporalUnit temporalUnit, ZoneId zoneId)
Returns an iterator for iterating over all activities found for the given layer and time interval.Instant
getEarliestTimeUsed()
Returns the earliest time used by the activities stored in this repository / on this row.Instant
getLatestTimeUsed()
Returns the latest time used by the activities stored in this repository / on this row.void
removeEventHandler(EventHandler<RepositoryEvent> handler)
Removes the given event handler from the repository.Methods inherited from interface javafx.event.EventTarget
buildEventDispatchChain
-
Method Details
-
getActivities
Iterator<A> getActivities(Layer layer, Instant startTime, Instant endTime, TemporalUnit temporalUnit, ZoneId zoneId)Returns an iterator for iterating over all activities found for the given layer and time interval. This method has to return very fast as it gets called many times during rendering of the chart. A slow implementation will have a direct impact on scrolling / rendering performance.- Parameters:
layer
- the layer for which to return the activitiesstartTime
- the start time of the time interval for which to return the activitiesendTime
- the end time of the time interval for which to return the activitiestemporalUnit
- the temporal unit currently displayed in the datelinezoneId
- the timezone currently displayed in the dateline- Returns:
- the activities on the given layer and in the given time interval
- Since:
- 1.0
-
getEarliestTimeUsed
Instant getEarliestTimeUsed()Returns the earliest time used by the activities stored in this repository / on this row. This method gets used for navigation (e.g. "scroll to earliest time used in the Gantt chart", "zoom out to show all activities").- Returns:
- the earliest time used by the activities in this repository / row (null if no activities found)
- Since:
- 1.0
-
getLatestTimeUsed
Instant getLatestTimeUsed()Returns the latest time used by the activities stored in this repository / on this row. This method gets used for navigation (e.g. "scroll to latest time used in the Gantt chart", "zoom out to show all activities").- Returns:
- the latest time used by the activities in this repository / row (null if no activities found)
- Since:
- 1.0
-
addEventHandler
Adds an event handler for receiving repository events. A repository will fire events if its state changes (e.g. activities added / removed).- Parameters:
handler
- the event handler that will be added to the repository- Since:
- 1.0
-
removeEventHandler
Removes the given event handler from the repository.- Parameters:
handler
- the event handler that will be removed from the repository- Since:
- 1.0
-