kaapo.project
Class DiagramComponent

java.lang.Object
  extended by kaapo.Observable
      extended by kaapo.project.ProjectComponent
          extended by kaapo.project.DiagramComponent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Connection, Element

public abstract class DiagramComponent
extends ProjectComponent

Base class for elements and connections. Concrete elements and connections don't inherit from this class, but the subclasses of this class.

See Also:
Serialized Form

Nested Class Summary
static class DiagramComponent.ComponentType
           
 
Nested classes/interfaces inherited from class kaapo.project.ProjectComponent
ProjectComponent.ObservableMessage
 
Field Summary
 
Fields inherited from class kaapo.project.ProjectComponent
attributeMap, attributePanel
 
Constructor Summary
DiagramComponent()
           
 
Method Summary
protected abstract  DCGraphics buildDCGraphics(DiagramComponentWrapper wrapper, ProjectManager pm)
          Build a new graphical representation of the element as DCGraphics.
abstract  boolean canMove(DiagramComponentWrapper wrapper)
          Tell whether the element can be moved by user.
abstract  boolean canResize(DiagramComponentWrapper wrapper)
          Tell whether the element can be resized by user.
abstract  DiagramComponent.ComponentType getComponentType()
          Get the basic type of the diagram component (element or connection).
abstract  ImageIcon getLargeIcon()
          Returns a 24*24 pixel icon of the diagram component type.
abstract  boolean isElement()
          Tell whether the diagram component is an element or a connection.
 
Methods inherited from class kaapo.project.ProjectComponent
addAttribute, addAttribute, buildAttributePanel, getAttribute, getAttributeMap, getAttributePanel, getSmallIcon, getTypeName, hasAttribute, removeAttribute, setAttribute
 
Methods inherited from class kaapo.Observable
addObserver, notifyObservers, notifyObservers, removeAllObservers, removeObserver, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DiagramComponent

public DiagramComponent()
Method Detail

getLargeIcon

public abstract ImageIcon getLargeIcon()
Returns a 24*24 pixel icon of the diagram component type. The icon is used in element palette by the GUI.

Returns:
Icon

canResize

public abstract boolean canResize(DiagramComponentWrapper wrapper)
Tell whether the element can be resized by user.

Parameters:
wrapper - The wrapper in question. The wrapper is given as parameter because it may depend on the wrapper whether the component can be resized.
Returns:
True if element can be resized.

canMove

public abstract boolean canMove(DiagramComponentWrapper wrapper)
Tell whether the element can be moved by user.

Parameters:
wrapper - The wrapper in question. The wrapper is given as parameter because it may depend on the wrapper whether the component can be moved.
Returns:
True if element can be moved.

isElement

public abstract boolean isElement()
Tell whether the diagram component is an element or a connection.

Returns:
True if element, false if connection.

getComponentType

public abstract DiagramComponent.ComponentType getComponentType()
Get the basic type of the diagram component (element or connection).

Returns:
Basic type

buildDCGraphics

protected abstract DCGraphics buildDCGraphics(DiagramComponentWrapper wrapper,
                                              ProjectManager pm)
Build a new graphical representation of the element as DCGraphics. This method must always build a new instance.

Parameters:
wrapper - The wrapper containing the attributes of the element the differ between diagrams.
pm - Project manager
Returns:
New DCGraphics instance