public class IlvBasicTimeScrollController extends IlvBasicTimeScrollSupport implements IlvTimeScrollable
IlvBasicTimeScrollController
coordinates the time scrolling
of one or more IlvTimeScrollable
objects. In addition, the controller
itself exports the IlvTimeScrollable
interface. Two scrolling
modes are supported by the controller and its associated scrollable objects:
minimum visible time
and the maximum visible time
. Both values
must be valid and non null
. In bounded scrolling mode there
are four interrelated time properties:
minVisibleTime
maxVisibleTime
visibleTime
visibleDuration
minVisibleTime <= visibleTime <= visibleTime+visibleDuration <= maxVisibleTimeThe controller enforces this relationship by correcting or trimming properties as follows:
setMinVisibleTime(Date)
and
setMaxVisibleTime(Date)
methods validate that:
minVisibleTime <= maxVisibleTime
If this is not true, an IllegalArgumentException
is thrown.
setVisibleTime(Date)
and
setVisibleDuration(IlvDuration)
methods
trim their argument to fit within the limits defined by the other
three properties. For example, if
maxVisibleTime.equals(visibleTime.add(IlvDuration.ONE_DAY))
,
then setVisibleDuration(IlvDuration.ONE_WEEK)
would change the duration to IlvDuration.ONE_DAY
.
The controller uses the IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeInterval, java.util.Date, java.util.Date, ilog.views.gantt.IlvDuration)
method to perform consistent validation and trimming of the time value
arguments.
minimum visible time
and the
maximum visible time
are undefined and are
set to null
.
In unbounded scrolling mode, there is an inherent limitation on the
minimum
and maximum
times that can be
scrolled to. As with bounded scrolling mode, this is enforced by having
the controller use the IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeInterval, java.util.Date, java.util.Date, ilog.views.gantt.IlvDuration)
method to
perform validation and trimming of the time value arguments.
Note: a time scroll controller does not propagate duration changes
that are fired by a resized user interface component to the other
registered time scrollables.
However, such VisibleDurationChangedEvent
s are
propagated to all registered listeners. This is
because each time scrollable component is responsible
for updating its own duration value in order to maintain a constant zoom factor when it
is resized. Swing resizes user interface components with indeterminate timing and this
avoids potential time interval desynchronization across multiple components in the
same interface.
DEFAULT_MINIMUM_DURATION
Constructor and Description |
---|
IlvBasicTimeScrollController()
Creates a new
IlvBasicTimeScrollController . |
Modifier and Type | Method and Description |
---|---|
void |
addTimeScrollable(IlvTimeScrollable ts)
Adds an
IlvTimeScrollable object to be coordinated by this
controller. |
void |
addTimeScrollListener(TimeScrollListener listener)
Adds the specified listener to receive time scroll events from this
controller.
|
protected void |
fireMaxVisibleTimeChanged()
Call this method to fire a
maxVisibleTimeChanged event to all registered listeners . |
protected void |
fireMinVisibleDurationChanged()
Call this method to fire a
minVisibleDurationChanged event to all registered
listeners . |
protected void |
fireMinVisibleTimeChanged()
Call this method to fire a
minVisibleTimeChanged event to all registered listeners . |
protected void |
fireVisibleDurationChanged()
Call this method to fire a
visibleDurationChanged
event to all registered listeners . |
protected void |
fireVisibleTimeChanged(boolean adjusting)
Call this method to fire a
visibleTimeChanged event to all registered
listeners . |
IlvTimeScrollable |
getOwner()
Returns the owner of the controller.
|
void |
removeTimeScrollable(IlvTimeScrollable ts)
Removes an
IlvTimeScrollable object so that it is no longer
coordinated by this controller. |
void |
removeTimeScrollListener(TimeScrollListener listener)
Removes the specified listener so that it will no longer receive time
scroll events from this controller.
|
void |
setMaxVisibleTime(Date max)
Sets the maximum time that the controller and its associated
time scrollable objects can show in
bounded scrolling mode. |
void |
setMinVisibleDuration(IlvDuration duration)
Sets the minimum duration that the controller and its associated
time scrollable objects can show. |
void |
setMinVisibleTime(Date min)
Sets the minimum time that the controller and its associated
time scrollable objects can show in
bounded scrolling mode. |
void |
setOwner(IlvTimeScrollable owner)
Sets the owner of the controller.
|
void |
setVisibleDuration(IlvDuration duration)
Sets the duration of the time interval displayed by the controller and
its associated
time scrollable objects. |
void |
setVisibleInterval(Date time,
IlvDuration duration)
Sets the time interval displayed by the controller and its associated
time scrollable objects. |
void |
setVisibleTime(Date time)
Sets the beginning of the time interval displayed by the controller
and its associated
time scrollable objects. |
durationChanged, getMaxVisibleTime, getMinVisibleDuration, getMinVisibleTime, getVisibleDuration, getVisibleInterval, getVisibleTime, maxTimeChanged, minDurationChanged, minTimeChanged, startTimeChanged, timeIntervalChanged
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getMaxVisibleTime, getMinVisibleDuration, getMinVisibleTime, getVisibleDuration, getVisibleInterval, getVisibleTime
public IlvBasicTimeScrollController()
IlvBasicTimeScrollController
.public void setMinVisibleTime(Date min)
time scrollable
objects can show in
bounded scrolling mode.
The current visible time
and
duration
are trimmed to fit the new
min-max interval by calling the IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeInterval, java.util.Date, java.util.Date, ilog.views.gantt.IlvDuration)
method.
A minVisibleTimeChanged
event
is then fired to all registered
listeners
. If min > maxVisibleTime
an
IllegalArgumentException
will be thrown.setMinVisibleTime
in interface IlvTimeScrollable
setMinVisibleTime
in class IlvBasicTimeScrollSupport
min
- The minimum visible time or null
to set the
controller to unbounded scrolling mode.IlvBasicTimeScrollSupport.getMinVisibleTime()
public void setMaxVisibleTime(Date max)
time scrollable
objects can show in
bounded scrolling mode.
The current visible time
and
duration
are trimmed to fit the new
min-max interval by calling the
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeInterval, java.util.Date, java.util.Date, ilog.views.gantt.IlvDuration)
method.
A maxVisibleTimeChanged event
is then fired to all
registered listeners
.
If max < minVisibleTime
an
IllegalArgumentException
will be thrown.setMaxVisibleTime
in interface IlvTimeScrollable
setMaxVisibleTime
in class IlvBasicTimeScrollSupport
max
- The maximum visible time or null
to set the
controller to unbounded scrolling mode.IlvBasicTimeScrollSupport.getMaxVisibleTime()
public void setMinVisibleDuration(IlvDuration duration)
time scrollable
objects can show.
The duration
parameter specifies the maximum zoom level that
can be displayed. An minVisibleDurationChanged event
is fired to all
registered listeners
.setMinVisibleDuration
in interface IlvTimeScrollable
setMinVisibleDuration
in class IlvBasicTimeScrollSupport
duration
- The minimum visible duration.IlvBasicTimeScrollSupport.getMinVisibleDuration()
public void setVisibleTime(Date time)
time scrollable
objects.
The specified time value is compared against the
min
and max
visible times and is trimmed if necessary by calling the
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeInterval, java.util.Date, java.util.Date, ilog.views.gantt.IlvDuration)
method.
A VisibleTimeChangedEvent
is then fired to all registered listeners
. If you are changing
both the visible time and duration, it is preferable to use the
setVisibleInterval(Date, IlvDuration)
method instead.setVisibleTime
in interface IlvTimeScrollable
setVisibleTime
in class IlvBasicTimeScrollSupport
time
- The new time value.IlvBasicTimeScrollSupport.getVisibleTime()
public void setVisibleDuration(IlvDuration duration)
time scrollable
objects.
The specified duration is compared against the
min
and max
visible times and is trimmed if necessary by calling the
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeInterval, java.util.Date, java.util.Date, ilog.views.gantt.IlvDuration)
method.
A VisibleDurationChangedEvent
is then fired to all registered listeners
.
If you are changing both the visible time and duration, it is
preferable to use the setVisibleInterval(Date, IlvDuration)
method instead.setVisibleDuration
in interface IlvTimeScrollable
setVisibleDuration
in class IlvBasicTimeScrollSupport
duration
- The new duration value.IlvBasicTimeScrollSupport.getVisibleDuration()
public void setVisibleInterval(Date time, IlvDuration duration)
time scrollable
objects.
The specified interval is compared against the
min
and max
visible times and is trimmed if necessary by calling the
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeInterval, java.util.Date, java.util.Date, ilog.views.gantt.IlvDuration)
method. This method then
fires an adjusting VisibleTimeChangedEvent
followed by a
VisibleDurationChangedEvent
to all registered listeners
.setVisibleInterval
in interface IlvTimeScrollable
setVisibleInterval
in class IlvBasicTimeScrollSupport
time
- The new time value.duration
- The new duration value.IlvBasicTimeScrollSupport.getVisibleInterval()
public void addTimeScrollListener(TimeScrollListener listener)
addTimeScrollListener
in interface IlvTimeScrollable
listener
- The listener that will be subscribed to subsequent time
scroll events.removeTimeScrollListener(ilog.views.gantt.event.TimeScrollListener)
public void removeTimeScrollListener(TimeScrollListener listener)
removeTimeScrollListener
in interface IlvTimeScrollable
listener
- The listener that will be unsubscribed from receiving
time scroll events.addTimeScrollListener(ilog.views.gantt.event.TimeScrollListener)
public void addTimeScrollable(IlvTimeScrollable ts)
IlvTimeScrollable
object to be coordinated by this
controller.ts
- The time scrollable.removeTimeScrollable(ilog.views.gantt.IlvTimeScrollable)
public void removeTimeScrollable(IlvTimeScrollable ts)
IlvTimeScrollable
object so that it is no longer
coordinated by this controller.ts
- The time scrollable.addTimeScrollable(ilog.views.gantt.IlvTimeScrollable)
public IlvTimeScrollable getOwner()
public void setOwner(IlvTimeScrollable owner)
owner
- The owner of the controller or null
if the
controller has no owner.protected void fireMinVisibleTimeChanged()
minVisibleTimeChanged event
to all registered listeners
.setMinVisibleTime(Date)
protected void fireMaxVisibleTimeChanged()
maxVisibleTimeChanged event
to all registered listeners
.setMaxVisibleTime(Date)
protected void fireMinVisibleDurationChanged()
minVisibleDurationChanged event
to all registered
listeners
.setMinVisibleDuration(IlvDuration)
protected void fireVisibleTimeChanged(boolean adjusting)
visibleTimeChanged event
to all registered
listeners
.setVisibleTime(Date)
protected void fireVisibleDurationChanged()
visibleDurationChanged
event
to all registered listeners
.setVisibleDuration(IlvDuration)
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.