All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class kraft.monitor.display.Area

java.lang.Object
   |
   +----java.awt.Rectangle
           |
           +----kraft.monitor.display.Area

public class Area
extends Rectangle
Defines a rectangular area which contains a number of Nodes.

The MonitorCanvas will own several of these objects, each to represent different areas of the canvas.

An Area has a type associated with it, corresonding to the type of 'agents' it displays. All Nodes in the Area will have this same type (any of the types in the Monitorable interface).

The Area can lay out the Nodes it contains in different ways: a horizontal line, a vertical line, or a circle. It keeps the Nodes correctly laid out as they are added to and removed from the Area.
The area initialises with a default layout based on its type, but this can be changed using setNodeLayout.

Author:
Ted Francis
See Also:
setNodeLayout, Node, MonitorCanvas, Monitorable

Variable Index

 o CIRCLE
Constant used to adjust the Node layout rule used.
 o H_SPACE
The minimum amount of space between adjacent Nodes in this Area and the position of the nearest Node (defaults to 15 pixels)
 o HORIZ_LINE
Constant used to adjust the Node layout rule used.
 o V_SPACE
The minimum amount of space between adjacent Nodes in this Area and the position of the nearest Node (defaults to 15 pixels)
 o VERT_LINE
Constant used to adjust the Node layout rule used.

Constructor Index

 o Area(int)
Start the new Area with the given type of Nodes it should display Type should be any type in the Monitorable interface.
 o Area(int, int, int, int, int)
Start the new Area with the given type, position, and dimensions.

Method Index

 o add(Node)
Adds a Node to this Area, it applies the default labelOrientation to the Node for this type of Area.
 o add(Node, int)
Adds a Node to this Area with the orientation specified.
 o adjustBounds(double, double)
Adjust the dimensions of this area by the given scaling factor.
 o getBackground()
 o getMinimumSize()
 o hasNodes()
 o mousePressedHasEffect(int, int)
Determine whether a mouse press at (x,y) has an effect on any of the Nodes in this Area.
 o mouseReleasedHasEffect(int, int)
Determine whether a mouse released at (x,y) has an effect on any of the Nodes in this Area.
 o paint(Graphics)
Paint the nodes in this area onto the given graphics context
 o remove(Node)
Remove the Node from this area and adjust positions of remaining Nodes to compensate
 o setBackground(Color)
 o setBounds(int, int, int, int)
 o setBounds(Rectangle)
 o setContainerSize(Dimension)
Set the maximum size for all the Nodes in this Area
 o setGraphics(Graphics)
Set the graphics context for drawing onto
 o setLabelOrientation(int)
Set the default label orientation for all newly added Nodes in this Area.
 o setLocation(int, int)
 o setLocation(Point)
 o setNodeLayout(int)
Set the layout rule for the Nodes in this Area.
 o setSize(Dimension)
 o setSize(int, int)
 o toString()

Variables

 o V_SPACE
 public static int V_SPACE
The minimum amount of space between adjacent Nodes in this Area and the position of the nearest Node (defaults to 15 pixels)

 o H_SPACE
 public static int H_SPACE
The minimum amount of space between adjacent Nodes in this Area and the position of the nearest Node (defaults to 15 pixels)

 o HORIZ_LINE
 public static final int HORIZ_LINE
Constant used to adjust the Node layout rule used.

See Also:
setNodeLayout
 o VERT_LINE
 public static final int VERT_LINE
Constant used to adjust the Node layout rule used.

See Also:
setNodeLayout
 o CIRCLE
 public static final int CIRCLE
Constant used to adjust the Node layout rule used.

See Also:
setNodeLayout

Constructors

 o Area
 public Area(int t)
Start the new Area with the given type of Nodes it should display Type should be any type in the Monitorable interface.

See Also:
Monitorable
 o Area
 public Area(int t,
             int x,
             int y,
             int w,
             int h)
Start the new Area with the given type, position, and dimensions. Type should be any type in the Monitorable interface.

See Also:
Monitorable

Methods

 o hasNodes
 public boolean hasNodes()
 o add
 public void add(Node b,
                 int orient)
Adds a Node to this Area with the orientation specified.
Adjusts position of all Nodes to make space for it.

Parameters:
b - The Node to add
orient - Any of the compass point values defined in Node
See Also:
setLabelOrientation
 o add
 public void add(Node b)
Adds a Node to this Area, it applies the default labelOrientation to the Node for this type of Area.
Adjusts position of all Nodes to make space for it.

See Also:
setLabelOrientation
 o remove
 public void remove(Node b)
Remove the Node from this area and adjust positions of remaining Nodes to compensate

 o paint
 public void paint(Graphics g)
Paint the nodes in this area onto the given graphics context

See Also:
paint
 o setContainerSize
 public void setContainerSize(Dimension d)
Set the maximum size for all the Nodes in this Area

 o setGraphics
 public void setGraphics(Graphics g)
Set the graphics context for drawing onto

 o mousePressedHasEffect
 public boolean mousePressedHasEffect(int x,
                                      int y)
Determine whether a mouse press at (x,y) has an effect on any of the Nodes in this Area. If so, make that effect occur, and return true, else return false

See Also:
mousePressedHasEffect
 o mouseReleasedHasEffect
 public boolean mouseReleasedHasEffect(int x,
                                       int y)
Determine whether a mouse released at (x,y) has an effect on any of the Nodes in this Area. If so, make that effect occur, and return true, else return false

See Also:
mouseReleasedHasEffect
 o setBackground
 public void setBackground(Color c)
 o setNodeLayout
 public void setNodeLayout(int l)
Set the layout rule for the Nodes in this Area.

See Also:
HORIZ_LINE, VERT_LINE, CIRCLE
 o setLabelOrientation
 public void setLabelOrientation(int l)
Set the default label orientation for all newly added Nodes in this Area.

See Also:
NORTH
 o adjustBounds
 public void adjustBounds(double scaleX,
                          double scaleY)
Adjust the dimensions of this area by the given scaling factor.

 o setBounds
 public void setBounds(Rectangle r)
Overrides:
setBounds in class Rectangle
 o setBounds
 public void setBounds(int x,
                       int y,
                       int w,
                       int h)
Overrides:
setBounds in class Rectangle
 o setSize
 public void setSize(Dimension d)
Overrides:
setSize in class Rectangle
 o setSize
 public void setSize(int w,
                     int h)
Overrides:
setSize in class Rectangle
 o setLocation
 public void setLocation(Point p)
Overrides:
setLocation in class Rectangle
 o setLocation
 public void setLocation(int x,
                         int y)
Overrides:
setLocation in class Rectangle
 o getBackground
 public Color getBackground()
 o getMinimumSize
 public Dimension getMinimumSize()
 o toString
 public String toString()
Overrides:
toString in class Rectangle

All Packages  Class Hierarchy  This Package  Previous  Next  Index