All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class kraft.monitor.display.Node

java.lang.Object
   |
   +----kraft.monitor.display.Node

public class Node
extends Object
implements DisplayEvent
The graphical representation of a Monitorable agent in the visualisation tool.

Will draw the agent as a red circle with the agent's name nearby it -- the orientation of the label with respect to the circle can be changed.

This object will also store a set of status strings which are relevant at particular steps in the visualisation -- calling setCurrentIndex will determine which status string is relevant at that point.

If there is a relevant status string, the node's colour will be set to green.
Mouse clicks on the object (via calls to MousePressedHasEffect and MouseReleasedHasEffect ) will cause the currently relevant status string to be shown when the object is repainted.

Author:
Ted Francis
See Also:
setCurrentIndex, Monitorable

Variable Index

 o EAST
Constant for use with label orientation
 o NORTH
Constant for use with label orientation
 o NORTHEAST
Constant for use with label orientation
 o NORTHWEST
Constant for use with label orientation
 o SOUTH
Constant for use with label orientation
 o SOUTHEAST
Constant for use with label orientation
 o SOUTHWEST
Constant for use with label orientation
 o WEST
Constant for use with label orientation

Constructor Index

 o Node(String, Monitorable)
A new Node to represent a Monitorable object.
 o Node(String, Monitorable, int)
A new Node to represent a Monitorable object.
 o Node(String, Monitorable, Point)
A new Node to represent a Monitorable object.

Method Index

 o addComment(String, int)
Give the Node a status string for the visualisation step 'index'.
 o addDisplayMonitor(DisplayMonitor)
 o contains(int, int)
Return whether this object contains the point (x,y)
 o getContextString()
Returns the current status message of this Node.
 o getName()
 o getPosition()
 o getRadius()
 o getType()
Returns the type of Monitorable object this Node represents
 o hostName(String)
Get the host name from the given RMI name.
 o mousePressedHasEffect(int, int)
If a mouse press at (x,y) has an effect on this Node-- i.e.
 o mouseReleasedHasEffect(int, int)
If a mouse releas at (x,y) has an effect on this Node-- i.e.
 o paint(Graphics)
Display this Node on the graphics context.
 o setBounds(Rectangle)
 o setContainerSize(Dimension)
 o setCurrentIndex(int)
Set the current index, so this object knows which status string is currently relevant at this visualisation step -- if there is one.
 o setLabel(String)
 o setLabelOrientation(int)
Set the orientation of the label with respect to the Node.
 o setPosition(int, int)
 o setPosition(Point)
 o simpleName(String)
Get the simple 'agent' name from the given RMI name
 o tidyUp()
 o toString()
 o unpaint(Graphics)

Variables

 o NORTH
 public static final int NORTH
Constant for use with label orientation

See Also:
setLabelOrientation
 o NORTHEAST
 public static final int NORTHEAST
Constant for use with label orientation

See Also:
setLabelOrientation
 o EAST
 public static final int EAST
Constant for use with label orientation

See Also:
setLabelOrientation
 o SOUTHEAST
 public static final int SOUTHEAST
Constant for use with label orientation

See Also:
setLabelOrientation
 o SOUTH
 public static final int SOUTH
Constant for use with label orientation

See Also:
setLabelOrientation
 o SOUTHWEST
 public static final int SOUTHWEST
Constant for use with label orientation

See Also:
setLabelOrientation
 o WEST
 public static final int WEST
Constant for use with label orientation

See Also:
setLabelOrientation
 o NORTHWEST
 public static final int NORTHWEST
Constant for use with label orientation

See Also:
setLabelOrientation

Constructors

 o Node
 public Node(String name,
             Monitorable obj,
             int type)
A new Node to represent a Monitorable object.

Parameters:
name - the label for the Node
obj - the monitorable object this Node represents grahically
type - the Monitorable type of 'obj'
See Also:
Monitorable
 o Node
 public Node(String name,
             Monitorable obj)
A new Node to represent a Monitorable object.

Parameters:
name - the label for the Node
obj - the monitorable object this Node represents grahically
 o Node
 Node(String name,
      Monitorable obj,
      Point pos)
A new Node to represent a Monitorable object.

Parameters:
name - the label for the Node
obj - the monitorable object this Node represents grahically
pos - the initial position of the Node
See Also:
Monitorable

Methods

 o unpaint
 public void unpaint(Graphics g)
 o paint
 public void paint(Graphics g)
Display this Node on the graphics context. Set colour and display status string depending on the current index number we are at (ie. the visualisation step)

See Also:
setCurrentIndex
 o getContextString
 public String getContextString()
Returns the current status message of this Node.

 o setCurrentIndex
 public void setCurrentIndex(int ix)
Set the current index, so this object knows which status string is currently relevant at this visualisation step -- if there is one.

 o addComment
 public void addComment(String comment,
                        int index)
Give the Node a status string for the visualisation step 'index'. Will be displayed when setCurrentIndex(index) is called

 o hostName
 public static String hostName(String rminame)
Get the host name from the given RMI name.

 o simpleName
 public static String simpleName(String rminame)
Get the simple 'agent' name from the given RMI name

 o setContainerSize
 public void setContainerSize(Dimension d)
See Also:
DisplayEvent
 o tidyUp
 public void tidyUp()
See Also:
DisplayEvent
 o addDisplayMonitor
 public void addDisplayMonitor(DisplayMonitor dm)
See Also:
DisplayEvent
 o contains
 public boolean contains(int x,
                         int y)
Return whether this object contains the point (x,y)

 o mousePressedHasEffect
 public boolean mousePressedHasEffect(int x,
                                      int y)
If a mouse press at (x,y) has an effect on this Node-- i.e. there is a relevant status string that can be popped up

 o mouseReleasedHasEffect
 public boolean mouseReleasedHasEffect(int x,
                                       int y)
If a mouse releas at (x,y) has an effect on this Node-- i.e. there is a relevant status string that can be popped down

 o getPosition
 public Point getPosition()
 o getName
 public String getName()
 o getType
 public int getType()
Returns the type of Monitorable object this Node represents

See Also:
BROKER
 o getRadius
 public int getRadius()
 o setBounds
 public void setBounds(Rectangle r)
 o setPosition
 public void setPosition(Point newpos)
 o setPosition
 public void setPosition(int x,
                         int y)
 o setLabel
 public void setLabel(String str)
 o setLabelOrientation
 public void setLabelOrientation(int ori)
Set the orientation of the label with respect to the Node.

See Also:
NORTH
 o toString
 public String toString()
Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index