com.tensegrity.composite
Interface Composite

All Superinterfaces:
Attributable, AttributableOnSet, BaseComposite, BaseInteractable, Interactable
All Known Subinterfaces:
CompositeControl, CompositeGroup, CompositeLabel, CompositeSwimLane, CompositeSwimLanePool, CompositeTable, VisualNodeComposite, VisualSubgraphComposite

public interface Composite
extends BaseComposite, Interactable

A Composite is a specialization of the BaseComposite interface. Therefore, it is recommended that you read the documentation of the BaseComposite interface first to acquire a basic understanding of this interface's inherited responsibility.

The Composite interface supplements the BaseComposite behavior by managing its own CoordinateSystem. In doing so, the coordinates of the contained Primitive objects remain independent of any other CoordinateSystem used in a view, such as that of a parent container or the top-level CompositeView.

Moreover, a Composite object has a location and a size within its managed CoordinateSystem and is set by a BoundingBox. This box defines the top-left corner and size of all inlying Primitive objects managed by the Composite container.

Taken together, the CoordinateSystem and BoundingBox of a Composite uniquely determine the transformation that is used when drawing the contained Primitive objects.

To get a clearer understanding of how a CoordinateSystem works and is used, please read the CoordinateSystem class. The methods exposed by the Composite interface to interact with its CoordinateSystem are the following:

In order to manipulate the BoundingBox of a Composite, you should use the following methods:

A Composite object fires events for every change that can happen to it. In order to be notified about these events, you have to programmatically register an object that implements the CompositeListener interface. For more information about this interface, please take a closer look at the documentation for CompositeListener.

Some of the events generated by a Composite are vetoable, which means that the processing of an event can be programmatically stopped. In order to veto an event, you have to register a VetoableCompositeListener. For more information about this interface, please take a closer look at the documentation for VetoableCompositeListener.

For more information about the event mechanism in the tensegrity frameworks, please see interface EventListenerTag and class EventMultiplexer.

The methods a Composite provides to support the event mechanism are:

Version:
$Id: Composite.java,v 1.82 2006/03/23 11:33:37 MichaelKegel Exp $
Author:
MichaelKegel

Field Summary
static int BBOXMASK_INCLUDE_ALL
           
static int BBOXMASK_INCLUDE_EXTERNALS_ALL
          BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on all sides of the node boundaries
static int BBOXMASK_INCLUDE_EXTERNALS_BACK
          BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the back (z-direction) side of the Composite boundaries
static int BBOXMASK_INCLUDE_EXTERNALS_BOTTOM
          BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the bottom side of the Composite boundaries
static int BBOXMASK_INCLUDE_EXTERNALS_FRONT
          BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the front (z-direction) side of the Composite boundaries
static int BBOXMASK_INCLUDE_EXTERNALS_LEFT
          BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the left side of the Composite boundaries
static int BBOXMASK_INCLUDE_EXTERNALS_RIGHT
          BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the right side of the Composite boundaries
static int BBOXMASK_INCLUDE_EXTERNALS_TOP
          BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the top side of the Composite boundaries
static int BBOXMASK_INCLUDE_MARKER
          BBOXMASK_INCLUDE_MARKER:
static int BBOXMASK_INCLUDE_SHADOW
          BBOXMASK_INCLUDE_MARKER:
static int BBOXMASK_INCLUDE_STROKE
          BBOXMASK_INCLUDE_STROKE:
static int BBOXMASK_INCLUDE_TEXT_OUTSIDE_OF_LABELS
          BBOXMASK_INCLUDE_TEXT_OUTSIDE_OF_LABELS:
static int EVENT_MASK_CHANGE
          Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and BaseComposite.disableEvents(int) to turn them off.
static int EVENT_MASK_MOVE
          Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and BaseComposite.disableEvents(int) to turn them off.
static int EVENT_MASK_RESIZE
          Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and BaseComposite.disableEvents(int) to turn them off.
static int TRANSFORMFROM_COMPOSITE
          Constants that determine the transformation direction for method getCoordinateSytemTransform(int).
static int TRANSFORMTO_COMPOSITE
          Constants that determine the transformation direction for method getCoordinateSytemTransform(int).
 
Fields inherited from interface com.tensegrity.composite.BaseComposite
DELEGATE_INFOVALUE, EVENT_MASK_MOUSE, EVENT_MASK_SELECT, GENERAL_INFOVALUE, NON_INFOVALUE
 
Fields inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
TREE_SUBSET_POSTFIX
 
Method Summary
 void addCompositeListener(CompositeListener listener)
          Adds the given CompositeListener to the Composites internal structure, such that the listener is informed about every event that occurs.
 void addToLocation(Size sizes)
          Adds the extensions given by sizes to the Composites current location.
 void addVetoableCompositeListener(VetoableCompositeListener listener)
          Adds the given CompositeListener to the Composites internal structure, such that the listener is informed about every event that occurs.
 void applyState(CompositeState state)
          Applies the CompositeState given by state to the Composite.
 void centerAtLocation(Coordinate coordinate)
          Sets the given Coordinate as the new center position of the Composite.
 Composite deepCopy()
          Deep copies a Composite.
 int getBackgroundCursorID()
           
 BoundingBox getBoundingBox(int calculationFlags)
          Returns the bounding box of this composite.
 CoordinateSystem getCoordinateSystem()
          Returns the CoordianteSystem the composite uses.
 Transform2D getCoordinateSytemTransform(int type)
          Returns a Tranform2D that can be used to calculate the transformation from or the transformation to this Composite depending on the given type.
 Coordinate getLocation()
          Returns the current location of the Composite.
 Size getMinimumSize()
          Returns the minimum size for the Composite.
 Size getSize()
          Returns the current size of the Composite.
 CompositeState getState()
          Returns a CompositeState instance that can be used to reset the state of the Composite to the state that is stored into the CompositeState.
 Transform2D getTransform()
          Returns the transformation the composite currently is transformed by.
 boolean internalGetHasSideHandles()
          For internal use only!
 boolean internalGetKeepAspectRatioAtCornerHandles()
          For internal use only!
 void internalSetHasSideHandles(boolean enable)
          For internal use only!
 void internalSetKeepAspectRatioAtCornerHandles(boolean enable)
          For internal use only!
 void layout(int left, int top, int right, int bottom)
          Sets the Composites bounding box to the values given by left, top, right and bottom.
 void removeCompositeListener(CompositeListener listener)
          Removes the given CompositeListener from the Composites internal structure, such that the listener is no longer informed about occurring events.
 void removeVetoableCompositeListener(VetoableCompositeListener listener)
          Removes the given CompositeListener from the Composites internal structure, such that the listener is no longer informed about occurring events.
 void setBackgroundCursorID(int cursorID)
           
 void setBoundingBox(int left, int right, int top, int bottom)
          Sets the composites bounding box to the values given by left, right, top and bottom.
 void setCoordinateSystem(CoordinateSystem coordSystem)
          Sets the CoordinateSystem used by this Composite to the given one.
 void setLocation(Coordinate coordinate)
          Sets the locations of the Composite to the Coordinate given by coordinate.
 void setMinimumSize(Size size)
          Sets the minimum size of the Composite to the value given by size.
 void setSize(Size size)
          Sets the size of the Composite to the extensions given by size.
 void setTransform(Transform2D xform)
          Sets the transform the composite is transformed by.
 
Methods inherited from interface com.tensegrity.composite.BaseComposite
addPrimitive, adjustGeometry, adjustGeometry, applyGeometry, applyStyle, areEventsEnabled, disableEvents, draw, draw, drawComposite, enableEvents, getBaseCompositeContainer, getEventMask, getGeometryName, getInfoValue, getInfoValueIdentifier, getName, getPrimitiveIterator, getShadowColor, getShadowDirection, getStyleName, internalSetGeometryName, internalSetStyleName, isDeletable, isShadowVisible, registerAttributeConstraint, registerEventMediator, registerVetoableEventMediator, removeAllPrimitives, removePrimitive, setBaseCompositeContainer, setDeletable, setEventMask, setInfoValue, setInfoValue, setName, setShadowColor, setShadowDirection, setShadowVisible, unregisterAttributeConstraint
 
Methods inherited from interface com.tensegrity.generic.attribute.AttributableOnSet
addAttributableOnSetListener, areAttributableEventsEnabled, disableAttributableEvents, enableAttributableEvents, getAttributes, getAttributesTree, removeAttributableOnSetListener, setAttributes, setAttributesTree
 
Methods inherited from interface com.tensegrity.generic.attribute.Attributable
getAttribute, getAttributeType, getAttributeValue, setAttribute, setAttributeValue
 
Methods inherited from interface com.tensegrity.graphics.interaction.BaseInteractable
getBoundingBox, getInteractionDescriptor, getMoveItem, hits, internalEnableSelection, internalSelect, internalSetSelected, isMovable, isSelectable, isSelected, mouseClick, mouseDown, mouseEnter, mouseExit, mouseUp, postActing, preActing, select, setMovable, setSelectable, setSelected, startAction, stopAction
 
Methods inherited from interface com.tensegrity.graphics.interaction.Interactable
calculateBoundingBox, isResizable, setResizable
 

Field Detail

EVENT_MASK_CHANGE

public static final int EVENT_MASK_CHANGE
Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and BaseComposite.disableEvents(int) to turn them off.

See Also:
Constant Field Values

EVENT_MASK_MOVE

public static final int EVENT_MASK_MOVE
Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and BaseComposite.disableEvents(int) to turn them off.

See Also:
Constant Field Values

EVENT_MASK_RESIZE

public static final int EVENT_MASK_RESIZE
Constant that tells about the different events or groups of events and can be used with BaseComposite.enableEvents(int) to turn them on and BaseComposite.disableEvents(int) to turn them off.

See Also:
Constant Field Values

TRANSFORMTO_COMPOSITE

public static final int TRANSFORMTO_COMPOSITE
Constants that determine the transformation direction for method getCoordinateSytemTransform(int).

See Also:
Constant Field Values

TRANSFORMFROM_COMPOSITE

public static final int TRANSFORMFROM_COMPOSITE
Constants that determine the transformation direction for method getCoordinateSytemTransform(int).

See Also:
Constant Field Values

BBOXMASK_INCLUDE_EXTERNALS_LEFT

public static final int BBOXMASK_INCLUDE_EXTERNALS_LEFT
BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the left side of the Composite boundaries

See Also:
Constant Field Values

BBOXMASK_INCLUDE_EXTERNALS_TOP

public static final int BBOXMASK_INCLUDE_EXTERNALS_TOP
BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the top side of the Composite boundaries

See Also:
Constant Field Values

BBOXMASK_INCLUDE_EXTERNALS_RIGHT

public static final int BBOXMASK_INCLUDE_EXTERNALS_RIGHT
BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the right side of the Composite boundaries

See Also:
Constant Field Values

BBOXMASK_INCLUDE_EXTERNALS_BOTTOM

public static final int BBOXMASK_INCLUDE_EXTERNALS_BOTTOM
BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the bottom side of the Composite boundaries

See Also:
Constant Field Values

BBOXMASK_INCLUDE_EXTERNALS_FRONT

public static final int BBOXMASK_INCLUDE_EXTERNALS_FRONT
BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the front (z-direction) side of the Composite boundaries

See Also:
Constant Field Values

BBOXMASK_INCLUDE_EXTERNALS_BACK

public static final int BBOXMASK_INCLUDE_EXTERNALS_BACK
BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on the back (z-direction) side of the Composite boundaries

See Also:
Constant Field Values

BBOXMASK_INCLUDE_STROKE

public static final int BBOXMASK_INCLUDE_STROKE
BBOXMASK_INCLUDE_STROKE:

See Also:
Constant Field Values

BBOXMASK_INCLUDE_MARKER

public static final int BBOXMASK_INCLUDE_MARKER
BBOXMASK_INCLUDE_MARKER:

See Also:
Constant Field Values

BBOXMASK_INCLUDE_SHADOW

public static final int BBOXMASK_INCLUDE_SHADOW
BBOXMASK_INCLUDE_MARKER:

See Also:
Constant Field Values

BBOXMASK_INCLUDE_TEXT_OUTSIDE_OF_LABELS

public static final int BBOXMASK_INCLUDE_TEXT_OUTSIDE_OF_LABELS
BBOXMASK_INCLUDE_TEXT_OUTSIDE_OF_LABELS:

See Also:
Constant Field Values

BBOXMASK_INCLUDE_ALL

public static final int BBOXMASK_INCLUDE_ALL
See Also:
Constant Field Values

BBOXMASK_INCLUDE_EXTERNALS_ALL

public static final int BBOXMASK_INCLUDE_EXTERNALS_ALL
BBOXMASK_INCLUDE_EXTERNALS_LEFT: Constant for getBoundingBox(int) to include externals on all sides of the node boundaries

See Also:
Constant Field Values
Method Detail

getBackgroundCursorID

public int getBackgroundCursorID()

setBackgroundCursorID

public void setBackgroundCursorID(int cursorID)

getLocation

public Coordinate getLocation()
Returns the current location of the Composite. The components of the returned Coordinate are given in the coordinate system the Composite lies within.

Returns:
Coordinate the current location of the Composite

Find more information in the class documentation


setLocation

public void setLocation(Coordinate coordinate)
Sets the locations of the Composite to the Coordinate given by coordinate. The components of the given Coordinate should be given in the coordinate system the Composite lies within. Setting the location of a Composite creates a MoveEvent if the location is different from the current location. Notice that a call to this method has no effect if the Composite is not movable.

Parameters:
coordinate - the new location of the Composite

Find more information in the class documentation


addToLocation

public void addToLocation(Size sizes)
Adds the extensions given by sizes to the Composites current location. These extensions should be given in the coordinate system the Composite lies within. Adding the extensions to the current location of the Composite creates a MoveEvent if the extensions are not zero. Notice that a call to this method has no effect if the Composite is not movable.

Parameters:
sizes - the extensions to add to the Composites current location

Find more information in the class documentation


centerAtLocation

public void centerAtLocation(Coordinate coordinate)
Sets the given Coordinate as the new center position of the Composite. The components of the given Coordinate should be given in the coordinate system the Composite lies within. Centering the Composite at the given Coordinate creates a MoveEvent if the center is different from the current center. Notice that a call to this method has no effect if the Composite is not movable.

Parameters:
coordinate - the coordinate to center the Composite at

getMinimumSize

public Size getMinimumSize()
Returns the minimum size for the Composite. While user interaction takes place the size of the Composite is compared against the minimum size and adjusted to this size if necessary.

Returns:
Size the minimum size for the Composite

Find more information in the class documentation


setMinimumSize

public void setMinimumSize(Size size)
Sets the minimum size of the Composite to the value given by size. While user interaction takes place the size of the Composite is compared against the minimum size and adjusted to this size if necessary. Note: Currently the size of the Composite is only compared against the minimum size while user interaction. Hence it is possible to set a smaller size through the interface methods.

Parameters:
size - the new value for the minimum size of the Composite

Find more information in the class documentation


getSize

public Size getSize()
Returns the current size of the Composite. The extensions of the returned Size are given in the coordinate system the Composite lies within.

Returns:
Size the current size of the Composite

Find more information in the class documentation


setSize

public void setSize(Size size)
Sets the size of the Composite to the extensions given by size. The extensions of the Size should be given in the coordinate system the Composite lies within. Setting the size of a Composite creates a ResizeEvent if the size is different from the current size of the Composite. Notice that a call to this methods has no effect if the Composite is not resizable.

Parameters:
size - the extensions to set as the new size of the Composite

Find more information in the class documentation


setBoundingBox

public void setBoundingBox(int left,
                           int right,
                           int top,
                           int bottom)
Sets the composites bounding box to the values given by left, right, top and bottom. These values should be given in the coordinate system the Composite lies within. Setting the bounding box of a Composite creates a MoveEvent if the new location of the bounding box is different from the current location and a ResizeEvent if the new size of the bounding box is different from the current size. Notice that a call to this method has no effect to the position when the Composite is not movable and no effect to the size when the Composite is not resizable.

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

Find more information in the class documentation


layout

public void layout(int left,
                   int top,
                   int right,
                   int bottom)
Sets the Composites bounding box to the values given by left, top, right and bottom. These values should be given in the coordinate system the Composite lies within. Notice that a call to layout creates no events and does not take care of the movable and resizable settings for the Composite but takes the setting for the minimum size into account.

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

Find more information in the class documentation


getTransform

public Transform2D getTransform()
Returns the transformation the composite currently is transformed by.
Notice:This functionallity hasn't been implemented completely throughout the whole API. Especially when working with text inside the composites. Therefore it must be used with care.

Returns:
Transform2D the current transform for the composite

Find more information in the class documentation


setTransform

public void setTransform(Transform2D xform)
Sets the transform the composite is transformed by.
Notice:This functionallity hasn't been implemented completely throughout the whole API. Especially when working with text inside the composites. Therefore it must be used with care.

Parameters:
xform - the new transform for the composite

Find more information in the class documentation


getCoordinateSystem

public CoordinateSystem getCoordinateSystem()
Returns the CoordianteSystem the composite uses.

Returns:
CoordinateSystem of the composite

Find more information in the class documentation


setCoordinateSystem

public void setCoordinateSystem(CoordinateSystem coordSystem)
Sets the CoordinateSystem used by this Composite to the given one. If you need a mutable version you can set an instance of MutableCoordinateSystem.

Parameters:
coordSystem - the new CoordinateSystem for the composite

Find more information in the class documentation


getCoordinateSytemTransform

public Transform2D getCoordinateSytemTransform(int type)
Returns a Tranform2D that can be used to calculate the transformation from or the transformation to this Composite depending on the given type. The transformation is definite determined by the CoordinateSystem and the BoundingBox of this Composite.

Parameters:
type - can either be TRANSFORMTO_COMPOSITE or TRANSFORMFROM_COMPOSITE.
Returns:
the corresponding transformation.

Find more information in the class documentation


getState

public CompositeState getState()
Returns a CompositeState instance that can be used to reset the state of the Composite to the state that is stored into the CompositeState.

Returns:
CompositeState the current state of the Composite

applyState

public void applyState(CompositeState state)
                throws StateNotApplicableException
Applies the CompositeState given by state to the Composite. If the given state is not applicable an exception is thrown.

Parameters:
state - the CompositeState instance that should be applied to the Composite
Throws:
StateNotApplicableException - if the given state is not applicable.

addCompositeListener

public void addCompositeListener(CompositeListener listener)
Adds the given CompositeListener to the Composites internal structure, such that the listener is informed about every event that occurs.

Parameters:
listener - the CompositeListener to add

Find more information in the class documentation


removeCompositeListener

public void removeCompositeListener(CompositeListener listener)
Removes the given CompositeListener from the Composites internal structure, such that the listener is no longer informed about occurring events.

Parameters:
listener - the CompositeListener to remove

Find more information in the class documentation


addVetoableCompositeListener

public void addVetoableCompositeListener(VetoableCompositeListener listener)
Adds the given CompositeListener to the Composites internal structure, such that the listener is informed about every event that occurs.

Parameters:
listener - the CompositeListener to add

Find more information in the class documentation


removeVetoableCompositeListener

public void removeVetoableCompositeListener(VetoableCompositeListener listener)
Removes the given CompositeListener from the Composites internal structure, such that the listener is no longer informed about occurring events.

Parameters:
listener - the CompositeListener to remove

Find more information in the class documentation


deepCopy

public Composite deepCopy()
Deep copies a Composite. Each implementation is responsible for providing the semantics of a deep copy in this method.

Returns:
Composite the deep copied instance

internalSetHasSideHandles

public void internalSetHasSideHandles(boolean enable)
For internal use only! Sets the HasSideHandles attribute of the composite

Parameters:
enable - true, to enable the side handles

internalGetHasSideHandles

public boolean internalGetHasSideHandles()
For internal use only! Returns true, if the side handles are enabled

Returns:
true, if the side handles are enabled

internalSetKeepAspectRatioAtCornerHandles

public void internalSetKeepAspectRatioAtCornerHandles(boolean enable)
For internal use only! Enables/Disables the keep aspect ratio behavior when resizing a composite using the corner handles.

Parameters:
enable - true, to enable the keep aspect ratio behavior

internalGetKeepAspectRatioAtCornerHandles

public boolean internalGetKeepAspectRatioAtCornerHandles()
For internal use only! Returns true, if the keep aspect ratio behavior when resizing a composite using the corner handles is turned on.

Returns:
true, if the keep aspect ratio behavior when resizing a composite using the corner handles is turned on.

getBoundingBox

public BoundingBox getBoundingBox(int calculationFlags)
Returns the bounding box of this composite. This is an extended version of the BaseInteractable.getBoundingBox(), so you can control the calculation by using the flags defined in the constants starting with BBOXMASK in the Composite interface.

Parameters:
calculationFlags - The flags to control the calculation
Returns:
The bounding box of the composite


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