be.ac.vub.cocompose.lang.impl.core
Class DefaultRelationElement

java.lang.Object
  extended bybe.ac.vub.cocompose.lang.impl.DefaultElement
      extended bybe.ac.vub.cocompose.lang.impl.core.DefaultModelElement
          extended bybe.ac.vub.cocompose.lang.impl.core.DefaultNamespace
              extended bybe.ac.vub.cocompose.lang.impl.core.DefaultRelationElement
All Implemented Interfaces:
Cloneable, Element, ModelElement, Namespace, RelationElement, VisitedElement
Direct Known Subclasses:
DefaultRefinedElement

public abstract class DefaultRelationElement
extends DefaultNamespace
implements RelationElement

Represents CoCompose language elements that can participate in a relationship.

Since:
0.2.0
Version:
0.2.5, 03/03/2004
Author:
Dennis Wagelaar

Constructor Summary
DefaultRelationElement()
           
 
Method Summary
 void accept(ModelVisitor modelVisitor)
          Accepts a visitor.
 void addRelationship(int index, Relationship relationship)
          Adds a relationship for this element at the specified index.
 void addRelationship(Relationship relationship)
          Adds a relationship for this element.
protected  void fireBackgroundColorUpdate()
          Fires an ID_BGCOLOR event for the hierarchy of owned elements.
 Color getBackgroundColor()
          Gets the background color.
protected  Color getDefaultBackgroundColor()
          Gets the default background color.
 Point getPosition()
          Gets the element position.
 List getRelationships()
          Gets the relationships for this element.
 List getSourceRelationships()
          Gets the source relationships for this element.
 List getTargetRelationships()
          Gets the target relationships for this element.
 void removeRelationship(Relationship relationship)
          Removes a relationship from this element.
 void setBackgroundColor(Color bgcolor)
          Sets the background color.
 void setPosition(Point position)
          Sets the element position.
 
Methods inherited from class be.ac.vub.cocompose.lang.impl.core.DefaultNamespace
addOwnedElement, addOwnedElement, getDeepOwnedElement, getDeepOwnedElements, getOwnedElement, getOwnedElementId, getOwnedElements, getOwnedElements, getOwnedIds, isRegistered, registerNameChange, removeOwnedElement, translateIndex, translateIndex
 
Methods inherited from class be.ac.vub.cocompose.lang.impl.core.DefaultModelElement
getId, getModel, getName, getNamespace, getRootNamespace, setId, setName, setNamespace, toString
 
Methods inherited from class be.ac.vub.cocompose.lang.impl.DefaultElement
addPropertyChangeListener, firePropertyChange, fireStructureChange, removePropertyChangeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface be.ac.vub.cocompose.lang.core.Namespace
addOwnedElement, addOwnedElement, getDeepOwnedElement, getDeepOwnedElements, getOwnedElement, getOwnedElementId, getOwnedElements, getOwnedElements, getOwnedIds, isRegistered, registerNameChange, removeOwnedElement
 
Methods inherited from interface be.ac.vub.cocompose.lang.core.ModelElement
getId, getModel, getName, getNamespace, getRootNamespace, setId, setName, setNamespace
 
Methods inherited from interface be.ac.vub.cocompose.lang.Element
addPropertyChangeListener, removePropertyChangeListener
 

Constructor Detail

DefaultRelationElement

public DefaultRelationElement()
Method Detail

getDefaultBackgroundColor

protected Color getDefaultBackgroundColor()
Gets the default background color.

Returns:
the default background color.

getRelationships

public List getRelationships()
Gets the relationships for this element.

Specified by:
getRelationships in interface RelationElement
Returns:
a copy of the list of relationships.

getSourceRelationships

public List getSourceRelationships()
Gets the source relationships for this element.

Specified by:
getSourceRelationships in interface RelationElement
Returns:
the list of source relationships.

getTargetRelationships

public List getTargetRelationships()
Gets the target relationships for this element.

Specified by:
getTargetRelationships in interface RelationElement
Returns:
the list of target relationships.

accept

public void accept(ModelVisitor modelVisitor)
            throws ModelElementException
Accepts a visitor.

Specified by:
accept in interface VisitedElement
Overrides:
accept in class DefaultNamespace
Parameters:
modelVisitor - The visitor to accept.
Throws:
ModelElementException

addRelationship

public void addRelationship(Relationship relationship)
Adds a relationship for this element.

Specified by:
addRelationship in interface RelationElement
Parameters:
relationship - - the relationship to add.

addRelationship

public void addRelationship(int index,
                            Relationship relationship)
Adds a relationship for this element at the specified index.

Specified by:
addRelationship in interface RelationElement
Parameters:
index - - the index at which to add the relationship.
relationship - - the relationship to add.

removeRelationship

public void removeRelationship(Relationship relationship)
Removes a relationship from this element.

Specified by:
removeRelationship in interface RelationElement
Parameters:
relationship - - the relationship to remove.

getPosition

public Point getPosition()
Gets the element position.

Specified by:
getPosition in interface RelationElement
Returns:
the position.

setPosition

public void setPosition(Point position)
Sets the element position.

Specified by:
setPosition in interface RelationElement
Parameters:
position - - the position.

getBackgroundColor

public Color getBackgroundColor()
Gets the background color.

Specified by:
getBackgroundColor in interface RelationElement
Returns:
the background color.

setBackgroundColor

public void setBackgroundColor(Color bgcolor)
Sets the background color.

Specified by:
setBackgroundColor in interface RelationElement
Parameters:
bgcolor - - the background color.

fireBackgroundColorUpdate

protected void fireBackgroundColorUpdate()
Fires an ID_BGCOLOR event for the hierarchy of owned elements.