se.umu.cs.SequenceDiagramEditor
Class ClassEntity

java.lang.Object
  extended byse.umu.cs.SequenceDiagramEditor.Entity
      extended byse.umu.cs.SequenceDiagramEditor.ClassEntity
Direct Known Subclasses:
Actor, SequenceObject

public abstract class ClassEntity
extends Entity

This class represents a classEntity in a sequence diagram.

Author:
Matilda Östling

Field Summary
protected  bluej.extensions.BClass bClass
          The BClass that this ClassEntity is connected to.
protected  DestroySymbol destroySymbol
          The destroy symbol belonging to this ClassEntity.
protected  boolean hasCreationMessage
          Tells if the the ClassEntity has a creation message or not.
protected  boolean hasDestroySymbol
          Tells if the ClassEntity has a destroy symbol or not.
protected  java.util.Vector messageList
          All messages belonging to this ClassEntity.
 
Fields inherited from class se.umu.cs.SequenceDiagramEditor.Entity
drawingArea, endPoint, lifeLine, name, selected, startPoint, string
 
Constructor Summary
ClassEntity(DrawingArea d)
          The constructor of the class.
ClassEntity(DrawingArea d, bluej.extensions.BClass b)
          The constructor of the class.
 
Method Summary
 void addMessage(Message m)
          This method adds a message to the messageList of the classEntity, if it is not already in the list.
 void arrangeObjects(Entity e)
          This method is used when the user has moved one object and then the others should get rearranged.
private  void checkMessages()
          This method is called to remove all methods not having a startPoint or an endPoint.
 void createDestroySymbol()
          This method creates a destroysymbol for the classEntity and adds it to the drawingobjects for the drawingarea.
 void delete()
          This method deletes a classEntity from the drawingarea.
 void deleteMessage(Message m)
          This method removes a messages from the messageList of the classEntity if the message is in the list.
 bluej.extensions.BClass getBClass()
          This method return the BClass for the object.
 void moveObject(java.awt.Point p)
          This method is used when the user wants to move an actor or an object in the drawingarea.
 void moveObjects(int firstIndex, int lastIndex, boolean direction)
          This method is used by the method delete and moves all classEntitys from the given index to the left or to the right.
 void moveObjectUp(java.awt.Point p)
          This method is called when a create message is removed from the ClassEntity and also if the classEntity has a creationmessage and the user wants to move it in the vertical plane.
 void moveVertical(java.awt.Point p)
          This method moves a classEntity in the vertical plane.
 void setSelected(boolean b)
          This method sets the object selected or not selected.
 
Methods inherited from class se.umu.cs.SequenceDiagramEditor.Entity
draw, getEndPoint, getName, getNextState, getStartPoint, getString, isClickedOn, modifyString, setEndPoint, setName, setNextState, setStartPoint, showMenu
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageList

protected java.util.Vector messageList
All messages belonging to this ClassEntity.


destroySymbol

protected DestroySymbol destroySymbol
The destroy symbol belonging to this ClassEntity.


hasDestroySymbol

protected boolean hasDestroySymbol
Tells if the ClassEntity has a destroy symbol or not.


hasCreationMessage

protected boolean hasCreationMessage
Tells if the the ClassEntity has a creation message or not.


bClass

protected bluej.extensions.BClass bClass
The BClass that this ClassEntity is connected to.

Constructor Detail

ClassEntity

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

Parameters:
d - The component where the classEntity will be drawn.

ClassEntity

public ClassEntity(DrawingArea d,
                   bluej.extensions.BClass b)
The constructor of the class. This constructor is used when the sequence diagram is connected to a BlueJ-project.

Parameters:
d - The component where the classEntity will be drawn.
b - The Class to which the sequence object belongs.
Method Detail

delete

public void delete()
This method deletes a classEntity from the drawingarea. It also deletes all attributes (activationbox, destroysymbol, messages) belonging to it. Then it rearranges the other classEntitys on the drawingarea.


moveObject

public void moveObject(java.awt.Point p)
This method is used when the user wants to move an actor or an object in the drawingarea.

Parameters:
p - The actor/object is moved to this point

arrangeObjects

public void arrangeObjects(Entity e)
This method is used when the user has moved one object and then the others should get rearranged.

Parameters:
e - The Entity that has been moved.

moveObjects

public void moveObjects(int firstIndex,
                        int lastIndex,
                        boolean direction)
This method is used by the method delete and moves all classEntitys from the given index to the left or to the right.

Parameters:
firstIndex - From this index all classEntity are moved.
lastIndex - To this index all ClassEntitys are moved.
direction - If true move to left, if false move to right.

moveVertical

public void moveVertical(java.awt.Point p)
This method moves a classEntity in the vertical plane. If the classEntity has any attributes (activationbox, destroysymbol, messages) they are removed.

Parameters:
p - The point to where the classEntity is to be moved.

moveObjectUp

public void moveObjectUp(java.awt.Point p)
This method is called when a create message is removed from the ClassEntity and also if the classEntity has a creationmessage and the user wants to move it in the vertical plane.

Parameters:
p - The point to where the classEntity is to be moved.

addMessage

public void addMessage(Message m)
This method adds a message to the messageList of the classEntity, if it is not already in the list.

Parameters:
m - The message to add to the messageList.

deleteMessage

public void deleteMessage(Message m)
This method removes a messages from the messageList of the classEntity if the message is in the list.

Parameters:
m - The message to be deleted.

checkMessages

private void checkMessages()
This method is called to remove all methods not having a startPoint or an endPoint.


createDestroySymbol

public void createDestroySymbol()
This method creates a destroysymbol for the classEntity and adds it to the drawingobjects for the drawingarea.


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.

getBClass

public bluej.extensions.BClass getBClass()
This method return the BClass for the object.

Returns:
The BClass object