public class IlvTimeScrollSupport extends IlvTimeScrollController
IlvTimeScrollSupport
provides calculation support for
IlvTimeScrollable
implementations.
IlvTimeScrollSupport
converts bidirectionally between
dates and screen coordinates in two phases:
IlvTimeConverter
.
DEFAULT_MINIMUM_DURATION
Constructor and Description |
---|
IlvTimeScrollSupport()
Creates a new
IlvTimeScrollSupport . |
IlvTimeScrollSupport(IlvTimeScrollable owner)
Creates a new
IlvTimeScrollSupport for the specified
owner. |
IlvTimeScrollSupport(IlvTimeScrollSupport support)
Creates a new
IlvTimeScrollSupport that has the same
time interval, minimum time, maximum time, minimum duration,
time converter, view width, and owner as the specified support
instance. |
Modifier and Type | Method and Description |
---|---|
Date |
computeVisibleTimeScroll(long x0,
long x1)
Computes the beginning of the visible interval that will cause the
time at position
x0 to scroll to position x1 . |
long |
getLocation(Date time)
Returns the screen coordinate position that corresponds to the
specified time.
|
double |
getOffset()
Returns the offset used to transform a position in world coordinates
to its corresponding position in pixel screen coordinates.
|
Date |
getTime(long x)
Returns the time that corresponds to the specified position in screen
coordinates.
|
IlvTimeConverter |
getTimeConverter()
Returns the converter between time and world coordinates.
|
int |
getViewStart()
Returns the beginning of the view in screen coordinates.
|
int |
getViewWidth()
Returns the width of the view in screen coordinates.
|
double |
getZoomFactor()
Returns the scaling factor used to transform a position in world
coordinates to its corresponding position in pixel screen coordinates,
expressed as the ratio of screen to world coordinates.
|
boolean |
isConstantZoomFactorOnWidthChange()
Returns whether the duration will be modified when the view width
changes in order to maintain a constant
zoomFactor . |
boolean |
isLeftToRight()
Returns whether time increases left-to-right in the view.
|
void |
setConstantZoomFactorOnWidthChange(boolean enabled)
Sets whether the duration will be modified when the view width changes
in order to maintain a constant
zoomFactor . |
void |
setLeftToRight(boolean ltr)
Sets whether time increases left-to-right in the view.
|
void |
setTimeConverter(IlvTimeConverter timeConverter)
Sets the converter between time and world coordinates.
|
void |
setViewStart(int start)
Sets the beginning of the view in screen coordinates.
|
void |
setViewWidth(int width)
Sets the width of the view in screen coordinates.
|
void |
setViewWidth(int width,
boolean componentResizing)
Sets the width of the view in screen coordinates.
|
protected void |
timeConverterChanged(IlvTimeConverter oldTimeConverter,
IlvTimeConverter newTimeConverter)
This method is automatically invoked when the time converter has
changed.
|
getAnimationSteps, setAnimationSteps
addTimeScrollable, addTimeScrollListener, fireMaxVisibleTimeChanged, fireMinVisibleDurationChanged, fireMinVisibleTimeChanged, fireVisibleDurationChanged, fireVisibleTimeChanged, getOwner, removeTimeScrollable, removeTimeScrollListener, setMaxVisibleTime, setMinVisibleDuration, setMinVisibleTime, setOwner, setVisibleDuration, setVisibleInterval, setVisibleTime
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 IlvTimeScrollSupport(IlvTimeScrollable owner)
IlvTimeScrollSupport
for the specified
owner. The owner will be used as the source of all events fired by the
controller.owner
- The owner of the controller or null
if the
controller has no owner.public IlvTimeScrollSupport()
IlvTimeScrollSupport
.public IlvTimeScrollSupport(IlvTimeScrollSupport support)
IlvTimeScrollSupport
that has the same
time interval, minimum time, maximum time, minimum duration,
time converter, view width, and owner as the specified support
instance.support
- The template support instance.public IlvTimeConverter getTimeConverter()
setTimeConverter(ilog.views.gantt.graphic.IlvTimeConverter)
public void setTimeConverter(IlvTimeConverter timeConverter)
timeConverter
- The new time converter.protected void timeConverterChanged(IlvTimeConverter oldTimeConverter, IlvTimeConverter newTimeConverter)
oldTimeConverter
- The previous time converter.newTimeConverter
- The new time converter.setTimeConverter(ilog.views.gantt.graphic.IlvTimeConverter)
public int getViewStart()
setViewStart(int)
public void setViewStart(int start)
start
- The beginning of the view.getViewStart()
public int getViewWidth()
setViewWidth(int)
public void setLeftToRight(boolean ltr)
ltr
- Indicates whether time increases left-to-right in the view.isLeftToRight()
public boolean isLeftToRight()
false
, then
time increases right-to-left in the view.false
indicates that time increases right-to-left.setLeftToRight(boolean)
public boolean isConstantZoomFactorOnWidthChange()
zoomFactor
. If
false
, the duration stays the same and the
zoomFactor
is modified when the view width changes. The
default value is true
.
Note: When multiple IlvTimeScrollable
user
interface components have their time scrolling synchronized through an
IlvBasicTimeScrollController
or one of its subclasses, all of
the scrollable components should be placed in a container that ensures
that they maintain equal widths and their
constantZoomFactorOnWidthChange
properties must be set
to the same value. When the GUI resizes, each scrollable component is
responsible for computing its own duration change.
zoomFactor
.setConstantZoomFactorOnWidthChange(boolean)
public void setConstantZoomFactorOnWidthChange(boolean enabled)
zoomFactor
. If
disabled, the duration stays the same and the zoomFactor
is modified when the view width changes. The default value is
true
.
Note: When multiple IlvTimeScrollable
user
interface components have their time scrolling synchronized through an
IlvBasicTimeScrollController
or one of its subclasses, all of
the scrollable components should be placed in a container that ensures
that they maintain equal widths and their
constantZoomFactorOnWidthChange
properties must be set
to the same value. When the GUI resizes, each scrollable component is
responsible for computing its own duration change.
enabled
- Indicates whether the zoomFactor
stays
the same and the duration changes when the view resizes. If
false
, the duration stays the same and the
zoomFactor
changes.isConstantZoomFactorOnWidthChange()
public void setViewWidth(int width, boolean componentResizing)
width
- The view width.componentResizing
- Indicates whether the
owner is a GUI component that is
being resized.getViewWidth()
public void setViewWidth(int width)
width
- The view width.getViewWidth()
public double getZoomFactor()
public double getOffset()
viewStart
.public Date getTime(long x)
x
- The position specified in screen coordinates.x
.public long getLocation(Date time)
time
- The time.time
.public Date computeVisibleTimeScroll(long x0, long x1)
x0
to scroll to position x1
. If the
current time converter is non-linear, then this
method makes a best attempt to converge on the correct result, while keeping
the processing time reasonable.x0
- The reference screen coordinate position.x1
- The new screen coordinate position.x0
to scroll to x1
.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.