public class IlvVerticalDisplayController extends Object
IlvVerticalDisplayController
is a display controller that
coordinates the vertical scrolling, row expand/collapse, and row visibility
behavior between an IlvGanttConfiguration
and 1 or more user
interface components.
Components that will have their vertical scrolling coordinated must implement
the IlvVerticalScrollable
interface and are registered by calling the
addScrollable
method. The vertical display controller
delegates responsibility for actual scrolling coordination to an
IlvVerticalScrollController
.
Components that will have their row expand/collapse and visibility behavior
coordinated must implement the IlvVerticalExpandable
interface and
are registered by calling the addExpandable
method.
The vertical display controller delegates responsibility for tracking row
expand/collapse and visibility state to an
IlvVerticalExpansionMaster
.
The way this works is this:
row organization
.
The controller then notifies the vertical expansion master by directly
calling the following methods:
expand
or collapse
nodes. The
controller similarly notifies the vertical expansion master by directly
calling the following methods:
ganttModelChanged
is republished as a
GanttModelChangedEvent
.
rowsInserted
is republished as a RowsInsertedEvent
.
rowsRemoved
is republished as a RowsRemovedEvent
.
rowMoved
is republished as a RowMovedEvent
.
rowExpanded
is republished as a RowExpandedEvent
.
rowCollapsed
is republished as a RowCollapsedEvent
.
fireXXXEvent()
method.
row height
and does not route these to the expansion
master. The controller publishes these as a RowHeightChangedEvent
.
The IlvVerticalDisplayController
manages the following states
of each node in the displayed data tree. An expanded node is one that
displays its children. A collapsed node is one that hides them. A
hidden node is one that is under a collapsed parent. A visible
node is the opposite of hidden, it is under an expanded parent, but may or
may not be displayed. A displayed node is both visible and in the
display area, where it can be seen.
The IlvVerticalDisplayController
must be connected to its Gantt
configuration before any vertical expandables or scrollables can be added to
it or before its expansion master can be set.
Modifier and Type | Class and Description |
---|---|
class |
IlvVerticalDisplayController.ActivityAdapter
ActivityAdapter can adapt between a vertical controller and
the activity tree of a Gantt data model. |
class |
IlvVerticalDisplayController.ResourceAdapter
ResourceAdapter can adapt between a vertical controller and
the resource tree of a Gantt data model. |
Modifier and Type | Field and Description |
---|---|
static int |
ACTIVITY_ROWS
Each row represents an activity.
|
static int |
DEFAULT_ROW_HEIGHT
The default row height.
|
static int |
RESOURCE_ROWS
Each row represents a resource.
|
Constructor and Description |
---|
IlvVerticalDisplayController(int rowType)
Construct a new
IlvVerticalDisplayController that will
coordinate the vertical scrolling, expand/collapse, and visibility behavior
of the specified type of rows. |
Modifier and Type | Method and Description |
---|---|
void |
addExpandable(IlvVerticalExpandable expandable)
Adds the specified expandable UI component to be coordinated with this
controller.
|
void |
addExpansionListener(VerticalExpansionListener listener)
Adds the specified listener to receive expansion events from this
controller.
|
void |
addScrollable(IlvVerticalScrollable scrollable)
Adds the specified scrollable UI component to be coordinated with this
controller.
|
void |
addScrollListener(VerticalScrollListener listener)
Adds the specified listener to receive vertical scroll events from this
controller.
|
void |
collapseNode(IlvHierarchyNode node)
Ensures that the specified node is collapsed.
|
int |
computeScrollPosition(int rowDelta)
Returns the position that will cause the controller and its associated
vertically scrollable components to scroll by the specified
number of rows, up or down. |
void |
expandNode(IlvHierarchyNode node)
Ensures that the specified node is expanded and visible.
|
void |
fireGanttModelChanged(GanttModelChangedEvent event)
Fires a
GanttModelChangedEvent to all registered expandable UI
components. |
void |
fireNodeCollapsed(RowCollapsedEvent event)
Fires a
RowCollapsedEvent to all registered expandable UI
components. |
void |
fireNodeExpanded(RowExpandedEvent event)
Fires a
RowExpandedEvent to all registered expandable UI
components. |
void |
fireNodeMoved(RowMovedEvent event)
Fires a
RowMovedEvent to all registered expandable UI
components. |
void |
fireNodesInserted(RowsInsertedEvent event)
Fires a
RowsInsertedEvent to all registered expandable UI
components. |
void |
fireNodesRemoved(RowsRemovedEvent event)
Fires a
RowsRemovedEvent to all registered expandable UI
components. |
void |
fireRootRowVisibilityChanged(RootRowVisibilityChangedEvent event)
Fires a
RootRowVisibilityChangedEvent to all registered expandable UI
components. |
IlvHierarchyNode |
getDisplayedNodeAtPosition(int position)
Returns the node at the specified vertical position relative to the
display area.
|
int |
getDisplayedRowAtPosition(int position)
Returns the row at the specified vertical position relative to the
display area.
|
int |
getExtent()
Returns the extent of the vertical range displayed by the controller and
its associated
vertically scrollable components. |
IlvHierarchyNode |
getFirstNode()
Returns the first visible node in the displayed tree or
null if no nodes
are visible. |
IlvGanttConfiguration |
getGanttConfiguration()
Returns the Gantt configuration that is being displayed by the
user interface components of this controller.
|
int |
getMaxPosition()
Returns the maximum position that the controller and its associated
vertically scrollable components can display. |
IlvHierarchyNode |
getNodeAtPosition(int position)
Returns the node at the specified vertical position, relative to the
first visible node at
position = 0 . |
Rectangle |
getNodeBounds(IlvHierarchyNode node)
Returns the vertical bounds of the specified node as the y and
height fields of a rectangle.
|
IlvHierarchyNode |
getNodeForRow(int row)
Returns the node for the specified row.
|
int |
getPosition()
Returns the beginning of the vertical range displayed by the controller and
its associated
vertically scrollable components. |
IlvHierarchyNode |
getRootDataNode()
Returns the root node of the Gantt configuration and its data model.
|
IlvHierarchyNode |
getRootNode()
Deprecated.
Beginning with Rogue Wave JViews 8.5, use
getFirstNode()
instead. |
int |
getRowAtPosition(int position)
Returns the row at the specified vertical position, relative to the
first visible row at
position = 0 . |
Rectangle |
getRowBounds(int row)
Returns the vertical bounds of the specified row as the y and
height fields of a rectangle.
|
int |
getRowCount()
Returns the number of rows that are visible.
|
int |
getRowForNode(IlvHierarchyNode node)
Returns the row that the specified node is displayed on.
|
int |
getRowHeight()
Returns the row height used when all rows are set to have the same height.
|
int |
getRowHeight(IlvHierarchyNode row)
Returns the height of the specified row.
|
int |
getRowType()
Returns an
int that represents the row organization of this
vertical display controller. |
void |
inform(GanttModelChangedEvent event)
Invoked through the event demultiplexer when the entire data model has
been replaced.
|
boolean |
isExpanded(IlvHierarchyNode node)
Returns whether the specified node and all of its ancestors are currently expanded.
|
boolean |
isFixedRowHeight()
Returns whether all rows are set to have the same fixed height.
|
boolean |
isRootNodeVisible()
Returns
true if the root node of the tree is visible, or
false if the root node's children are the highest level visible nodes. |
boolean |
isVisible(IlvHierarchyNode node)
Returns whether the specified node is visible.
|
void |
makeDisplayed(IlvHierarchyNode node)
Ensures that the specified node is displayed.
|
void |
makeVisible(IlvHierarchyNode node)
Ensures that the specified node is visible.
|
void |
removeExpandable(IlvVerticalExpandable expandable)
Removes the specified expandable UI component so that it will no longer be
coordinated with this controller.
|
void |
removeExpansionListener(VerticalExpansionListener listener)
Removes the specified listener so that it will no longer receive expansion
events from this controller.
|
void |
removeScrollable(IlvVerticalScrollable scrollable)
Removes the specified scrollable UI component so that it will no longer be
coordinated with this controller.
|
void |
removeScrollListener(VerticalScrollListener listener)
Removes the specified listener so that it will no longer receive vertical
scroll events from this controller.
|
void |
scrollBoundsToDisplay(Rectangle bounds)
Scrolls the vertical bounds specified by the y and height
fields of the given rectangle into the display area.
|
void |
setExtent(int extent)
Sets the extent of the vertical range displayed by the controller and its
associated
vertically scrollable components. |
protected void |
setGanttConfigurationImpl(IlvGanttConfiguration ganttConfig)
Sets the Gantt configuration that will be displayed by the
user interface components of this controller.
|
void |
setMaxPosition(int max)
Sets the maximum position that the controller and its associated
vertically scrollable components can display. |
void |
setPosition(int position)
Sets the beginning of the vertical range displayed by the controller and
its associated
vertically scrollable components. |
void |
setRootNodeVisible(boolean rootVisible)
Sets whether the root node of the tree is visible, or whether the root node's children
should be the highest level visible nodes.
|
void |
setRowHeight(IlvHierarchyNode row,
int rowHeight)
Sets the height of the specified row.
|
void |
setRowHeight(int rowHeight)
Sets all rows to have the same height.
|
void |
setVerticalExpansionMaster(IlvVerticalExpansionMaster expansionMaster)
Sets the object that will track the expand/collapse status of the
hierarchical tree and the corresponding rows that each node is displayed
on.
|
void |
validateRowHeights()
Validates the heights of all rows, that is, ensures that they are all
up-to-date.
|
Iterator<IlvHierarchyNode> |
visibleNodesIterator()
Returns an iterator that traverses all of the visible nodes.
|
Iterator<IlvHierarchyNode> |
visibleNodesIterator(IlvHierarchyNode root)
Returns an iterator that traverses only the visible nodes in the specified
subtree.
|
public static final int ACTIVITY_ROWS
IlvGanttConfiguration.ACTIVITY_ROWS
.public static final int RESOURCE_ROWS
IlvGanttConfiguration.RESOURCE_ROWS
.public static final int DEFAULT_ROW_HEIGHT
20
.public IlvVerticalDisplayController(int rowType)
IlvVerticalDisplayController
that will
coordinate the vertical scrolling, expand/collapse, and visibility behavior
of the specified type of rows.rowType
- The type of rows being displayed. The value must be either
ACTIVITY_ROWS
or RESOURCE_ROWS
.public int getRowType()
int
that represents the row organization of this
vertical display controller. This will be one of of the constants
ACTIVITY_ROWS
or RESOURCE_ROWS
.ACTIVITY_ROWS
or RESOURCE_ROWS
.public IlvGanttConfiguration getGanttConfiguration()
null
if this controller is
not currently associated with a Gantt configuration.protected void setGanttConfigurationImpl(IlvGanttConfiguration ganttConfig)
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the Gantt configuration should invoke this method.
ganttConfig
- The Gantt configuration.public IlvHierarchyNode getRootDataNode()
null
if the Gantt configuration has no nodes.
This method does not account for processing of the data model by this
controller's vertical expansion master, as getFirstNode()
does.
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the controller's vertical expansion master should
invoke this method.
@Deprecated public IlvHierarchyNode getRootNode()
getFirstNode()
instead.null
if no
nodes are visible.public IlvHierarchyNode getFirstNode()
null
if no nodes
are visible. If the data model contains at least a root node and the root node is set visible, then this method will return the root
node. If the root node is set not visible, then this method will return the first child
of the root node, if it exists in the data model. This method is equivalent to
calling getNodeForRow(0)
.public IlvHierarchyNode getNodeForRow(int row)
null
is returned.row
- The row.null
if
row < 0
or row >= getRowCount()
.public int getRowForNode(IlvHierarchyNode node)
node
- The node.node
is displayed on, where 0 is the
first row, or -1 if node
is not visible.public int getRowCount()
public void validateRowHeights()
public boolean isFixedRowHeight()
true
if all rows are set to the same height, false
otherwise.setRowHeight(int)
,
setRowHeight(IlvHierarchyNode, int)
public int getRowHeight()
setRowHeight(IlvHierarchyNode,
int)
method, then this value will be the height of those rows whose height has not
been specifically set. The default value is 20
.setRowHeight(int)
,
setRowHeight(IlvHierarchyNode, int)
public int getRowHeight(IlvHierarchyNode row)
row
- The row.setRowHeight(int)
,
setRowHeight(IlvHierarchyNode,int)
public void setRowHeight(int rowHeight)
setRowHeight(IlvHierarchyNode, int)
method,
then this value will be used as the height for those rows whose height has not been
specifically set.rowHeight
- The row height.getRowHeight()
,
getRowHeight(IlvHierarchyNode)
public void setRowHeight(IlvHierarchyNode row, int rowHeight)
row
- The row.rowHeight
- The row height.getRowHeight()
,
getRowHeight(IlvHierarchyNode)
,
setRowHeight(int)
public int getRowAtPosition(int position)
position = 0
. This method does not take
the current vertical scroll position into account and returns -1 if the
row < 0
or row >= getRowCount()
.position
- The vertical position of interest.getNodeAtPosition(int)
,
getDisplayedRowAtPosition(int)
,
getDisplayedNodeAtPosition(int)
public int getDisplayedRowAtPosition(int position)
row < 0
or
row >= getRowCount()
.position
- The vertical position of interest, relative to the display
area.getRowAtPosition(int)
,
getNodeAtPosition(int)
,
getDisplayedNodeAtPosition(int)
public IlvHierarchyNode getNodeAtPosition(int position)
position = 0
. This method does not take
the current vertical scroll position into account and returns
null
if the position does not correspond to a visible row.position
- The vertical position of interest.null
if the
position is out of range.getRowAtPosition(int)
,
getDisplayedRowAtPosition(int)
,
getDisplayedNodeAtPosition(int)
public IlvHierarchyNode getDisplayedNodeAtPosition(int position)
null
if the position does
not correspond to a visible row.position
- The vertical position of interest, relative to the display
area.null
if the position is out of range.getRowAtPosition(int)
,
getNodeAtPosition(int)
,
getDisplayedRowAtPosition(int)
public Rectangle getRowBounds(int row)
y = 0
and do
not take the current vertical scroll position into account. If the row is
not visible, then null
is returned.row
- The row.null
if
the row < 0
or row >= getRowCount()
.public Rectangle getNodeBounds(IlvHierarchyNode node)
root node
at
y = 0
and do not take the current vertical scroll position
into account. If the node is not visible, then null
is
returned.node
- The node.null
if node is not visible.public boolean isRootNodeVisible()
true
if the root node of the tree is visible, or
false
if the root node's children are the highest level visible nodes.
This method returns the value of the rootNodeVisible
property and is
independent of whether the data model has a root node to be displayed. The default
value is true
.true
if the root node of the tree is visible, or
false
if the root node's children are the highest level visible
nodes.setRootNodeVisible(boolean)
,
getFirstNode()
,
getRootDataNode()
public void setRootNodeVisible(boolean rootVisible)
rootVisible
- true
to make the root node of the tree visible, or
false
to make the root node's children the highest
level visible node.isRootNodeVisible()
,
getFirstNode()
,
getRootDataNode()
public boolean isExpanded(IlvHierarchyNode node)
true
implies that the node has children that are visible.
If the node has no children or it, or any of its ancestors, are not expanded then
this method returns false
. This implies that the node has no visible
children.node
- The node.true
if the node has children and it, and all of its
ancestors, are expanded. Otherwise, this method returns false
.public boolean isVisible(IlvHierarchyNode node)
node
- The node.true
if the node is visible, and false
otherwise.public Iterator<IlvHierarchyNode> visibleNodesIterator(IlvHierarchyNode root)
root
- The root node of the subtree.visibleNodesIterator()
public Iterator<IlvHierarchyNode> visibleNodesIterator()
visibleNodesIterator(IlvHierarchyNode)
public void makeVisible(IlvHierarchyNode node)
expanded
.node
- The node.public void expandNode(IlvHierarchyNode node)
node
- The node.collapseNode(ilog.views.gantt.IlvHierarchyNode)
public void collapseNode(IlvHierarchyNode node)
node
- The node.expandNode(ilog.views.gantt.IlvHierarchyNode)
public void addExpandable(IlvVerticalExpandable expandable)
expandable
- The UI component.IllegalStateException
- if the display controller is not part of
a Gantt configuration.setVerticalExpansionMaster(ilog.views.gantt.IlvVerticalExpansionMaster)
public void removeExpandable(IlvVerticalExpandable expandable)
expandable
- The UI component to remove.public void setVerticalExpansionMaster(IlvVerticalExpansionMaster expansionMaster)
expansionMaster
- The vertical expansion master.IllegalStateException
- if the display controller is not part of
a Gantt configuration.public void addExpansionListener(VerticalExpansionListener listener)
listener
- The listener that will be subscribed to subsequent
expansion events.public void removeExpansionListener(VerticalExpansionListener listener)
listener
- The listener that will be unsubscribed from receiving
expansion events.public int getMaxPosition()
vertically scrollable
components can display.setMaxPosition(int)
public void setMaxPosition(int max)
vertically scrollable
components 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.max
- The maximum position.getMaxPosition()
public int getPosition()
vertically scrollable
components.setPosition(int)
public void setPosition(int position)
vertically scrollable
components.
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
.position
- The new position.getPosition()
,
computeScrollPosition(int)
public int getExtent()
vertically scrollable
components.setExtent(int)
public void setExtent(int extent)
vertically scrollable
components. 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
.extent
- The new extent.getExtent()
public void addScrollable(IlvVerticalScrollable scrollable)
scrollable
- The scrollable UI component.removeScrollable(ilog.views.gantt.IlvVerticalScrollable)
public void removeScrollable(IlvVerticalScrollable scrollable)
scrollable
- The scrollable UI component to remove.addScrollable(ilog.views.gantt.IlvVerticalScrollable)
public void addScrollListener(VerticalScrollListener listener)
listener
- The listener that will be subscribed to subsequent
scroll events.removeScrollListener(ilog.views.gantt.event.VerticalScrollListener)
public void removeScrollListener(VerticalScrollListener listener)
listener
- The listener that will be unsubscribed from receiving
vertical scroll events.addScrollListener(ilog.views.gantt.event.VerticalScrollListener)
public void makeDisplayed(IlvHierarchyNode node)
visible
and is scrolled into
the display area.node
- The node.public void scrollBoundsToDisplay(Rectangle bounds)
bounds
- The vertical region to scroll into the display area,
specified by the y and height fields.public int computeScrollPosition(int rowDelta)
vertically scrollable
components to scroll by the specified
number of rows, up or down. The value returned by this method can then be applied
using the setPosition(int)
method to effect the scroll.rowDelta
- The number of rows to scroll. Negative values indicate to scroll up,
while positive numbers indicate to scroll down.public void inform(GanttModelChangedEvent event)
IlvVerticalExpansionMaster.ganttModelChanged(ilog.views.gantt.event.GanttModelChangedEvent)
method for handling.event
- The event.public void fireGanttModelChanged(GanttModelChangedEvent event)
GanttModelChangedEvent
to all registered expandable UI
components.
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the controller's vertical expansion master should
invoke this method.
event
- The event.public void fireNodesInserted(RowsInsertedEvent event)
RowsInsertedEvent
to all registered expandable UI
components.
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the controller's vertical expansion master should
invoke this method.
event
- The event.public void fireNodesRemoved(RowsRemovedEvent event)
RowsRemovedEvent
to all registered expandable UI
components.
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the controller's vertical expansion master should
invoke this method.
event
- The event.public void fireNodeMoved(RowMovedEvent event)
RowMovedEvent
to all registered expandable UI
components.
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the controller's vertical expansion master should
invoke this method.
event
- The event.public void fireNodeExpanded(RowExpandedEvent event)
RowExpandedEvent
to all registered expandable UI
components.
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the controller's vertical expansion master should
invoke this method.
event
- The event.public void fireNodeCollapsed(RowCollapsedEvent event)
RowCollapsedEvent
to all registered expandable UI
components.
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the controller's vertical expansion master should
invoke this method.
event
- The event.public void fireRootRowVisibilityChanged(RootRowVisibilityChangedEvent event)
RootRowVisibilityChangedEvent
to all registered expandable UI
components.
Warning: This method is considered to be part of an
IlvVerticalDisplayController
's internal implementation and is
not a public API. Only the controller's vertical expansion master should
invoke this method.
event
- The event.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.