|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectch.epfl.craft.maglib.magnet.DefaultMagnetModel
ch.epfl.craft.magmap.magnet.MagMapMagnetModel
Manages the nodes. Knows who is selected, magnetic or visible.
Terminology: We make no difference between a node or a MagnetNode,
they are the same. Everything that is handled by this class is a MagnetNode. However
not every MagnetNode is magnetic, only those that attracts or repulse
other nodes.
We also use this class as model for the JList instance in MagMap.
This means that we have to implement a way to filter node based on a string, as
the MagMap application offers this feature. This is done thanks to
GlazedGists
For peformance reason(to be verified), we maintain two lists of nodes,
one in the superclass which is a basic ArrayList, fast to iterate, and we also
have a BasicEventList that is needed for the livesearch implementation
| Field Summary |
| Fields inherited from class ch.epfl.craft.maglib.magnet.DefaultMagnetModel |
allNodes, listeners, magneticNodes, selectedNodes, visibleNodes |
| Constructor Summary | |
MagMapMagnetModel()
Constructs a MagMapMagnetModel instance and initialize
the internal model. |
|
| Method Summary | |
void |
addMagnetNode(MagnetNode newMagnetNode)
Adds a MagnetNode instance to this model
Nothing happens if aMagnetNode is null or already exists in the model.
|
void |
addMagnetNodes(MagnetNode[] newMagnetNodes)
Adds MagnetNode instances to this model
If a node is null or already exists in the model, it is not added to the model.
|
BasicEventList |
getEventList()
Returns the list that contains all node. |
void |
removeMagnetNode(MagnetNode aMagnetNode)
Removes a MagnetNode instance from this model.
|
void |
reset()
Resets the model. |
| Methods inherited from class ch.epfl.craft.maglib.magnet.DefaultMagnetModel |
addListener, clearMagneticNodes, clearVisibleNodes, getIsMagneticNode, getIsSelectedNode, getIsVisibleNode, getMagneticNodes, getMagnetNodes, getSelectedNodes, getSimilarNodes, getVisibleMagnetNodes, getVisibleMagnetNodesInRect, removeListener, setIsMagneticNode, setIsSelectedNode, setIsVisibleNode |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public MagMapMagnetModel()
MagMapMagnetModel instance and initialize
the internal model.
| Method Detail |
public BasicEventList getEventList()
public void addMagnetNode(MagnetNode newMagnetNode)
MagnetNode instance to this model
Nothing happens if aMagnetNode is null or already exists in the model.
This overrides the method from the superclass because we need to add the
new node to the secondary internal BasicEventList of nodes
addMagnetNode in interface MagnetModeladdMagnetNode in class DefaultMagnetModelnewMagnetNode - the node to add to the modelpublic void addMagnetNodes(MagnetNode[] newMagnetNodes)
MagnetNode instances to this model
If a node is null or already exists in the model, it is not added to the model.
This does not affect other nodes.
This overrides the method from the superclass because we need to add the
new nodes to the secondary internal BasicEventList of nodes
addMagnetNodes in interface MagnetModeladdMagnetNodes in class DefaultMagnetModelnewMagnetNodes - the nodes to add to the modelpublic void removeMagnetNode(MagnetNode aMagnetNode)
MagnetNode instance from this model.
Nothing happens if aMagnetNode is null or does not exist in the model.
This overrides the method from the superclass because we need to remove the
node from the secondary internal BasicEventList of nodes
removeMagnetNode in interface MagnetModelremoveMagnetNode in class DefaultMagnetModelaMagnetNode - the node to remove from the modelpublic void reset()
reset in interface MagnetModelreset in class DefaultMagnetModel
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||