com.tensegrity.graphics
Class AbstractPrimitive

java.lang.Object
  extended bycom.tensegrity.graphics.AbstractPrimitive
All Implemented Interfaces:
Attributable, AttributableOnSet, BaseInteractable, Primitive
Direct Known Subclasses:
Ellipse2D, Label2D, Line2D, Polygon2D, Polyline2D, Rect2D

public abstract class AbstractPrimitive
extends java.lang.Object
implements Primitive

The AbstractPrimitive class contains the shared, reusable code needed by all of our Primitive implementations. By deriving from this abstract base class, concrete Primitive classes are much easier to write and maintain.

It is not possible for the AbstractPrimitive class to implement all methods defined in the Primitive interface for the obvious reason that some methods require specialized behavior.

You will not create instances of this abstract class but an instance of derived class.

Version:
$Id: AbstractPrimitive.java,v 1.81 2006/04/13 10:10:56 MichaelKegel Exp $
Author:
MichaelKegel

Field Summary
protected  AttributableOnSetListener attributableOnSetListener
          instance variable that holds the AttributableOnSetListeners currently registered at the Primitive.
protected  boolean doAttributableEvents
          instance variable that indicates whether the registered AttributableOnSetListeners should be notified on changes or not
protected  java.util.HashMap infovalueregistry
           
protected  InteractionDescriptor interactionDescriptor
          instance variable for the InteractionDescriptor of this Primitve
protected  boolean selected
          instance variable that indicats whether this Primitve is currently selected or not
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Constructor Summary
AbstractPrimitive()
          Default constructor necessary for deserialization.
AbstractPrimitive(boolean hasStroke, boolean hasPaint, boolean hasFont)
          Constructor specifying whether this Primitve has a default Stroke-, Paint- and FontFormat.
 
Method Summary
 void addAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
          Adds a listener to the attributable on set instance.
 void addInfoValue(java.lang.Object key, java.lang.Object value)
           Adds the infovalue given by value with the given key to the infovalue registry of the Primitive.
 void addOrSetInfoValue(java.lang.Object key, java.lang.Object value)
           Adds the infovalue given by value with the given key to the infovalue registry of the Primitive.
 boolean areAttributableEventsEnabled()
          Returns a boolean that indicates whether generating of events is enabled or not.
 void disableAttributableEvents()
          Disables events for the registered listeners.
 void enableAttributableEvents()
          Enables the transmission of events to registered listeners.
protected  void fireAttributableOnSetChangedEvent(AttributeSet attributeschanged_tablelike, AttributeSet attributeschanged_treelike)
          Fires the attributableonset has changed event internally in order to notify all registered listener that one or many of the attribute of the Primitive instance has/have been changed.
protected  void fireAttributableOnSetChangedEvent(AttributeSet attributeschanged_tablelike, AttributeSet attributeschanged_treelike, java.util.Map attribute2oldvalue_tablelike, java.util.Map attribute2oldvalue_treelike)
          Fires the attributableonset has changed event internally in order to notify all registered listener that one or many of the attribute of the Primitive instance has/have been changed.
 Attribute getAttribute(java.lang.String name)
          Returns the attribute with the given name or null if there is no Attribute with the given name.
 AttributeType getAttributeType(java.lang.String name)
          Returns the AttributeType of the attribute with the given name.
 java.lang.Object getAttributeValue(java.lang.String name)
          Return the value of the attribute with the given name.
 FontFormat getFont()
          Returns the FontFormat that is used by this Primitive to draw text.
 java.lang.Object getInfoValue(java.lang.Object key)
          Returns the infovalue that is stored with the given key in the infovalue registry of the Primitive.
 InteractionDescriptor getInteractionDescriptor()
          This method returns the InteractionDescriptor for the BaseInteractable.
 InteractionItem getMoveItem()
          Returns the InteractionItem that is used to move the BaseInteractable.
 PaintFormat getPaint()
          Returns the PaintFormat that is used by the Primitive to fill areas.
 RenderingData getRenderingData(Transform2D xform_context)
          Returns a RenderingData instance, which are used by a Renderer implementation to render a Primitive.
 StrokeFormat getStroke()
          Returns the StrokeFormat that is used by the Primitive to draw lines, borders and such.
 Transform2D getTransform()
          Returns a Transform2D currently used to transform the coordinates of the graphical Primitive.
 boolean hasInfoValue(java.lang.Object key)
          Returns a boolean that indicates whether an infovalue with the key given by key is already registered or not.
 InteractionItem hits(InteractionInfo interactionInfo)
          This method is called to check if the given point hits the BaseInteractable object.
protected abstract  InteractionDescriptor internalCreateInteractionDescriptor()
          This method should return an InteractionDescriptor that defines the interaction capabilities of a certain Primitive.
protected  void internalDeepCopyInfoValues(java.util.HashMap infovalueregistry)
          Deep copies the info values stored in the info-value-registry given by infovalueregistry into the info-value-registry of this Primitive.
 void internalEnableSelection(boolean enabled)
          Sets the internal state of selectability for this BaseInteractable instance to the value given by enabled.
 InteractionItem internalSelect(InteractionInfo interactionInfo)
          This method is called by the InteractionContext to select the BaseInteractable.
protected  boolean internalSetFont(FontFormat font, AttributeSet attributeschanged_tablelike, AttributeSet attributeschanged_treelike)
           
protected  void internalSetPaint(PaintFormat paint, AttributeSet attributeschanged_tablelike, AttributeSet attributeschanged_treelike)
           
 void internalSetSelected(boolean select)
          Sets the state of selection for this BaseInteractable to the value given by select.
protected  void internalSetStroke(StrokeFormat stroke, java.lang.String attributename)
           
protected  void internalSetStroke(StrokeFormat stroke, java.lang.String attributename, AttributeSet attributeschanged_tablelike, AttributeSet attributeschanged_treelike)
           
 boolean isMovable()
          Returns a boolean that indicates whether this BaseInteractable is movable or not.
 boolean isSelectable()
          Returns a boolean that indicates whether is it allowed to select the BaseInteractable or not.
 boolean isSelected()
          Returns a boolean that indicates whether this BaseInteractable is selected or not.
 void mouseClick(InteractionInfo interactionInfo)
          This method is called when a mouse button click has been occured upon the BaseInteractable.
 void mouseDown(InteractionInfo interactionInfo)
          This method is called when a mouse button has been pressed upon the BaseInteractable.
 void mouseEnter(InteractionInfo interactionInfo)
          This method is called when the mouse cursor has entered the BaseInteractable bounding box.
 void mouseExit(InteractionInfo interactionInfo)
          This method is called when the mouse cursor has exited the BaseInteractable bounding box.
 void mouseUp(InteractionInfo interactionInfo)
          This method is called when a mouse button has been released upon the BaseInteractable.
 void postActing(InteractionInfo interactionInfo, int itemspecifier)
          This method is called by the InteractionContext while the interaction takes place.
 boolean preActing(InteractionInfo interactionInfo, int itemspecifier)
          This method is called by the InteractionContext while the interaction takes place.
protected  boolean raiseAttributableEvents()
           
 void removeAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
          Removes a listener from the attributable on set instance.
 void removeInfoValue(java.lang.Object key)
          Removes the infovalue that is stored with the given key in the infovalue registry of the Primitive from the infovalue registry.
 InteractionItem select(InteractionInfo interactionInfo)
          This method is called by the InteractionContext to select the BaseInteractable.
 void setAttribute(Attribute attribute)
          Sets the value of the attribute with the same name to the value of the given attribute.
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          Sets the value of the attribute with the name to the given value.
 void setFontFormat(FontFormat font)
          Sets the FontFormat for the Primitive.
 void setInfoValue(java.lang.Object key, java.lang.Object newValue)
           Sets the value of the infovalue with the key given by key to the value given by newValue.
 void setMovable(boolean movable)
          Sets the state of movability for this BaseInteractable to the value given by movable.
 void setPaint(PaintFormat paint)
          Sets the PaintFormat for the Primitive.
 void setSelectable(boolean allowSelection)
          Sets the state of selectability for this BaseInteractable to the value given by selectable.
 void setSelected(boolean selected)
          Sets the state of selection for this BaseInteractable to the value given by selected.
 void setTransform(Transform2D transform)
          Sets the Transform2D given by transform as the new transform for the coordinates of the Primitive.
 boolean startAction(InteractionInfo interactionInfo, int itemspecifier)
          This method is called by the InteractionContext before the interaction takes place.
 void stopAction(InteractionInfo interactionInfo, int itemspecifier)
          This method is called by the InteractionContext after the interaction has taken place.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tensegrity.graphics.Primitive
applyState, deepCopy, getBoundingBox, getIllustrator, getState, setStroke
 
Methods inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
getAttributes, getAttributesTree, setAttributes, setAttributesTree
 

Field Detail

selected

protected boolean selected
instance variable that indicats whether this Primitve is currently selected or not


interactionDescriptor

protected InteractionDescriptor interactionDescriptor
instance variable for the InteractionDescriptor of this Primitve


attributableOnSetListener

protected AttributableOnSetListener attributableOnSetListener
instance variable that holds the AttributableOnSetListeners currently registered at the Primitive.


doAttributableEvents

protected boolean doAttributableEvents
instance variable that indicates whether the registered AttributableOnSetListeners should be notified on changes or not


infovalueregistry

protected java.util.HashMap infovalueregistry
Constructor Detail

AbstractPrimitive

public AbstractPrimitive()
Default constructor necessary for deserialization.


AbstractPrimitive

public AbstractPrimitive(boolean hasStroke,
                         boolean hasPaint,
                         boolean hasFont)
Constructor specifying whether this Primitve has a default Stroke-, Paint- and FontFormat.

Parameters:
hasStroke - true, if this Primitve should have a default StrokeFormat.
hasPaint - true, if this Primitve should have a default PaintFormat.
hasFont - true, if this Primitve should have a default FontFormat.
Method Detail

getStroke

public StrokeFormat getStroke()
Description copied from interface: Primitive
Returns the StrokeFormat that is used by the Primitive to draw lines, borders and such. The returned StrokeFormat can be null for Primitives that have no lines, borders or such.

Specified by:
getStroke in interface Primitive
Returns:
StrokeFormat

internalSetStroke

protected final void internalSetStroke(StrokeFormat stroke,
                                       java.lang.String attributename)

internalSetStroke

protected final void internalSetStroke(StrokeFormat stroke,
                                       java.lang.String attributename,
                                       AttributeSet attributeschanged_tablelike,
                                       AttributeSet attributeschanged_treelike)

getPaint

public PaintFormat getPaint()
Description copied from interface: Primitive
Returns the PaintFormat that is used by the Primitive to fill areas. The returned PaintFormat can be null for Primitives that have no areas.

Specified by:
getPaint in interface Primitive
Returns:
PaintFormat

setPaint

public void setPaint(PaintFormat paint)
Description copied from interface: Primitive
Sets the PaintFormat for the Primitive.

Specified by:
setPaint in interface Primitive
Parameters:
paint - the PaintFormat to use

internalSetPaint

protected final void internalSetPaint(PaintFormat paint,
                                      AttributeSet attributeschanged_tablelike,
                                      AttributeSet attributeschanged_treelike)

getFont

public FontFormat getFont()
Description copied from interface: Primitive
Returns the FontFormat that is used by this Primitive to draw text. The returned FontFormat can be null for Primitives that have no text.

Specified by:
getFont in interface Primitive
Returns:
FontFormat

setFontFormat

public void setFontFormat(FontFormat font)
Description copied from interface: Primitive
Sets the FontFormat for the Primitive.

Specified by:
setFontFormat in interface Primitive
Parameters:
font - the FontFormat to use

internalSetFont

protected final boolean internalSetFont(FontFormat font,
                                        AttributeSet attributeschanged_tablelike,
                                        AttributeSet attributeschanged_treelike)

getTransform

public final Transform2D getTransform()
Description copied from interface: Primitive
Returns a Transform2D currently used to transform the coordinates of the graphical Primitive.

Specified by:
getTransform in interface Primitive
Returns:
Transform2D the current transform of the Primitive

setTransform

public void setTransform(Transform2D transform)
Description copied from interface: Primitive
Sets the Transform2D given by transform as the new transform for the coordinates of the Primitive.

Specified by:
setTransform in interface Primitive
Parameters:
transform - the new transform of the Primitive, may not be null.

hasInfoValue

public boolean hasInfoValue(java.lang.Object key)
Description copied from interface: Primitive
Returns a boolean that indicates whether an infovalue with the key given by key is already registered or not.

Specified by:
hasInfoValue in interface Primitive
Parameters:
key - the key to check for
Returns:
boolean a flag that indicates whether the given key is in use or not

addInfoValue

public void addInfoValue(java.lang.Object key,
                         java.lang.Object value)
Description copied from interface: Primitive

Adds the infovalue given by value with the given key to the infovalue registry of the Primitive.

If there is already an infovalue registered with the given key an InvalidArgumentException is thrown.

Specified by:
addInfoValue in interface Primitive
Parameters:
key - the key to store the infovalue with
value - the infovalue to store

removeInfoValue

public void removeInfoValue(java.lang.Object key)
Description copied from interface: Primitive
Removes the infovalue that is stored with the given key in the infovalue registry of the Primitive from the infovalue registry.

Specified by:
removeInfoValue in interface Primitive
Parameters:
key - the key of the infovalue to remove

getInfoValue

public java.lang.Object getInfoValue(java.lang.Object key)
Description copied from interface: Primitive
Returns the infovalue that is stored with the given key in the infovalue registry of the Primitive. If there is no infovalue stored for the given key the methods returns null

Specified by:
getInfoValue in interface Primitive
Parameters:
key - the key to return the infovalue for
Returns:
the info value for the given key or null if there is none

setInfoValue

public void setInfoValue(java.lang.Object key,
                         java.lang.Object newValue)
Description copied from interface: Primitive

Sets the value of the infovalue with the key given by key to the value given by newValue.

If there is no infovalue registered with the given key an InvalidArgumentException is thrown.

Specified by:
setInfoValue in interface Primitive
Parameters:
key - the key of the infovalue to set a new value for
newValue - the new value for the infovalue

addOrSetInfoValue

public void addOrSetInfoValue(java.lang.Object key,
                              java.lang.Object value)
Description copied from interface: Primitive

Adds the infovalue given by value with the given key to the infovalue registry of the Primitive.

If there is already an infovalue registered with the given key the value given by value is set as the new value of the infovalue.

Specified by:
addOrSetInfoValue in interface Primitive
Parameters:
key - the key to store the infovalue with
value - the infovalue to store or set

getRenderingData

public RenderingData getRenderingData(Transform2D xform_context)
Description copied from interface: Primitive
Returns a RenderingData instance, which are used by a Renderer implementation to render a Primitive.
To get more informations about the RenderingData object see the class documentation above or the documentation of the RenderingData class.
To get more information about the Renderer technique see the class documentation above or the documentation of the Renderer class.

Specified by:
getRenderingData in interface Primitive
Parameters:
xform_context - the transformation of the context the Primitive lies within. May not be null.
Returns:
RenderingData the RenderingData instance

isSelectable

public boolean isSelectable()
Description copied from interface: BaseInteractable
Returns a boolean that indicates whether is it allowed to select the BaseInteractable or not.

Specified by:
isSelectable in interface BaseInteractable
Returns:
boolean that indicates the state of selectability for the BaseInteractable

setSelectable

public void setSelectable(boolean allowSelection)
Description copied from interface: BaseInteractable
Sets the state of selectability for this BaseInteractable to the value given by selectable.

Specified by:
setSelectable in interface BaseInteractable
Parameters:
allowSelection - the new state of selectability for the BaseInteractable

internalEnableSelection

public void internalEnableSelection(boolean enabled)
Description copied from interface: BaseInteractable
Sets the internal state of selectability for this BaseInteractable instance to the value given by enabled.
Normally this method is only called by the Interaction API itself and it is recommended not to use it.

Specified by:
internalEnableSelection in interface BaseInteractable
Parameters:
enabled - the new state of internal selectability for the BaseInteractable instance

isSelected

public boolean isSelected()
Description copied from interface: BaseInteractable
Returns a boolean that indicates whether this BaseInteractable is selected or not.

Specified by:
isSelected in interface BaseInteractable
Returns:
boolean that indicates the state of selection for this BaseInteractable

setSelected

public void setSelected(boolean selected)
Description copied from interface: BaseInteractable
Sets the state of selection for this BaseInteractable to the value given by selected.

Specified by:
setSelected in interface BaseInteractable
Parameters:
selected - the new state of selection for this BaseInteractable

internalSetSelected

public void internalSetSelected(boolean select)
Description copied from interface: BaseInteractable
Sets the state of selection for this BaseInteractable to the value given by select.
NOTICE that this method is an internal method and should mostly never be used from outside. The difference to the BaseInteractable.setSelected(boolean) method is that not the complete hierarchy is selected the BaseInteractable may be belongs to.

Specified by:
internalSetSelected in interface BaseInteractable
Parameters:
select - the new state of selection for this BaseInteractable

isMovable

public boolean isMovable()
Description copied from interface: BaseInteractable
Returns a boolean that indicates whether this BaseInteractable is movable or not.

Specified by:
isMovable in interface BaseInteractable
Returns:
boolean that indicates the state of movability for the BaseInteractable

setMovable

public void setMovable(boolean movable)
Description copied from interface: BaseInteractable
Sets the state of movability for this BaseInteractable to the value given by movable.

Specified by:
setMovable in interface BaseInteractable
Parameters:
movable - the new state of movability

getMoveItem

public InteractionItem getMoveItem()
Description copied from interface: BaseInteractable
Returns the InteractionItem that is used to move the BaseInteractable. The returned value can be null if there is no InteractionItem defined for moving the BaseInteractable.

Specified by:
getMoveItem in interface BaseInteractable
Returns:
InteractionItem that is used to move the BaseInteractable

getInteractionDescriptor

public InteractionDescriptor getInteractionDescriptor()
Description copied from interface: BaseInteractable
This method returns the InteractionDescriptor for the BaseInteractable.

Specified by:
getInteractionDescriptor in interface BaseInteractable
Returns:
InteractionDescriptor for the BaseInteractable
See Also:
InteractionDescriptor

mouseEnter

public void mouseEnter(InteractionInfo interactionInfo)
Description copied from interface: BaseInteractable
This method is called when the mouse cursor has entered the BaseInteractable bounding box.

Specified by:
mouseEnter in interface BaseInteractable
Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

mouseExit

public void mouseExit(InteractionInfo interactionInfo)
Description copied from interface: BaseInteractable
This method is called when the mouse cursor has exited the BaseInteractable bounding box.

Specified by:
mouseExit in interface BaseInteractable
Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

mouseDown

public void mouseDown(InteractionInfo interactionInfo)
Description copied from interface: BaseInteractable
This method is called when a mouse button has been pressed upon the BaseInteractable.

Specified by:
mouseDown in interface BaseInteractable
Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

mouseUp

public void mouseUp(InteractionInfo interactionInfo)
Description copied from interface: BaseInteractable
This method is called when a mouse button has been released upon the BaseInteractable.

Specified by:
mouseUp in interface BaseInteractable
Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

mouseClick

public void mouseClick(InteractionInfo interactionInfo)
Description copied from interface: BaseInteractable
This method is called when a mouse button click has been occured upon the BaseInteractable.

Specified by:
mouseClick in interface BaseInteractable
Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

hits

public InteractionItem hits(InteractionInfo interactionInfo)
Description copied from interface: BaseInteractable
This method is called to check if the given point hits the BaseInteractable object. It returns null if the object is not hit or the responsable InteractionItem. Notice that it do not influence the state of selected for the BaseInteractable.

Specified by:
hits in interface BaseInteractable
Parameters:
interactionInfo - the InteractionInfo's to check, may not be null.
Returns:
InteractionItem the responsible selection item or null.

select

public InteractionItem select(InteractionInfo interactionInfo)
Description copied from interface: BaseInteractable
This method is called by the InteractionContext to select the BaseInteractable. It returns null if the BaseInteractable is not hit or the responsible InteractionItem.

Specified by:
select in interface BaseInteractable
Parameters:
interactionInfo - the InteractionInfo's to check, may not be null.
Returns:
the responsible InteractionItem or null.

internalSelect

public InteractionItem internalSelect(InteractionInfo interactionInfo)
Description copied from interface: BaseInteractable
This method is called by the InteractionContext to select the BaseInteractable. It returns null if the BaseInteractable is not hit or the responsable InteractionItem.
NOTICE: This method is an internal method and should mostly never be used from outside. The difference to the BaseInteractable.select(com.tensegrity.graphics.interaction.InteractionInfo) method is that the flag returned by BaseInteractable.isSelected() will not be changed nor an event is generated by a call to this method.

Specified by:
internalSelect in interface BaseInteractable
Parameters:
interactionInfo - the InteractionInfo to check, may not be null.
Returns:
InteractionItem the reponsable selection item or null

preActing

public boolean preActing(InteractionInfo interactionInfo,
                         int itemspecifier)
Description copied from interface: BaseInteractable
This method is called by the InteractionContext while the interaction takes place. The prefix pre indicates that it is called before the InteractionContext calls the InteractionItem to do his work. The returned boolean indicates whether it is allowed to interact with the BaseInteractable or not.

Specified by:
preActing in interface BaseInteractable
Parameters:
interactionInfo - the InteractionInfo instance; must not be null.
itemspecifier - the specifier of the InteractionItem the InteractionContext will use
Returns:
boolean that indicates whether it is allowed to interact with the BaseInteractable

postActing

public void postActing(InteractionInfo interactionInfo,
                       int itemspecifier)
Description copied from interface: BaseInteractable
This method is called by the InteractionContext while the interaction takes place. The prefix post indicates that it is called after the InteractionContext has called the InteractionItem to do his work, so that the BaseInteractable can update needed values, fire events and such

Specified by:
postActing in interface BaseInteractable
Parameters:
interactionInfo - the InteractionInfo instance; must not be null.
itemspecifier - the specifier of the InteractionItem the InteractionContext will use

startAction

public boolean startAction(InteractionInfo interactionInfo,
                           int itemspecifier)
Description copied from interface: BaseInteractable
This method is called by the InteractionContext before the interaction takes place. It enables the BaseInteractable object to fire events or to prepare some datas und such. The returned value indicates that interaction is allowed or not.

Specified by:
startAction in interface BaseInteractable
Parameters:
interactionInfo - the InteractionInfo instance; must not be null.
itemspecifier - the specifier of the InteractionItem the InteractionContext will use.
Returns:
boolean a flag that indicates whether interaction is allowed or not.

stopAction

public void stopAction(InteractionInfo interactionInfo,
                       int itemspecifier)
Description copied from interface: BaseInteractable
This method is called by the InteractionContext after the interaction has taken place. It enabled the BaseInteractable object to fire events, update some datas and such.

Specified by:
stopAction in interface BaseInteractable
Parameters:
interactionInfo - the InteractionInfo instance; must not be null.
itemspecifier - the specifier of the InteractionItem the InteractionContext will use

getAttribute

public Attribute getAttribute(java.lang.String name)
Description copied from interface: Attributable
Returns the attribute with the given name or null if there is no Attribute with the given name.

Specified by:
getAttribute in interface Attributable
Parameters:
name - name of the attribute to return.
Returns:
the attribute with the given name or null.

getAttributeType

public AttributeType getAttributeType(java.lang.String name)
Description copied from interface: Attributable
Returns the AttributeType of the attribute with the given name.

Specified by:
getAttributeType in interface Attributable
Parameters:
name - the name of the attribute.
Returns:
the attribute type with given name.

getAttributeValue

public java.lang.Object getAttributeValue(java.lang.String name)
Description copied from interface: Attributable
Return the value of the attribute with the given name.

Specified by:
getAttributeValue in interface Attributable
Parameters:
name - the name of the attribute to return the value from.
Returns:
the value of the attribute with the given name.

setAttribute

public void setAttribute(Attribute attribute)
                  throws IllegalValueException,
                         ConstraintViolationException
Description copied from interface: Attributable
Sets the value of the attribute with the same name to the value of the given attribute.
Notice: If the specific implementor of the Attributable interface doesn't support an Attribute with the name of the Attribute given by attribute, the given attribute is not handled by nor added to the attributes of the Attributable.

Specified by:
setAttribute in interface Attributable
Parameters:
attribute - the attribute to be set.
Throws:
ConstraintViolationException - is thrown when the value of the given Attribute violates the constraint of the Attribute to set.
IllegalValueException - is thrown when the value of the given Attribute is illegal (for instance when it is null).

setAttributeValue

public void setAttributeValue(java.lang.String name,
                              java.lang.Object value)
                       throws IllegalValueException,
                              ConstraintViolationException
Description copied from interface: Attributable
Sets the value of the attribute with the name to the given value.
Notice: If the specific implementor of the Attributable interface doesn't support an Attribute with the name given by name, the attribute given through name and value is not handled nor created by Attributable.

Specified by:
setAttributeValue in interface Attributable
Parameters:
name - the name of the attribute.
value - the value to set the attributes value to.
Throws:
ConstraintViolationException - is thrown when the given value violates the constraint of the Attribute to set.
IllegalValueException - is thrown when the given value is illegal (for instance when it is null).

addAttributableOnSetListener

public void addAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
Description copied from interface: AttributableOnSet
Adds a listener to the attributable on set instance.

Specified by:
addAttributableOnSetListener in interface AttributableOnSet
Parameters:
attributableOnSetListener - an AttributableOnSet listener listening for changes

removeAttributableOnSetListener

public void removeAttributableOnSetListener(AttributableOnSetListener attributableOnSetListener)
Description copied from interface: AttributableOnSet
Removes a listener from the attributable on set instance.

Specified by:
removeAttributableOnSetListener in interface AttributableOnSet
Parameters:
attributableOnSetListener - the AttributableOnSet to be removed from the list of listeners.

enableAttributableEvents

public void enableAttributableEvents()
Description copied from interface: AttributableOnSet
Enables the transmission of events to registered listeners.

Specified by:
enableAttributableEvents in interface AttributableOnSet

disableAttributableEvents

public void disableAttributableEvents()
Description copied from interface: AttributableOnSet
Disables events for the registered listeners.

Specified by:
disableAttributableEvents in interface AttributableOnSet

areAttributableEventsEnabled

public boolean areAttributableEventsEnabled()
Description copied from interface: AttributableOnSet
Returns a boolean that indicates whether generating of events is enabled or not.

Specified by:
areAttributableEventsEnabled in interface AttributableOnSet
Returns:
boolean flag that indicates whether event generation is active or not

internalCreateInteractionDescriptor

protected abstract InteractionDescriptor internalCreateInteractionDescriptor()
This method should return an InteractionDescriptor that defines the interaction capabilities of a certain Primitive. Since the InteractionDescriptor varies for different kinds of primitives this method is declared as abstract and must be implemented for each Primitive that is based on the AbstractPrimitive class.
NOTICE: The return value must not be null.

Returns:
InteractionDescriptor the InteractionDescriptor for the certain Primitive instance

fireAttributableOnSetChangedEvent

protected void fireAttributableOnSetChangedEvent(AttributeSet attributeschanged_tablelike,
                                                 AttributeSet attributeschanged_treelike)
Fires the attributableonset has changed event internally in order to notify all registered listener that one or many of the attribute of the Primitive instance has/have been changed.


fireAttributableOnSetChangedEvent

protected void fireAttributableOnSetChangedEvent(AttributeSet attributeschanged_tablelike,
                                                 AttributeSet attributeschanged_treelike,
                                                 java.util.Map attribute2oldvalue_tablelike,
                                                 java.util.Map attribute2oldvalue_treelike)
Fires the attributableonset has changed event internally in order to notify all registered listener that one or many of the attribute of the Primitive instance has/have been changed.
Additionally this method provides the possibility to transport the old values of the changed attributes with the event.


raiseAttributableEvents

protected final boolean raiseAttributableEvents()

internalDeepCopyInfoValues

protected final void internalDeepCopyInfoValues(java.util.HashMap infovalueregistry)
Deep copies the info values stored in the info-value-registry given by infovalueregistry into the info-value-registry of this Primitive.

Parameters:
infovalueregistry - the info-value-registry to copy the info values from


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.