com.tensegrity.graphics.interaction
Interface BaseInteractable

All Known Subinterfaces:
BaseComposite, Composite, CompositeControl, CompositeGroup, CompositeLabel, CompositeLine, CompositeSwimLane, CompositeSwimLanePool, CompositeTable, Interactable, InteractableLine, Primitive, VisualEdgeComposite, VisualGraphObjectComposite, VisualNodeComposite, VisualSubgraphComposite
All Known Implementing Classes:
AbstractPrimitive, Ellipse2D, Label2D, Line2D, Polygon2D, Polyline2D, Rect2D

public interface BaseInteractable

This interface marks a graphical object as one that can be selected, repositioned and manipulated via interaction with the mouse or API calls.

A BaseInteractable must provide a BoundingBox so that intersection detection and other calculations can be made on it. Thus, this interface includes the following method:

Version:
$Id: BaseInteractable.java,v 1.7 2005/08/11 09:27:54 MichaelKegel Exp $
Author:
MichaelKegel
See Also:
InteractionContext, InteractionItem, InteractionDescriptor, Interactable, InteractableLine

Method Summary
 Boundary getBoundingBox()
          Returns the bounding box of the BaseInteractable.
 InteractionDescriptor getInteractionDescriptor()
          This method returns the InteractionDescriptor for the BaseInteractable.
 InteractionItem getMoveItem()
          Returns the InteractionItem that is used to move the BaseInteractable.
 InteractionItem hits(InteractionInfo interactionInfo)
          This method is called to check if the given point hits the BaseInteractable object.
 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.
 void internalSetSelected(boolean select)
          Sets the state of selection for this BaseInteractable to the value given by select.
 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.
 InteractionItem select(InteractionInfo interactionInfo)
          This method is called by the InteractionContext to select the BaseInteractable.
 void setMovable(boolean movable)
          Sets the state of movability for this BaseInteractable to the value given by movable.
 void setSelectable(boolean selectable)
          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.
 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.
 

Method Detail

isSelectable

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

Returns:
boolean that indicates the state of selectability for the BaseInteractable

setSelectable

public void setSelectable(boolean selectable)
Sets the state of selectability for this BaseInteractable to the value given by selectable.

Parameters:
selectable - the new state of selectability for the BaseInteractable

internalEnableSelection

public void internalEnableSelection(boolean enabled)
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.

Parameters:
enabled - the new state of internal selectability for the BaseInteractable instance

isSelected

public boolean isSelected()
Returns a boolean that indicates whether this BaseInteractable is selected or not.

Returns:
boolean that indicates the state of selection for this BaseInteractable

setSelected

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

Parameters:
selected - the new state of selection for this BaseInteractable

internalSetSelected

public void internalSetSelected(boolean select)
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 setSelected(boolean) method is that not the complete hierarchy is selected the BaseInteractable may be belongs to.

Parameters:
select - the new state of selection for this BaseInteractable

isMovable

public boolean isMovable()
Returns a boolean that indicates whether this BaseInteractable is movable or not.

Returns:
boolean that indicates the state of movability for the BaseInteractable

setMovable

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

Parameters:
movable - the new state of movability

getBoundingBox

public Boundary getBoundingBox()
Returns the bounding box of the BaseInteractable.

Returns:
Boundary the bounding box of the BaseInteractable

getMoveItem

public InteractionItem getMoveItem()
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.

Returns:
InteractionItem that is used to move the BaseInteractable

getInteractionDescriptor

public InteractionDescriptor getInteractionDescriptor()
This method returns the InteractionDescriptor for the BaseInteractable.

Returns:
InteractionDescriptor for the BaseInteractable
See Also:
InteractionDescriptor

mouseEnter

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

Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

mouseExit

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

Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

mouseDown

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

Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

mouseUp

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

Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

mouseClick

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

Parameters:
interactionInfo - the corresponding InteractionInfo to the interaction

hits

public InteractionItem hits(InteractionInfo interactionInfo)
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.

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)
This method is called by the InteractionContext to select the BaseInteractable. It returns null if the BaseInteractable is not hit or the responsible InteractionItem.

Parameters:
interactionInfo - the InteractionInfo's to check, may not be null.
Returns:
the responsible InteractionItem or null.

internalSelect

public InteractionItem internalSelect(InteractionInfo interactionInfo)
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 select(com.tensegrity.graphics.interaction.InteractionInfo) method is that the flag returned by isSelected() will not be changed nor an event is generated by a call to this method.

Parameters:
interactionInfo - the InteractionInfo to check, may not be null.
Returns:
InteractionItem the reponsable selection item or null

startAction

public boolean startAction(InteractionInfo interactionInfo,
                           int itemspecifier)
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.

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.

preActing

public boolean preActing(InteractionInfo interactionInfo,
                         int itemspecifier)
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.

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)
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

Parameters:
interactionInfo - the InteractionInfo instance; must not be null.
itemspecifier - the specifier of the InteractionItem the InteractionContext will use

stopAction

public void stopAction(InteractionInfo interactionInfo,
                       int itemspecifier)
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.

Parameters:
interactionInfo - the InteractionInfo instance; must not be null.
itemspecifier - the specifier of the InteractionItem the InteractionContext will use


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