com.tensegrity.graphics.primitive2D
Class Label2D

java.lang.Object
  extended bycom.tensegrity.graphics.AbstractPrimitive
      extended bycom.tensegrity.graphics.primitive2D.Label2D
All Implemented Interfaces:
Attributable, AttributableOnSet, BaseInteractable, Interactable, Primitive

public class Label2D
extends AbstractPrimitive
implements Interactable

An object of class Label2D represents a 2-dimensional multi-lined text area that may be edited in-place.

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

Field Summary
protected  BoundingBox bbox
          instance variable for the labels bounding box
 boolean doSizeAdjustments
          instance variable that indicates whether the label should attend the size-adjustment mode or not (used in the context of composites)
protected static double[] tmpCoords
          instance variable that is used to transform the coordinates of the rectangle
protected static int[] tmpPtX
          instance variable that is used to transform the coordinates of the rectangle
protected static int[] tmpPtY
          instance variable that is used to transform the coordinates of the rectangle
 boolean updateTextFormatter
          instance variable that indicates whether to update the text formatter or not
static boolean USE_COMPENSATION_FOR_SIZE_ADJUSTMENT
          USE_COMPENSATION_FOR_SIZE_ADJUSTMENT: If this is true, the Label2D will use a transformation to compensate the stretching that occurs by using size adjustment.
 
Fields inherited from class com.tensegrity.graphics.AbstractPrimitive
attributableOnSetListener, doAttributableEvents, infovalueregistry, interactionDescriptor, selected
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Constructor Summary
Label2D()
          Constructor that creates an empty Label2D.
Label2D(int left, int top, int right, int bottom)
          Constructor that creates a Label2D with the coordinates given by left, top, right and bottom.
Label2D(Label2D label)
          Copy constructor for Label2D.
 
Method Summary
protected  void addSpecificAttributes(AttributeFactory factory, AttributeSet attributes)
          Add the specific attributes of a Label2D to the AttributeSet given by attributes.
 void applyState(PrimitiveState state)
           
 BoundingBox calculateBoundingBox(InteractionInfo interactionInfo)
           
 Primitive deepCopy()
          An implementation of this method is responsible for returning a deep- copy of the Primitive instance
 void enableAutomaticShortening(boolean enable)
          If set to true lines of the label text that do not fit into the label boundaries are not just clipped but get shortened and ...
 void enableAutomaticWordWrap(boolean enable)
          Sets the line-wrapping policy of the label.
 void enableClipping(boolean enable)
          Text that does not fit into the label boundaries gets clipped when enableClipping is set to true.
 void enableFirstWordCharacterWrap(boolean enable)
          Set the style of wrapping used if automatic word-wrap is enabled.
 void enableKeepingFirstCharacter(boolean enable)
          Enables/disables the keeping of the first character, even if it doesn't fit into the label.
 Attribute getAttribute(java.lang.String name)
          Returns the attribute with the given name or null if there is no Attribute with the given name.
 AttributeSet getAttributes()
          Returns an AttributeSet consisting of all attributes of this AttributableOnSet.
 AttributeSet getAttributesTree()
          Returns an AttributeSet containing all Attributes of this AttributableOnSet in a treelike structure.
 int getBottom()
          Returns the y-coordinate of the bottom bounding.
 Boundary getBoundingBox()
          Returns the bounding box of the BaseInteractable.
 int getFontUnit()
          Returns the unit that is currently used to scale text the.
 int getHeight()
          Returns the height of the bounding Rect2D.
 int getHorizontalAlignment()
          Returns the a constant that represents the horizontal alignment of the text that is associated to the Label2D.
 Illustrator getIllustrator(Transform2D xform_context)
          Returns the Primitives illustrator object.
 int getLeft()
          Returns the x-coordinate of the left bounding.
 int getLineLength()
           
 int getMarginBottom()
          Returns the current bottom-margin value.
 int getMarginLeft()
          Returns the current left-margin value.
 int getMarginRight()
          Returns the current right-margin value.
 int getMarginTop()
          Returns the current top-margin value.
 int getPreferredHeight(Transform2D xform_context, ScaleValues scalevalues)
          Returns the preferred height for the Label2D with respect to the current line length, the line breaks within the current text and the context transformation given by xform_context.
 Size getPreferredSize(Transform2D xform_context, ScaleValues scalevalues)
          Returns the preferred size for the Label2D with respect to the line breaks within the current text and the context transformation given by xform_context.
 RenderingData getRenderingData(Transform2D xform_context)
          Returns a RenderingData instance, which are used by a Renderer implementation to render a Primitive.
 int getRight()
          Returns the x-coordinate of the right bounding.
 int getSizeAdjustmentMode()
          Returns a constant that represents the current setting for the size adjustment mode.
 PrimitiveState getState()
           
 java.lang.String getText()
          Returns the current text of the Label2D.
 PaintFormat getTextBackgroundPaint()
           
 TextFormatter getTextFormatter()
          Returns the underlying TextFormatter object.
 int getTop()
          Returns the y-coordinate of the top bounding.
 int getVerticalAlignment()
          Returns the a constant that represents the vertical alignment of the text that is associated to the Label2D.
 int getWidth()
          Returns the width of the bounding Rect2D.
protected  InteractionDescriptor internalCreateInteractionDescriptor()
          This method should return an InteractionDescriptor that defines the interaction capabilities of a certain Primitive.
 Transform2D internalGetLocalTransform()
          Returns the local transform which contains a transformation to compensate a stretching that occurred through size adjustment
 void internalSetLocalTransform(Transform2D trans, boolean compensate)
          Sets the local transform that is usually generated by a composite that contains this label.
protected  void internalSetTextBackgroundPaint(PaintFormat paintTextBackgroud, AttributeSet attributeschanged_tablelike, AttributeSet attributeschanged_treelike)
           
 boolean isAutomaticShorteningEnabled()
          Returns a boolean that indicates whether line shortening is enabled or not.
 boolean isAutomaticWordWrapEnabled()
          Returns a boolean that indicates whether word wrapping is enabled or not.
 boolean isClippingEnabled()
          Returns a boolean that indicates whether clipping is enabled or not.
 boolean isEditable()
          Returns true if the label is editable.
 boolean isFirstWordCharacterWrapEnabled()
          Returns a boolean that indicates whether first word character wrapping is enabled or not.
 boolean isKeepingFirstCharacter()
          Returns true, if the line shortening should not remove the first character, even if it doesn't fit into the label
 boolean isResizable()
          Returns a boolean that indicates whether the Interactable is resizable or not.
 void postActing(InteractionInfo interactionInfo, int itemspecifier)
          This method is called by the InteractionContext while the interaction takes place.
 InteractionItem select(InteractionInfo interactionInfo)
          This method is called by the InteractionContext to select the BaseInteractable.
 void set(int left, int top, int right, int bottom)
          Sets the bounding of the Label2D to the values given by left, top, right and bottom
 void setAttributes(AttributeSet attributes)
          Searches within the AttributeSet given by attributes for attributes that have the same name as the attributes of this AttributableOnSet holds.
 void setAttributesTree(AttributeSet attributes)
          Performs the same operation as the setAttributes(com.tensegrity.generic.attribute.AttributeSet) method with the difference that the AttributeSet given to this method must provide the treelike structure mentioned in the documentation of the getAttributesTree().
 void setAttributeValue(java.lang.String name, java.lang.Object value)
          Sets the value of the attribute with the name to the given value.
 void setBottom(int bottom)
          Sets the y-coordinate of the bottom bounding.
 void setEditable(boolean editable)
          Sets whether or not this component is editable
 void setFontFormat(FontFormat font)
          Sets the FontFormat for the Primitive.
 void setFontUnit(int fontunit)
          Sets the font unit to the value given by fontunit.
 void setHeight(int height)
          Sets the height of this Rect2D to the given height.
 void setHorizontalAlignment(int horizontalAlignment)
          Sets the horizontal alignment for the text that is associated to the Label2D.
 void setLeft(int left)
          Sets the x-coordinate of the left bounding.
 void setLineLength(int lineLength)
          Sets the line length to the value given by lineLength.
 void setMarginBottom(int marginBottom)
          Sets the bottom-margin to the value given by marginBottom
 void setMarginLeft(int marginLeft)
          Sets the left-margin to the value given by marginLeft
 void setMarginRight(int marginRight)
          Sets the right-margin to the value given by marginRight
 void setMargins(int marginLeft, int marginTop, int marginRight, int marginBottom)
          Sets the margin of the label to the values given by marginLeft, marginTop, marginRight and marginBottom.
 void setMarginTop(int marginTop)
          Sets the top-margin to the value given by marginTop
 void setResizable(boolean resizable)
          Sets the state of resizability for the Interactable to the value given by resizable.
 void setRight(int right)
          Sets the x-coordinate of the right bounding.
 void setSizeAdjustmentMode(int sizeAdjustmentMode)
          Sets the size adjustment mode for Label2D to the value given by sizeAdjustmentMode.
 void setSizeAdjustmentMode(Transform2D xform_context, ScaleValues scalevalues, int sizeAdjustmentMode)
          Sets the size adjustment mode for Label2D to the value given by sizeAdjustmentMode.
protected  void setSpecificAttributes(AttributeFactory aFac, AttributeSet attributes, AttributeSet attributeschanged_tablelike, AttributeSet attributeschanged_treelike, java.util.Map attribute2oldvalue_tablelike, java.util.Map attribute2oldvalue_treelike)
          Set the specific attributes of a Label2D located in the AttributeSet given by attributes to the Label2D's properties.
 void setStroke(StrokeFormat stroke)
          Sets a StrokeFormat for the Primitive.
 void setText(java.lang.String text)
          Sets the text of the Label2D to the value given by text.
 void setTextBackgroundPaint(PaintFormat paintTextBackgroud)
           
 void setTop(int top)
          Sets the y-coordinate of the top bounding.
 void setTransform(Transform2D transform)
          Sets the Transform2D given by transform as the new transform for the coordinates of the Primitive.
 void setVerticalAlignment(int verticalAlignment)
          Sets the vertical alignment for the text that is associated to the Label2D.
 void setWidth(int width)
          Sets the width of this Rect2D to the given width.
 java.lang.String toString()
           
 
Methods inherited from class com.tensegrity.graphics.AbstractPrimitive
addAttributableOnSetListener, addInfoValue, addOrSetInfoValue, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, fireAttributableOnSetChangedEvent, fireAttributableOnSetChangedEvent, getAttributeType, getAttributeValue, getFont, getInfoValue, getInteractionDescriptor, getMoveItem, getPaint, getStroke, getTransform, hasInfoValue, hits, internalDeepCopyInfoValues, internalEnableSelection, internalSelect, internalSetFont, internalSetPaint, internalSetSelected, internalSetStroke, internalSetStroke, isMovable, isSelectable, isSelected, mouseClick, mouseDown, mouseEnter, mouseExit, mouseUp, preActing, raiseAttributableEvents, removeAttributableOnSetListener, removeInfoValue, setAttribute, setInfoValue, setMovable, setPaint, setSelectable, setSelected, startAction, stopAction
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.tensegrity.graphics.interaction.BaseInteractable
getInteractionDescriptor, getMoveItem, hits, internalEnableSelection, internalSelect, internalSetSelected, isMovable, isSelectable, isSelected, mouseClick, mouseDown, mouseEnter, mouseExit, mouseUp, preActing, setMovable, setSelectable, setSelected, startAction, stopAction
 

Field Detail

USE_COMPENSATION_FOR_SIZE_ADJUSTMENT

public static boolean USE_COMPENSATION_FOR_SIZE_ADJUSTMENT
USE_COMPENSATION_FOR_SIZE_ADJUSTMENT: If this is true, the Label2D will use a transformation to compensate the stretching that occurs by using size adjustment. Only applies to labels with object unit fonts.


bbox

protected final BoundingBox bbox
instance variable for the labels bounding box


doSizeAdjustments

public boolean doSizeAdjustments
instance variable that indicates whether the label should attend the size-adjustment mode or not (used in the context of composites)


updateTextFormatter

public boolean updateTextFormatter
instance variable that indicates whether to update the text formatter or not


tmpCoords

protected static final double[] tmpCoords
instance variable that is used to transform the coordinates of the rectangle


tmpPtX

protected static final int[] tmpPtX
instance variable that is used to transform the coordinates of the rectangle


tmpPtY

protected static final int[] tmpPtY
instance variable that is used to transform the coordinates of the rectangle

Constructor Detail

Label2D

public Label2D()
Constructor that creates an empty Label2D.


Label2D

public Label2D(int left,
               int top,
               int right,
               int bottom)
Constructor that creates a Label2D with the coordinates given by left, top, right and bottom.

Parameters:
left - the left bounding
top - the top bounding
right - the right bounding
bottom - the bottom bounding

Label2D

public Label2D(Label2D label)
Copy constructor for Label2D.

Parameters:
label - the Label2D to copy
Method Detail

getLeft

public final int getLeft()
Returns the x-coordinate of the left bounding.

Returns:
the x-coordinate of the left bounding.

setLeft

public final void setLeft(int left)
Sets the x-coordinate of the left bounding.

Parameters:
left - the left-bounding to set.

getTop

public final int getTop()
Returns the y-coordinate of the top bounding.

Returns:
the y-coordinate of the top bounding.

setTop

public final void setTop(int top)
Sets the y-coordinate of the top bounding.

Parameters:
top - the top-bounding to set.

getRight

public final int getRight()
Returns the x-coordinate of the right bounding.

Returns:
the x-coordinate of the right bounding.

setRight

public final void setRight(int right)
Sets the x-coordinate of the right bounding.

Parameters:
right - the right-bounding to set.

getBottom

public final int getBottom()
Returns the y-coordinate of the bottom bounding.

Returns:
the y-coordinate of the bottom bounding.

setBottom

public final void setBottom(int bottom)
Sets the y-coordinate of the bottom bounding.

Parameters:
bottom - the bottom-bounding to set.

getWidth

public final int getWidth()
Returns the width of the bounding Rect2D.

Returns:
the width of the bounding Rect2D.

setWidth

public final void setWidth(int width)
Sets the width of this Rect2D to the given width.

Parameters:
width - the new width for this rectangle.

getHeight

public final int getHeight()
Returns the height of the bounding Rect2D.

Returns:
the height of the bounding Rect2D.

setHeight

public final void setHeight(int height)
Sets the height of this Rect2D to the given height.

Parameters:
height - the new height for this rectangle.

set

public final void set(int left,
                      int top,
                      int right,
                      int bottom)
Sets the bounding of the Label2D to the values given by left, top, right and bottom

Parameters:
left - the new value for the left bounding
top - the new value for the top bounding
right - the new value for the right bounding
bottom - the new value for the bottom bounding

isEditable

public boolean isEditable()
Returns true if the label is editable.

Returns:
true if the label is editable.

setEditable

public void setEditable(boolean editable)
Sets whether or not this component is editable

Parameters:
editable - true if this label should be editable, false otherwise.

getHorizontalAlignment

public final int getHorizontalAlignment()
Returns the a constant that represents the horizontal alignment of the text that is associated to the Label2D. The possible constants this method may return are defined by GraphicConstants.ALIGN_LEFT, GraphicConstants.ALIGN_RIGHT or GraphicConstants.ALIGN_CENTER.

Returns:
int the constant that represents the current alignment setting

setHorizontalAlignment

public final void setHorizontalAlignment(int horizontalAlignment)
Sets the horizontal alignment for the text that is associated to the Label2D. The supported constants are defined by

Parameters:
horizontalAlignment - the new horizontal alignment

Find more information in the class documentation


getVerticalAlignment

public final int getVerticalAlignment()
Returns the a constant that represents the vertical alignment of the text that is associated to the Label2D. The possible constants this method may return are defined by GraphicConstants.ALIGN_TOP, GraphicConstants.ALIGN_BOTTOM or GraphicConstants.ALIGN_CENTER.

Returns:
int the constant that represents the current alignment setting

setVerticalAlignment

public final void setVerticalAlignment(int verticalAlignment)
Sets the vertical alignment for the text that is associated to the Label2D. The supported constants are defined by

Parameters:
verticalAlignment - the new vertical alignment

Find more information in the class documentation


getMarginLeft

public final int getMarginLeft()
Returns the current left-margin value.

Returns:
int the current left-margin value

setMarginLeft

public final void setMarginLeft(int marginLeft)
Sets the left-margin to the value given by marginLeft

Parameters:
marginLeft - the new value for left-margin

getMarginRight

public final int getMarginRight()
Returns the current right-margin value.

Returns:
int the current right-margin value

setMarginRight

public final void setMarginRight(int marginRight)
Sets the right-margin to the value given by marginRight

Parameters:
marginRight - the new value for right-margin

getMarginTop

public final int getMarginTop()
Returns the current top-margin value.

Returns:
int the current top-margin value

setMarginTop

public final void setMarginTop(int marginTop)
Sets the top-margin to the value given by marginTop

Parameters:
marginTop - the new value for top-margin

getMarginBottom

public final int getMarginBottom()
Returns the current bottom-margin value.

Returns:
int the current bottom-margin value

setMarginBottom

public final void setMarginBottom(int marginBottom)
Sets the bottom-margin to the value given by marginBottom

Parameters:
marginBottom - the new value for bottom-margin

setMargins

public final void setMargins(int marginLeft,
                             int marginTop,
                             int marginRight,
                             int marginBottom)
Sets the margin of the label to the values given by marginLeft, marginTop, marginRight and marginBottom.

Parameters:
marginLeft - the new value for the left-margin
marginTop - the new value for the top-margin
marginRight - the new value for the right-margin
marginBottom - the new value for the bottom-margin

Find more information in the class documentation


getText

public final java.lang.String getText()
Returns the current text of the Label2D.

Returns:
String the current text of the Label2D

setText

public final void setText(java.lang.String text)
Sets the text of the Label2D to the value given by text. For multiple lines this text can contain line breaks.

Parameters:
text - the new text

getTextFormatter

public final TextFormatter getTextFormatter()
Returns the underlying TextFormatter object.
NOTICE:Try not to use this method it is about to be removed.

Returns:
TextFormatter the underlying TextFormatter object

getFontUnit

public final int getFontUnit()
Returns the unit that is currently used to scale text the.

Returns:
int the font unit constant

setFontUnit

public final void setFontUnit(int fontunit)
Sets the font unit to the value given by fontunit.

Parameters:
fontunit - the new font unit to use

isClippingEnabled

public final boolean isClippingEnabled()
Returns a boolean that indicates whether clipping is enabled or not.

Returns:
boolean flag that indicates whether clipping is enabled or not

enableClipping

public final void enableClipping(boolean enable)
Text that does not fit into the label boundaries gets clipped when enableClipping is set to true. If set to false, text can overlap the labels rectangular boundary.

Parameters:
enable - flag that enables or disables clipping

isAutomaticShorteningEnabled

public final boolean isAutomaticShorteningEnabled()
Returns a boolean that indicates whether line shortening is enabled or not.

Returns:
boolean flag that indicates whether line shortening is enabled or not

enableAutomaticShortening

public final void enableAutomaticShortening(boolean enable)
If set to true lines of the label text that do not fit into the label boundaries are not just clipped but get shortened and ... appended at the end.

Parameters:
enable - flag that enables or disables line shortening

Find more information in the class documentation


isKeepingFirstCharacter

public final boolean isKeepingFirstCharacter()
Returns true, if the line shortening should not remove the first character, even if it doesn't fit into the label

Returns:
true, if the line shortening should not remove the first character, even if it doesn't fit into the label

enableKeepingFirstCharacter

public final void enableKeepingFirstCharacter(boolean enable)
Enables/disables the keeping of the first character, even if it doesn't fit into the label.


isAutomaticWordWrapEnabled

public final boolean isAutomaticWordWrapEnabled()
Returns a boolean that indicates whether word wrapping is enabled or not.

Returns:
boolean flag that indicates whether word wrapping is enabled or not

enableAutomaticWordWrap

public final void enableAutomaticWordWrap(boolean enable)
Sets the line-wrapping policy of the label. If set to true the text will be wrapped if it is too long to fit within the allocated width of the labels rectangular boundary.

Parameters:
enable - flag that enables or disables word wrapping

Find more information in the class documentation


isFirstWordCharacterWrapEnabled

public final boolean isFirstWordCharacterWrapEnabled()
Returns a boolean that indicates whether first word character wrapping is enabled or not.

Returns:
boolean flag that indicates whether first word character wrapping is enabled or not

enableFirstWordCharacterWrap

public final void enableFirstWordCharacterWrap(boolean enable)
Set the style of wrapping used if automatic word-wrap is enabled. If set to true, the lines will be wrapped at word boundaries if they are too long to fit within the allocated width of the label. If set to false, the lines will be wrapped at the text character boundaries.

Parameters:
enable - flag that enables or disables first word character wrapping

Find more information in the class documentation


getSizeAdjustmentMode

public final int getSizeAdjustmentMode()
Returns a constant that represents the current setting for the size adjustment mode. The possible constants this method may return are defined by GraphicConstants.SIZE_ADJUSTMENT_NONE, GraphicConstants.SIZE_ADJUSTMENT_LINE_COUNT, GraphicConstants.SIZE_ADJUSTMENT_LINE_LENGTH or GraphicConstants.SIZE_ADJUSTMENT_LINE_COUNTANDLENGTH.

Returns:
int the constant that represents the current size adjustment setting

setSizeAdjustmentMode

public final void setSizeAdjustmentMode(int sizeAdjustmentMode)
Sets the size adjustment mode for Label2D to the value given by sizeAdjustmentMode. The supported constants are:

Parameters:
sizeAdjustmentMode - the new size adjustment mode

setSizeAdjustmentMode

public final void setSizeAdjustmentMode(Transform2D xform_context,
                                        ScaleValues scalevalues,
                                        int sizeAdjustmentMode)
Sets the size adjustment mode for Label2D to the value given by sizeAdjustmentMode. The supported constants are defined by GraphicConstants.SIZE_ADJUSTMENT_NONE, GraphicConstants.SIZE_ADJUSTMENT_LINE_COUNT, GraphicConstants.SIZE_ADJUSTMENT_LINE_LENGTH or GraphicConstants.SIZE_ADJUSTMENT_LINE_COUNTANDLENGTH.
The context transformation is used to calculate the correct size in case the Label2D is used in a context that has it's own coordinate system and don't uses device coordinates.

Parameters:
xform_context - the context transformation
scalevalues - the values to scale the font the with
sizeAdjustmentMode - the new size adjustment mode

getLineLength

public final int getLineLength()

setLineLength

public final void setLineLength(int lineLength)
Sets the line length to the value given by lineLength. The line length value is used by the text formatter to calculate wrapped lines.

Parameters:
lineLength - the new value for the line length

getPreferredHeight

public final int getPreferredHeight(Transform2D xform_context,
                                    ScaleValues scalevalues)
Returns the preferred height for the Label2D with respect to the current line length, the line breaks within the current text and the context transformation given by xform_context.

Parameters:
xform_context - the context transformation
scalevalues - the values to scale the font the with
Returns:
int the preferred height for the Label2D

getPreferredSize

public final Size getPreferredSize(Transform2D xform_context,
                                   ScaleValues scalevalues)
Returns the preferred size for the Label2D with respect to the line breaks within the current text and the context transformation given by xform_context.
NOTICE:The current line length does not attend for the preferred size.

Parameters:
xform_context - the context transformation
scalevalues - the values to scale the font the with
Returns:
Size the preferred size for the Label2D

getTextBackgroundPaint

public final PaintFormat getTextBackgroundPaint()

setTextBackgroundPaint

public final void setTextBackgroundPaint(PaintFormat paintTextBackgroud)

internalSetTextBackgroundPaint

protected final void internalSetTextBackgroundPaint(PaintFormat paintTextBackgroud,
                                                    AttributeSet attributeschanged_tablelike,
                                                    AttributeSet attributeschanged_treelike)

setStroke

public void setStroke(StrokeFormat stroke)
Description copied from interface: Primitive
Sets a StrokeFormat for the Primitive.

Specified by:
setStroke in interface Primitive
Parameters:
stroke - the StrokeFormat to use

setFontFormat

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

Specified by:
setFontFormat in interface Primitive
Overrides:
setFontFormat in class AbstractPrimitive

setTransform

public final 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
Overrides:
setTransform in class AbstractPrimitive

getBoundingBox

public Boundary getBoundingBox()
Description copied from interface: BaseInteractable
Returns the bounding box of the BaseInteractable.

Specified by:
getBoundingBox in interface BaseInteractable
Returns:
Boundary the bounding box of the BaseInteractable

getState

public PrimitiveState getState()
Specified by:
getState in interface Primitive

applyState

public void applyState(PrimitiveState state)
                throws PrimitiveStateNotApplicableException
Specified by:
applyState in interface Primitive
Throws:
PrimitiveStateNotApplicableException

getIllustrator

public Illustrator getIllustrator(Transform2D xform_context)
Description copied from interface: Primitive
Returns the Primitives illustrator object. To get more informations about the illustrator object see the class above or the documentation of the Illustrator class.

Specified by:
getIllustrator in interface Primitive
Parameters:
xform_context - the transformation of the context the Primitive lies within.
Returns:
Illustrator the illustrator for outputting the Primitive.

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
Overrides:
getRenderingData in class AbstractPrimitive

deepCopy

public Primitive deepCopy()
Description copied from interface: Primitive
An implementation of this method is responsible for returning a deep- copy of the Primitive instance

Specified by:
deepCopy in interface Primitive
Returns:
a deep copy of the Primitive.

isResizable

public boolean isResizable()
Description copied from interface: Interactable
Returns a boolean that indicates whether the Interactable is resizable or not.

Specified by:
isResizable in interface Interactable
Returns:
boolean that indicates the state of resizability of the Interactable

setResizable

public void setResizable(boolean resizable)
Description copied from interface: Interactable
Sets the state of resizability for the Interactable to the value given by resizable.

Specified by:
setResizable in interface Interactable
Parameters:
resizable - the new state of resizability for the Interactable

calculateBoundingBox

public BoundingBox calculateBoundingBox(InteractionInfo interactionInfo)
Specified by:
calculateBoundingBox in interface Interactable

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
Overrides:
select in class AbstractPrimitive

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
Overrides:
postActing in class AbstractPrimitive

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
Overrides:
setAttributeValue in class AbstractPrimitive
Throws:
IllegalValueException
ConstraintViolationException

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
Overrides:
getAttribute in class AbstractPrimitive

getAttributes

public AttributeSet getAttributes()
Description copied from interface: AttributableOnSet
Returns an AttributeSet consisting of all attributes of this AttributableOnSet.

Specified by:
getAttributes in interface AttributableOnSet
Returns:
AttributeSet an AttributeSet with all attributes.

setAttributes

public void setAttributes(AttributeSet attributes)
Description copied from interface: AttributableOnSet
Searches within the AttributeSet given by attributes for attributes that have the same name as the attributes of this AttributableOnSet holds. The value of every attribute that has the same name is used as the new value for the corresponding attribute of this AttributableOnSet. An Attribute within the given AttributeSet that is not an attribute of the object that implements the AttributableOnSet interface is not handled by nor added to the specific implementor of the AttributableOnSet interface.

Specified by:
setAttributes in interface AttributableOnSet
Parameters:
attributes - the AttributeSet consisting of the attributes whose values to set.

getAttributesTree

public AttributeSet getAttributesTree()
Description copied from interface: AttributableOnSet
Returns an AttributeSet containing all Attributes of this AttributableOnSet in a treelike structure.
Treelike means that each attribute can have a subset that contains subsequent Attributes for an Attribute of this AttributableOnSet.
Since an Attribute can only have one value (in this case an object or the Attributes for an object) the subsequent attributes are plugged into the returned AttributeSet as a new Attribute with the same name and the AttributableOnSet.TREE_SUBSET_POSTFIX.

Specified by:
getAttributesTree in interface AttributableOnSet
Returns:
AttributeSet an AttributeSet with the attributes in a treelike structure

setAttributesTree

public void setAttributesTree(AttributeSet attributes)
Description copied from interface: AttributableOnSet
Performs the same operation as the AttributableOnSet.setAttributes(com.tensegrity.generic.attribute.AttributeSet) method with the difference that the AttributeSet given to this method must provide the treelike structure mentioned in the documentation of the AttributableOnSet.getAttributesTree().

Specified by:
setAttributesTree in interface AttributableOnSet
Parameters:
attributes - the AttributeSet containing the attributes whose values to set.

addSpecificAttributes

protected void addSpecificAttributes(AttributeFactory factory,
                                     AttributeSet attributes)
Add the specific attributes of a Label2D to the AttributeSet given by attributes.

Parameters:
factory - an instance of AttributeFactory needed to create new a new attribute
attributes - the AttributeSet to add the attributes to

setSpecificAttributes

protected void setSpecificAttributes(AttributeFactory aFac,
                                     AttributeSet attributes,
                                     AttributeSet attributeschanged_tablelike,
                                     AttributeSet attributeschanged_treelike,
                                     java.util.Map attribute2oldvalue_tablelike,
                                     java.util.Map attribute2oldvalue_treelike)
Set the specific attributes of a Label2D located in the AttributeSet given by attributes to the Label2D's properties.

Parameters:
attributes - the AttributeSet that contains the attributes to set

internalCreateInteractionDescriptor

protected InteractionDescriptor internalCreateInteractionDescriptor()
Description copied from class: AbstractPrimitive
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.

Specified by:
internalCreateInteractionDescriptor in class AbstractPrimitive
Returns:
InteractionDescriptor the InteractionDescriptor for the certain Primitive instance

toString

public java.lang.String toString()

internalSetLocalTransform

public void internalSetLocalTransform(Transform2D trans,
                                      boolean compensate)
Sets the local transform that is usually generated by a composite that contains this label. This method is for internal use and should be called by the geometry adjustment only.

Parameters:
trans - The current transformation, meaning the scale between the original composite bounds and the current
compensate - True, if this is a call that should lead to a compensation. This is automatically done by the Label2D when setting the Text or the FontFormat. The only case when the transform should NOT be compensated is when resizing the composite.

internalGetLocalTransform

public Transform2D internalGetLocalTransform()
Returns the local transform which contains a transformation to compensate a stretching that occurred through size adjustment

Returns:
the local transform which contains a transformation to compensate a stretching that occurred through size adjustment


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