org.jplot2d.interaction
Class InteractionHandler
- java.lang.Object
-
- org.jplot2d.interaction.InteractionHandler
-
- All Implemented Interfaces:
- VisualFeedbackDrawer
public class InteractionHandler extends java.lang.Object implements VisualFeedbackDrawer
This class handle the mouse actions that can respond to user's mouse events like left-click, double-click, right-click. The mouse event will translate to application level behavior, such as select an object, select data points in a layer, zoom in/out, etc. The translation can be configured by register and unregister the binding between application behavior to mouse events.Notice: most methods in this class is not thread-safe. They should be called within EDT.
-
-
Constructor Summary
Constructors Constructor and Description InteractionHandler(InteractionManager imanager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddraw(java.lang.Object graphics)Draws visual feedback on the given graphics.InteractionModeHandlergetInteractionModeHandler(java.lang.String modeName)InteractionModegetMode()java.lang.ObjectgetValue(java.lang.String key)Gets theObjectassociated with the specified key.voidinit()create mode handler and fill them with behavior handlersvoidkeyPressed(int modifiers, int modifierKey)voidkeyReleased(int modifiers, int modifierKey)voidmouseDragged(GenericMouseEvent e)voidmouseEntered(GenericMouseEvent e)voidmouseExited(GenericMouseEvent e)voidmouseMoved(GenericMouseEvent e)voidmousePressed(GenericMouseEvent e)voidmouseReleased(GenericMouseEvent e)voidmouseWheelMoved(GenericMouseEvent e)voidputValue(java.lang.String key, java.lang.Object newValue)Sets theValueassociated with the specified key.voidsetMode(InteractionMode mode)
-
-
-
Constructor Detail
-
InteractionHandler
public InteractionHandler(InteractionManager imanager)
-
-
Method Detail
-
init
public void init()
create mode handler and fill them with behavior handlers- Parameters:
ihandler-
-
keyPressed
public void keyPressed(int modifiers, int modifierKey)- Parameters:
modifiers- the modifiers mask after a modifier key pressedmodifierKey- the modifiers mask of the modifier key pressed
-
keyReleased
public void keyReleased(int modifiers, int modifierKey)- Parameters:
modifiers- the modifiers mask after a modifier key releasedmodifierKey- the modifiers mask of the modifier key released
-
mouseEntered
public void mouseEntered(GenericMouseEvent e)
-
mouseExited
public void mouseExited(GenericMouseEvent e)
-
mousePressed
public void mousePressed(GenericMouseEvent e)
-
mouseReleased
public void mouseReleased(GenericMouseEvent e)
-
mouseDragged
public void mouseDragged(GenericMouseEvent e)
-
mouseMoved
public void mouseMoved(GenericMouseEvent e)
-
mouseWheelMoved
public void mouseWheelMoved(GenericMouseEvent e)
- Parameters:
e- the negative count values if the mouse wheel was rotated up/away from the user, and positive count values if the mouse wheel was rotated down/ towards the user
-
draw
public void draw(java.lang.Object graphics)
Description copied from interface:VisualFeedbackDrawerDraws visual feedback on the given graphics.- Specified by:
drawin interfaceVisualFeedbackDrawer
-
getMode
public InteractionMode getMode()
-
setMode
public void setMode(InteractionMode mode)
-
getInteractionModeHandler
public InteractionModeHandler getInteractionModeHandler(java.lang.String modeName)
-
getValue
public java.lang.Object getValue(java.lang.String key)
Gets theObjectassociated with the specified key.- Parameters:
key- a string containing the specifiedkey- Returns:
- the binding
Objectstored with this key; if there are no keys, it will returnnull - See Also:
Action#getValue
-
putValue
public void putValue(java.lang.String key, java.lang.Object newValue)Sets theValueassociated with the specified key.- Parameters:
key- theStringthat identifies the stored objectnewValue- theObjectto store using this key- See Also:
Action#putValue
-
-
DMelt 3.0 © DataMelt by jWork.ORG