public class IlvTimeScrollBar extends JScrollBar implements IlvTimeScrollable
IlvTimeScrollbar
is a scroll bar that implements the
IlvTimeScrollable
interface and is designed to scroll over a
time period. The scroll bar is used in an IlvJScrollGanttSheet
to scroll the
IlvGanttSheet
. Two time
scrolling modes are supported:
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, and visibleDuration. These four values define two nested ranges like this:
minVisibleTime <= visibleTime <= visibleTime + visibleDuration <= maxVisibleTime
The scroll bar enforces this relationship by correcting or trimming properties according to the following rules:
setMinVisibleTime(java.util.Date)
and setMaxVisibleTime(java.util.Date)
methods first validate that:
minVisibleTime <= maxVisibleTime
If not, an IllegalArgumentException
is thrown. Next, the
visible time and visible duration properties may be trimmed (in that
order) to fit within the new min-max interval.
setVisibleTime(java.util.Date)
and setVisibleDuration(ilog.views.gantt.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 scroll bar uses the
IlvTimeScrollUtil.trimInterval(IlvTimeScrollable, Date, 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
. The scroll bar can scroll to the left or to
the right normally, but the slider always snaps back to the center and
its size never changes.
Even in unbounded scrolling mode, there is an inherent limitation on the
minimum
and
maximum
times that can be
scrolled to. As in bounded scrolling mode, this is enforced by having
the scroll bar use the
IlvTimeScrollUtil.trimInterval(IlvTimeScrollable, Date, IlvDuration)
method to perform validation and trimming of the time value arguments.
JScrollBar.AccessibleJScrollBar
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
blockIncrement, model, orientation, unitIncrement
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
DEFAULT_MINIMUM_DURATION
HORIZONTAL, NO_ORIENTATION, VERTICAL
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
IlvTimeScrollBar()
Creates a horizontal time scroll bar.
|
Modifier and Type | Method and Description |
---|---|
void |
addTimeScrollListener(TimeScrollListener listener)
Adds the specified listener to receive time scroll events from this
scroll bar.
|
protected void |
fireVisibleTimeChanged(Date time)
This method is called to fire a time value modification.
|
Date |
getMaxVisibleTime()
Returns the maximum time that the scroll bar can show in bounded
scrolling mode.
|
IlvDuration |
getMinVisibleDuration()
Returns the minimum duration that the scroll bar can display.
|
Date |
getMinVisibleTime()
Returns the minimum time that the scroll bar can show in bounded
scrolling mode.
|
IlvDuration |
getVisibleDuration()
Returns the duration of the time interval displayed by the scroll bar.
|
IlvTimeInterval |
getVisibleInterval()
Returns the time interval displayed by the scroll bar.
|
Date |
getVisibleTime()
Returns the beginning of the time interval displayed by the scroll
bar.
|
void |
removeTimeScrollListener(TimeScrollListener listener)
Removes the specified listener so that it will no longer receive time
scroll events from this scroll bar.
|
void |
setBounds(int x,
int y,
int width,
int height)
Moves and resizes the time scale.
|
void |
setMaxVisibleTime(Date max)
Sets the maximum time that the scroll bar can show in bounded
scrolling mode.
|
void |
setMinVisibleDuration(IlvDuration duration)
Sets the minimum duration that the scroll bar can display.
|
void |
setMinVisibleTime(Date min)
Sets the minimum time that the scroll bar can show in bounded
scrolling mode.
|
void |
setVisibleDuration(IlvDuration duration)
Sets the duration of the time interval displayed by the scroll bar.
|
void |
setVisibleInterval(Date time,
IlvDuration duration)
Sets the time interval displayed by the scroll bar.
|
void |
setVisibleTime(Date time)
Sets the beginning of the time interval displayed by the scroll bar.
|
protected void |
widthChanged(int oldWidth,
int newWidth)
This method is invoked when the time scroll bar width has been modified
in bounded mode.
|
addAdjustmentListener, fireAdjustmentValueChanged, getAccessibleContext, getAdjustmentListeners, getBlockIncrement, getBlockIncrement, getMaximum, getMaximumSize, getMinimum, getMinimumSize, getModel, getOrientation, getUI, getUIClassID, getUnitIncrement, getUnitIncrement, getValue, getValueIsAdjusting, getVisibleAmount, paramString, removeAdjustmentListener, setBlockIncrement, setEnabled, setMaximum, setMinimum, setModel, setOrientation, setUI, setUnitIncrement, setValue, setValueIsAdjusting, setValues, setVisibleAmount, updateUI
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public void setBounds(int x, int y, int width, int height)
x
and y
, and the
new size is specified by width
and height
.protected void widthChanged(int oldWidth, int newWidth)
oldWidth
- The old width of the scroll bars.newWidth
- The new width of the scroll bars.public Date getMinVisibleTime()
getMinVisibleTime
in interface IlvTimeScrollable
null
if the scroll
bar is in unbounded scrolling mode.setMinVisibleTime(java.util.Date)
public void setMinVisibleTime(Date min)
time
and
duration
are trimmed to fit the new
min-max interval by calling the
IlvTimeScrollUtil.trimInterval(IlvTimeScrollable, Date, IlvDuration)
method. A
minVisibleTimeChanged event
is then fired to all
registered listeners
. If
min > maxVisibleTime
an
IllegalArgumentException
will be thrown.setMinVisibleTime
in interface IlvTimeScrollable
min
- The minimum visible time or null
to set the
scroll bar to unbounded scrolling mode.getMinVisibleTime()
public Date getMaxVisibleTime()
getMaxVisibleTime
in interface IlvTimeScrollable
null
if the scroll
bar is in unbounded scrolling mode.setMaxVisibleTime(java.util.Date)
public void setMaxVisibleTime(Date max)
time
and
duration
are trimmed to fit the new
min-max interval by calling the
IlvTimeScrollUtil.trimInterval(IlvTimeScrollable, Date, IlvDuration)
method. A
maxVisibleTimeChanged event
is then fired to all
registered listeners
. If
max < minVisibleTime
an
IllegalArgumentException
will be thrown.setMaxVisibleTime
in interface IlvTimeScrollable
max
- The maximum visible time or null
to set the
scroll bar to unbounded scrolling mode.getMaxVisibleTime()
public IlvDuration getMinVisibleDuration()
getMinVisibleDuration
in interface IlvTimeScrollable
setMinVisibleDuration(ilog.views.gantt.IlvDuration)
public void setMinVisibleDuration(IlvDuration duration)
minVisibleDurationChanged event
is fired to all registered listeners
.setMinVisibleDuration
in interface IlvTimeScrollable
duration
- The minimum visible duration.getMinVisibleDuration()
public Date getVisibleTime()
getVisibleTime
in interface IlvTimeScrollable
setVisibleTime(java.util.Date)
public void setVisibleTime(Date time)
min
and max
visible times and is trimmed if necessary by calling the
IlvTimeScrollUtil.trimInterval(IlvTimeScrollable, Date, IlvDuration)
method. The subsequent movement of the scroll bar then fires a
VisibleTimeChangedEvent
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.setVisibleTime
in interface IlvTimeScrollable
time
- The new time value.getVisibleTime()
public IlvDuration getVisibleDuration()
getVisibleDuration
in interface IlvTimeScrollable
setVisibleDuration(ilog.views.gantt.IlvDuration)
public void setVisibleDuration(IlvDuration duration)
min
and max
visible times and is trimmed if necessary by calling the
IlvTimeScrollUtil.trimInterval(IlvTimeScrollable, Date, IlvDuration)
method. The subsequent movement of the scroll bar then fires a
VisibleDurationChangedEvent
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.setVisibleDuration
in interface IlvTimeScrollable
duration
- The new duration value.getVisibleDuration()
public IlvTimeInterval getVisibleInterval()
getVisibleInterval
in interface IlvTimeScrollable
setVisibleInterval(java.util.Date, ilog.views.gantt.IlvDuration)
public void setVisibleInterval(Date time, IlvDuration duration)
min
and
max
visible times and is trimmed if
necessary by calling the
IlvTimeScrollUtil.trimInterval(IlvTimeScrollable, Date, IlvDuration)
method. This method then fires an adjusting
VisibleTimeChangedEvent
followed by a
VisibleDurationChangedEvent
to all registered listeners
.setVisibleInterval
in interface IlvTimeScrollable
time
- The new time value.duration
- The new duration value.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)
protected void fireVisibleTimeChanged(Date time)
time
- The new time value.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.