hep.wired.services
Interface InteractionHandler

All Superinterfaces:
WiredRegistry.ID, org.freehep.xml.io.XMLIO
All Known Subinterfaces:
DelegatingInteractionHandler
All Known Implementing Classes:
AbstractInteractionHandler, DefaultInteractionHandler, DragAngledRectangleToScale, DragBallToRotate, DragRectangleToScale, DragToRotate, DragToScale, DragToTranslate, NullInteractionHandler

public interface InteractionHandler
extends WiredRegistry.ID, org.freehep.xml.io.XMLIO

Handles user interaction (Mouse and Keyboard) and dispatches edits to the plot. This interface filters the mouse interactions to only call subclasses for button 1 mouse events. To keep cross platform compatibility it is wise to only use button 1 mouse events (The Macintosh only has one mouse button). Other buttons are mapped using special keys, but then again, keys can also be used to adjust mouse behaviour. Also the pop up trigger (press and release) is filtered and not acted on. The sequence of some mouse events is slightly modified to make it easier to distinguish different sequences without extra logic. The basic sequences are:

All other sequences are as usual. Keyboard events are caught and handled. The Esc key allows to abort when a mouse was already pressed, but not yet released. The above sequences may be shortened to: press and press-drag. The sublass' reset() method gets called for hitting the escape key. Key such as ctrl, alt, shift and meta (option) are handled, and their repeat behaviour is filtered. Use methods such as isAltKeyDown() to find out if the alt key is pressed.

Version:
$Id: InteractionHandler.java 8598 2006-08-14 20:38:02Z duns $
Author:
Mark Donszelmann

Method Summary
 boolean altKeyPressed(RecordPlot plot, KeyEvent event)
          Called when the alt key is pressed.
 boolean altKeyReleased(RecordPlot plot, KeyEvent event)
          Called when the alt key is released.
 void changeCursor(RecordPlot plot, InputEvent event)
          Called to allow the InteractionHandler to change the cursor.
 boolean ctrlKeyPressed(RecordPlot plot, KeyEvent event)
          Called when the ctrl key is pressed.
 boolean ctrlKeyReleased(RecordPlot plot, KeyEvent event)
          Called when the ctrl key is released.
 boolean ctrlMetaKeyPressed(RecordPlot plot, KeyEvent event)
          Called when the ctrl (other OSs) or meta (MacOS) key is pressed key is pressed.
 boolean ctrlMetaKeyReleased(RecordPlot plot, KeyEvent event)
          Called when the ctrl (other OSs) or meta (MacOS) key is released.
 boolean escKeyPressed(RecordPlot plot, KeyEvent event)
          Called when the esc key is pressed.
 boolean escKeyReleased(RecordPlot plot, KeyEvent event)
          Called when the esc key is released.
 String getDescription()
          Returns a one line description.
 int getHeight()
          Returns the height of the interaction panel.
 Icon getIcon(int size)
          Returns associated icon
 String getName()
          Returns the name of the Interaction Handler.
 int getWidth()
          Returns the width of the interaction panel.
 boolean isSupportedBy(GraphicsPanel panel)
          Returns true if this Interaction Handler is supported by this Graphics Panel.
 boolean keyTyped(RecordPlot plot, KeyEvent event)
          Called when a key is typed.
 boolean metaKeyPressed(RecordPlot plot, KeyEvent event)
          Called when the meta/option key is pressed.
 boolean metaKeyReleased(RecordPlot plot, KeyEvent event)
          Called when the meta/option key is released.
 void mouseButton1Clicked(RecordPlot plot, MouseEvent event)
          Called when mouse button 1 is clicked
 void mouseButton1DragEnded(RecordPlot plot, MouseEvent event)
          Called when mouse button 1 is ending a drag
 void mouseButton1Dragged(RecordPlot plot, MouseEvent event)
          Called when mouse button 1 is dragged
 void mouseButton1DragStarted(RecordPlot plot, MouseEvent event)
          Called when mouse button 1 is starting a drag
 void mouseButton1Pressed(RecordPlot plot, MouseEvent event)
          Called when mouse button 1 is pressed
 void mouseButton1Released(RecordPlot plot, MouseEvent event)
          Called when mouse button 1 is released
 void mouseEntered(RecordPlot plot, MouseEvent event)
          Called when the mouse is entering the component
 void mouseExited(RecordPlot plot, MouseEvent event)
          Called when the mouse is exitting the component
 void mouseMoved(RecordPlot plot, MouseEvent event)
          Called when the mouse is moved
 void mouseWheelMoved(RecordPlot plot, MouseWheelEvent event)
          Called when the mousewheel is moved
 boolean otherKeyPressed(RecordPlot plot, KeyEvent event)
          Called when any other key is pressed.
 boolean otherKeyReleased(RecordPlot plot, KeyEvent event)
          Called when any other key is released.
 void reset(RecordPlot plot, InputEvent event)
          Called to reset the interaction handler in its initial state.
 void setRecord(RecordPlot plot, Object record)
          Sets the Record which is displayed in the GraphicsPanel.
 void setSelected(RecordPlot plot, boolean selected)
          Called when underlying plot is selected/unselected.
 void setSize(RecordPlot plot, int width, int height)
          Sets the size of the wired plot on the handler, to be able to move/resize objects drawn by the handler.
 boolean shiftKeyPressed(RecordPlot plot, KeyEvent event)
          Called when the shift key is pressed.
 boolean shiftKeyReleased(RecordPlot plot, KeyEvent event)
          Called when the esc key is released.
 
Methods inherited from interface hep.wired.util.WiredRegistry.ID
getID
 
Methods inherited from interface org.freehep.xml.io.XMLIO
restore, save
 

Method Detail

getName

String getName()
Returns the name of the Interaction Handler.


getDescription

String getDescription()
Returns a one line description.


isSupportedBy

boolean isSupportedBy(GraphicsPanel panel)
Returns true if this Interaction Handler is supported by this Graphics Panel.


setRecord

void setRecord(RecordPlot plot,
               Object record)
Sets the Record which is displayed in the GraphicsPanel. To be used if the interaction handler is event dependent.


setSelected

void setSelected(RecordPlot plot,
                 boolean selected)
Called when underlying plot is selected/unselected.


setSize

void setSize(RecordPlot plot,
             int width,
             int height)
Sets the size of the wired plot on the handler, to be able to move/resize objects drawn by the handler.


getWidth

int getWidth()
Returns the width of the interaction panel.


getHeight

int getHeight()
Returns the height of the interaction panel.


getIcon

Icon getIcon(int size)
Returns associated icon


reset

void reset(RecordPlot plot,
           InputEvent event)
Called to reset the interaction handler in its initial state.


changeCursor

void changeCursor(RecordPlot plot,
                  InputEvent event)
Called to allow the InteractionHandler to change the cursor.


mouseButton1Clicked

void mouseButton1Clicked(RecordPlot plot,
                         MouseEvent event)
Called when mouse button 1 is clicked


mouseButton1Pressed

void mouseButton1Pressed(RecordPlot plot,
                         MouseEvent event)
Called when mouse button 1 is pressed


mouseButton1Released

void mouseButton1Released(RecordPlot plot,
                          MouseEvent event)
Called when mouse button 1 is released


mouseButton1DragStarted

void mouseButton1DragStarted(RecordPlot plot,
                             MouseEvent event)
Called when mouse button 1 is starting a drag


mouseButton1Dragged

void mouseButton1Dragged(RecordPlot plot,
                         MouseEvent event)
Called when mouse button 1 is dragged


mouseButton1DragEnded

void mouseButton1DragEnded(RecordPlot plot,
                           MouseEvent event)
Called when mouse button 1 is ending a drag


mouseMoved

void mouseMoved(RecordPlot plot,
                MouseEvent event)
Called when the mouse is moved


mouseEntered

void mouseEntered(RecordPlot plot,
                  MouseEvent event)
Called when the mouse is entering the component


mouseExited

void mouseExited(RecordPlot plot,
                 MouseEvent event)
Called when the mouse is exitting the component


mouseWheelMoved

void mouseWheelMoved(RecordPlot plot,
                     MouseWheelEvent event)
Called when the mousewheel is moved


escKeyPressed

boolean escKeyPressed(RecordPlot plot,
                      KeyEvent event)
Called when the esc key is pressed. Return true if the event is handled.


escKeyReleased

boolean escKeyReleased(RecordPlot plot,
                       KeyEvent event)
Called when the esc key is released. Return true if the event is handled.


altKeyPressed

boolean altKeyPressed(RecordPlot plot,
                      KeyEvent event)
Called when the alt key is pressed. Return true if the event is handled.


altKeyReleased

boolean altKeyReleased(RecordPlot plot,
                       KeyEvent event)
Called when the alt key is released. Return true if the event is handled.


ctrlKeyPressed

boolean ctrlKeyPressed(RecordPlot plot,
                       KeyEvent event)
Called when the ctrl key is pressed. Return true if the event is handled.


ctrlKeyReleased

boolean ctrlKeyReleased(RecordPlot plot,
                        KeyEvent event)
Called when the ctrl key is released. Return true if the event is handled.


shiftKeyPressed

boolean shiftKeyPressed(RecordPlot plot,
                        KeyEvent event)
Called when the shift key is pressed. Return true if the event is handled.


shiftKeyReleased

boolean shiftKeyReleased(RecordPlot plot,
                         KeyEvent event)
Called when the esc key is released. Return true if the event is handled.


metaKeyPressed

boolean metaKeyPressed(RecordPlot plot,
                       KeyEvent event)
Called when the meta/option key is pressed. Return true if the event is handled.

Since:
4.1

metaKeyReleased

boolean metaKeyReleased(RecordPlot plot,
                        KeyEvent event)
Called when the meta/option key is released. Return true if the event is handled.

Since:
4.1

ctrlMetaKeyPressed

boolean ctrlMetaKeyPressed(RecordPlot plot,
                           KeyEvent event)
Called when the ctrl (other OSs) or meta (MacOS) key is pressed key is pressed. Return true if the event is handled. If handles ctrlKeyPressed or metaKeyPressed will NOT be called.

Since:
4.1

ctrlMetaKeyReleased

boolean ctrlMetaKeyReleased(RecordPlot plot,
                            KeyEvent event)
Called when the ctrl (other OSs) or meta (MacOS) key is released. Return true if the event is handled. If handled crlKeyPressed or metaKeyPressed will NOT be called.

Since:
4.1

otherKeyPressed

boolean otherKeyPressed(RecordPlot plot,
                        KeyEvent event)
Called when any other key is pressed. Return true if the event is handled.


otherKeyReleased

boolean otherKeyReleased(RecordPlot plot,
                         KeyEvent event)
Called when any other key is released. Return true if the event is handled.


keyTyped

boolean keyTyped(RecordPlot plot,
                 KeyEvent event)
Called when a key is typed.



Copyright © 1996-2013 FreeHEP. All Rights Reserved.