com.jgraph.layout

Class JGraphLayoutProgress

public class JGraphLayoutProgress extends Object

Describes the state of a long-running layout. The UI can listen to property changes to inform the user of the layout progress, and it can set the isStopped property to signal the layout to terminate.
Field Summary
protected PropertyChangeSupportchangeSupport
Property change support is delegated to this class.
protected booleanisStopped
Specifies whether the layout was stopped in the user interface.
static StringISSTOPPED_PROPERTY
Bound property name for isStopped.
protected intmaximum
Specifies the maximum progress, for example 100%.
static StringMAXIMUM_PROPERTY
Bound property name for maximum.
protected intprogress
Specifies the current progress.
static StringPROGRESS_PROPERTY
Bound property name for progress.
Constructor Summary
JGraphLayoutProgress()
Constructs a new layout progress with a maximum progress of 0.
JGraphLayoutProgress(int maximum)
Constructs a new layout progress for the specified maximum progress.
Method Summary
voidaddPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener.
PropertyChangeSupportgetChangeSupport()
intgetMaximum()
intgetProgress()
booleanisStopped()
Stoppable layouts should check this within their inner-most loops and return immediately if this returns true.
voidremovePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.
voidreset(int maximum)
Resets the progress to 0 and sets isStopped to false.
voidsetChangeSupport(PropertyChangeSupport changeSupport)
voidsetMaximum(int maximum)
Sets the maximum progress of the layout.
voidsetProgress(int progress)
Sets the current progress of the layout.
voidsetStopped(boolean isStopped)
Signals the layout to stop running.

Field Detail

changeSupport

protected PropertyChangeSupport changeSupport
Property change support is delegated to this class.

isStopped

protected boolean isStopped
Specifies whether the layout was stopped in the user interface.

ISSTOPPED_PROPERTY

public static final String ISSTOPPED_PROPERTY
Bound property name for isStopped.

maximum

protected int maximum
Specifies the maximum progress, for example 100%.

MAXIMUM_PROPERTY

public static final String MAXIMUM_PROPERTY
Bound property name for maximum.

progress

protected int progress
Specifies the current progress.

PROGRESS_PROPERTY

public static final String PROGRESS_PROPERTY
Bound property name for progress.

Constructor Detail

JGraphLayoutProgress

public JGraphLayoutProgress()
Constructs a new layout progress with a maximum progress of 0.

JGraphLayoutProgress

public JGraphLayoutProgress(int maximum)
Constructs a new layout progress for the specified maximum progress.

Parameters: maximum

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a property change listener.

Parameters: listener

getChangeSupport

public PropertyChangeSupport getChangeSupport()

Returns: Returns the changeSupport.

getMaximum

public int getMaximum()

Returns: Returns the maximum progress.

getProgress

public int getProgress()

Returns: Returns the progress.

isStopped

public boolean isStopped()
Stoppable layouts should check this within their inner-most loops and return immediately if this returns true.

Returns: Returns true if the layout should terminate.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a property change listener.

Parameters: listener

reset

public void reset(int maximum)
Resets the progress to 0 and sets isStopped to false.

setChangeSupport

public void setChangeSupport(PropertyChangeSupport changeSupport)

Parameters: changeSupport The changeSupport to set.

setMaximum

public void setMaximum(int maximum)
Sets the maximum progress of the layout. This should be set at construction time only.

Fires a property change for the MAXIMUM_PROPERTY.

Parameters: maximum The maximum to set.

setProgress

public void setProgress(int progress)
Sets the current progress of the layout.

Fires a property change for the PROGRESS_PROPERTY.

Parameters: progress The progress to set.

setStopped

public void setStopped(boolean isStopped)
Signals the layout to stop running.

Fires a property change for the ISSTOPPED_PROPERTY.

Parameters: isStopped Whether the layout should stop.

Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.