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
-
EAST
- Constant for use with label orientation
-
NORTH
- Constant for use with label orientation
-
NORTHEAST
- Constant for use with label orientation
-
NORTHWEST
- Constant for use with label orientation
-
SOUTH
- Constant for use with label orientation
-
SOUTHEAST
- Constant for use with label orientation
-
SOUTHWEST
- Constant for use with label orientation
-
WEST
- Constant for use with label orientation
-
Node(String, Monitorable)
- A new Node to represent a Monitorable object.
-
Node(String, Monitorable, int)
- A new Node to represent a Monitorable object.
-
Node(String, Monitorable, Point)
- A new Node to represent a Monitorable object.
-
addComment(String, int)
- Give the Node a status string for the visualisation step 'index'.
-
addDisplayMonitor(DisplayMonitor)
-
-
contains(int, int)
- Return whether this object contains the point (x,y)
-
getContextString()
- Returns the current status message of this
Node.
-
getName()
-
-
getPosition()
-
-
getRadius()
-
-
getType()
- Returns the type of Monitorable object this Node represents
-
hostName(String)
- Get the host name from the given RMI name.
-
mousePressedHasEffect(int, int)
- If a mouse press at (x,y) has an effect on this Node-- i.e.
-
mouseReleasedHasEffect(int, int)
- If a mouse releas at (x,y) has an effect on this Node-- i.e.
-
paint(Graphics)
- Display this Node on the graphics context.
-
setBounds(Rectangle)
-
-
setContainerSize(Dimension)
-
-
setCurrentIndex(int)
- Set the current index, so this object knows which status string is
currently relevant at this visualisation step -- if there is one.
-
setLabel(String)
-
-
setLabelOrientation(int)
- Set the orientation of the label with respect to the Node.
-
setPosition(int, int)
-
-
setPosition(Point)
-
-
simpleName(String)
- Get the simple 'agent' name from the given RMI name
-
tidyUp()
-
-
toString()
-
-
unpaint(Graphics)
-
NORTH
public static final int NORTH
- Constant for use with label orientation
- See Also:
- setLabelOrientation
NORTHEAST
public static final int NORTHEAST
- Constant for use with label orientation
- See Also:
- setLabelOrientation
EAST
public static final int EAST
- Constant for use with label orientation
- See Also:
- setLabelOrientation
SOUTHEAST
public static final int SOUTHEAST
- Constant for use with label orientation
- See Also:
- setLabelOrientation
SOUTH
public static final int SOUTH
- Constant for use with label orientation
- See Also:
- setLabelOrientation
SOUTHWEST
public static final int SOUTHWEST
- Constant for use with label orientation
- See Also:
- setLabelOrientation
WEST
public static final int WEST
- Constant for use with label orientation
- See Also:
- setLabelOrientation
NORTHWEST
public static final int NORTHWEST
- Constant for use with label orientation
- See Also:
- setLabelOrientation
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
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
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
unpaint
public void unpaint(Graphics g)
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
getContextString
public String getContextString()
- Returns the current status message of this
Node.
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.
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
hostName
public static String hostName(String rminame)
- Get the host name from the given RMI name.
simpleName
public static String simpleName(String rminame)
- Get the simple 'agent' name from the given RMI name
setContainerSize
public void setContainerSize(Dimension d)
- See Also:
- DisplayEvent
tidyUp
public void tidyUp()
- See Also:
- DisplayEvent
addDisplayMonitor
public void addDisplayMonitor(DisplayMonitor dm)
- See Also:
- DisplayEvent
contains
public boolean contains(int x,
int y)
- Return whether this object contains the point (x,y)
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
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
getPosition
public Point getPosition()
getName
public String getName()
getType
public int getType()
- Returns the type of Monitorable object this Node represents
- See Also:
- BROKER
getRadius
public int getRadius()
setBounds
public void setBounds(Rectangle r)
setPosition
public void setPosition(Point newpos)
setPosition
public void setPosition(int x,
int y)
setLabel
public void setLabel(String str)
setLabelOrientation
public void setLabelOrientation(int ori)
- Set the orientation of the label with respect to the Node.
- See Also:
- NORTH
toString
public String toString()
- Overrides:
- toString in class Object
All Packages Class Hierarchy This Package Previous Next Index