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
-
CIRCLE
- Constant used to adjust the Node layout rule used.
-
H_SPACE
- The minimum amount of space between adjacent Nodes in this Area and
the position of the nearest Node (defaults to 15 pixels)
-
HORIZ_LINE
- Constant used to adjust the Node layout rule used.
-
V_SPACE
- The minimum amount of space between adjacent Nodes in this Area and
the position of the nearest Node (defaults to 15 pixels)
-
VERT_LINE
- Constant used to adjust the Node layout rule used.
-
Area(int)
- Start the new Area with the given type of Nodes it should display
Type should be any type in the Monitorable interface.
-
Area(int, int, int, int, int)
- Start the new Area with the given type, position, and dimensions.
-
add(Node)
- Adds a Node to this Area, it applies the default labelOrientation
to the Node for this type of Area.
-
add(Node, int)
- Adds a Node to this Area with the orientation specified.
-
adjustBounds(double, double)
- Adjust the dimensions of this area by the given scaling factor.
-
getBackground()
-
-
getMinimumSize()
-
-
hasNodes()
-
-
mousePressedHasEffect(int, int)
- Determine whether a mouse press at (x,y) has
an effect on any of the Nodes in this Area.
-
mouseReleasedHasEffect(int, int)
- Determine whether a mouse released at (x,y) has
an effect on any of the Nodes in this Area.
-
paint(Graphics)
- Paint the nodes in this area onto the given graphics context
-
remove(Node)
- Remove the Node from this area and adjust positions of remaining
Nodes to compensate
-
setBackground(Color)
-
-
setBounds(int, int, int, int)
-
-
setBounds(Rectangle)
-
-
setContainerSize(Dimension)
- Set the maximum size for all the Nodes in this Area
-
setGraphics(Graphics)
- Set the graphics context for drawing onto
-
setLabelOrientation(int)
- Set the default label orientation for all newly added Nodes
in this Area.
-
setLocation(int, int)
-
-
setLocation(Point)
-
-
setNodeLayout(int)
- Set the layout rule for the Nodes in this Area.
-
setSize(Dimension)
-
-
setSize(int, int)
-
-
toString()
-
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)
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)
HORIZ_LINE
public static final int HORIZ_LINE
- Constant used to adjust the Node layout rule used.
- See Also:
- setNodeLayout
VERT_LINE
public static final int VERT_LINE
- Constant used to adjust the Node layout rule used.
- See Also:
- setNodeLayout
CIRCLE
public static final int CIRCLE
- Constant used to adjust the Node layout rule used.
- See Also:
- setNodeLayout
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
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
hasNodes
public boolean hasNodes()
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
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
remove
public void remove(Node b)
- Remove the Node from this area and adjust positions of remaining
Nodes to compensate
paint
public void paint(Graphics g)
- Paint the nodes in this area onto the given graphics context
- See Also:
- paint
setContainerSize
public void setContainerSize(Dimension d)
- Set the maximum size for all the Nodes in this Area
setGraphics
public void setGraphics(Graphics g)
- Set the graphics context for drawing onto
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
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
setBackground
public void setBackground(Color c)
setNodeLayout
public void setNodeLayout(int l)
- Set the layout rule for the Nodes in this Area.
- See Also:
- HORIZ_LINE, VERT_LINE, CIRCLE
setLabelOrientation
public void setLabelOrientation(int l)
- Set the default label orientation for all newly added Nodes
in this Area.
- See Also:
- NORTH
adjustBounds
public void adjustBounds(double scaleX,
double scaleY)
- Adjust the dimensions of this area by the given scaling factor.
setBounds
public void setBounds(Rectangle r)
- Overrides:
- setBounds in class Rectangle
setBounds
public void setBounds(int x,
int y,
int w,
int h)
- Overrides:
- setBounds in class Rectangle
setSize
public void setSize(Dimension d)
- Overrides:
- setSize in class Rectangle
setSize
public void setSize(int w,
int h)
- Overrides:
- setSize in class Rectangle
setLocation
public void setLocation(Point p)
- Overrides:
- setLocation in class Rectangle
setLocation
public void setLocation(int x,
int y)
- Overrides:
- setLocation in class Rectangle
getBackground
public Color getBackground()
getMinimumSize
public Dimension getMinimumSize()
toString
public String toString()
- Overrides:
- toString in class Rectangle
All Packages Class Hierarchy This Package Previous Next Index