public class IlvCacheManager extends Object
IlvCacheManager
class manages and coordinates the various
caching and load-on-demand mechanisms for an IlvGanttConfiguration
.Modifier and Type | Method and Description |
---|---|
void |
addReservationListener(ReservationListener listener)
Adds the specified listener to receive reservation events from the cache
manager.
|
void |
cacheAllReservations()
Sets the time interval of the reservation cache to include all of the reservations
that are associated with the already cached resources.
|
float |
getReservationCacheLoadFactor()
Returns the factor by which the reservation cache's time interval is
expanded.
|
float |
getReservationCacheLoadThreshold()
Returns the threshold that will trigger the time interval of the
reservation cache to be expanded.
|
boolean |
isReservationCachingEnabled()
Returns whether reservation caching is currently enabled.
|
void |
removeReservationListener(ReservationListener listener)
Removes the specified listener so that it no longer receives
reservation events from the cache.
|
Iterator<IlvReservation> |
reservationIterator(IlvResource resource)
Returns an iterator over the reservations that are associated with the
specified resource.
|
void |
setReservationCacheLoadFactor(float loadFactor)
Sets the factor by which the reservation cache's time interval is
expanded.
|
void |
setReservationCacheLoadThreshold(float loadThreshold)
Sets the threshold that will trigger the reservation cache's time
interval to be expanded.
|
void |
setReservationCachingEnabled(boolean enabled)
Sets whether reservation caching is currently enabled.
|
public boolean isReservationCachingEnabled()
false
.public void setReservationCachingEnabled(boolean enabled)
Gantt data model
currently bound to the
Gantt configuration
, the data
model will be momentarily unbound and then rebound.public void cacheAllReservations()
public float getReservationCacheLoadThreshold()
queries the Gantt data model
for reservations that fall within the new
interval. The threshold is expressed as a fraction of the configuration's
current visible duration.
Higher values mean that the reservation cache will query the data model
more frequently. A value of 0 means that the data model will not be queried
until the visible interval is scrolled to the current limits of the cache.
The default value is 0.25.
For example, let us assume that the reservation cache has a time interval from May 1 to May 20, a duration of 20 days, the current visible interval is 8 days, and the reservationCacheLoadThreshold is 0.25. The time interval of the reservation cache will be expanded, and therefore new reservations will be loaded from the data model, when the visible interval is scrolled to be within 2 days (0.25 * 8) of May 1 or May 20.
May 1 May 20 |<----------reservation cache--------->| -> |<-2 days ->| <-2 days | |<----visible--->| | | 8 days | threshold threshold
public void setReservationCacheLoadThreshold(float loadThreshold)
queries the Gantt data model
for reservations that fall within the new
interval. The threshold is expressed as a fraction of the configuration's
current visible duration and must be >=0. Higher values mean that the
reservation cache will query the data model more frequently. A value of 0
means that the data model will not be queried until the visible interval
is scrolled to the current limits of the cache. You should not set a
threshold that is larger than the
reservationCacheLoadFactor
because
the cache will still exceed the threshold after its interval is expanded.
For example, let us assume that the reservation cache has a time interval from May 1 to May 20, a duration of 20 days, the current visible interval is 8 days, and the reservationCacheLoadThreshold is 0.25. The reservation cache's time interval will be expanded, and therefore new reservations will be loaded from the data model, when the visible interval is scrolled to be within 2 days (0.25 * 8) of May 1 or May 20.
May 1 May 20 |<----------reservation cache--------->| -> |<-2 days ->| <-2 days | |<----visible--->| | | 8 days | threshold threshold
public float getReservationCacheLoadFactor()
For example, let us assume that the Gantt
configuration
has a visible duration of 10 days, has just been scrolled
to the visible interval of June 1 to June 10, and the
reservationCacheLoadThreshold
has just been triggered. If the loadFactor is 0, the cache
will be expanded to include exactly the June 1 - June 10 interval. If the
the loadFactor is 0.1, the cache will be expanded to include
the interval May 31 - June 11, which is 1 day longer (0.1 * 10) at both
ends than the visible interval.
public void setReservationCacheLoadFactor(float loadFactor)
For example, let us assume that the Gantt
configuration
has a visible duration of 10 days, has just been scrolled
to the visible interval of June 1 to June 10, and the
reservationCacheLoadThreshold
has just been triggered. If the loadFactor is 0, the cache
will be expanded to include exactly the June 1 - June 10 interval. If the
the loadFactor is 0.1, the cache will be expanded to include
the interval May 31 - June 11, which is 1 day longer (0.1 * 10) at both
ends than the visible interval.
public Iterator<IlvReservation> reservationIterator(IlvResource resource)
reservation caching
is enabled, the reservations will be retrieved from
the cache and will be limited to the current time interval of the cache.
Otherwise, the reservations are retrieved directly from the data model.
The iterator will actually be over a copy of the reservations, making it safe to add or remove reservations during the course of the iteration.
resource
- The resource.public void addReservationListener(ReservationListener listener)
reservation caching
is enabled, the listeners are subscribed to the cache. Otherwise, the
listeners are subscribed directly to the data model.listener
- The listener that will be subscribed to subsequent
ReservationListener
events.public void removeReservationListener(ReservationListener listener)
listener
- The listener that will be unsubscribed from receiving
ReservationListener
events.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.