net.sourceforge.toscanaj.model.diagram
Class LabelInfo

java.lang.Object
  extended bynet.sourceforge.toscanaj.model.diagram.LabelInfo
All Implemented Interfaces:
ChangeObservable, XMLizable

public class LabelInfo
extends java.lang.Object
implements XMLizable, ChangeObservable

This class encapsulates all information needed to paint a label.


Field Summary
static int ALIGNCENTER
          A constant for center alignment.
static int ALIGNLEFT
          A constant for left alignment.
static int ALIGNRIGHT
          A constant for right alignment.
 
Constructor Summary
LabelInfo()
          The default constructor creates a label with default settings.
LabelInfo(org.jdom.Element element)
           
LabelInfo(LabelInfo other)
          The copy constructor makes a deep copy without the observers.
 
Method Summary
 void addObserver(ChangeObserver observer)
          Method to add an observer.
 boolean equals(java.lang.Object obj)
           
 java.awt.Color getBackgroundColor()
          Returns the current background color.
 DiagramNode getNode()
          Returns the node the label belongs to.
 java.awt.geom.Point2D getOffset()
          Returns the current offset.
 int getTextAlignment()
          Returns the current text alignment.
 java.awt.Color getTextColor()
          Returns the current text color.
 void readXML(org.jdom.Element elem)
          Read this element as the content of elem.
 void removeObserver(ChangeObserver observer)
          Method to remove an observer.
 void setBackgroundColor(java.awt.Color color)
          Sets the background color.
 void setOffset(double x, double y)
          A convenience method mapping to setOffset(Point2D).
 void setOffset(java.awt.geom.Point2D offset)
          Sets the label offset.
 void setTextAlignment(int alignment)
          Sets the alignment of the text.
 void setTextColor(java.awt.Color color)
          Sets the text color.
 java.lang.String toString()
          Debug output.
 org.jdom.Element toXML()
          Write this element as the content of elem.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ALIGNLEFT

public static final int ALIGNLEFT
A constant for left alignment.

See Also:
Constant Field Values

ALIGNCENTER

public static final int ALIGNCENTER
A constant for center alignment.

See Also:
Constant Field Values

ALIGNRIGHT

public static final int ALIGNRIGHT
A constant for right alignment.

See Also:
Constant Field Values
Constructor Detail

LabelInfo

public LabelInfo()
The default constructor creates a label with default settings. A node has to be attached to it by calling attachNode(DiagramNode). The node is used for finding the position for the diagram line and to access the concept with the information on the contingents (strings).


LabelInfo

public LabelInfo(LabelInfo other)
The copy constructor makes a deep copy without the observers.


LabelInfo

public LabelInfo(org.jdom.Element element)
          throws XMLSyntaxError
Method Detail

toXML

public org.jdom.Element toXML()
Description copied from interface: XMLizable
Write this element as the content of elem.

Specified by:
toXML in interface XMLizable

readXML

public void readXML(org.jdom.Element elem)
             throws XMLSyntaxError
Description copied from interface: XMLizable
Read this element as the content of elem.

Specified by:
readXML in interface XMLizable
Throws:
XMLSyntaxError

getNode

public DiagramNode getNode()
Returns the node the label belongs to.


getOffset

public java.awt.geom.Point2D getOffset()
Returns the current offset.


setOffset

public void setOffset(java.awt.geom.Point2D offset)
Sets the label offset. The offset defines how far the label is moved from the point. The bahaviour is different for attribute and object labels: the attribute labels are positioned on top of a point, directly connecting to the top edge if the offset is (0,0). The object labels are below the points, contacting them at the bottom.


setOffset

public void setOffset(double x,
                      double y)
A convenience method mapping to setOffset(Point2D).


getBackgroundColor

public java.awt.Color getBackgroundColor()
Returns the current background color.


setBackgroundColor

public void setBackgroundColor(java.awt.Color color)
Sets the background color.


getTextColor

public java.awt.Color getTextColor()
Returns the current text color.


setTextColor

public void setTextColor(java.awt.Color color)
Sets the text color.


getTextAlignment

public int getTextAlignment()
Returns the current text alignment.


setTextAlignment

public void setTextAlignment(int alignment)
Sets the alignment of the text.


addObserver

public void addObserver(ChangeObserver observer)
Method to add an observer.

Specified by:
addObserver in interface ChangeObservable

removeObserver

public void removeObserver(ChangeObserver observer)
Method to remove an observer.

Specified by:
removeObserver in interface ChangeObservable

equals

public boolean equals(java.lang.Object obj)

toString

public java.lang.String toString()
Debug output.



The ToscanaJ project