com.tensegrity.graphics.interaction
Interface InteractionContext

All Known Implementing Classes:
DefaultInteractionContext

public interface InteractionContext

The InteractionContext provides all functionalities needed for the selection, movement and manipulation of a graphical object that implement the BaseInteractable interface.


NOTICE:This class is subject of reconstruction such that it might change in the near future. It is recommended not to make to much use of it.

Version:
$Id: InteractionContext.java,v 1.33 2006/05/24 10:33:08 MichaelKegel Exp $
Author:
MichaelKegel
See Also:
BaseInteractable, InteractionProvider

Method Summary
 int act(InteractionInfo interactionInfo)
          This method has to be called from the object that holds an instance of InteractionContext to move or manipulate the current selection.
 int act(InteractionInfo interactionInfo, java.util.List interactables_fixed)
           
 int getCursorID(InteractionInfo interactionInfo, java.util.List interactables)
          Returns a identifier for a mouse cursor that should be displayed for the given coordinate.
 int getInteractionProviderCount()
          Returns the number of InteractionProviders that have a sub selection.
 java.util.List getInteractionProviders()
          Returns a List of InteractionProviders that have a selection.
 java.util.List getSelection()
          Returns the currently selected BaseInteractables in a List.
 Boundary getSelectionBoundingBox()
          Returns the bounding box of the currently selected objects.
 int getSelectionCount()
          Returns the number of the currently selected BaseInteractables.
 boolean hasMultiSelection()
          Returns a flag that indicates whether more than one object is selected or not.
 boolean hasSelection()
          Returns a flag that indicates whether something is selected or not.
 boolean hasSubSelection()
          Returns a flag that indicates whether this InteractionContext has a sub selection or not.
 int hits(InteractionInfo interactionInfo, java.util.List interactables)
          Checks if an BaseInteractable is hit.
 void internalAddInteractionProvider(InteractionProvider interactionProvider)
          Internal method of the selection api.
 void internalChangeDescriptor(BaseInteractable interactable, java.util.List interactables_fixed, InteractionDescriptor newDescriptor, InteractionItem newItem)
          Internal method of the selection api.
 InteractionItem internalGetCurrentInteractionItemFor(BaseInteractable interactable)
          Internal method of the selection api.
 void internalRemoveInteractionProvider(InteractionProvider interactionProvider)
          Internal method of the selection api.
 boolean isInteractionCycleComplete()
           
 boolean isInteractionStarted()
          Returns a boolean that indicates whether an interaction has been started on this InteractionContext.
 int mouseClick(InteractionInfo interactionInfo, java.util.List interactables)
          This method has to be called from the object that holds an instance of InteractionContext when a mouse button has been clicked.
 int mouseDown(InteractionInfo interactionInfo, java.util.List interactables)
          This method has to be called from the object that holds an instance of InteractionContext when a mouse button has been pressed.
 int mouseMove(InteractionInfo interactionInfo, java.util.List interactables)
          This method has to be called from the object that holds an instance of InteractionContext when the mouse has been moved.
 int mouseUp(InteractionInfo interactionInfo, java.util.List interactables)
          This method has to be called from the object that holds an instance of InteractionContext when a mouse button has been released.
 void paint(Renderer renderer, Device device, Transform2D xform_context)
          This method has to be called from the objects that holds an instance of InteractionContext to paint the current selection.
 int postAction(InteractionInfo interactionInfo, java.util.List interactables)
          TODO : comment
 void preAction(InteractionInfo interactionInfo, java.util.List interactables)
          TODO : comment
 void select(BaseInteractable interactable, boolean adjustSelectionFlag)
          Selects the BaseInteractable given by interactable and adds it to the InteractionContext.
 void select(BaseInteractable interactable, InteractionItem interactionItem)
          Select the BaseInteractable given by interactable and adds it to the InteractionContext.
 int select(InteractionInfo interactionInfo, java.util.List selectables)
          This method has to be called from the object that holds an instance of InteractionContext to select a BaseInteractable if it lies at the given point.
 int select(InteractionInfo interactionInfo, java.util.List interactables, Boundary boundary)
          This method has to be called from the object that holds an instance of InteractionContext to select all BaseInteractable objects that lie within the given Boundary.
 void select(java.util.List selectables)
          This method has to be called to select the given List of BaseInteractable objects.
 void selectSubsequent(InteractionProvider interactionProvider)
          Adds the InteractionProvider given by interactionProvider to the InteractionContext.
 void startAction(InteractionInfo interactionInfo)
          This method has to be called from the object that holds an instance of InteractionContext before movement or manipulation of the current selection starts.
 int stopAction(InteractionInfo interactionInfo)
          This method has to be called from the object that holds an instance of InteractionContext when movement or manipulation of the current selection is done.
 void unselect()
          This method has to be called to unselect each BaseInteractable that is currently selected.
 void unselect(BaseInteractable interactable, boolean adjustSelectionFlag)
          Unselects the BaseInteractable given by interactable and removes it from the InteractionContext.
 void unselect(java.util.List interactables)
          This method has to be called to unselect the given List of BaseInteractable objects.
 void unselectSubsequent(InteractionProvider interactionProvider)
          Removes the InteractionProvider given by interactionProvider from the InteractionContext.
 

Method Detail

hasSelection

public boolean hasSelection()
Returns a flag that indicates whether something is selected or not.

Returns:
boolean that indicates a selection

hasMultiSelection

public boolean hasMultiSelection()
Returns a flag that indicates whether more than one object is selected or not.

Returns:
boolean that indicates a multi selection

getSelectionCount

public int getSelectionCount()
Returns the number of the currently selected BaseInteractables.

Returns:
int the number of the currently selected BaseInteractables

getSelection

public java.util.List getSelection()
Returns the currently selected BaseInteractables in a List.

Returns:
List a List of the currently selected objects

hasSubSelection

public boolean hasSubSelection()
Returns a flag that indicates whether this InteractionContext has a sub selection or not. A sub selection means that an InteractionProvider that belongs to this InteractionContext has a selection.

Returns:
boolean that indicates a sub selection

isInteractionStarted

public boolean isInteractionStarted()
Returns a boolean that indicates whether an interaction has been started on this InteractionContext.

Returns:
boolean a flag indicating a started interaction process

isInteractionCycleComplete

public boolean isInteractionCycleComplete()

getInteractionProviderCount

public int getInteractionProviderCount()
Returns the number of InteractionProviders that have a sub selection.

Returns:
int the number of InteractionProviders with a sub selection

getInteractionProviders

public java.util.List getInteractionProviders()
Returns a List of InteractionProviders that have a selection.
Notice that InteractionProviders that have a selection must not be selected by itself and therefore they must not but can be part of the List returned by getSelection().

Returns:
List a List of InteractionProviders that have a selection

getCursorID

public int getCursorID(InteractionInfo interactionInfo,
                       java.util.List interactables)
Returns a identifier for a mouse cursor that should be displayed for the given coordinate. If no cursor should be displayed it returns -1. The cursor identifiers are defined in GraphicConstants.

Parameters:
interactionInfo - the info values needed to find the right cursor.
interactables - the List of BaseInteractables to check for.
Returns:
int the cursor identifier or -1

hits

public int hits(InteractionInfo interactionInfo,
                java.util.List interactables)
Checks if an BaseInteractable is hit. The informations needed therefore have to be given by the interactionInfo parameter. The BaseInteractables to check have to be given by the interactables parameter. A constant is returned that identifies what has been hit.

Parameters:
interactionInfo - the info values needed to check for a hit
interactables - the List of BaseInteractables to check for.
Returns:
constant that identifies what has been hit.
See Also:
hit identifiers

select

public int select(InteractionInfo interactionInfo,
                  java.util.List selectables)
This method has to be called from the object that holds an instance of InteractionContext to select a BaseInteractable if it lies at the given point.

Parameters:
selectables - the list of BaseInteractable objects that can be selected.
interactionInfo - the InteractionInfo holding information on the manipulation.
Returns:
constant that indicates what effect the selection had
See Also:
selection identifiers

select

public int select(InteractionInfo interactionInfo,
                  java.util.List interactables,
                  Boundary boundary)
This method has to be called from the object that holds an instance of InteractionContext to select all BaseInteractable objects that lie within the given Boundary.

Parameters:
interactionInfo - the InteractionInfo holding information on the manipulation.
interactables - the list of BaseInteractable objects that should process the mouse move interaction.
boundary - the rectangle to select within
Returns:
constant that indicates what effect the selection had
See Also:
selection identifiers

select

public void select(BaseInteractable interactable,
                   boolean adjustSelectionFlag)
Selects the BaseInteractable given by interactable and adds it to the InteractionContext.
NOTICE:This method is an internal method of the selection api and it is strongly recommended not to make use of it.

Parameters:
interactable -
adjustSelectionFlag -

select

public void select(BaseInteractable interactable,
                   InteractionItem interactionItem)
Select the BaseInteractable given by interactable and adds it to the InteractionContext. The InteractionItem given by interactionItem is used for further interaction.
NOTICE:This method is an internal method of the selection api and it is strongly recommended not to make use of it.

Parameters:
interactable -
interactionItem -

select

public void select(java.util.List selectables)
This method has to be called to select the given List of BaseInteractable objects.

Parameters:
selectables - the list of BaseInteractable objects that should be selected

unselect

public void unselect()
This method has to be called to unselect each BaseInteractable that is currently selected.


unselect

public void unselect(BaseInteractable interactable,
                     boolean adjustSelectionFlag)
Unselects the BaseInteractable given by interactable and removes it from the InteractionContext.
NOTICE:This method is an internal method of the selection api and it is strongly recommended not to make use of it.

Parameters:
interactable -
adjustSelectionFlag -

unselect

public void unselect(java.util.List interactables)
This method has to be called to unselect the given List of BaseInteractable objects.

Parameters:
interactables - the list of BaseInteractable objects that should process the mouse button down interaction.

selectSubsequent

public void selectSubsequent(InteractionProvider interactionProvider)
Adds the InteractionProvider given by interactionProvider to the InteractionContext.
NOTICE:This method is an internal method of the selection api and it is strongly recommended not to make use of it.

Parameters:
interactionProvider -

unselectSubsequent

public void unselectSubsequent(InteractionProvider interactionProvider)
Removes the InteractionProvider given by interactionProvider from the InteractionContext.
NOTICE:This method is an internal method of the selection api and it is strongly recommended not to make use of it.

Parameters:
interactionProvider - the InteractionProvider to remove

getSelectionBoundingBox

public Boundary getSelectionBoundingBox()
Returns the bounding box of the currently selected objects.

Returns:
Boundary the currents selection bounding box

mouseDown

public int mouseDown(InteractionInfo interactionInfo,
                     java.util.List interactables)
This method has to be called from the object that holds an instance of InteractionContext when a mouse button has been pressed.

Parameters:
interactionInfo - the InteractionInfo holding information on the manipulation.
interactables - the list of BaseInteractable objects that should process the mouse button down interaction.
Returns:
int constant that indicates what effect the interaction had
See Also:
mouse interaction identifiers

mouseUp

public int mouseUp(InteractionInfo interactionInfo,
                   java.util.List interactables)
This method has to be called from the object that holds an instance of InteractionContext when a mouse button has been released.

Parameters:
interactionInfo - the InteractionInfo holding information on the manipulation.
interactables - the list of BaseInteractable objects that should process the mouse button up interaction.
Returns:
int constant that indicates what effect the interaction had
See Also:
mouse interaction identifiers

mouseClick

public int mouseClick(InteractionInfo interactionInfo,
                      java.util.List interactables)
This method has to be called from the object that holds an instance of InteractionContext when a mouse button has been clicked. Clicked means in this case that a mouse buttin has been pressed and released.

Parameters:
interactionInfo - the InteractionInfo holding information on the manipulation.
interactables - the list of BaseInteractable objects that should process the mouse move interaction.
Returns:
int constant that indicates what effect the interaction had
See Also:
mouse interaction identifiers

mouseMove

public int mouseMove(InteractionInfo interactionInfo,
                     java.util.List interactables)
This method has to be called from the object that holds an instance of InteractionContext when the mouse has been moved.

Parameters:
interactionInfo - the InteractionInfo holding information on the manipulation.
interactables - the list of BaseInteractable objects that should process the mouse move interaction.
Returns:
int constant that indicates what effect the interaction had
See Also:
mouse interaction identifiers

preAction

public void preAction(InteractionInfo interactionInfo,
                      java.util.List interactables)
TODO : comment

Parameters:
interactionInfo -
interactables -

startAction

public void startAction(InteractionInfo interactionInfo)
This method has to be called from the object that holds an instance of InteractionContext before movement or manipulation of the current selection starts.

Parameters:
interactionInfo - the InteractionInfo holding information on the manipulation.

act

public int act(InteractionInfo interactionInfo)
This method has to be called from the object that holds an instance of InteractionContext to move or manipulate the current selection.

Parameters:
interactionInfo - the InteractionInfo holding information on the manipulation.
Returns:
int constant that indicates what effect the interaction had
See Also:
interaction identifiers

act

public int act(InteractionInfo interactionInfo,
               java.util.List interactables_fixed)

stopAction

public int stopAction(InteractionInfo interactionInfo)
This method has to be called from the object that holds an instance of InteractionContext when movement or manipulation of the current selection is done.

Parameters:
interactionInfo - the InteractionInfo holding information on the manipulation.
Returns:
int constant that indicates what effect the interaction had
See Also:
interaction identifiers

postAction

public int postAction(InteractionInfo interactionInfo,
                      java.util.List interactables)
TODO : comment

Parameters:
interactionInfo -
interactables -
Returns:

paint

public void paint(Renderer renderer,
                  Device device,
                  Transform2D xform_context)
This method has to be called from the objects that holds an instance of InteractionContext to paint the current selection.

Parameters:
renderer - the Renderer to render with
device - the Device to paint onto
xform_context - the transformation of the context

internalRemoveInteractionProvider

public void internalRemoveInteractionProvider(InteractionProvider interactionProvider)
Internal method of the selection api. It is strongly recommended not to make use of it.


internalAddInteractionProvider

public void internalAddInteractionProvider(InteractionProvider interactionProvider)
Internal method of the selection api. It is strongly recommended not to make use of it.


internalGetCurrentInteractionItemFor

public InteractionItem internalGetCurrentInteractionItemFor(BaseInteractable interactable)
Internal method of the selection api. It is strongly recommended not to make use of it.

Parameters:
interactable -
Returns:

internalChangeDescriptor

public void internalChangeDescriptor(BaseInteractable interactable,
                                     java.util.List interactables_fixed,
                                     InteractionDescriptor newDescriptor,
                                     InteractionItem newItem)
Internal method of the selection api. It is strongly recommended not to make use of it.

Parameters:
interactable - |param interactables_fixed
newDescriptor -
newItem -


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