public class IlvVerticalScrollController extends Object implements IlvVerticalScrollable
An IlvVerticalScrollController
coordinates the vertical
scrolling of 1 or more IlvVerticalScrollable
objects. In addition,
the controller itself exports the IlvVerticalScrollable
interface. Scrolling is determined by three interrelated integer properties:
maxVerticalPosition, verticalPosition, and verticalExtent. These three
values define two nested ranges like this:
0 <= verticalPosition <= verticalPosition+verticalExtent <= maxVerticalPosition
The controller enforces this relationship by correcting or trimming properties according to the following rules:
setMaxVerticalPosition(int)
method first validates
that:
0 <= maxVisibleTime
If not, an IllegalArgumentException
is thrown. Next, the
vertical position and extent properties may be trimmed (in that order),
to fit within the new 0-max range.
setVerticalPosition(int)
and
setVerticalExtent(int)
methods trim their argument to fit within
the limits defined by the other two properties.
Constructor and Description |
---|
IlvVerticalScrollController()
Creates a new
IlvVerticalScrollController . |
Modifier and Type | Method and Description |
---|---|
void |
addVerticalScrollable(IlvVerticalScrollable vs)
Adds an
IlvVerticalScrollable object to be coordinated by this
controller. |
void |
addVerticalScrollListener(VerticalScrollListener listener)
Adds the specified listener to receive vertical scroll events from this
controller.
|
protected void |
fireMaxVerticalPositionChanged()
Call this method to fire a
maxVerticalPositionChanged event to all registered listeners . |
protected void |
fireVerticalExtentChanged()
Call this method to fire a
verticalExtentChanged
event to all registered listeners . |
protected void |
fireVerticalPositionChanged()
Call this method to fire a
verticalPositionChanged event to all registered listeners . |
int |
getMaxVerticalPosition()
Returns the maximum vertical position that the controller and its
associated
vertically scrollable objects
can display. |
int |
getVerticalExtent()
Returns the extent of the vertical range displayed by the controller and
its associated
vertically scrollable
objects. |
int |
getVerticalPosition()
Returns the beginning of the vertical range displayed by the controller
and its associated
vertically scrollable
objects. |
void |
removeVerticalScrollable(IlvVerticalScrollable vs)
Removes an
IlvVerticalScrollable object so that it is no longer
coordinated by this controller. |
void |
removeVerticalScrollListener(VerticalScrollListener listener)
Removes the specified listener so that it will no longer receive vertical
scroll events from this controller.
|
void |
setMaxVerticalPosition(int max)
Sets the maximum vertical position that the controller and its associated
vertically scrollable objects can display. |
void |
setVerticalExtent(int extent)
Sets the extent of the vertical range displayed by the controller and its
associated
vertically scrollable objects. |
void |
setVerticalPosition(int position)
Sets the beginning of the vertical range displayed by the controller and
its associated
vertically scrollable
objects. |
public IlvVerticalScrollController()
IlvVerticalScrollController
.public void addVerticalScrollable(IlvVerticalScrollable vs)
IlvVerticalScrollable
object to be coordinated by this
controller.public void removeVerticalScrollable(IlvVerticalScrollable vs)
IlvVerticalScrollable
object so that it is no longer
coordinated by this controller.public int getMaxVerticalPosition()
vertically scrollable
objects
can display.getMaxVerticalPosition
in interface IlvVerticalScrollable
setMaxVerticalPosition(int)
public void setMaxVerticalPosition(int max)
vertically scrollable
objects can display.
The current vertical position
and
extent
are trimmed to fit the new 0-max range.
A maxVerticalPositionChanged event
is then fired to all
registered listeners
.
If max < 0
an IllegalArgumentException
will
be thrown.setMaxVerticalPosition
in interface IlvVerticalScrollable
max
- The maximum position.getMaxVerticalPosition()
public int getVerticalPosition()
vertically scrollable
objects.getVerticalPosition
in interface IlvVerticalScrollable
setVerticalPosition(int)
public void setVerticalPosition(int position)
vertically scrollable
objects. The specified value is compared against the
max
displayable value and is trimmed if
necessary. A verticalPositionChanged event
is then fired to all
registered listeners
.setVerticalPosition
in interface IlvVerticalScrollable
position
- The new position.getVerticalPosition()
public int getVerticalExtent()
vertically scrollable
objects.getVerticalExtent
in interface IlvVerticalScrollable
setVerticalExtent(int)
public void setVerticalExtent(int extent)
vertically scrollable
objects.
The specified value is compared against the max
displayable value and is trimmed if necessary. A
verticalExtentChanged
event
is then fired to all registered
listeners
.setVerticalExtent
in interface IlvVerticalScrollable
extent
- The new extent.getVerticalExtent()
public void addVerticalScrollListener(VerticalScrollListener listener)
addVerticalScrollListener
in interface IlvVerticalScrollable
listener
- The listener that will be subscribed to subsequent
scroll events.removeVerticalScrollListener(ilog.views.gantt.event.VerticalScrollListener)
public void removeVerticalScrollListener(VerticalScrollListener listener)
removeVerticalScrollListener
in interface IlvVerticalScrollable
listener
- The listener that will be unsubscribed from receiving
vertical scroll events.addVerticalScrollListener(ilog.views.gantt.event.VerticalScrollListener)
protected void fireMaxVerticalPositionChanged()
maxVerticalPositionChanged event
to all registered listeners
.setMaxVerticalPosition(int)
protected void fireVerticalPositionChanged()
verticalPositionChanged event
to all registered listeners
.setVerticalPosition(int)
protected void fireVerticalExtentChanged()
verticalExtentChanged
event
to all registered listeners
.setVerticalExtent(int)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.