|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectch.epfl.craft.maglib.magnet.DefaultMagnetLayout
This class will layout the nodes on the MagnetView it controls.
It will choose the position of each node, and the which node is visible.
| Field Summary | |
protected java.awt.Rectangle |
boundsOfView
the bounds of the main view in which the layout has to be done |
protected boolean |
continueupdating
|
protected java.lang.Thread |
currentThread
the current thread |
protected java.util.ArrayList |
listeners
the listeners of the layout changes |
protected MagnetModel |
magnetModel
the model that we layout |
protected int |
numberOfVisibleNodes
the number of node that the layouter will set as visible |
| Constructor Summary | |
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 |
modelHasChanged()
Implementation of the MagnetModelListener interface. |
void |
removeListener(MagnetLayoutListener listener)
Removes a listener. |
void |
run()
Runs the layout algorithm. |
void |
setBounds(java.awt.Rectangle bounds)
Sets the bounds of the main view. |
void |
setMagnetModel(MagnetModel newMagnetModel)
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected MagnetModel magnetModel
protected java.util.ArrayList listeners
protected int numberOfVisibleNodes
protected java.lang.Thread currentThread
protected java.awt.Rectangle boundsOfView
protected boolean continueupdating
| Constructor Detail |
public DefaultMagnetLayout()
| Method Detail |
public void setMagnetModel(MagnetModel newMagnetModel)
setMagnetModel in interface MagnetLayoutnewMagnetModel - the model that will be updated by receiver.public void updatePositions(UpdateEvent event)
updatePositions in interface MagnetLayoutevent - the associated eventUpdateEventpublic void stopUpdatingPositions()
stopUpdatingPositions in interface MagnetLayoutrun()public void addListener(MagnetLayoutListener listener)
addListener in interface MagnetLayoutlistener - the listener object to addpublic void removeListener(MagnetLayoutListener listener)
removeListener in interface MagnetLayoutlistener - the listener object to removepublic void modelHasChanged()
MagnetModelListener interface. Called
when the model has changed
modelHasChanged in interface MagnetModelListenerpublic void setNumberOfVisibleNodes(int numberOfVisibleNodes)
setNumberOfVisibleNodes in interface MagnetLayoutnumberOfVisibleNodes - the number of visible nodes.public int getNumberOfVisibleNodes()
getNumberOfVisibleNodes in interface MagnetLayoutpublic void setBounds(java.awt.Rectangle bounds)
setBounds in interface MagnetLayoutpublic void run()
run in interface java.lang.Runnable
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||