gishur.gui2.handler
Class MouseHandler

java.lang.Object
  |
  +--gishur.gui2.DrawAtom
        |
        +--gishur.gui2.DrawObject
              |
              +--gishur.gui2.InputHandler
                    |
                    +--gishur.gui2.handler.MouseHandler

public class MouseHandler
extends InputHandler

Version:
1.0
Author:
Thomas Wolf

Field Summary
static int ACTIVATE_ELEMENTS
          If set, activation of elements is enabled.
static int MOVE_ELEMENTS
          If set, translation of elements is enabled.
 
Fields inherited from class gishur.gui2.DrawAtom
BLOCK_REPAINT, MARK_RECALC, MARK_REPAINT, MARK_SIZE, REPAINT, UNBLOCK_REPAINT, USER_STATES_FIRST, USER_STATES_MASK
 
Constructor Summary
MouseHandler()
          Default constructor.
MouseHandler(DrawAtom drw)
          Constructs a new MouseHandler which watches the given element (and all of its members for mouseovers).
 
Method Summary
 boolean activationEnabled()
          Returns true, if this MouseHandler activates the top level elements itself.
 void add(InputHandler drw)
          Adds the InputHandler drw at the end of the layer.
 void add(InputHandler drw, boolean enable)
          Adds the InputHandler drw at the end of the layer.
 void clear()
          Removes all member DrawObjects from this layer.
 SimpleList elements()
          Returns the list of the elements to watch for Mouse overs.
protected  void filterEvent(java.awt.AWTEvent e)
          Filters events for this InputHandler and all of its members.
 void insert(InputHandler p, InputHandler drw)
          Inserts the InputHandler drw in the layer before p.
 void insert(InputHandler p, InputHandler drw, boolean enable)
          Inserts the InputHandler drw in the layer before p.
protected  void onConsumedEvent(java.awt.event.InputEvent e)
          Processes consumed InputEvents.
protected  void onConsumedEvent(java.awt.event.MouseEvent e)
           
 java.lang.String overElement()
          Returns the element name under the mouse cursor.
 DrawAtom overObject()
          Returns the DrawAtom (of the hierachy of watched DrawAtoms under the mouse cursor.
protected  void processMouseEvent(java.awt.event.MouseEvent e)
          Processes mouse events.
protected  void processMouseMotionEvent(java.awt.event.MouseEvent e)
          Processes mouse motion events.
 void refresh()
          Refreshes the mouse-over list.
 void remove(InputHandler drw)
          Removes the given InputHandler from this layer.
 boolean setActivation(boolean activation)
          Sets the activation support for top level elements.
 boolean setTransformation(boolean transformation)
          Sets the transformation support for top level elements.
 boolean transformationEnabled()
          Returns true, if this MouseHandler can transform top level elements itself.
 
Methods inherited from class gishur.gui2.InputHandler
acceptConsumed, allButtons, disable, dispatchModifyEvent, enable, enabled, oneButton, preprocessEvent, processActionEvent, processAdjustmentEvent, processComponentEvent, processContainerEvent, processEvent, processFocusEvent, processItemEvent, processKeyEvent, processModifyEvent, processPaintEvent, processTextEvent, processWindowEvent, recalculate, removeCursor, sendEvent, setAcceptConsumed, setCursor, setCursor
 
Methods inherited from class gishur.gui2.DrawObject
addDrawDependency, addPainter, blockRepaint, checkState, checkStateCleared, child, clearCache, clearState, dependency, dirty, disableEvents, draw, draw, enableEvents, ensureRecalculate, findPainter, firstPainter, fullscreen, hide, hide, insert, levelMask, levelUsed, locate, makeDirty, makeDirty, next, next, nextPainter, parent, prepeareRenderContext, prev, prev, processDrawEvent, propertyReader, recalculate, remove, removeDrawDependency, repaint, screenTransformation, setFullscreen, setPaintBeforeMembers, setScreenTransformation, setState, show, show, state, state, unblockRepaint, unblockRepaint, visible
 
Methods inherited from class gishur.gui2.DrawAtom
addProperties, collectHits, dispatchEvent, displayManager, drawComponent, getBounds, getLocalProperty, getProperty, getProperty, getRequiredProperty, processMessage, properties, removeProperty, sendEvent, sendMessage, setBounds, setPropertiesTo, setProperty, setProperty, setProperty, setProperty, toString, toString, toStringDetail, toTreeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ACTIVATE_ELEMENTS

public static final int ACTIVATE_ELEMENTS
If set, activation of elements is enabled.

MOVE_ELEMENTS

public static final int MOVE_ELEMENTS
If set, translation of elements is enabled.
Constructor Detail

MouseHandler

public MouseHandler()
Default constructor.

MouseHandler

public MouseHandler(DrawAtom drw)
Constructs a new MouseHandler which watches the given element (and all of its members for mouseovers).
Parameters:
drw - element to watch for mouseover
Method Detail

elements

public SimpleList elements()
Returns the list of the elements to watch for Mouse overs. The order is relevant here! The list can be modified, but only objects of the drawing hierachy of the type DrawAtom will be respected.
Returns:
a SimpleList that contains all watched elements

filterEvent

protected void filterEvent(java.awt.AWTEvent e)
Filters events for this InputHandler and all of its members. This method should call InputHandler.sendEvent(java.awt.AWTEvent) in order to process events through this InputHandler and all of its members.
Overrides:
filterEvent in class InputHandler
Parameters:
e - the source event. The event mask must be enabled in order to filter that type of events

onConsumedEvent

protected void onConsumedEvent(java.awt.event.InputEvent e)
Processes consumed InputEvents. In order to process the events further, call InputHandler.sendEvent(java.awt.AWTEvent).
Overrides:
onConsumedEvent in class InputHandler
Parameters:
e - consumed InputEvent.

processMouseEvent

protected void processMouseEvent(java.awt.event.MouseEvent e)
Processes mouse events.
Overrides:
processMouseEvent in class InputHandler
Parameters:
e - the event.

processMouseMotionEvent

protected void processMouseMotionEvent(java.awt.event.MouseEvent e)
Processes mouse motion events.
Overrides:
processMouseMotionEvent in class InputHandler
Parameters:
e - the event.

onConsumedEvent

protected void onConsumedEvent(java.awt.event.MouseEvent e)

activationEnabled

public final boolean activationEnabled()
Returns true, if this MouseHandler activates the top level elements itself.
Returns:
true, if activation is enabled

setActivation

public boolean setActivation(boolean activation)
Sets the activation support for top level elements.
Parameters:
activation - if true, if this MouseHandler activates the top level elements itself.
Returns:
old state of the activation support.

transformationEnabled

public final boolean transformationEnabled()
Returns true, if this MouseHandler can transform top level elements itself.
Returns:
true, if transformation is enabled

setTransformation

public boolean setTransformation(boolean transformation)
Sets the transformation support for top level elements.
Parameters:
transformation - if true, if this MouseHandler transforms the top level elements itself.
Returns:
old state of the transformation support.

refresh

public void refresh()
Refreshes the mouse-over list.

overObject

public DrawAtom overObject()
Returns the DrawAtom (of the hierachy of watched DrawAtoms under the mouse cursor.
Returns:
the DrawAtom under the mouse cursor.

overElement

public java.lang.String overElement()
Returns the element name under the mouse cursor.
Returns:
the element name under the mouse cursor.

add

public void add(InputHandler drw)
Adds the InputHandler drw at the end of the layer.
Parameters:
drw - InputHandler to add

insert

public void insert(InputHandler p,
                   InputHandler drw)
Inserts the InputHandler drw in the layer before p. The inserted element will be made enabled via InputHandler.enable().
Parameters:
p - group member to insert before or null to add at the end of the layer
drw - InputHandler to insert

add

public void add(InputHandler drw,
                boolean enable)
Adds the InputHandler drw at the end of the layer.
Parameters:
drw - InputHandler to add
enable - if true, the element will be enabled via InputHandler.enable() else it will be disabled via InputHandler.disable()

insert

public void insert(InputHandler p,
                   InputHandler drw,
                   boolean enable)
Inserts the InputHandler drw in the layer before p.
Parameters:
p - layer member to insert before or null to add at the end of the layer
drw - InputHandler to insert
enable - if true, the element will be enabled via InputHandler.enable() else it will be disabled via InputHandler.disable()

remove

public void remove(InputHandler drw)
Removes the given InputHandler from this layer. If the specified InputHandler has members, all members were removed first. Insertion of the InputHandler inserts only the InputHandler - without its members.
Parameters:
drw - InputHandler to remove

clear

public void clear()
Removes all member DrawObjects from this layer.
Overrides:
clear in class DrawObject