se.umu.cs.SequenceDiagramEditor
Class Message

java.lang.Object
  extended byse.umu.cs.SequenceDiagramEditor.Entity
      extended byse.umu.cs.SequenceDiagramEditor.Message
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
          The endentity of the message.
private  boolean isCreateMessage
          Tells if the message is a creationmessage or not.
private  boolean isReturnMessage
          Tells if the message is a returnmessage or not.
private  javax.swing.JMenuItem menuChangeMessage
          The menuitem for changing the message.
private  javax.swing.JMenuItem menuDelete
          The menuitem for deleting the message.
private  boolean moveObject
          Tells if the message could be moved or not.
private  boolean moveStart
          Tells if the message could be moved or not.
private  Message returnMessage
          The return message belonging to the message.
private  int sequenceIndex
          If the message is in a sequence this is the index of the message in the sequence.
private  ClassEntity startEntity
          The startentity of the message.
private  Handle startHandle
          The handle of the message, used to move the messaga.
private  boolean validEnd
          Tells if the end of the message is valid or not.
 
Fields inherited from class se.umu.cs.SequenceDiagramEditor.Entity
drawingArea, endPoint, lifeLine, name, selected, 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()
          This method returns the endentity of the message.
 boolean getIsCreateMessage()
          Returns whether the message is a creation message or not.
 boolean getIsReturnMessage()
          Returns whether the message is a return message or not.
 int getNextState()
          This method returns the next state for this class.
 Message getReturnMessage()
          This method returns the return message belonging to this message.
 int getSequenceIndex()
          This method returns the index of the message in a sequence.
 ClassEntity getStartEntity()
          This method returns the startentity of the message.
 boolean isClickedOn(java.awt.Point p)
          This method decides whether the object is clicked on or not.
 void setEndEntity(ClassEntity end)
          This method sets the endentity of the message.
 void setEndPoint(java.awt.Point p)
          This method sets the endpoint for the object.
 void setIsCreateMessage(boolean b)
          This method sets whether the message is a creation message or not.
 void setIsReturnMessage(boolean b)
          Sets if the message is a return message or not.
 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)
          This method sets the return message of the message.
 void setSelected(boolean b)
          This method sets the object selected or not selected.
 void setSequenceIndex(int i)
          This method sets the index in the sequence for the message.
 void setStartEntity(ClassEntity start)
          This method sets the startentity of the message.
 void setStartHandle(Handle h)
          This method sets the handle of the message.
 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 se.umu.cs.SequenceDiagramEditor.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
The menuitem for changing the message.


menuDelete

private javax.swing.JMenuItem menuDelete
The menuitem for deleting the message.


startEntity

private ClassEntity startEntity
The startentity of the message.


endEntity

private ClassEntity endEntity
The endentity of the message.


startHandle

private Handle startHandle
The handle of the message, used to move the messaga.


moveStart

private boolean moveStart
Tells if the message could be moved or not.


validEnd

private boolean validEnd
Tells if the end of the message is valid or not.


moveObject

private boolean moveObject
Tells if the message could be moved or not.


isCreateMessage

private boolean isCreateMessage
Tells if the message is a creationmessage or not.


isReturnMessage

private boolean isReturnMessage
Tells if the message is a returnmessage or not.


returnMessage

private Message returnMessage
The return message belonging to the message. Null if the message is a return message.


sequenceIndex

private int sequenceIndex
If the message is in a sequence this is the index of the message in the sequence.

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()
This method returns the startentity of the message.

Returns:
The startentity

setStartEntity

public void setStartEntity(ClassEntity start)
This method sets the startentity of the message.

Parameters:
start - The startentity

setEndEntity

public void setEndEntity(ClassEntity end)
This method sets the endentity of the message.

Parameters:
end - The endentity

getEndEntity

public ClassEntity getEndEntity()
This method returns the endentity of the message.

Returns:
The endentity

setStartHandle

public void setStartHandle(Handle h)
This method sets the handle of the message.

Parameters:
h - The handle

setIsCreateMessage

public void setIsCreateMessage(boolean b)
This method sets whether the message is a creation message or not.

Parameters:
b - True if creation message else false

getIsCreateMessage

public boolean getIsCreateMessage()
Returns whether the message is a creation message or not.

Returns:
True if creation message else false

getIsReturnMessage

public boolean getIsReturnMessage()
Returns whether the message is a return message or not.

Returns:
True if return message else false

setIsReturnMessage

public void setIsReturnMessage(boolean b)
Sets if the message is a return message or not.

Parameters:
b - True if return message else false

getReturnMessage

public Message getReturnMessage()
This method returns the return message belonging to this message.

Returns:
The return message

setReturnMessage

public void setReturnMessage(Message retMess)
This method sets the return message of the message.

Parameters:
retMess - The return message

setSequenceIndex

public void setSequenceIndex(int i)
This method sets the index in the sequence for the message.

Parameters:
i - The index

getSequenceIndex

public int getSequenceIndex()
This method returns the index of the message in a sequence.

Returns:
The index