The label layout framework provides the same
event mechanism as the graph layout framework. Various events may
occur.
Label layout events
The class GraphLayoutEvent corresponds to the class GraphLayoutEvent (see Graph layout event listeners). You can
install a listener for these events at the layout instance by
using the method:
labelLayout.addLabelLayoutEventListener(listener);
The listener must implement the LabelLayoutEventListener interface and
receives events while the layout is running. A typical example is
to check how much of the layout has already completed:
class MyLabelLayoutListener implements LabelLayoutEventListener { public void layoutStepPerformed(LabelLayoutEvent event) { IlvLabelLayoutReport layoutReport = event.getLayoutReport(); System.out.println("percentage of completion: " + layoutReport.getPercentageComplete()); } }
Label layout parameter events
The class LabelLayoutParameterEvent corresponds to
the class GraphLayoutParameterEvent (see Parameter event listeners). You can install
a listener to these events at the layout instance by
labelLayout.addLabelLayoutParameterEventListener(listener);
The listener must implement the
LabelLayoutParameterEventListener
interface and receives events when layout parameters change. It
also receives a special event at the end of a successful layout.
For example:
class MyLabelLayoutParameterListener implements LabelLayoutParameterEventListener { public void parametersUpToDate(LabelLayoutParameterEvent event) { if (!event.isParametersUpToDate()) System.out.println("Any label layout parameter has changed.”); } }