Class JGraphLayoutProgress
java.lang.Object
com.jgraph.layout.JGraphLayoutProgress
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
FieldsModifier and TypeFieldDescriptionprotected PropertyChangeSupportProperty change support is delegated to this class.protected booleanSpecifies whether the layout was stopped in the user interface.static final StringBound property name forisStopped.protected intSpecifies the maximum progress, for example 100%.static final StringBound property name formaximum.protected intSpecifies the current progress.static final StringBound property name forprogress. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs 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
Modifier and TypeMethodDescriptionvoidAdds a property change listener.intintbooleanStoppable layouts should check this within their inner-most loops and return immediately if this returns true.voidRemoves a property change listener.voidreset(int maximum) Resets the progress to 0 and sets isStopped tofalse.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 Details
-
MAXIMUM_PROPERTY
-
PROGRESS_PROPERTY
-
ISSTOPPED_PROPERTY
-
changeSupport
Property change support is delegated to this class. -
maximum
protected int maximumSpecifies the maximum progress, for example 100%. -
progress
protected int progressSpecifies the current progress. -
isStopped
protected boolean isStoppedSpecifies whether the layout was stopped in the user interface.
-
-
Constructor Details
-
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 Details
-
reset
public void reset(int maximum) Resets the progress to 0 and sets isStopped tofalse. -
getChangeSupport
- Returns:
- Returns the changeSupport.
-
setChangeSupport
- Parameters:
changeSupport- The changeSupport to set.
-
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.
-
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.
-
getMaximum
public int getMaximum()- Returns:
- Returns the maximum progress.
-
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.
-
getProgress
public int getProgress()- Returns:
- Returns the progress.
-
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.
-
addPropertyChangeListener
Adds a property change listener.- Parameters:
listener-
-
removePropertyChangeListener
Removes a property change listener.- Parameters:
listener-
-