|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.javadocking.drag.DefaultDragListener
public class DefaultDragListener
This drag listener contains a Dragger. The real dragging functionality is done by this dragger.
This class only analyzes the mouse events and decides if dragging should be started, continued, stopped,
or canceled.
Dragging is started when a mouse button is pressed and a specific modifier (CTRL, ALT, SHIFT or META) is down.
To have a specific mouse button for starting dragging, this button should be specified with
the method setStartButtonMask(int), e.g. if you want to use
the middle mouse button for dragging:
setStartButtonMask(java.awt.event.InputEvent.BUTTON2_MASK)
The default mouse button for starting dragging is the left mouse button.
To have a specific modifier for starting dragging, this modifier should be specified with
the method setStartModifierMask(int), e.g. if you want to use
the CTRL modifier for dragging:
setStartModifierMask(java.awt.event.InputEvent.CTRL_DOWN_MASK)
If no specific modifier should be down, give NO_MASK as parameter.
The default modifier for starting dragging is NO_MASK.
Dragging is canceled when a specific mouse button is pressed. To have a specific mouse button for canceling dragging,
this button should be specified with the method setCancelButtonMask(int), e.g. if you want to use
the right mouse button for canceling dragging:
setCancelButtonMask(java.awt.event.InputEvent.BUTTON3_MASK)
The default mouse button for canceling dragging is the right mouse button.
Dragging can also be canceled when releasing the mouse button while a modifier (CTRL, ALT, SHIFT or META) is pressed.
To have a specific modifier for canceling dragging,
this modifier should be specified with the method setCancelModifierMask(int), f.e. if you want to use
the ALT modifier for canceling dragging:
setCancelModifierMask(java.awt.event.InputEvent.ALT_DOWN_MASK)
There is no default modifier for canceling dragging.
| Field Summary | |
|---|---|
static int |
NO_MASK
|
| Constructor Summary | |
|---|---|
DefaultDragListener(Dock dock)
Constructs a drag mouse listener for the given dock. |
|
DefaultDragListener(Dockable dockable)
Constructs a drag mouse listener for the given dockable. |
|
| Method Summary | |
|---|---|
protected boolean |
canCancelDragging(java.awt.event.MouseEvent mouseEvent)
Determines if dragging should be canceled for the given mouse event. |
protected boolean |
canShowPopup(java.awt.event.MouseEvent mouseEvent)
Determines if for this mouse event the popup of the dockable should be shown. |
protected boolean |
canStartDragging(java.awt.event.MouseEvent mouseEvent)
Determines if dragging should be started for the given mouse event. |
int |
getCancelButtonMask()
Gets the mouse button that should be pressed for canceling dragging. |
int |
getCancelModifierMask()
Gets the modifier that should be down for canceling dragging when the button is released. |
int |
getStartButtonMask()
Gets the mouse button that should be pressed for starting dragging. |
int |
getStartModifierMask()
Gets the modifier that should be pressed for starting dragging. |
void |
mouseClicked(java.awt.event.MouseEvent mouseEvent)
|
void |
mouseDragged(java.awt.event.MouseEvent mouseEvent)
|
void |
mouseEntered(java.awt.event.MouseEvent mouseEvent)
|
void |
mouseExited(java.awt.event.MouseEvent mouseEvent)
|
void |
mouseMoved(java.awt.event.MouseEvent mouseEvent)
|
void |
mousePressed(java.awt.event.MouseEvent mouseEvent)
|
void |
mouseReleased(java.awt.event.MouseEvent mouseEvent)
|
void |
setCancelButtonMask(int cancelButtonMask)
Sets the mouse button that should be pressed for canceling dragging. |
void |
setCancelModifierMask(int cancelModifierMask)
Sets the modifier that should be down for canceling dragging when the button is released. |
void |
setStartButtonMask(int startButtonMask)
Sets the mouse button that should be pressed for starting dragging. |
void |
setStartModifierMask(int startModifierMask)
Sets the modifier that should be pressed for starting dragging. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NO_MASK
| Constructor Detail |
|---|
public DefaultDragListener(Dock dock)
dock - The drag listener listens to drag events for this dock.
java.lang.IllegalArgumentException - If the dock is null.public DefaultDragListener(Dockable dockable)
dockable - The drag listener listens to drag events for this dockable.
java.lang.IllegalArgumentException - If the dockable is null.| Method Detail |
|---|
public void mousePressed(java.awt.event.MouseEvent mouseEvent)
mousePressed in interface java.awt.event.MouseListenerpublic void mouseDragged(java.awt.event.MouseEvent mouseEvent)
mouseDragged in interface java.awt.event.MouseMotionListenerpublic void mouseReleased(java.awt.event.MouseEvent mouseEvent)
mouseReleased in interface java.awt.event.MouseListenerpublic void mouseMoved(java.awt.event.MouseEvent mouseEvent)
mouseMoved in interface java.awt.event.MouseMotionListenerpublic void mouseClicked(java.awt.event.MouseEvent mouseEvent)
mouseClicked in interface java.awt.event.MouseListenerpublic void mouseEntered(java.awt.event.MouseEvent mouseEvent)
mouseEntered in interface java.awt.event.MouseListenerpublic void mouseExited(java.awt.event.MouseEvent mouseEvent)
mouseExited in interface java.awt.event.MouseListenerpublic int getCancelButtonMask()
public void setCancelButtonMask(int cancelButtonMask)
cancelButtonMask - The mouse button that should be pressed for canceling dragging.
When no mouse button has to be pressed, this should be NO_MASK.public int getCancelModifierMask()
public void setCancelModifierMask(int cancelModifierMask)
cancelModifierMask - The modifier that should be down for canceling dragging when the button is released.
When no modifier has to be down, this should be NO_MASK.public int getStartButtonMask()
public void setStartButtonMask(int startButtonMask)
startButtonMask - The mouse button that should be pressed for starting dragging.
When no specific mouse button has to be pressed, this should be NO_MASK.public int getStartModifierMask()
public void setStartModifierMask(int startModifierMask)
startModifierMask - The modifier that should be pressed for starting dragging.
When no modifier has to be pressed, this should be NO_MASK.protected boolean canStartDragging(java.awt.event.MouseEvent mouseEvent)
getStartButtonMask()
is pressed and if one of the modifiers defined by getStartModifierMask()
is down.
protected boolean canCancelDragging(java.awt.event.MouseEvent mouseEvent)
getCancelButtonMask()
is pressed and if one of the modifiers defined by getCancelModifierMask()
is down.
protected boolean canShowPopup(java.awt.event.MouseEvent mouseEvent)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||