org.malai.interaction
Interface EventHandler

All Known Implementing Classes:
AbortableDnD, ButtonPressed, CheckBoxModified, DnD, DoubleClick, Interaction, KeyInteraction, KeyPressure, KeysPressure, KeysScrolling, KeysTyped, KeyTyped, ListSelectionModified, MenuItemPressed, MultiClick, PointInteraction, Press, Scrolling, SimpleClick, SpinnerModified, TabSelected, TextChanged, WindowClosed

public interface EventHandler

This interface can be used for object that want to gather events (mouse pressed, etc.) produced by HIDs.

This file is part of Malai.
Copyright (c) 2009-2012 Arnaud BLOUIN

Malai is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Malai is distributed without any warranty; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

05/19/2010

Since:
0.1
Author:
Arnaud BLOUIN

Method Summary
 void onButtonPressed(javax.swing.AbstractButton button)
          Defines actions to do when a button is activated.
 void onCheckBoxModified(javax.swing.JCheckBox checkbox)
          Defines actions to do when the given check box is selected/unselected.
 void onItemSelected(java.awt.ItemSelectable itemSelectable)
          Defines actions to do when the selected items of the given list changed.
 void onKeyPressure(int key, int idHID, java.lang.Object source)
          Defines actions to do when a key of a keyboard is pressed.
 void onKeyRelease(int key, int idHID, java.lang.Object source)
          Defines actions to do when a key of a keyboard is released.
 void onMenuItemPressed(javax.swing.JMenuItem menuItem)
          Defines actions to do when the given menu item is pressed.
 void onMove(int button, int x, int y, boolean pressed, int idHID, java.lang.Object source)
          Defines action to do when a mouse or something equivalent is moved.
 void onPressure(int button, int x, int y, int idHID, java.lang.Object source)
          Defines action to do when the button of a mouse or something equivalent is pressed.
 void onRelease(int button, int x, int y, int idHID, java.lang.Object source)
          Defines action to do when the button of a mouse or something equivalent is released.
 void onScroll(int posX, int posY, int direction, int amount, int type, int idHID, java.lang.Object src)
          Defines actions to do when a scrolling device (e.g. a mouse wheel) is used.
 void onSpinnerChanged(javax.swing.JSpinner spinner)
          Defines actions to do when the value of the given spinner change.
 void onTabChanged(javax.swing.JTabbedPane tabbedPanel)
          Defines actions to do when the selected tab of a tabbed panel has changed.
 void onTextChanged(javax.swing.text.JTextComponent textComp)
          Defines actions to do when the text of a text field or something equivalent is modified.
 void onTimeout(TimeoutTransition timeoutTransition)
          Defines action to do when a timeout is elapsed.
 void onWindowClosed(MFrame frame)
          Defines actions to do when the decorative close button of a frame is pressed.
 

Method Detail

onTimeout

void onTimeout(TimeoutTransition timeoutTransition)
Defines action to do when a timeout is elapsed.

Parameters:
timeoutTransition - The transition which produced the timeout event.
Since:
0.2

onPressure

void onPressure(int button,
                int x,
                int y,
                int idHID,
                java.lang.Object source)
Defines action to do when the button of a mouse or something equivalent is pressed.

Parameters:
button - The identifier of the pressed button.
x - The X-coordinate of the pressure location.
y - The Y-coordinate of the pressure location.
idHID - The identifier of the used HID.
source - The object that produces the event.
Since:
0.1

onRelease

void onRelease(int button,
               int x,
               int y,
               int idHID,
               java.lang.Object source)
Defines action to do when the button of a mouse or something equivalent is released.

Parameters:
button - The identifier of the released button.
x - The X-coordinate of the release location.
y - The Y-coordinate of the release location.
idHID - The identifier of the used HID.
source - The object that produces the event.
Since:
0.1

onMove

void onMove(int button,
            int x,
            int y,
            boolean pressed,
            int idHID,
            java.lang.Object source)
Defines action to do when a mouse or something equivalent is moved.

Parameters:
button - The identifier of the pressed button, if a button is pressed (else -1).
x - The X-coordinate of the pressure location.
y - The Y-coordinate of the pressure location.
pressed - True: a button of the mouse is pressed.
idHID - The identifier of the used HID.
source - The object that produces the event.
Since:
0.1

onKeyPressure

void onKeyPressure(int key,
                   int idHID,
                   java.lang.Object source)
Defines actions to do when a key of a keyboard is pressed.

Parameters:
key - The pressed key code.
idHID - The identifier of the HID that produced the event.
source - The object that produces the event.
Since:
0.2

onKeyRelease

void onKeyRelease(int key,
                  int idHID,
                  java.lang.Object source)
Defines actions to do when a key of a keyboard is released.

Parameters:
key - The released key code.
idHID - The identifier of the HID that produced the event.
source - The object that produces the event.
Since:
0.2

onButtonPressed

void onButtonPressed(javax.swing.AbstractButton button)
Defines actions to do when a button is activated.

Parameters:
button - The pressed button.
Since:
0.1

onSpinnerChanged

void onSpinnerChanged(javax.swing.JSpinner spinner)
Defines actions to do when the value of the given spinner change.

Parameters:
spinner - The spinner that changed.
Since:
0.2

onItemSelected

void onItemSelected(java.awt.ItemSelectable itemSelectable)
Defines actions to do when the selected items of the given list changed.

Parameters:
itemSelectable - The list that changed.
Since:
0.2

onCheckBoxModified

void onCheckBoxModified(javax.swing.JCheckBox checkbox)
Defines actions to do when the given check box is selected/unselected.

Parameters:
checkbox - The modified check box;
Since:
0.2

onMenuItemPressed

void onMenuItemPressed(javax.swing.JMenuItem menuItem)
Defines actions to do when the given menu item is pressed.

Parameters:
menuItem - The pressed menu item.
Since:
0.2

onTextChanged

void onTextChanged(javax.swing.text.JTextComponent textComp)
Defines actions to do when the text of a text field or something equivalent is modified.

Parameters:
textComp - The text field.
Since:
0.1

onScroll

void onScroll(int posX,
              int posY,
              int direction,
              int amount,
              int type,
              int idHID,
              java.lang.Object src)
Defines actions to do when a scrolling device (e.g. a mouse wheel) is used.

Parameters:
posX - The X-coordinate of the position where the event occurred.
posY - The Y-coordinate of the position where the event occurred.
direction - Defines if the scrolling is up (positive value) or down (negative value).
amount - The number of units to scroll by scroll.
type - The type of scrolling that should take place in response to this event (block or unit increment).
idHID - The identifier of the used HID.
src - The object that threw the event.
Since:
0.2

onWindowClosed

void onWindowClosed(MFrame frame)
Defines actions to do when the decorative close button of a frame is pressed.

Parameters:
frame - The frame closed.
Since:
0.2

onTabChanged

void onTabChanged(javax.swing.JTabbedPane tabbedPanel)
Defines actions to do when the selected tab of a tabbed panel has changed.

Parameters:
tabbedPanel - The tabbed panel that produces the event.
Since:
0.2