net.sourceforge.toscanaj.model.diagram
Class DiagramNode

java.lang.Object
  extended bynet.sourceforge.toscanaj.model.diagram.DiagramNode
All Implemented Interfaces:
XMLizable
Direct Known Subclasses:
NDimDiagramNode, NestedDiagramNode

public class DiagramNode
extends java.lang.Object
implements XMLizable

Stores the information on a node in a diagram. This is mainly the position, the concept for the node and the information on the labels attached to it.


Field Summary
static java.lang.String ATTRIBUTE_LABEL_STYLE_ELEMENT_NAME
           
protected  LabelInfo attributeLabelInfo
          The layout information for the attribute label.
protected  Concept concept
          The concept the node represents.
protected  WriteableDiagram2D diagram
           
static java.lang.String ID_ATTRIBUTE_NAME
           
static java.lang.String NODE_ELEMENT_NAME
           
static java.lang.String OBJECT_LABEL_STYLE_ELEMENT_NAME
           
protected  LabelInfo objectLabelInfo
          The layout information for the attribute label.
protected  DiagramNode outerNode
           
protected  java.awt.geom.Point2D position
          The position of the node.
static java.lang.String POSITION_ELEMENT_NAME
           
static java.lang.String POSITION_X_ATTRIBUTE_NAME
           
static java.lang.String POSITION_Y_ATTRIBUTE_NAME
           
 
Constructor Summary
DiagramNode(DiagramNode other)
          A copy constructor creating a duplicate of the given node.
DiagramNode(WriteableDiagram2D diagram, org.jdom.Element element)
           
DiagramNode(WriteableDiagram2D diagram, java.lang.String identifier, java.awt.geom.Point2D position, Concept concept, LabelInfo attributeLabelInfo, LabelInfo objectLabelInfo, DiagramNode outerNode)
           
DiagramNode(WriteableDiagram2D diagram, java.lang.String identifier, java.awt.geom.Point2D position, Concept concept, LabelInfo attributeLabel, LabelInfo objectLabel, DiagramNode outerNode, double radiusX, double radiusY)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 LabelInfo getAttributeLabelInfo()
          Returns the layout information for the attribute label.
 Concept getConcept()
          Get the concept for this node.
 Concept[] getConceptNestingList()
           
static java.lang.String getElementName()
           
 Concept getFilterConcept()
          Returns the concept which should be used for filtering.
 java.lang.String getIdentifier()
           
 LabelInfo getObjectLabelInfo()
          Returns the layout information for the object label.
 DiagramNode getOuterNode()
           
 java.awt.geom.Point2D getPosition()
          Get the current node position.
 double getRadiusX()
          Get the horizontal radius used for this node.
 double getRadiusY()
          Get the vertical radius used for this node.
 double getX()
          Get the x coordinate in the model space.
 double getY()
          Get the y coordinate in the model space.
 boolean hasCollision()
          Returns true iff the node connects to a line it does not belong to.
 void invertY()
          Inverts the y-coordinates of the node and the labels offsets.
 void readXML(org.jdom.Element elem)
          Read this element as the content of elem.
 void setAttributeLabelInfo(LabelInfo labelInfo)
          Sets the layout information for the attribute label attached.
 void setObjectLabelInfo(LabelInfo labelInfo)
          Sets the layout information for the object label attached.
 void setPosition(double x, double y)
          Set the node position in the model space.
 void setPosition(java.awt.geom.Point2D position)
          Set the node position in the model space.
 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

concept

protected Concept concept
The concept the node represents. If this is set to null the node points to a not realised concept in the diagram, i.e. the concept theoretically could exist but is not supported by the current set of data.


position

protected java.awt.geom.Point2D position
The position of the node.


attributeLabelInfo

protected LabelInfo attributeLabelInfo
The layout information for the attribute label.


objectLabelInfo

protected LabelInfo objectLabelInfo
The layout information for the attribute label.


outerNode

protected DiagramNode outerNode

NODE_ELEMENT_NAME

public static final java.lang.String NODE_ELEMENT_NAME
See Also:
Constant Field Values

POSITION_ELEMENT_NAME

public static final java.lang.String POSITION_ELEMENT_NAME
See Also:
Constant Field Values

POSITION_X_ATTRIBUTE_NAME

public static final java.lang.String POSITION_X_ATTRIBUTE_NAME
See Also:
Constant Field Values

POSITION_Y_ATTRIBUTE_NAME

public static final java.lang.String POSITION_Y_ATTRIBUTE_NAME
See Also:
Constant Field Values

ID_ATTRIBUTE_NAME

public static final java.lang.String ID_ATTRIBUTE_NAME
See Also:
Constant Field Values

ATTRIBUTE_LABEL_STYLE_ELEMENT_NAME

public static final java.lang.String ATTRIBUTE_LABEL_STYLE_ELEMENT_NAME
See Also:
Constant Field Values

OBJECT_LABEL_STYLE_ELEMENT_NAME

public static final java.lang.String OBJECT_LABEL_STYLE_ELEMENT_NAME
See Also:
Constant Field Values

diagram

protected WriteableDiagram2D diagram
Constructor Detail

DiagramNode

public DiagramNode(WriteableDiagram2D diagram,
                   java.lang.String identifier,
                   java.awt.geom.Point2D position,
                   Concept concept,
                   LabelInfo attributeLabelInfo,
                   LabelInfo objectLabelInfo,
                   DiagramNode outerNode)

DiagramNode

public DiagramNode(WriteableDiagram2D diagram,
                   java.lang.String identifier,
                   java.awt.geom.Point2D position,
                   Concept concept,
                   LabelInfo attributeLabel,
                   LabelInfo objectLabel,
                   DiagramNode outerNode,
                   double radiusX,
                   double radiusY)

DiagramNode

public DiagramNode(WriteableDiagram2D diagram,
                   org.jdom.Element element)
            throws XMLSyntaxError

DiagramNode

public DiagramNode(DiagramNode other)
A copy constructor creating a duplicate of the given node. This is a deep copy for position and labels but refers to the same concept.

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

getIdentifier

public java.lang.String getIdentifier()

getOuterNode

public DiagramNode getOuterNode()

getFilterConcept

public Concept getFilterConcept()
Returns the concept which should be used for filtering. This is not the concept of this node if the node is nested into another node. In that case we use the concept of the outermost node.


getPosition

public java.awt.geom.Point2D getPosition()
Get the current node position.


setPosition

public final void setPosition(java.awt.geom.Point2D position)
Set the node position in the model space. This is just a convenience method calling setPosition(double, double). Do not override to ensure behaviour is consistent.


setPosition

public void setPosition(double x,
                        double y)
Set the node position in the model space.


getConcept

public Concept getConcept()
Get the concept for this node.


getX

public double getX()
Get the x coordinate in the model space.


getY

public double getY()
Get the y coordinate in the model space.


getRadiusX

public double getRadiusX()
Get the horizontal radius used for this node.


getRadiusY

public double getRadiusY()
Get the vertical radius used for this node.


getAttributeLabelInfo

public LabelInfo getAttributeLabelInfo()
Returns the layout information for the attribute label. This might be null if there is no label attached.


getObjectLabelInfo

public LabelInfo getObjectLabelInfo()
Returns the layout information for the object label. This might be null if there is no label attached.


setAttributeLabelInfo

public void setAttributeLabelInfo(LabelInfo labelInfo)
Sets the layout information for the attribute label attached.


setObjectLabelInfo

public void setObjectLabelInfo(LabelInfo labelInfo)
Sets the layout information for the object label attached.


invertY

public void invertY()
Inverts the y-coordinates of the node and the labels offsets. This is used when the diagram given has the y-axis pointing upwards.

See Also:
SimpleLineDiagram.checkCoordinateSystem()

toString

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


getElementName

public static java.lang.String getElementName()

getConceptNestingList

public Concept[] getConceptNestingList()

equals

public boolean equals(java.lang.Object obj)

hasCollision

public boolean hasCollision()
Returns true iff the node connects to a line it does not belong to.



The ToscanaJ project