uchicago.src.sim.network
Class DefaultDrawableNode

java.lang.Object
  extended by uchicago.src.sim.network.DefaultNode
      extended by uchicago.src.sim.network.DefaultDrawableNode
All Implemented Interfaces:
Drawable2DGridNode, DrawableNonGridNode, Moveable, NonGridDrawable, Node
Direct Known Subclasses:
AsynchAgent, Births, Boss, Boss, Boss, Competitor, DeathMultiplier, Deaths, Employee, Employee, HyperCell, JainNode, JiggleNode, JinGirNewNode, Judge, PopulationDensity, RabbitPopulation, Stapler

public class DefaultDrawableNode
extends DefaultNode
implements DrawableNonGridNode, Moveable, Drawable2DGridNode

Version:
$Revision: 1.11 $ $Date: 2004/11/03 19:51:00 $

Nested Class Summary
 
Nested classes/interfaces inherited from class uchicago.src.sim.network.DefaultNode
DefaultNode.OrderedHashMap
 
Field Summary
protected  NetworkDrawable item
           
 
Fields inherited from class uchicago.src.sim.network.DefaultNode
inEdges, inMap, label, outEdges, outMap
 
Constructor Summary
DefaultDrawableNode()
          Creates this DefaultDrawableNode.
DefaultDrawableNode(NetworkDrawable nDrawable)
           
DefaultDrawableNode(java.lang.String label, NetworkDrawable nDrawable)
           
 
Method Summary
 void allowResizing(boolean val)
          Sets whether or not this DefaultDrawableNode will be resized to fit its label.
 void calcSize(SimGraphics g)
          Calculates the size of this DefaultDrawableNode.
 boolean contains(java.awt.Point p)
          Does this object contain the point specified by p.
 void draw(SimGraphics g)
          Draws this Drawable2DGridNode.
 java.awt.Color getBorderColor()
          Gets the border color for this DefaultDrawableNode.
 int getBorderWidth()
          Gets the border width for this DefaultDrawableNode.
 java.awt.Color getColor()
          Gets the color of this DefaultDrawableNode.
 java.awt.Font getFont()
          Gets the label font for this DefaultDrawableNode.
 int getHeight()
          Gets the height of this DefaultDrawableNode.
 java.awt.Color getLabelColor()
          Gets label color for this DefaultDrawableNode.
 Node getNode()
          Deprecated.  
 int getWidth()
          Gets the width of this DefaultDrawableNode.
 double getX()
          Gets the x coordinate for this node.
 double getY()
          Gets the y coordinate for this node.
 void setBorderColor(java.awt.Color c)
          Sets the border color for this DefaultDrawableNode.
 void setBorderWidth(int width)
          Sets the border width for this DefaultDrawableNode.
 void setColor(java.awt.Color c)
          Sets the color of this DefaultDrawableNode.
 void setDrawable(NetworkDrawable nDrawable)
          Sets the drawable for this DefaultNetworkNode.
 void setDrawableNoCopy(NetworkDrawable nDrawable)
           
 void setFont(java.awt.Font font)
          Sets the label font for this DefaultDrawableNode.
 void setHeight(int height)
          Sets the height of this DefaultDrawableNode.By default this will be ignored and the DefaultDrawableNode will be sized to fit its label.
 void setLabelColor(java.awt.Color c)
          Sets label color for this DefaultDrawableNode.
 void setNodeLabel(java.lang.String nlabel)
          Sets the label for this DefaultDrawableNode.
 void setWidth(int width)
          Sets the width of this DefaultDrawableNode.
 void setX(double x)
          Sets the x coordinate for this node.
 void setX(int val)
          Implements the moveable interface, setting the x coordinate to some integer value.
 void setY(double y)
          Sets the y coordinate for this node.
 void setY(int val)
          Implements the moveable interface, setting the y coordinate to some integer value.
 
Methods inherited from class uchicago.src.sim.network.DefaultNode
addInEdge, addInEdges, addOutEdge, addOutEdges, clearInEdges, clearOutEdges, getEdgesFrom, getEdgesTo, getFromNodes, getId, getInDegree, getInEdges, getInNodes, getNodeLabel, getNumInEdges, getNumOutEdges, getOutDegree, getOutEdges, getOutNodes, getRandomFromNode, getRandomNodeIn, getRandomNodeOut, getRandomToNode, getToNodes, hasEdgeFrom, hasEdgeTo, hasEdgeToOrFrom, makeRandomInEdge, makeRandomOutEdge, removeEdgesFrom, removeEdgesTo, removeInEdge, removeOutEdge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uchicago.src.sim.gui.DrawableNonGridNode
getOutEdges
 
Methods inherited from interface uchicago.src.sim.gui.Drawable2DGridNode
getOutEdges
 

Field Detail

item

protected NetworkDrawable item
Constructor Detail

DefaultDrawableNode

public DefaultDrawableNode()
Creates this DefaultDrawableNode. This DefaultDrawableNode will created with an x and y coordinate of 0,0 and as a Rectangular node.


DefaultDrawableNode

public DefaultDrawableNode(java.lang.String label,
                           NetworkDrawable nDrawable)

DefaultDrawableNode

public DefaultDrawableNode(NetworkDrawable nDrawable)
Method Detail

setDrawable

public void setDrawable(NetworkDrawable nDrawable)
Sets the drawable for this DefaultNetworkNode. All the properties (color, borderWidth, etc.) of the current NetworkDrawable will be copied to the specified NetworkDrawable.


setDrawableNoCopy

public void setDrawableNoCopy(NetworkDrawable nDrawable)

calcSize

public void calcSize(SimGraphics g)
Calculates the size of this DefaultDrawableNode. This is used to ensure that the DefaultDrawableNode is large enough to accomodate its label. This method is used internally by RePast.

Specified by:
calcSize in interface DrawableNonGridNode

getNode

public Node getNode()
Deprecated. 

Gets the actual network node. The intention here is to get the actual node if a node is being wrapped by an implementor of the DrawableNonGridNodeInterface.

Overrides:
getNode in class DefaultNode

getWidth

public int getWidth()
Gets the width of this DefaultDrawableNode.

Specified by:
getWidth in interface NonGridDrawable

setWidth

public void setWidth(int width)
Sets the width of this DefaultDrawableNode. By default this will be ignored and the DefaultDrawableNode will be sized to fit its label. Do allowsResizing(false) to set the width and height manually.


getHeight

public int getHeight()
Gets the height of this DefaultDrawableNode.

Specified by:
getHeight in interface NonGridDrawable

setHeight

public void setHeight(int height)
Sets the height of this DefaultDrawableNode.By default this will be ignored and the DefaultDrawableNode will be sized to fit its label. Do allowsResizing(false) to set the width and height manually.


allowResizing

public void allowResizing(boolean val)
Sets whether or not this DefaultDrawableNode will be resized to fit its label. If this is set to true, any setting of the width or height is ignored.


setNodeLabel

public void setNodeLabel(java.lang.String nlabel)
Sets the label for this DefaultDrawableNode.

Specified by:
setNodeLabel in interface Node
Overrides:
setNodeLabel in class DefaultNode

setBorderColor

public void setBorderColor(java.awt.Color c)
Sets the border color for this DefaultDrawableNode.


getBorderColor

public java.awt.Color getBorderColor()
Gets the border color for this DefaultDrawableNode.


setBorderWidth

public void setBorderWidth(int width)
Sets the border width for this DefaultDrawableNode.


getBorderWidth

public int getBorderWidth()
Gets the border width for this DefaultDrawableNode.


setFont

public void setFont(java.awt.Font font)
Sets the label font for this DefaultDrawableNode.


getFont

public java.awt.Font getFont()
Gets the label font for this DefaultDrawableNode.


setLabelColor

public void setLabelColor(java.awt.Color c)
Sets label color for this DefaultDrawableNode.


getLabelColor

public java.awt.Color getLabelColor()
Gets label color for this DefaultDrawableNode.


setColor

public void setColor(java.awt.Color c)
Sets the color of this DefaultDrawableNode.


getColor

public java.awt.Color getColor()
Gets the color of this DefaultDrawableNode.


getX

public double getX()
Gets the x coordinate for this node.

Specified by:
getX in interface Drawable2DGridNode
Specified by:
getX in interface NonGridDrawable

getY

public double getY()
Gets the y coordinate for this node.

Specified by:
getY in interface Drawable2DGridNode
Specified by:
getY in interface NonGridDrawable

setX

public void setX(double x)
Sets the x coordinate for this node. Used by GraphLayouts.

Specified by:
setX in interface DrawableNonGridNode

setY

public void setY(double y)
Sets the y coordinate for this node. Used by GraphLayouts.

Specified by:
setY in interface DrawableNonGridNode

contains

public boolean contains(java.awt.Point p)
Does this object contain the point specified by p. This is necessary for probing when returning what is in a cell on a grid is impossible.

Specified by:
contains in interface NonGridDrawable
Parameters:
p - the point to test for.

draw

public void draw(SimGraphics g)
Description copied from interface: Drawable2DGridNode
Draws this Drawable2DGridNode.

Specified by:
draw in interface Drawable2DGridNode
Specified by:
draw in interface NonGridDrawable
Parameters:
g - the SimGraphics object used for drawing

setX

public void setX(int val)
Implements the moveable interface, setting the x coordinate to some integer value.

Specified by:
setX in interface Moveable

setY

public void setY(int val)
Implements the moveable interface, setting the y coordinate to some integer value.

Specified by:
setY in interface Moveable