Package org.primefaces.model.timeline
Class TimelineModel<E,G>
java.lang.Object
org.primefaces.model.timeline.TimelineModel<E,G>
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
ConstructorDescriptionTimelineModel
(List<TimelineEvent<E>> events) TimelineModel
(List<TimelineEvent<E>> events, List<TimelineGroup<G>> groups) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(TimelineEvent<E> event) Adds a given event to the model without UI update.void
add
(TimelineEvent<E> event, TimelineUpdater timelineUpdater) Adds a given event to the model with UI update.void
addAll
(Collection<TimelineEvent<E>> events) Adds all given event to the model without UI update.void
addAll
(Collection<TimelineEvent<E>> events, TimelineUpdater timelineUpdater) Adds all given events to the model with UI update.void
addAllGroups
(Collection<TimelineGroup<G>> groups) Adds all given groups to the model.void
addGroup
(TimelineGroup<G> group) Adds a given group to the model.void
clear()
Clears the timeline model without UI update (no events are available after that)void
clear
(TimelineUpdater timelineUpdater) Clears the timeline model with UI update (no events are available after that)void
delete
(TimelineEvent<E> event) Deletes a given event in the model without UI update.void
delete
(TimelineEvent<E> event, TimelineUpdater timelineUpdater) Deletes a given event in the model with UI update.void
deleteAll
(Collection<TimelineEvent<E>> events) Deletes all given events in the model without UI update.void
deleteAll
(Collection<TimelineEvent<E>> events, TimelineUpdater timelineUpdater) Deletes all given events in the model with UI update.Gets event by its id property.Gets all events in this modelGets all groups in this modelgetOverlappedEvents
(TimelineEvent<E> event) Gets all overlapped events to the given one.boolean
hasEvent
(TimelineEvent<E> event) Check if current model has the event passed as parameter.merge
(TimelineEvent<E> event, Collection<TimelineEvent<E>> events) Merge the given one event with the given collection of events without UI update.merge
(TimelineEvent<E> event, Collection<TimelineEvent<E>> events, TimelineUpdater timelineUpdater) Merge the given one event with the given collection of events with UI update.void
select
(TimelineEvent<E> event, TimelineUpdater timelineUpdater) Selects a given event in UI visually.void
setEvents
(List<TimelineEvent<E>> events) Sets events into this modelvoid
setGroups
(List<TimelineGroup<G>> groups) Sets groups into this modelvoid
update
(TimelineEvent<E> event) Updates a given event in the model without UI update.void
update
(TimelineEvent<E> event, TimelineUpdater timelineUpdater) Updates a given event in the model with UI update.void
updateAll
(Collection<TimelineEvent<E>> events) Updates all given events in the model without UI update.void
updateAll
(Collection<TimelineEvent<E>> events, TimelineUpdater timelineUpdater) Updates all given events in the model with UI update.
-
Constructor Details
-
TimelineModel
public TimelineModel() -
TimelineModel
-
TimelineModel
-
-
Method Details
-
add
Adds a given event to the model without UI update.- Parameters:
event
- event to be added
-
addGroup
Adds a given group to the model.- Parameters:
group
- group to be added
-
add
Adds a given event to the model with UI update.- Parameters:
event
- event to be addedtimelineUpdater
- TimelineUpdater instance to add the event in UI
-
addAll
Adds all given event to the model without UI update.- Parameters:
events
- collection of events to be added
-
addAllGroups
Adds all given groups to the model.- Parameters:
groups
- collection of groups to be added
-
addAll
Adds all given events to the model with UI update.- Parameters:
events
- collection of events to be addedtimelineUpdater
- TimelineUpdater instance to add the events in UI
-
update
Updates a given event in the model without UI update.- Parameters:
event
- event to be updated
-
update
Updates a given event in the model with UI update.- Parameters:
event
- event to be addedtimelineUpdater
- TimelineUpdater instance to update the event in UI
-
updateAll
Updates all given events in the model without UI update.- Parameters:
events
- collection of events to be updated
-
updateAll
Updates all given events in the model with UI update.- Parameters:
events
- collection of events to be updatedtimelineUpdater
- TimelineUpdater instance to update the events in UI
-
delete
Deletes a given event in the model without UI update.- Parameters:
event
- event to be deleted
-
delete
Deletes a given event in the model with UI update.- Parameters:
event
- event to be deletedtimelineUpdater
- TimelineUpdater instance to delete the event in UI
-
deleteAll
Deletes all given events in the model without UI update.- Parameters:
events
- collection of events to be deleted
-
deleteAll
Deletes all given events in the model with UI update.- Parameters:
events
- collection of events to be deletedtimelineUpdater
- TimelineUpdater instance to delete the events in UI
-
select
Selects a given event in UI visually. To unselect all events, pass a null as event.- Parameters:
event
- event to be selectedtimelineUpdater
- TimelineUpdater instance to select the event in UI
-
clear
public void clear()Clears the timeline model without UI update (no events are available after that) -
clear
Clears the timeline model with UI update (no events are available after that)- Parameters:
timelineUpdater
- TimelineUpdater instance to clear the timeline in UI
-
getOverlappedEvents
Gets all overlapped events to the given one. The given and overlapped events belong to the same group. Events are ordered by their start dates - first events with more recent start dates and then events with older start dates. If start dates are equal, events will be ordered by their end dates. In this case, if an event has a null end date, it is ordered before the event with a not null end date.- Parameters:
event
- given event- Returns:
- TreeSet<TimelineEvent<E>> ordered overlapped events or null if no overlapping exist
-
merge
Merge the given one event with the given collection of events without UI update. Only events within one group can be merged. Note: after merging, the merged event will get the same properties as the given one event except start and end dates.- Parameters:
event
- given event to be merged with collection of eventsevents
- collection of events- Returns:
- TimelineEvent result event after merging
- Throws:
IllegalStateException
- thrown if not all events are within the same group
-
merge
public TimelineEvent<E> merge(TimelineEvent<E> event, Collection<TimelineEvent<E>> events, TimelineUpdater timelineUpdater) Merge the given one event with the given collection of events with UI update. Only events within one group can be merged. Note: after merging, the merged event will get the same properties as the given one event except start and end dates.- Parameters:
event
- given event to be merged with collection of eventsevents
- collection of eventstimelineUpdater
- TimelineUpdater instance to update the merged events in UI- Returns:
- TimelineEvent result event after merging
- Throws:
IllegalStateException
- thrown if not all events are within the same group
-
getEvents
Gets all events in this model- Returns:
- List<TimelineEvent<E>> list of events
-
setEvents
Sets events into this model- Parameters:
events
- List<TimelineEvent<E>> list of events
-
getGroups
Gets all groups in this model- Returns:
- List<TimelineGroup<G>> list of groups
-
setGroups
Sets groups into this model- Parameters:
groups
- List<TimelineGroup<G>> list of groups
-
getEvent
Gets event by its id property.- Parameters:
id
- id property of the event- Returns:
- TimelineEvent found event or null
-
hasEvent
Check if current model has the event passed as parameter.- Parameters:
event
-- Returns:
-