Class Message

java.lang.Object
  extended byEntity
      extended byMessage
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class Message
extends Entity
implements java.awt.event.ActionListener

This class represents a message.

Author:
Matilda Östling

Field Summary
private  ClassEntity endEntity
           
private  Handle endHandle
           
private  boolean isCreateMessage
           
private  boolean isReturnMessage
           
private  javax.swing.JMenuItem menuChangeMessage
           
private  javax.swing.JMenuItem menuDelete
           
private  boolean moveEnd
           
private  boolean moveObject
           
private  boolean moveStart
           
private  Message returnMessage
           
private  ClassEntity startEntity
           
private  Handle startHandle
           
private  boolean validEnd
           
 
Fields inherited from class Entity
drawingArea, end, endPoint, lifeLine, name, selected, start, startPoint, string
 
Constructor Summary
Message(DrawingArea d)
          The constructor of the class.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          This method is called when an ActionEvent takes place.
 void changeMessage()
          This method is called when the user wants to change the message.
 void delete()
          This method is called to delete a message.
 void draw(java.awt.Graphics g)
          This method is called to draw the object.
 ClassEntity getEndEntity()
           
 boolean getIsCreateMessage()
           
 boolean getIsReturnMessage()
           
 int getNextState()
          This method returns the next state for this class.
 Message getReturnMessage()
           
 ClassEntity getStartEntity()
           
 boolean isClickedOn(java.awt.Point p)
          This method decides whether the object is clicked on or not.
 void setEndEntity(ClassEntity end)
           
 void setEndHandle(Handle h)
           
 void setEndPoint(java.awt.Point p)
          This method sets the endpoint for the object.
 void setIsCreateMessage(boolean b)
           
 void setIsReturnMessage(boolean b)
           
 void setNextState(java.awt.Point p)
          This method is called to update the next state of the class based upon what the user has choosen.
 void setReturnMessage(Message retMess)
           
 void setSelected(boolean b)
          This method sets the object selected or not selected.
 void setStartEntity(ClassEntity start)
           
 void setStartHandle(Handle h)
           
 void setStartPoint(java.awt.Point p)
          This method sets the startpoint for the object.
 void showMenu(java.awt.Point p)
          This method is called to show the menu of the object.
 
Methods inherited from class Entity
getEndPoint, getName, getStartPoint, getString, modifyString, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

menuChangeMessage

private javax.swing.JMenuItem menuChangeMessage

menuDelete

private javax.swing.JMenuItem menuDelete

startEntity

private ClassEntity startEntity

endEntity

private ClassEntity endEntity

startHandle

private Handle startHandle

endHandle

private Handle endHandle

moveStart

private boolean moveStart

moveEnd

private boolean moveEnd

validEnd

private boolean validEnd

moveObject

private boolean moveObject

isCreateMessage

private boolean isCreateMessage

isReturnMessage

private boolean isReturnMessage

returnMessage

private Message returnMessage
Constructor Detail

Message

public Message(DrawingArea d)
The constructor of the class.

Parameters:
d - The component where the message will be drawn.
Method Detail

draw

public void draw(java.awt.Graphics g)
This method is called to draw the object.

Specified by:
draw in class Entity
Parameters:
g - Used for the drawing.

setStartPoint

public void setStartPoint(java.awt.Point p)
This method sets the startpoint for the object.

Overrides:
setStartPoint in class Entity
Parameters:
p - The startpoint.

setEndPoint

public void setEndPoint(java.awt.Point p)
This method sets the endpoint for the object.

Overrides:
setEndPoint in class Entity
Parameters:
p - The endpoint.

showMenu

public void showMenu(java.awt.Point p)
This method is called to show the menu of the object.

Specified by:
showMenu in class Entity
Parameters:
p - The menu will be shown at the given point.

getNextState

public int getNextState()
This method returns the next state for this class.

Specified by:
getNextState in class Entity
Returns:
The next state for this class.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
This method is called when an ActionEvent takes place.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - The ActionEvent.

changeMessage

public void changeMessage()
This method is called when the user wants to change the message. It will create a popupwindow and ask the user for the new message.


isClickedOn

public boolean isClickedOn(java.awt.Point p)
This method decides whether the object is clicked on or not.

Overrides:
isClickedOn in class Entity
Parameters:
p - The point where the user has clicked.
Returns:
True if the object is clicked on, otherwise false.

delete

public void delete()
This method is called to delete a message. The message will be removed from all lists that it excists in.


setNextState

public void setNextState(java.awt.Point p)
This method is called to update the next state of the class based upon what the user has choosen.

Specified by:
setNextState in class Entity
Parameters:
p - The point of the mouse.

setSelected

public void setSelected(boolean b)
This method sets the object selected or not selected. If it is selected it also sets the current state for the DrawingArea object to Currentstate.CHANGE.

Overrides:
setSelected in class Entity
Parameters:
b - True if the object is selected, otherwise false.

getStartEntity

public ClassEntity getStartEntity()

setStartEntity

public void setStartEntity(ClassEntity start)

setEndEntity

public void setEndEntity(ClassEntity end)

getEndEntity

public ClassEntity getEndEntity()

setEndHandle

public void setEndHandle(Handle h)

setStartHandle

public void setStartHandle(Handle h)

setIsCreateMessage

public void setIsCreateMessage(boolean b)

getIsCreateMessage

public boolean getIsCreateMessage()

getIsReturnMessage

public boolean getIsReturnMessage()

setIsReturnMessage

public void setIsReturnMessage(boolean b)

getReturnMessage

public Message getReturnMessage()

setReturnMessage

public void setReturnMessage(Message retMess)