public static class IlvTimeScale.PaintContext extends Object
PaintContext
defines the context in which the time scale
paints.
It defines the following parameters required for painting the
time scale:
getVisibleTime
,
setVisibleTime
,
getVisibleDuration
,
and setVisibleDuration
to get or to set the visible time interval.getXTranslation
and
getXZoomFactor
to return the horizontal translation and the horizontal
zoom factor. Note, that the values returned by these methods are only
useful when the time scale is configured with a
linear time converter.
Use the getLocation(java.util.Date)
and getTime(long)
methods to more generally convert between positions along the horizontal
axis and time.PaintContext
is generally used by the method
paint(Graphics, Rectangle, PaintContext)
.
The time scale has a cached PaintContext
that can
be retrieved by calling getPaintContext
.
It is the paint context used to paint the time scale when you
call the paintComponent
method.Constructor and Description |
---|
PaintContext(IlvTimeScale.PaintContext context)
Creates a new
PaintContext by copying parameters from an existing
PaintContext . |
PaintContext(IlvTimeScale timeScale,
Date startTime,
IlvDuration duration,
int viewStart,
int viewWidth)
Creates a
PaintContext object that will paint a time
interval of the time scale within a viewport. |
PaintContext(IlvTimeScale timeScale,
Date startTime,
IlvDuration duration,
int viewStart,
int viewWidth,
Font font)
Deprecated.
Beginning with Rogue Wave JViews 8.5, it is no longer recommended to override
the time scale's font by setting a font on the paint context. Instead,
use the
IlvTimeScale.PaintContext(IlvTimeScale, Date, IlvDuration, int, int)
constructor. |
Modifier and Type | Method and Description |
---|---|
Date |
computeVisibleTimeScroll(long x0,
long x1)
Computes the beginning of the visible interval that will cause the time
that currently corresponds with the position
x0 to
correspond to the position x1 . |
int |
getDaySize()
Returns the number of pixels a day takes in this paint context.
|
Font |
getFont()
Deprecated.
Beginning with Rogue Wave JViews 8.5, it is no longer recommended to override
the time scale's font by setting a font on the paint context.
|
int |
getHourSize()
Returns the number of pixels an hour takes in this paint context.
|
long |
getLocation(Date time)
Returns the x position in screen coordinates that corresponds to the
specified time.
|
int |
getMinuteSize()
Returns the number of pixels a minute takes in this paint context.
|
int |
getMonthSize()
Returns the number of pixels a month takes in this paint context.
|
int |
getQuarterSize()
Returns the number of pixels a quarter takes in this paint context.
|
int |
getSizeOf(int unit)
Returns the number of pixels a unit of time takes in this paint context.
|
Date |
getTime(long x)
Returns the time that corresponds to the specified x position in screen
coordinates.
|
IlvTimeScale |
getTimeScale()
Returns the time scale from the paint context
|
IlvDuration |
getVisibleDuration()
Returns the duration of the time interval painted by the scale.
|
Date |
getVisibleTime()
Returns the beginning of the time interval displayed by the scale.
|
int |
getWeekSize()
Returns the number of pixels a week takes in this paint context.
|
double |
getXTranslation()
Returns the horizontal translation used while painting the time scale.
|
double |
getXZoomFactor()
Returns the horizontal zoom factor used while painting the time scale.
|
int |
getYearSize()
Returns the number of pixels a year takes in this paint context.
|
void |
setFont(Font font)
Deprecated.
Beginning with Rogue Wave JViews 8.5, it is no longer recommended to override
the time scale's font by setting a font on the paint context.
|
void |
setVisibleDuration(IlvDuration duration)
Sets the duration of the time interval painted by the scale.
|
void |
setVisibleTime(Date time)
Sets the beginning of the time interval painted by the scale.
|
@Deprecated public PaintContext(IlvTimeScale timeScale, Date startTime, IlvDuration duration, int viewStart, int viewWidth, Font font)
IlvTimeScale.PaintContext(IlvTimeScale, Date, IlvDuration, int, int)
constructor.PaintContext
that will paint a time interval of the time
scale within a viewport.timeScale
- The time scale.startTime
- The beginning of the time interval to be painted.duration
- The duration of the time interval to be painted.viewStart
- The beginning of the viewport.viewWidth
- The width of the viewport.font
- The font used to paint the labels of the time scale.public PaintContext(IlvTimeScale timeScale, Date startTime, IlvDuration duration, int viewStart, int viewWidth)
PaintContext
object that will paint a time
interval of the time scale within a viewport.timeScale
- The time scale.startTime
- The beginning of the time interval to be painted.duration
- The duration of the time interval to be painted.viewStart
- The beginning of the viewport.viewWidth
- The width of the viewport.public PaintContext(IlvTimeScale.PaintContext context)
PaintContext
by copying parameters from an existing
PaintContext
.context
- The existing paint context to copy from.public double getXTranslation()
public double getXZoomFactor()
public Date getVisibleTime()
setVisibleTime(java.util.Date)
public void setVisibleTime(Date time)
time
- The new time value.getVisibleTime()
public IlvDuration getVisibleDuration()
public void setVisibleDuration(IlvDuration duration)
duration
- The new duration value.getVisibleDuration()
@Deprecated public Font getFont()
setFont(java.awt.Font)
@Deprecated public void setFont(Font font)
null
. In this case the font
parameter in the context is ignored. The fonts defined for the
time scale rows are used instead.font
- The font.public long getLocation(Date time)
time
- The time.public Date getTime(long x)
x
- The x position in screen coordinates.public Date computeVisibleTimeScroll(long x0, long x1)
x0
to
correspond to the position x1
.x0
- The reference screen coordinate position.x1
- The new screen coordinate position.x0
to shift and correspond with x1
.public int getSizeOf(int unit)
Note, that this method returns the number of pixels for an idealized unit of
time. This may be adequate for most uses, but it is not perfectly accurate
when handling leap years, months of different lengths, daylight saving time,
nonlinear time scales, and so on.
For absolute accuracy, use the difference between getLocation(Date)
for
a specific start and end date.
unit
- A Calendar
field.public int getYearSize()
Note, that this method returns the number of pixels for an idealized year.
This may be adequate for most uses, but it is not perfectly accurate
when handling leap years or nonlinear time scales.
For absolute accuracy, use the difference between getLocation(Date)
for
a specific start and end date.
public int getQuarterSize()
Note, that this method returns the number of pixels for an idealized quarter.
This may be adequate for most uses, but it is not perfectly accurate
when handling leap years, months of different lengths, daylight saving time,
nonlinear time scales, and so on.
For absolute accuracy, use the difference between getLocation(Date)
for
a specific start and end date.
public int getMonthSize()
Note, that this method returns the number of pixels for an idealized month.
This may be adequate for most uses, but it is not perfectly accurate
when handling months of different lengths, daylight saving time,
nonlinear time scales, and so on.
For absolute accuracy, use the difference between getLocation(Date)
for
a specific start and end date.
public int getWeekSize()
Note, that this method returns the number of pixels for an idealized week.
This may be adequate for most uses, but it is not perfectly accurate
when handling daylight saving time, leap seconds, nonlinear time scales, and so on.
For absolute accuracy, use the difference between getLocation(Date)
for
a specific start and end date.
public int getDaySize()
Note, that this method returns the number of pixels for an idealized day.
This may be adequate for most uses, but it is not perfectly accurate
when handling daylight saving time, leap seconds, nonlinear time scales, and so on.
For absolute accuracy, use the difference between getLocation(Date)
for
a specific start and end date.
public int getHourSize()
Note, that this method returns the number of pixels for an idealized hour.
This may be adequate for most uses, but it is not perfectly accurate
when handling leap seconds, nonlinear time scales, and so on.
For absolute accuracy, use the difference between getLocation(Date)
for
a specific start and end date.
public int getMinuteSize()
Note, that this method returns the number of pixels for an idealized minute.
This may be adequate for most uses, but it is not perfectly accurate
when handling leap seconds, nonlinear time scales, and so on.
For absolute accuracy, use the difference between getLocation(Date)
for
a specific start and end date.
public IlvTimeScale getTimeScale()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.