public final class GraphLayoutEvent extends EventObject
If you install a GraphLayoutEventListener
on a layout
instance, a GraphLayoutEvent
is delivered to the listener
each time the method IlvGraphLayout.layoutStepPerformed()
is
called by the layout algorithms. This allows you to obtain the layout
report (using getLayoutReport()
more than once during the
layout and to be informed of the behavior of the layout algorithm
before its completion. You can, for example, implement a progress bar
and update it each time you receive the layout event.
Note that the layout event is delivered only if the method IlvGraphLayout.layoutStepPerformed()
is called. This depends on the
implementation of the method IlvGraphLayout.layout(boolean)
.
source
Constructor and Description |
---|
GraphLayoutEvent(IlvGraphLayout layout)
Creates the event.
|
Modifier and Type | Method and Description |
---|---|
IlvGraphLayout |
getGraphLayout()
Returns the graph layout that is the source of the event.
|
IlvGraphLayoutReport |
getLayoutReport()
Returns the graph layout report contained in the event.
|
boolean |
isLayoutFinished()
Returns whether the layout just has finished.
|
boolean |
isLayoutStarted()
Returns whether the layout just has started.
|
getSource, toString
public GraphLayoutEvent(IlvGraphLayout layout)
layout
- The layout instance source of the eventpublic boolean isLayoutStarted()
true
if this event is the first event at the beginning of the layout
process of a graph, and false
otherwise.
If this method returns true
, the method isLayoutFinished()
called on the same event instance returns
false
.
You can use this method to detect the first event sent by the layout
process of a graph, for instance, in order to print a message or to
give feedback to the end user. Note that the method returns
false
for the events that follow the first event.
isLayoutFinished()
,
IlvJGraphLayoutProgressBar
public boolean isLayoutFinished()
Returns true
if this event is sent at the end of the
layout process of a graph, and false
otherwise. You can
use this method to detect the last event sent by the layout process
of a graph, and to get the corresponding layout report code from it
using IlvGraphLayoutReport.getCode()
. For example, you could
use the following code:
if (event.isLayoutFinished()) System.out.println("final code: " + event.getLayoutReport().getCode());
isLayoutStarted()
public IlvGraphLayoutReport getLayoutReport()
IlvGraphLayout.getLayoutReport()
on the layout instance that is the
source of the event.
Note that if a subclass of IlvGraphLayout
overrides the
method IlvGraphLayout.createLayoutReport()
, this method can
return an instance of a subclass of IlvGraphLayoutReport
,
depending on the class of layout report created.
public IlvGraphLayout getGraphLayout()
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.