kaapo.types.diagramcomponents
Class Text

java.lang.Object
  extended by kaapo.Observable
      extended by kaapo.project.ProjectComponent
          extended by kaapo.project.DiagramComponent
              extended by kaapo.project.Element
                  extended by kaapo.types.diagramcomponents.Text
All Implemented Interfaces:
Serializable

public class Text
extends Element

Generic text element that may be added to any diagram. Text may be multi-line. The graphic representation is a text area with no visible boundary.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class kaapo.project.DiagramComponent
DiagramComponent.ComponentType
 
Nested classes/interfaces inherited from class kaapo.project.ProjectComponent
ProjectComponent.ObservableMessage
 
Field Summary
protected static String ATTRIBUTE_NAME
           
 
Fields inherited from class kaapo.project.ProjectComponent
attributeMap, attributePanel
 
Constructor Summary
Text()
           
 
Method Summary
protected  AttributePanel buildAttributePanel(ProjectManager pm)
          Build a new attribute panel.
protected  DCGraphics buildDCGraphics(DiagramComponentWrapper wrapper, ProjectManager pm)
          Build a new graphical representation of the element as DCGraphics.
 boolean canMove(DiagramComponentWrapper wrapper)
          Tell whether the element can be moved by user.
 boolean canResize(DiagramComponentWrapper wrapper)
          Tell whether the element can be resized by user.
 double getDefaultHeight()
          Returns the default height of the element.
 double getDefaultWidth()
          Returns the default width of the element.
 ImageIcon getLargeIcon()
          Returns a 24*24 pixel icon of the diagram component type.
 ImageIcon getSmallIcon()
          Returns a 16*16 icon representing the project component type.
 String getTypeName()
          Returns the component type name formatted in a human-friendly manner.
 
Methods inherited from class kaapo.project.Element
getComponentType, isElement
 
Methods inherited from class kaapo.project.ProjectComponent
addAttribute, addAttribute, getAttribute, getAttributeMap, getAttributePanel, 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
 

Field Detail

ATTRIBUTE_NAME

protected static final String ATTRIBUTE_NAME
See Also:
Constant Field Values
Constructor Detail

Text

public Text()
Method Detail

getDefaultWidth

public double getDefaultWidth()
Description copied from class: Element
Returns the default width of the element. Default width is used when creating a new element instance, for example.

Specified by:
getDefaultWidth in class Element
Returns:
Default width

getDefaultHeight

public double getDefaultHeight()
Description copied from class: Element
Returns the default height of the element. Default height is used when creating a new element instance, for example.

Specified by:
getDefaultHeight in class Element
Returns:
Default height

getLargeIcon

public ImageIcon getLargeIcon()
Description copied from class: DiagramComponent
Returns a 24*24 pixel icon of the diagram component type. The icon is used in element palette by the GUI.

Specified by:
getLargeIcon in class DiagramComponent
Returns:
Icon

canResize

public boolean canResize(DiagramComponentWrapper wrapper)
Description copied from class: DiagramComponent
Tell whether the element can be resized by user.

Specified by:
canResize in class DiagramComponent
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 boolean canMove(DiagramComponentWrapper wrapper)
Description copied from class: DiagramComponent
Tell whether the element can be moved by user.

Specified by:
canMove in class DiagramComponent
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.

buildDCGraphics

protected DCGraphics buildDCGraphics(DiagramComponentWrapper wrapper,
                                     ProjectManager pm)
Description copied from class: DiagramComponent
Build a new graphical representation of the element as DCGraphics. This method must always build a new instance.

Specified by:
buildDCGraphics in class DiagramComponent
Parameters:
wrapper - The wrapper containing the attributes of the element the differ between diagrams.
pm - Project manager
Returns:
New DCGraphics instance

getSmallIcon

public ImageIcon getSmallIcon()
Description copied from class: ProjectComponent
Returns a 16*16 icon representing the project component type. The icon is used by GUI in the diagram tree.

Specified by:
getSmallIcon in class ProjectComponent

getTypeName

public String getTypeName()
Description copied from class: ProjectComponent
Returns the component type name formatted in a human-friendly manner. For example, a UML class diagram type should return "Class Diagram" or "UML Class Diagram" or similar, not "classdiagram" or "uml_class_diagram".

Specified by:
getTypeName in class ProjectComponent

buildAttributePanel

protected AttributePanel buildAttributePanel(ProjectManager pm)
Description copied from class: ProjectComponent
Build a new attribute panel. This method must build a new instance on every call. The default implementation returns a GenericAttributePanel instance. If you want to make your own attribute panel, override this method.

Overrides:
buildAttributePanel in class ProjectComponent
Parameters:
pm - Project Manager
Returns:
A new attribute panel
See Also:
GenericAttributePanel