ch.epfl.craft.maglib.magnet
Interface MagnetModel

All Known Implementing Classes:
DefaultMagnetModel

public interface MagnetModel

Model that will manage the collection of MagnetNode instances

Version:
1.0
Author:
Jerome Caffaro
See Also:
MagnetNode

Method Summary
 void addListener(MagnetModelListener listener)
          Adds a listener that will be notified when the model has changed.
 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.
 void clearMagneticNodes()
          Resets all magnetic nodes.
 void clearVisibleNodes()
          Resets all visible nodes: none (except magnetic nodes) will be drawn on screen.
 boolean getIsMagneticNode(MagnetNode aNode)
          Returns true if the node is magnetic, else false
 boolean getIsSelectedNode(MagnetNode aNode)
          Returns true if the node is selected, else false
 boolean getIsVisibleNode(MagnetNode aMagnetNode)
          Returns true if aMagnetNode is visible, else false.
 java.util.Collection getMagneticNodes()
          Returns all magnetic nodes.
 java.util.Collection getMagnetNodes()
          Returns all the nodes in the model
 java.util.Collection getSelectedNodes()
          Returns all selected nodes.
 java.util.Collection getVisibleMagnetNodes()
          Returns all visible nodes in the model
 java.util.Collection getVisibleMagnetNodesInRect(java.awt.Rectangle aRectangle)
          Returns the nodes whoose origin is in a aRectangle
 void removeListener(MagnetModelListener listener)
          Removes a listener.
 void removeMagnetNode(MagnetNode aMagnetNode)
          Removes a MagnetNode instance from this model.
 void reset()
          Resets the model.
 void setIsMagneticNode(MagnetNode aNode, boolean aBoolean)
          Sets the node as magnetic if aBoolean is true, else set it as non magnetic.
 void setIsSelectedNode(MagnetNode aNode, boolean aBoolean)
          Sets the node as selected if aBoolean is true, else set it as not selected.
 void setIsVisibleNode(MagnetNode aNode, boolean aBoolean)
          Sets the node as visible or invisible in the view if aBoolean is true or false;
 

Method Detail

addMagnetNode

public void addMagnetNode(MagnetNode newMagnetNode)
Adds a MagnetNode instance to this model Nothing happens if aMagnetNode is null or already exists in the model.

Parameters:
newMagnetNode - the node to add to the model

addMagnetNodes

public 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. This does not affect other nodes.

Parameters:
newMagnetNodes - the nodes to add to the model

removeMagnetNode

public void removeMagnetNode(MagnetNode aMagnetNode)
Removes a MagnetNode instance from this model. Nothing happens if aMagnetNode is null or does not exist in the model.

Parameters:
aMagnetNode - the node to remove from the model

getMagnetNodes

public java.util.Collection getMagnetNodes()
Returns all the nodes in the model

Returns:
all the nodes of the model

getVisibleMagnetNodes

public java.util.Collection getVisibleMagnetNodes()
Returns all visible nodes in the model

Returns:
the visible nodes of the model

getIsVisibleNode

public boolean getIsVisibleNode(MagnetNode aMagnetNode)
Returns true if aMagnetNode is visible, else false.

Returns:
true if aMagnetNode is visible, else false.

setIsVisibleNode

public void setIsVisibleNode(MagnetNode aNode,
                             boolean aBoolean)
Sets the node as visible or invisible in the view if aBoolean is true or false;

Parameters:
aNode - the node to set visible/invisible
aBoolean - true if aMagnetNode has to be visible, else false.

clearVisibleNodes

public void clearVisibleNodes()
Resets all visible nodes: none (except magnetic nodes) will be drawn on screen.


clearMagneticNodes

public void clearMagneticNodes()
Resets all magnetic nodes.


getVisibleMagnetNodesInRect

public java.util.Collection getVisibleMagnetNodesInRect(java.awt.Rectangle aRectangle)
Returns the nodes whoose origin is in a aRectangle

Parameters:
aRectangle - a rectangle in the MagnetView coordinates
Returns:
the nodes inside the bounds of aRectangle

getIsMagneticNode

public boolean getIsMagneticNode(MagnetNode aNode)
Returns true if the node is magnetic, else false

Parameters:
aNode - the node to check if it is magnetic.
Returns:
true if the node is magnetic, else false

setIsMagneticNode

public void setIsMagneticNode(MagnetNode aNode,
                              boolean aBoolean)
Sets the node as magnetic if aBoolean is true, else set it as non magnetic.

Parameters:
aNode - the node to make magnetic/non-magnetic
aBoolean - true to make the node magnetic, else false

getMagneticNodes

public java.util.Collection getMagneticNodes()
Returns all magnetic nodes.

Returns:
all magnetic nodes

getIsSelectedNode

public boolean getIsSelectedNode(MagnetNode aNode)
Returns true if the node is selected, else false

Parameters:
aNode - the node to check if it is selected.
Returns:
true if the node is selected, else false

setIsSelectedNode

public void setIsSelectedNode(MagnetNode aNode,
                              boolean aBoolean)
Sets the node as selected if aBoolean is true, else set it as not selected.

Parameters:
aNode - the node to select/deselect
aBoolean - true to make the node selected, else false

getSelectedNodes

public java.util.Collection getSelectedNodes()
Returns all selected nodes.

Returns:
all selected nodes

addListener

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

Parameters:
listener - the listener object to add

removeListener

public void removeListener(MagnetModelListener listener)
Removes a listener.

Parameters:
listener - the listener object to remove

reset

public void reset()
Resets the model.



Copyright © CRAFT EPFL. All Rights Reserved.