| | | | Browse by category |
Question
How to restrict the activity displacement or resize to a certain threshold to create a "snap" effect?
Answer
There are two possible approaches:
- Using custom model classes
This approach consists of subclassing the activity implementation and overriding the
setTimeInterval
method, where one would enforce the threshold at hand.Here is a sample that demonstrates this approach.
- Using listeners
This approach consists of using an
ActivityListener
that would be installed in theIlvGanttModel
and would override the new time interval of theActivityTimeIntervalEvent
to enforce the specified threshold.
Here is a sample that demonstrates this approach.
The second approach (using ActivityListener
) is the recommended one. This approach is also illustrated in the Vacation Activities sample in the product distribution (check the implementation of the method VacationSample.createGanttModel()
for more information).