|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
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:
getLocation()setLocation(com.tensegrity.graphics.Coordinate)addToLocation(Size)centerAtLocation(Coordinate)
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:
void addCompositeListener(CompositeListener)void removeCompositeListener(CompositeListener)void addVetoableCompositeListener(VetoableCompositeListener)void removeVetoableCompositeListener(VetoableCompositeListener)
| 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.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 |
public static final int EVENT_MASK_CHANGE
BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off.
public static final int EVENT_MASK_MOVE
BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off.
public static final int EVENT_MASK_RESIZE
BaseComposite.enableEvents(int) to turn them on and
BaseComposite.disableEvents(int) to turn them off.
public static final int TRANSFORMTO_COMPOSITE
getCoordinateSytemTransform(int).
public static final int TRANSFORMFROM_COMPOSITE
getCoordinateSytemTransform(int).
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
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
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
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
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
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
public static final int BBOXMASK_INCLUDE_STROKE
BBOXMASK_INCLUDE_STROKE:
public static final int BBOXMASK_INCLUDE_MARKER
BBOXMASK_INCLUDE_MARKER:
public static final int BBOXMASK_INCLUDE_SHADOW
BBOXMASK_INCLUDE_MARKER:
public static final int BBOXMASK_INCLUDE_TEXT_OUTSIDE_OF_LABELS
BBOXMASK_INCLUDE_TEXT_OUTSIDE_OF_LABELS:
public static final int BBOXMASK_INCLUDE_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
| Method Detail |
public int getBackgroundCursorID()
public void setBackgroundCursorID(int cursorID)
public Coordinate getLocation()
Composite. The
components of the returned Coordinate are given in the
coordinate system the Composite lies within.
Compositepublic void setLocation(Coordinate coordinate)
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.
coordinate - the new location of the Compositepublic void addToLocation(Size sizes)
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.
sizes - the extensions to add to the Composites current
locationpublic void centerAtLocation(Coordinate coordinate)
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.
coordinate - the coordinate to center the Composite atpublic Size getMinimumSize()
Composite. While user
interaction takes place the size of the Composite is
compared against the minimum size and adjusted to this size if necessary.
Compositepublic void setMinimumSize(Size size)
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.
size - the new value for the minimum size of the
Compositepublic Size getSize()
Composite. The extensions of
the returned Size are given in the coordinate system
the Composite lies within.
Compositepublic void setSize(Size size)
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.
size - the extensions to set as the new size of the
Composite
public void setBoundingBox(int left,
int right,
int top,
int bottom)
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.
left - the new value for the left side of the bounding boxright - the new value for the right side of the bounding boxtop - the new value for the top side of the bounding boxbottom - the new value for the bottom side of the bounding box
public void layout(int left,
int top,
int right,
int bottom)
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.
left - the new value for the left side of the bounding boxright - the new value for the right side of the bounding boxtop - the new value for the top side of the bounding boxbottom - the new value for the bottom side of the bounding boxpublic Transform2D getTransform()
public void setTransform(Transform2D xform)
xform - the new transform for the compositepublic CoordinateSystem getCoordinateSystem()
CoordianteSystem the composite uses.
public void setCoordinateSystem(CoordinateSystem coordSystem)
CoordinateSystem used by this
Composite to the given one. If you need a mutable version
you can set an instance of MutableCoordinateSystem.
coordSystem - the new CoordinateSystem for the
compositepublic Transform2D getCoordinateSytemTransform(int type)
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.
type - can either be
TRANSFORMTO_COMPOSITE or
TRANSFORMFROM_COMPOSITE.
public CompositeState getState()
CompositeState instance that can be used to reset
the state of the Composite to the state that is stored into
the CompositeState.
Composite
public void applyState(CompositeState state)
throws StateNotApplicableException
CompositeState given by state to
the Composite. If the given state is not applicable an
exception is thrown.
state - the CompositeState instance that should be
applied to the Composite
StateNotApplicableException - if the given state is not applicable.public void addCompositeListener(CompositeListener listener)
CompositeListener to the
Composites internal structure, such that the listener is
informed about every event that occurs.
listener - the CompositeListener to addpublic void removeCompositeListener(CompositeListener listener)
CompositeListener from the
Composites internal structure, such that the listener is
no longer informed about occurring events.
listener - the CompositeListener to removepublic void addVetoableCompositeListener(VetoableCompositeListener listener)
CompositeListener to the
Composites internal structure, such that the listener is
informed about every event that occurs.
listener - the CompositeListener to addpublic void removeVetoableCompositeListener(VetoableCompositeListener listener)
CompositeListener from the
Composites internal structure, such that the listener is
no longer informed about occurring events.
listener - the CompositeListener to removepublic Composite deepCopy()
Composite. Each implementation is responsible
for providing the semantics of a deep copy in this method.
public void internalSetHasSideHandles(boolean enable)
enable - true, to enable the side handlespublic boolean internalGetHasSideHandles()
public void internalSetKeepAspectRatioAtCornerHandles(boolean enable)
enable - true, to enable the keep aspect ratio behaviorpublic boolean internalGetKeepAspectRatioAtCornerHandles()
public BoundingBox getBoundingBox(int calculationFlags)
BaseInteractable.getBoundingBox(),
so you can control the calculation by using the flags defined in the
constants starting with BBOXMASK in the Composite interface.
calculationFlags - The flags to control the calculation
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||