ilog.views.graphlayout.labellayout
Class IlvLabelLayoutReport

java.lang.Object
  extended by ilog.views.graphlayout.labellayout.IlvLabelLayoutReport
All Implemented Interfaces:
Serializable

public class IlvLabelLayoutReport
extends Object
implements Serializable

The base class of the objects used to store information about the behavior of the label layout algorithms.

The layout report is returned by the method IlvLabelLayout.performLayout(). It can be also obtained during the layout using the layout event listener mechanism.

Since:
JViews 5.0
See Also:
IlvLabelLayout, IlvLabelLayout.performLayout(), IlvLabelLayout.addLabelLayoutEventListener(LabelLayoutEventListener), LabelLayoutEvent, LabelLayoutEventListener, Serialized Form

Field Summary
static int EXCEPTION_DURING_LAYOUT
          An exception has been raised during layout.
static int GREATEST_CODE
          The largest integer value used as an error code.
static int INITIAL_CODE
          The initial value of the code.
static int LAYOUT_DONE
          The label layout was performed normally.
static int LAYOUT_FINISHED
          The layout was finished.
static int LAYOUT_STARTED
          The layout was started.
static int NO_LABELS
          The label layout was not performed because there are no labels.
static int NOT_NEEDED
          The label layout was not performed because there was no significant change in the manager since the last time the layout was performed successfully.
static int STOPPED_AND_INVALID
          The label layout was performed but stopped because either the layout time elapsed or IlvLabelLayout.stopImmediately() was called.
static int STOPPED_AND_VALID
          The label layout was performed but stopped because either the layout time elapsed or IlvLabelLayout.stopImmediately() was called.
 
Constructor Summary
protected IlvLabelLayoutReport()
          Creates a new instance of the report object.
 
Method Summary
 String codeToString(int code)
          Returns a message string (in English) corresponding to the code value that can be obtained by getCode().
 int getCode()
          Returns the code describing the current state of the layout algorithm.
 long getLayoutTime()
          Returns the total duration of the label layout algorithm (milliseconds).
 int getPercentageComplete()
          If the label layout algorithm supports the percentage completion feature, this method returns the current percentage of completion during layout.
 void setCode(int code)
          Sets the code for the current state of the label layout algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_CODE

public static final int INITIAL_CODE
The initial value of the code. The method getCode() returns this value if a different code was not set using setCode(int).

See Also:
Constant Field Values

NO_LABELS

public static final int NO_LABELS
The label layout was not performed because there are no labels.

See Also:
getCode(), Constant Field Values

NOT_NEEDED

public static final int NOT_NEEDED
The label layout was not performed because there was no significant change in the manager since the last time the layout was performed successfully. This normally means that there was no change of the contents (no label and no obstacle were added or removed), no change in position (no label and no obstacle were moved), and no change in parameter values.

See Also:
getCode(), Constant Field Values

LAYOUT_DONE

public static final int LAYOUT_DONE
The label layout was performed normally.

See Also:
getCode(), Constant Field Values

STOPPED_AND_VALID

public static final int STOPPED_AND_VALID
The label layout was performed but stopped because either the layout time elapsed or IlvLabelLayout.stopImmediately() was called. The result can be considered a valid layout. Iterative layout algorithms that can be stopped at any iteration set this result code if they do not run to completion (see IlvLabelLayout.supportsStopImmediately() and IlvLabelLayout.supportsAllowedTime()).

See Also:
getCode(), Constant Field Values

STOPPED_AND_INVALID

public static final int STOPPED_AND_INVALID
The label layout was performed but stopped because either the layout time elapsed or IlvLabelLayout.stopImmediately() was called. The result cannot be considered a valid layout. Noniterative layout algorithms set this result code if they do not run to completion (see IlvLabelLayout.supportsStopImmediately() and IlvLabelLayout.supportsAllowedTime()). The labels are either at intermediate positions (that is, the positions seem to be placed randomly) or have not changed at all, depending on the specific behavior of the layout algorithm.

See Also:
getCode(), Constant Field Values

LAYOUT_STARTED

public static final int LAYOUT_STARTED
The layout was started.

See Also:
getCode(), LabelLayoutEvent.isLayoutStarted(), Constant Field Values

LAYOUT_FINISHED

public static final int LAYOUT_FINISHED
The layout was finished.

See Also:
getCode(), LabelLayoutEvent.isLayoutStarted(), Constant Field Values

EXCEPTION_DURING_LAYOUT

public static final int EXCEPTION_DURING_LAYOUT
An exception has been raised during layout.

See Also:
getCode(), Constant Field Values

GREATEST_CODE

public static final int GREATEST_CODE
The largest integer value used as an error code. You can use the value GREATEST_CODE+1 for the definition of a new code.

See Also:
getCode(), Constant Field Values
Constructor Detail

IlvLabelLayoutReport

protected IlvLabelLayoutReport()
Creates a new instance of the report object. This is done by IlvLabelLayout.createLayoutReport().

Method Detail

getLayoutTime

public long getLayoutTime()
Returns the total duration of the label layout algorithm (milliseconds). The starting and ending times are automatically recorded. The total duration is the sum of the duration of the methods IlvLabelLayout.isLayoutNeeded() and IlvLabelLayout.layout(boolean).


getPercentageComplete

public int getPercentageComplete()
If the label layout algorithm supports the percentage completion feature, this method returns the current percentage of completion during layout. This value is set to 0 at the beginning of layout, increases during layout, and reaches 100 at the end of layout.

See Also:
IlvLabelLayout.supportsPercentageComplete(), IlvLabelLayout.increasePercentageComplete(int)

setCode

public void setCode(int code)
Sets the code for the current state of the label layout algorithm. The possible values are those defined in this class (LAYOUT_DONE, STOPPED_AND_VALID, NOT_NEEDED, and so on) or those defined in subclasses of IlvLabelLayoutReport. The codes are mutually exclusive. The last value specified using setCode(int) is returned by getCode().

Note that you should call this method only if you create your own layout class inside the implementation of IlvLabelLayout.layout(boolean). To obtain the layout report, use IlvLabelLayout.getLayoutReport().

See Also:
getCode()

getCode

public int getCode()
Returns the code describing the current state of the layout algorithm. The possible values are those defined in this class (LAYOUT_DONE, STOPPED_AND_VALID, NOT_NEEDED, and so on) or those defined in subclasses of IlvLabelLayoutReport.

Note that this method returns LAYOUT_STARTED if it is called inside the method LabelLayoutEventListener.layoutStepPerformed(LabelLayoutEvent) at the beginning of the layout process (except if the layout is not needed).

It returns LAYOUT_FINISHED if it is called inside the method LabelLayoutEventListener.layoutStepPerformed(LabelLayoutEvent) at the end of the layout process (except if the layout is not needed).

Whenever the code LAYOUT_STARTED is returned, the code LAYOUT_FINISHED will also be returned, even when an exception occurs during the layout process or the layout is stopped prematurely (by IlvLabelLayout.stopImmediately() or because the layout time elapsed).

See Also:
setCode(int), IlvLabelLayout.layout(boolean), IlvLabelLayout.supportsStopImmediately(), IlvLabelLayout.supportsAllowedTime(), LabelLayoutEvent.isLayoutStarted(), LabelLayoutEvent.isLayoutFinished()

codeToString

public String codeToString(int code)
Returns a message string (in English) corresponding to the code value that can be obtained by getCode(). Subclasses of IlvLabelLayoutReport can override and extend this method if they allow additional return values for getCode().

For example, the method returns the string "layout done" for the input code LAYOUT_DONE and the string "layout not needed" for the input code NOT_NEEDED.

See Also:
getCode()


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.