|
||||||||||
![]() |
FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--ilog.views.gantt.scale.IlvTimeScale
The IlvTimeScale class is a time scale component that contains
several IlvTimeScaleRow objects. Each row represents a particular
time unit and is responsible for drawing itself. The rows are not true
UI components, but behave like renderers.
To scroll through the scale or to zoom on it when changing the time value and the visible duration, a new IlvTimeConverter object must be set for the scale.
Default actions are provided on this object:
| Inner Class Summary | |
class |
IlvTimeScale.PaintContext
A PaintContext defines the context in which the time scale paints. |
| Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent,
Component.BltBufferStrategy,
Component.FlipBufferStrategy |
| Fields inherited from class javax.swing.JComponent |
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
| Constructor Summary | |
IlvTimeScale()
Creates a new IlvTimeScale that initially contains no
rows. |
|
| Method Summary | |
void |
addRow(IlvTimeScaleRow row)
Appends the specified row to the scale. |
void |
addTimeScrollListener(TimeScrollListener listener)
Adds the specified listener to receive time scroll events from this scale. |
void |
computeCalendar()
This method is called when changing the locale or the time zone of this scale to compute the new calendar. |
IlvTimeScale.PaintContext |
createPaintContext(Date start,
IlvDuration duration,
Rectangle viewport)
Creates a PaintContext so that the time scale paints
the specified time interval into the specified view port. |
protected void |
fireTimeScrollableValueChanged(boolean adjusting)
This method is called to fire a time value modification. |
protected void |
fireTimeScrollableVisibleDurationChanged()
This method is called to fire a visible duration value modification. |
Calendar |
getCalendar()
This method returns a Calendar object. |
Calendar |
getCalendar(Date time)
This utility method returns a Calendar object that points to the specified time. |
int |
getLocation(Date time)
This method returns the x position corresponding to the specified time. |
Date |
getMaxVisibleTime()
Returns the maximum time that the scale can show in bounded scrolling mode. |
Date |
getMinVisibleTime()
Returns the minimum time that the scale can show in bounded scrolling mode. |
IlvTimeScale.PaintContext |
getPaintContext()
Gets the cached PaintContext used to paint the time
scale on screen. |
Dimension |
getPreferredSize()
This method overrides the JComponent one to take the preferred
height of each row into account. |
IlvTimeScaleRow[] |
getRow()
This method returns the entire array of IlvTimeScaleRow objects. |
IlvTimeScaleRow |
getRow(int index)
This method returns the IlvTimeScaleRow at a specified index. |
Date |
getTime(int x)
This method returns the time that is under the x position in the component. |
IlvTimeConverter |
getTimeConverter()
Returns the IlvTimeConverter object of this scale. |
IlvTimeScaleRow |
getTimeScaleRow(int y)
This method returns the row under a y position in the component. |
TimeZone |
getTimeZone()
This method returns the time zone of this scale. |
IlvDuration |
getVisibleDuration()
Returns the duration of the time interval displayed by the scale. |
IlvTimeInterval |
getVisibleInterval()
Returns the time interval displayed by the scale. |
Date |
getVisibleTime()
Returns the beginning of the time interval displayed by the scale. |
void |
hideRow(IlvTimeScaleRow row)
This method hides the specified row. |
boolean |
isIntegerZoomAllowed()
Returns the integer zoom mode. |
boolean |
isOpaqueTranslation()
Returns the opaque translation mode. |
boolean |
isTranslationAllowed()
Returns the translation mode. |
boolean |
isZoomAllowed()
Returns the zoom mode. |
void |
paint(Graphics dst,
Rectangle viewport,
IlvTimeScale.PaintContext context)
Paints the time scale to the given Graphics by using an
external IlvTimeScale.PaintContext. |
protected void |
paintComponent(Graphics dst)
Paints the time scale by calling the paintRows method. |
protected void |
paintRows(Graphics dst)
Paints the time scale rows by calling the paint(Graphics, Rectangle, PaintContext) method. |
void |
paintSeparator(Graphics dst,
int x,
int y,
int width)
This method draws the separation between two rows. |
void |
removeRow(IlvTimeScaleRow row)
This method removes a row from the IlvTimeScale object. |
void |
removeTimeScrollListener(TimeScrollListener listener)
Removes the specified listener so that it will no longer receive time scroll events from this scale. |
void |
setIntegerZoomAllowed(boolean value)
Changes the integer zoom mode. |
void |
setLocale(Locale locale)
This method overrides the Component method to
compute the new Calendar object attached to this scale. |
void |
setMaxVisibleTime(Date max)
Sets the maximum time that the scale can show in bounded scrolling mode. |
void |
setMinVisibleTime(Date min)
Sets the minimum time that the scale can show in bounded scrolling mode. |
void |
setOpaqueTranslation(boolean value)
Changes the opaque translation mode. |
void |
setRow(IlvTimeScaleRow[] row)
This method replaces the existing IlvTimeScaleRow objects by those passed in the row argument. |
void |
setRow(int index,
IlvTimeScaleRow row)
This method changes the IlvTimeScaleRow object at a specified index. |
void |
setTimeConverter(IlvTimeConverter timeConverter)
This method can be used to change the IlvTimeConverter object of this scale. |
void |
setTimeZone(TimeZone timezone)
The time zone set with this method will be used instead of the default time zone. |
void |
setTranslationAllowed(boolean value)
Changes the translation mode. |
void |
setVisibleDuration(IlvDuration duration)
Sets the duration of the time interval displayed by the scale. |
void |
setVisibleInterval(Date time,
IlvDuration duration)
Sets the time interval displayed by the scale. |
void |
setVisibleTime(Date time)
Sets the beginning of the time interval displayed by the scale. |
void |
setZoomAllowed(boolean value)
Changes the zoom mode. |
void |
showRow(IlvTimeScaleRow row)
This method shows the specified row. |
void |
updateUI()
This method is a notification that the L&F has changed. |
protected void |
widthChanged(int width)
This method is invoked when the time scale width has been modified. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
public IlvTimeScale()
IlvTimeScale that initially contains no
rows. By default, the time scale uses an
IlvLinearTimeConverter. The time scale time converter can be set
by calling the setTimeConverter method.| Method Detail |
public IlvTimeScale.PaintContext getPaintContext()
PaintContext used to paint the time
scale on screen.
public IlvTimeScale.PaintContext createPaintContext(Date start,
IlvDuration duration,
Rectangle viewport)
PaintContext so that the time scale paints
the specified time interval into the specified view port.start - The begin of the visible time interval.duration - The duration of the visible time interval.viewport - The rectangle defining the position the time scale
to paint to.public void updateUI()
JTableHeader.public void addRow(IlvTimeScaleRow row)
row - The row to be added.removeRow(ilog.views.gantt.scale.IlvTimeScaleRow)public void removeRow(IlvTimeScaleRow row)
IlvTimeScale object.
To see the modification, you must redraw the object.row - The row to be removed.public IlvTimeScaleRow getRow(int index)
IlvTimeScaleRow at a specified index.index - The index of the returned row.
public void setRow(int index,
IlvTimeScaleRow row)
IlvTimeScaleRow object at a specified index.index - The index of the changed row.row - The new IlvTimeScaleRow.public IlvTimeScaleRow[] getRow()
IlvTimeScaleRow objects.public void setRow(IlvTimeScaleRow[] row)
IlvTimeScaleRow objects by those passed in the row argument.row - The new array of IlvTimeScaleRow.public IlvTimeScaleRow getTimeScaleRow(int y)
y - The y position in the component.public Date getTime(int x)
x - The x position in the component.public int getLocation(Date time)
time - The time.public void showRow(IlvTimeScaleRow row)
row - The row to be shown.public void hideRow(IlvTimeScaleRow row)
row - The row to be hidden.protected void paintComponent(Graphics dst)
dst - The destination graphics.protected void paintRows(Graphics dst)
PaintContext
is used.dst - The destination graphics.
public void paint(Graphics dst,
Rectangle viewport,
IlvTimeScale.PaintContext context)
Graphics by using an
external IlvTimeScale.PaintContext.
This method paints each visible IlvTimeScaleRow object of this scale
by calling the row's paint method.
Separation lines are drawn between each row by calling the
paintSeparator method.
This method is usually called by paintRows(). In this
case the cached PaintContext is used.
This method can also be called to print the time scale. In this case an
external PaintContext must be provided in order to print
the portion specified by the programmer.
dst - The destination graphics.viewport - The viewport. It defines the potion of the time scale
to be painted.context - The paint context.protected void widthChanged(int width)
width - The width of the time scale, less its horizontal insets.public void setIntegerZoomAllowed(boolean value)
value - If false, the integer zoom will not be performed.public boolean isIntegerZoomAllowed()
true.setIntegerZoomAllowed(boolean)public void setZoomAllowed(boolean value)
value - If false, zoom will not be performed.public boolean isZoomAllowed()
true.setZoomAllowed(boolean)public void setTranslationAllowed(boolean value)
value - If false, translation will not be performed.public boolean isTranslationAllowed()
true.setTranslationAllowed(boolean)public void setOpaqueTranslation(boolean value)
value - If false, the scale will not be drawn during translation.public boolean isOpaqueTranslation()
true.setOpaqueTranslation(boolean)public Dimension getPreferredSize()
JComponent one to take the preferred
height of each row into account.
public void paintSeparator(Graphics dst,
int x,
int y,
int width)
dst - The destination Graphics.x - The x coordinate of the separation origin.y - The y coordinate of the separation origin.width - The width of the separation.public IlvTimeConverter getTimeConverter()
IlvTimeConverter object of this scale.public void setTimeConverter(IlvTimeConverter timeConverter)
IlvTimeConverter object of this scale.
This object allows you to draw the scale correctly by converting time value to units
on the screen.timeConverter - The new IlvTimeConverter object.public Calendar getCalendar()
Calendar object. By default, it returns the result
of the method Calendar.getInstance() (default locale and default time zone).
If a Locale or a TimeZone has been specified
with one of the methods setLocale or setTimeZone, the method constructs
the calendar with these values.
When deriving the class IlvTimeScaleRow, you should use this method to get a
Calendar object to compute or display time values.
However, be careful, this method always returns the same Calendar object
constructed in computeCalendar. Therefore, you should clone it if you
need more than one Calendar objects.setLocale(java.util.Locale),
setTimeZone(java.util.TimeZone),
computeCalendar(),
getCalendar(Date),
IlvBasicTimeScaleRow.getDateFormat()public Calendar getCalendar(Date time)
Calendar object that points to the specified time.
Be careful, this method always returns the same Calendar object
constructed in computeCalendar. You should therefore clone it if you
need more than one object.time - The current day on the calendar.computeCalendar()public void setTimeZone(TimeZone timezone)
timezone argument to null.timezone - The new time zone.getCalendar()public TimeZone getTimeZone()
public void setLocale(Locale locale)
Component method to
compute the new Calendar object attached to this scale.public void computeCalendar()
public Date getMinVisibleTime()
null if the scale
is in unbounded scrolling mode.setMinVisibleTime(java.util.Date)public void setMinVisibleTime(Date min)
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeScrollable, ilog.views.gantt.IlvTimeInterval) method. A
minVisibleTimeChanged event
is then fired to all registered listeners. If
min > maxVisibleTime an IllegalArgumentException
will be thrown.min - The minimum visible time or null to set the scale
to unbounded scrolling mode.getMinVisibleTime()public Date getMaxVisibleTime()
null if the scale
is in unbounded scrolling mode.setMaxVisibleTime(java.util.Date)public void setMaxVisibleTime(Date max)
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeScrollable, ilog.views.gantt.IlvTimeInterval) method. A
maxVisibleTimeChanged event
is then fired to all registered listeners. If
max < minVisibleTime an IllegalArgumentException
will be thrown.max - The maximum visible time or null to set the scale
to unbounded scrolling mode.getMaxVisibleTime()public Date getVisibleTime()
setVisibleTime(java.util.Date)public void setVisibleTime(Date time)
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeScrollable, ilog.views.gantt.IlvTimeInterval) method. The
time scale then adjusts its internal zoom and scroll parameters so that the
specified time value is drawn at the beginning of the time scale. 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(java.util.Date, ilog.views.gantt.IlvDuration) method instead.time - The new time value.getVisibleTime()public IlvDuration getVisibleDuration()
setVisibleDuration(ilog.views.gantt.IlvDuration)public void setVisibleDuration(IlvDuration duration)
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeScrollable, ilog.views.gantt.IlvTimeInterval) method. The
time scale then adjusts its internal zoom and scroll parameters so that the
specified duration is visible. 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(java.util.Date, ilog.views.gantt.IlvDuration) method instead.duration - The new duration value.getVisibleDuration()public IlvTimeInterval getVisibleInterval()
setVisibleInterval(java.util.Date, ilog.views.gantt.IlvDuration)
public void setVisibleInterval(Date time,
IlvDuration duration)
IlvTimeScrollUtil.trimInterval(ilog.views.gantt.IlvTimeScrollable, ilog.views.gantt.IlvTimeInterval) method. This method
then fires an adjusting VisibleTimeChangedEvent followed by a
VisibleDurationChangedEvent to all
registered listeners.time - The new time value.duration - The new duration value.public void addTimeScrollListener(TimeScrollListener listener)
listener - The listener that will be subscribed to subsequent time
scroll events.removeTimeScrollListener(ilog.views.gantt.event.TimeScrollListener)public void removeTimeScrollListener(TimeScrollListener listener)
listener - The listener that will be unsubscribed from receiving
time scroll events.addTimeScrollListener(ilog.views.gantt.event.TimeScrollListener)protected void fireTimeScrollableValueChanged(boolean adjusting)
protected void fireTimeScrollableVisibleDurationChanged()
|
||||||||||
![]() |
FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||