fdda.graphics.java2d
Class Message

java.lang.Object
  |
  +--fdda.graphics.java2d.Component
        |
        +--fdda.graphics.java2d.Message
All Implemented Interfaces:
Cloneable, Component, Message

public class Message
extends Component
implements Message

Implementation of the message interface. The message is shown as a small rectangle.

Author:
Jörg Rüdenauer

Field Summary
static double HALF_LENGTH
          half the length of the message rectangle
static double HALF_WIDTH
          half the width of the message rectangle
 
Fields inherited from class fdda.graphics.java2d.Component
COLOR_NORMAL, COLOR_SELECTED, dirtyShape, selected, shape, x, y
 
Fields inherited from interface fdda.graphics.Component
SEL_ALL, SEL_EQUALS, SEL_MOVABLES, SEL_NOTHING
 
Constructor Summary
Message(Line line, boolean forward)
          Constructor
 
Method Summary
protected  void calcShape()
          Recalculates the shape.
 boolean doesMoveInLineDirection()
          Returns whether the message moves in the direction of the line
 void draw(Graphics2D graphContext)
          Draws the component, using the given graphics.
 Color getColor()
          Returns the color of the message
 Line getLine()
          Returns the line on which the message moves
 Message getRealMessage()
          Returns the underlying message of the algorithm
 boolean isMovable()
          Returns false.
 void move(double xOffset, double yOffset)
          Move the component (or its most prominent point).
 void moveForward()
          Moves the message forward, towards its destination
 int selectableWith()
          Returns SEL_NOTHING.
 void setColor(Color color)
          Sets the color of the message
 void setRealMessage(Message message)
          Sets the underlying message of the algorithm
 Object visit(ComponentVisitor visitor)
          Calls visitMessage according to visitor pattern
 
Methods inherited from class fdda.graphics.java2d.Component
clone, deselect, getGraphicalSystem, getShape, getX, getY, isSelected, recalculateShape, select, setGraphicalSystem, setXY
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface fdda.graphics.Component
clone, deselect, getGraphicalSystem, getShape, getX, getY, isSelected, recalculateShape, select, setGraphicalSystem, setXY
 

Field Detail

HALF_LENGTH

public static final double HALF_LENGTH
half the length of the message rectangle

See Also:
Constant Field Values

HALF_WIDTH

public static final double HALF_WIDTH
half the width of the message rectangle

See Also:
Constant Field Values
Constructor Detail

Message

public Message(Line line,
               boolean forward)
Constructor

Parameters:
line - the line on which the message moves
forward - whether the message moves forward
Method Detail

calcShape

protected void calcShape()
Description copied from class: Component
Recalculates the shape. Is called by getShape if the flag dirtyShape is set. Must unset the flag after calculation.

Specified by:
calcShape in class Component

draw

public void draw(Graphics2D graphContext)
Description copied from class: Component
Draws the component, using the given graphics. The graphics should have the same attributes (color, pen, etc.) after the call as before the call.

Specified by:
draw in class Component
Parameters:
graphContext - the graphics

getRealMessage

public Message getRealMessage()
Description copied from interface: Message
Returns the underlying message of the algorithm

Specified by:
getRealMessage in interface Message
Returns:
the real message

setRealMessage

public void setRealMessage(Message message)
Description copied from interface: Message
Sets the underlying message of the algorithm

Specified by:
setRealMessage in interface Message
Parameters:
message - the real message

doesMoveInLineDirection

public boolean doesMoveInLineDirection()
Description copied from interface: Message
Returns whether the message moves in the direction of the line

Specified by:
doesMoveInLineDirection in interface Message
Returns:
whether the message moves in the direction of the line

moveForward

public void moveForward()
Description copied from interface: Message
Moves the message forward, towards its destination

Specified by:
moveForward in interface Message

isMovable

public boolean isMovable()
Returns false.

Specified by:
isMovable in interface Component
Returns:
true, iff the user can move the component
See Also:
Component.isMovable()

move

public void move(double xOffset,
                 double yOffset)
Description copied from interface: Component
Move the component (or its most prominent point).

Specified by:
move in interface Component
Parameters:
xOffset - offset for move in x direction
yOffset - offset for move in y direction

selectableWith

public int selectableWith()
Returns SEL_NOTHING. But messages can't be selected anyway.

Specified by:
selectableWith in interface Component
Returns:
constant indicating the selection class
See Also:
Component.selectableWith()

visit

public Object visit(ComponentVisitor visitor)
Calls visitMessage according to visitor pattern

Specified by:
visit in interface Component
Parameters:
visitor - the visitor
Returns:
specific to subclass
See Also:
Component.visit(fdda.graphics.ComponentVisitor)

getLine

public Line getLine()
Description copied from interface: Message
Returns the line on which the message moves

Specified by:
getLine in interface Message
Returns:
the line

setColor

public void setColor(Color color)
Description copied from interface: Message
Sets the color of the message

Specified by:
setColor in interface Message
Parameters:
color - the color

getColor

public Color getColor()
Description copied from interface: Message
Returns the color of the message

Specified by:
getColor in interface Message
Returns:
the color


API documentation for FDDA version 0.9. Generated on 17/02/2004 14:12.