ch.epfl.craft.maglib.magnet
Interface MagnetLayout

All Known Implementing Classes:
CentralMagnetLayout, DefaultMagnetLayout

public interface MagnetLayout

A class that implements this interface will typically simply encapsulate a layout algorithm. This class will be used by MagnetView with the setMagnetLayout method. If no MagnetLayout is set for a MagnetView, a default one is used.

Version:
$version: 1.0$
Author:
Jerome Caffaro
See Also:
MagnetView, DefaultMagnetLayout

Method Summary
 void addListener(MagnetLayoutListener listener)
          Adds a listener that will be notified when the layout has changed.
 int getNumberOfVisibleNodes()
          Returns the number of nodes simulatenously drawn by the view that this layouter controls.
 void removeListener(MagnetLayoutListener listener)
          Removes a listener.
 void setBounds(java.awt.Rectangle bounds)
          Sets the bounds of the main view.
 void setMagnetModel(MagnetModel newModel)
          Set the model that the layout is in charge of updating.
 void setNumberOfVisibleNodes(int numberOfVisibleNodes)
          Sets the number of visible nodes drawn by the view that this layouter controls
 void stopUpdatingPositions()
          Tells the receiver to stop updating the nodes positions in the model.
 void updatePositions(UpdateEvent event)
          Tells the receiver to update the nodes positions in the model.
 

Method Detail

setMagnetModel

public void setMagnetModel(MagnetModel newModel)
Set the model that the layout is in charge of updating.

Parameters:
newModel - the model that will be updated by receiver.

updatePositions

public void updatePositions(UpdateEvent event)
Tells the receiver to update the nodes positions in the model. If model is null, does not do anything. The algorithm will begin updating the positions of the nodes, and stop only when the positions satisfy its constraints. The algorithm can also be stopped with the stopUpdatingPositions() method.

Parameters:
event - the associated event
See Also:
UpdateEvent

stopUpdatingPositions

public void stopUpdatingPositions()
Tells the receiver to stop updating the nodes positions in the model. If model is null, does not do anything.


addListener

public void addListener(MagnetLayoutListener listener)
Adds a listener that will be notified when the layout has changed.

Parameters:
listener - the listener object to add

removeListener

public void removeListener(MagnetLayoutListener listener)
Removes a listener.

Parameters:
listener - the listener object to remove

setNumberOfVisibleNodes

public void setNumberOfVisibleNodes(int numberOfVisibleNodes)
Sets the number of visible nodes drawn by the view that this layouter controls

Parameters:
numberOfVisibleNodes - the number of visible nodes.

getNumberOfVisibleNodes

public int getNumberOfVisibleNodes()
Returns the number of nodes simulatenously drawn by the view that this layouter controls.

Returns:
the number of visible nodes

setBounds

public void setBounds(java.awt.Rectangle bounds)
Sets the bounds of the main view. The algorithm can then be optimized for this rectangle



Copyright © CRAFT EPFL. All Rights Reserved.