Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

org.openquark.gems.client.utilities
Class MouseClickDragListener

java.lang.Object
  extended by org.openquark.gems.client.utilities.MouseClickDragListener
All Implemented Interfaces:
MouseListener, MouseMotionListener, EventListener
Direct Known Subclasses:
MouseClickDragAdapter

public abstract class MouseClickDragListener
extends Object
implements MouseListener, MouseMotionListener

MouseListener and MouseMotionListener that use reasonable models for click and drag Creation date: (12/13/01 4:28:24 PM)

Author:
Edward Lam

Nested Class Summary
static class MouseClickDragListener.DragMode
          Drag action enum pattern.
 
Field Summary
protected static int DOUBLE_CLICK_OFFSET_LIMIT
          Max distance between clicks to count as a double click
protected static long DOUBLE_CLICK_THRESHOLD_TIME
          The number of milliseconds that should bound a double click.
protected  boolean dragInitiatedWithCTRL
          The current drag was initiated with the CTRL modifier.
protected  boolean dragInitiatedWithSHIFT
          The current drag was initiated with the SHIFT modifier.
protected  MouseClickDragListener.DragMode dragMode
          What type of dragging action we are performing.
protected static int INITIAL_DRAG_OFFSET
          Naggle size the mouse can move before a button press becomes a drag
protected  Point pressedAt
          Where we pressed.
 
Constructor Summary
MouseClickDragListener()
          Constructor for a MouseClickDragListener Creation date: (12/13/01 4:41:24 PM)
 
Method Summary
protected  void abortDrag()
          Move the drag mode into the aborted state.
 void enterDragState(MouseEvent e)
          Carry out setup appropriate to enter the drag state.
 void exitDragState(MouseEvent e)
          Carry out setup appropriate to exit the drag state.
static int getNumMouseButtons(MouseEvent e)
          Return the number of mouse buttons associated with a mouse event.
protected  boolean isUsefulDragMode(MouseClickDragListener.DragMode mode)
          Whether this drag mode actually enables accomplishing anything.
 void mouseClicked(MouseEvent e)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(MouseEvent e)
          Creation date: (12/13/01 4:28:24 PM)
 void mousePressed(MouseEvent e)
          Invoked when a mouse button has been pressed on a component.
 boolean mouseReallyClicked(MouseEvent e)
          Surrogate method for mouseClicked.
abstract  void mouseReallyDragged(MouseEvent e, Point where, boolean wasDragging)
          Surrogate method for mouseDragged.
 void mouseReleased(MouseEvent e)
          Invoked when a mouse button has been released on a component.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.awt.event.MouseListener
mouseEntered, mouseExited
 
Methods inherited from interface java.awt.event.MouseMotionListener
mouseMoved
 

Field Detail

INITIAL_DRAG_OFFSET

protected static final int INITIAL_DRAG_OFFSET
Naggle size the mouse can move before a button press becomes a drag

See Also:
Constant Field Values

DOUBLE_CLICK_OFFSET_LIMIT

protected static final int DOUBLE_CLICK_OFFSET_LIMIT
Max distance between clicks to count as a double click

See Also:
Constant Field Values

DOUBLE_CLICK_THRESHOLD_TIME

protected static final long DOUBLE_CLICK_THRESHOLD_TIME
The number of milliseconds that should bound a double click.

See Also:
Constant Field Values

pressedAt

protected Point pressedAt
Where we pressed. Null if we're not in the pressed state.


dragMode

protected MouseClickDragListener.DragMode dragMode
What type of dragging action we are performing.


dragInitiatedWithCTRL

protected boolean dragInitiatedWithCTRL
The current drag was initiated with the CTRL modifier. This allows us to tell when a drag was started with the CTRL modifier but didn't end with it.


dragInitiatedWithSHIFT

protected boolean dragInitiatedWithSHIFT
The current drag was initiated with the SHIFT modifier. This allows us to tell when a drag was started with the SHIFT modifier but didn't end with it.

Constructor Detail

MouseClickDragListener

public MouseClickDragListener()
Constructor for a MouseClickDragListener Creation date: (12/13/01 4:41:24 PM)

Method Detail

abortDrag

protected void abortDrag()
Move the drag mode into the aborted state. Creation date: (12/06/01 12:22:15 PM)


getNumMouseButtons

public static final int getNumMouseButtons(MouseEvent e)
Return the number of mouse buttons associated with a mouse event. Creation date: (03/08/2001 10:32:13 AM)

Parameters:
e - MouseEvent the mouse event
Returns:
int the number of buttons

isUsefulDragMode

protected boolean isUsefulDragMode(MouseClickDragListener.DragMode mode)
Whether this drag mode actually enables accomplishing anything. Gem dragging, connecting, disconnecting, and selecting are useful. Aborted, useless, and not-dragging states are not useful. Creation date: (12/06/01 3:31:30 PM)

Parameters:
mode - DragMode the DragMode to check
Returns:
boolean true if accomplishing anything with this drag.

mouseClicked

public final void mouseClicked(MouseEvent e)
Invoked when the mouse has been clicked on a component. Note: DO NOT USE unless you really want annoying UI behaviour. Use mouseReallyClicked() instead. You don't want to use this method (unless you're a masochist!) Mouse clicked events are not generated unless the pointer doesn't move even one pixel between press and release! Creation date: (12/13/01 4:28:24 PM)

Specified by:
mouseClicked in interface MouseListener
See Also:
MouseListener.mouseClicked(MouseEvent)

mouseDragged

public void mouseDragged(MouseEvent e)
Creation date: (12/13/01 4:28:24 PM)

Specified by:
mouseDragged in interface MouseMotionListener
See Also:
MouseMotionListener.mouseDragged(MouseEvent)

mousePressed

public void mousePressed(MouseEvent e)
Invoked when a mouse button has been pressed on a component. Creation date: (12/13/01 4:28:24 PM)

Specified by:
mousePressed in interface MouseListener
See Also:
MouseListener.mousePressed(MouseEvent)

mouseReleased

public void mouseReleased(MouseEvent e)
Invoked when a mouse button has been released on a component. Creation date: (12/13/01 4:28:24 PM)

Specified by:
mouseReleased in interface MouseListener
See Also:
MouseListener.mouseReleased(MouseEvent)

mouseReallyClicked

public boolean mouseReallyClicked(MouseEvent e)
Surrogate method for mouseClicked. Called only when our definition of click occurs. Creation date: (12/13/01 5:23:24 PM)

Parameters:
e - MouseEvent the relevant event
Returns:
boolean true if the click was a double click

mouseReallyDragged

public abstract void mouseReallyDragged(MouseEvent e,
                                        Point where,
                                        boolean wasDragging)
Surrogate method for mouseDragged. Called only when our definition of drag occurs. Creation date: (12/13/01 5:23:24 PM)

Parameters:
e - MouseEvent the relevant event
where - java.awt.Point the (possibly adjusted from e) coordinates of the drag
wasDragging - boolean True: this is a continuation of a drag. False: first call upon transition from pressed to drag.

enterDragState

public void enterDragState(MouseEvent e)
Carry out setup appropriate to enter the drag state. Principal effect is to change dragMode as appropriate. Creation date: (12/13/01 5:23:24 PM)

Parameters:
e - MouseEvent the mouse event which triggered entry into the drag state.

exitDragState

public void exitDragState(MouseEvent e)
Carry out setup appropriate to exit the drag state. Principal effect is to change dragMode as appropriate. Creation date: (12/06/01 6:14:42 PM)

Parameters:
e - MouseEvent the mouse event which caused an exit from the drag state

Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.