cgl.narada.topology.viewer
Class NodeManagement

java.lang.Object
  extended by cgl.narada.topology.viewer.NodeManagement

public class NodeManagement
extends Object

This class encapsulates all the activities that happen on the nodes. It is responsible for addition of a new node, deletion of an existing node, addition of a link, deletion of a link, zooming, recentering, drawing whole picture on screen etc.


Field Summary
 List deletedNodes
           
static int INVALID_VALUE
           
 LinkManagement linkManagement
           
 VirtualNode virtualNode
           
 double ZOOM_IN_FACTOR
           
 double ZOOM_OUT_FACTOR
           
 
Constructor Summary
NodeManagement()
          Only constructor
 
Method Summary
 void addClientToNode(String nodeAddress, int clientId, String clientType)
           
 void addLink(String nodeAddress1, String nodeAddress2, int linkId, String linkType)
          Adds a single link into the system.
 void addNode(String nodeAddress)
          Adds a node into the system.
 void addTopicToClient(String nodeAddress, int clientId, String type)
           
 void deleteAllClients(String nodeAddress)
           
 void deleteAllTopicsFromNode(String nodeAddress, int clientId, String topic)
           
 void deleteClientFromNode(String nodeAddress, int clientId)
           
 void deleteLink(String nodeAddress1, String nodeAddress2, int linkId)
          Deletes a particular link from the system.
 void deleteNode(String nodeAddress)
          Deletes a node into the system.
 void deleteTopicFromClient(String nodeAddress, int clientId, String topic)
           
 void drawView()
          Draws the screen view.
 List getAllClientsForNode(Node n)
           
 String getCountInformation()
          Returns count information consisting of node counts and link count.
 Node getNodeAtParticularCoordinates(int x, int y)
          Returns Node object closest to specified coordinates.
 List getSnapShot(List allLinks)
           
 void recenter(int newCenterX, int newCenterY, int screenCenterX, int screenCenterY)
          Translates the view.
 void setGraphics(Graphics g)
           
 void setInitialPositions(int centerX, int centerY, int limitX1, int limitY1, int limitX2, int limitY2)
          Sets Initial positions for the view.
 void setZoomInFactor(int zoomInFactor)
          Sets ZOOM_IN_FACTOR
 void setZoomOutFactor(int zoomOutFactor)
          Sets ZOOM_OUT_FACTOR
 void zoomIn(int screenCenterX, int screenCenterY)
          zooms into the picture.
 void zoomOut(int screenCenterX, int screenCenterY)
          zooms out from the picture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INVALID_VALUE

public static int INVALID_VALUE

ZOOM_IN_FACTOR

public double ZOOM_IN_FACTOR

ZOOM_OUT_FACTOR

public double ZOOM_OUT_FACTOR

virtualNode

public VirtualNode virtualNode

linkManagement

public LinkManagement linkManagement

deletedNodes

public List deletedNodes
Constructor Detail

NodeManagement

public NodeManagement()
Only constructor

Method Detail

setInitialPositions

public void setInitialPositions(int centerX,
                                int centerY,
                                int limitX1,
                                int limitY1,
                                int limitX2,
                                int limitY2)
Sets Initial positions for the view.

Parameters:
centerX - X-coordinate of the center of the screen.
centerY - Y-coordinate of the center of the screen.
limitX1 - lower limit for X-coordinate
limitY1 - lower limit for Y-coordinate
limitX2 - upper limit for X-coordinate
limitY2 - upper limit for Y-coordinate

setGraphics

public void setGraphics(Graphics g)

addNode

public void addNode(String nodeAddress)
Adds a node into the system.

Parameters:
nodeAddress - String representation of the node address.

deleteNode

public void deleteNode(String nodeAddress)
Deletes a node into the system.

Parameters:
nodeAddress - String representation of the node address.

addLink

public void addLink(String nodeAddress1,
                    String nodeAddress2,
                    int linkId,
                    String linkType)
             throws TopologyException
Adds a single link into the system.

Parameters:
nodeAddress1 - address of one end node.
nodeAddress2 - address of other end node.
linkId - id of a link to be inserted.
linkType - String representing the link type.
Throws:
TopologyException - if one of the end nodes is absent while insertion

deleteLink

public void deleteLink(String nodeAddress1,
                       String nodeAddress2,
                       int linkId)
Deletes a particular link from the system.

Parameters:
nodeAddress1 - address of one end node.
nodeAddress2 - address of other end node.
linkId - id of a link to be deleted.

addClientToNode

public void addClientToNode(String nodeAddress,
                            int clientId,
                            String clientType)

deleteClientFromNode

public void deleteClientFromNode(String nodeAddress,
                                 int clientId)

deleteAllClients

public void deleteAllClients(String nodeAddress)

addTopicToClient

public void addTopicToClient(String nodeAddress,
                             int clientId,
                             String type)

deleteTopicFromClient

public void deleteTopicFromClient(String nodeAddress,
                                  int clientId,
                                  String topic)

deleteAllTopicsFromNode

public void deleteAllTopicsFromNode(String nodeAddress,
                                    int clientId,
                                    String topic)

getAllClientsForNode

public List getAllClientsForNode(Node n)

getCountInformation

public String getCountInformation()
Returns count information consisting of node counts and link count.

Returns:
String representing all the counts in system.

getSnapShot

public List getSnapShot(List allLinks)

getNodeAtParticularCoordinates

public Node getNodeAtParticularCoordinates(int x,
                                           int y)
Returns Node object closest to specified coordinates.

Parameters:
x - X-coordinate of mouse pointer.
y - Y-coordinate of mouse pointer.
Returns:
Node

drawView

public void drawView()
Draws the screen view. First draws all the nodes and then links.


setZoomInFactor

public void setZoomInFactor(int zoomInFactor)
Sets ZOOM_IN_FACTOR

Parameters:
zoomInFactor -

setZoomOutFactor

public void setZoomOutFactor(int zoomOutFactor)
Sets ZOOM_OUT_FACTOR

Parameters:
zoomOutFactor -

zoomIn

public void zoomIn(int screenCenterX,
                   int screenCenterY)
zooms into the picture. Modifies center and radius of virtualNode. Repositions all the components.

Parameters:
screenCenterX - X-coordinate of center of the screen.
screenCenterY - Y-coordinate of the center of the screen.

zoomOut

public void zoomOut(int screenCenterX,
                    int screenCenterY)
zooms out from the picture. Modifies center and radius of virtualNode. Repositions all the components.

Parameters:
screenCenterX - X-coordinate of center of the screen.
screenCenterY - Y-coordinate of the center of the screen.

recenter

public void recenter(int newCenterX,
                     int newCenterY,
                     int screenCenterX,
                     int screenCenterY)
Translates the view. New center becomes the location where mouse is clicked. It changes center of a virtualNode and repositions all the components in the system.

Parameters:
newCenterX - X-coordinate of a new center for the view.
newCenterY - Y-coordinate of a new center for the view.
screenCenterX - X-coordinate of a screen center.
screenCenterY - Y-coordinate of a screen center.


For comments and suggestions please send e-mail to The NaradaBrokering Project