info.aduna.linkmap.layout
Class IteratingLayoutManager

java.lang.Object
  extended by info.aduna.linkmap.layout.GraphLayoutManager
      extended by info.aduna.linkmap.layout.IteratingLayoutManager
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
SpringLayoutManager

public abstract class IteratingLayoutManager
extends GraphLayoutManager

An IteratingLayoutManager is an abstract GraphLayoutManager that provides facilities for concrete GraphLayoutManagers that need to iterate a lot when calculating a layout. These facilities include:


Field Summary
static int UNDEFINED_MAX_ITERATION
          Used to indicate that there is no maximum number of iterations that are allowed to be performed.
 
Constructor Summary
IteratingLayoutManager()
          Inherit comment.
 
Method Summary
 void continueLayout()
          Sets the _pauseLayout attribute to 'false' and notifies all objects waiting on this object.
 int getIteration()
           
 int getMaxIteration()
           
 void handlePauseLayout()
          Utility method that takes care of all complexity related to pausing and continuing the layout algorithm.
 void increaseIteration()
           
 boolean isMaxIterationReached()
          Returns true when a maximum number of iterations has been set and the current iteration number is greater than or equal to this maximum.
 void pauseLayout()
          Sets the _pauseLayout attribute to 'true', which should cause the IteratingLayoutManager to pause real soon.
 boolean pauseLayoutRequested()
          Returns the state of the _pauseLayout attribute.
 void setIteration(int iteration)
           
 void setMaxIteration(int maxIteration)
          Adapt the maximum number of iterations this IteratingLayoutManager is allowed to perform within one doLayout invocation, and notify all IteratingLayoutListeners.
 void setPauseLayout(boolean pauseLayout)
           
 void setStopLayout(boolean stopLayout)
           
 void stopLayout()
          Sets the _pauseLayout and _stopLayout attributes to 'false' and 'true' respectively, and notifies all objects waiting on this object.
 boolean stopLayoutRequested()
          Returns the state of the _stopLayout attribute.
 
Methods inherited from class info.aduna.linkmap.layout.GraphLayoutManager
createLayoutConverter, doLayout, getGraph, initialize, run, setGraph
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNDEFINED_MAX_ITERATION

public static final int UNDEFINED_MAX_ITERATION
Used to indicate that there is no maximum number of iterations that are allowed to be performed.

See Also:
Constant Field Values
Constructor Detail

IteratingLayoutManager

public IteratingLayoutManager()
Inherit comment.

Method Detail

setMaxIteration

public void setMaxIteration(int maxIteration)
Adapt the maximum number of iterations this IteratingLayoutManager is allowed to perform within one doLayout invocation, and notify all IteratingLayoutListeners.


getMaxIteration

public int getMaxIteration()

setIteration

public void setIteration(int iteration)

getIteration

public int getIteration()

increaseIteration

public void increaseIteration()

isMaxIterationReached

public boolean isMaxIterationReached()
Returns true when a maximum number of iterations has been set and the current iteration number is greater than or equal to this maximum.


pauseLayout

public void pauseLayout()
Sets the _pauseLayout attribute to 'true', which should cause the IteratingLayoutManager to pause real soon. When exactly this will happen depends on the implementation of doLayout.


continueLayout

public void continueLayout()
Sets the _pauseLayout attribute to 'false' and notifies all objects waiting on this object. If the IteratingLayoutManager was currently paused during the execution of the layout algorithm, it should catch this signal and continue its work. If the doLayout method periodically invokes the _handlePauseLayout method, this will all be done automatically.


stopLayout

public void stopLayout()
Sets the _pauseLayout and _stopLayout attributes to 'false' and 'true' respectively, and notifies all objects waiting on this object. The latter action is needed for IteratingLayoutManagers which are currently paused: this allows them to stop their actions gracefully.


setStopLayout

public void setStopLayout(boolean stopLayout)

setPauseLayout

public void setPauseLayout(boolean pauseLayout)

pauseLayoutRequested

public boolean pauseLayoutRequested()
Returns the state of the _pauseLayout attribute.


stopLayoutRequested

public boolean stopLayoutRequested()
Returns the state of the _stopLayout attribute.


handlePauseLayout

public void handlePauseLayout()
Utility method that takes care of all complexity related to pausing and continuing the layout algorithm. This method checks whether a "pause layout" was requested and, if so, waits until a "continue layout" signal is received. It also sends the appropriate events when doing so.

This method does not send a "continuation event" when it gets out of a wait state and the _stopLayout attribute is set.



Copyright © 1997-2008 Aduna. All Rights Reserved.