public abstract class SimpleDragTracker extends AbstractTool implements DragTracker
AbstractTool.Input
Modifier and Type | Field and Description |
---|---|
protected static int |
MAX_FLAG
The maximum bit-mask used as a flag constant.
|
MAX_STATE, MOUSE_BUTTON_ANY, MOUSE_BUTTON1, MOUSE_BUTTON2, MOUSE_BUTTON3, PROPERTY_UNLOAD_WHEN_FINISHED, STATE_ACCESSIBLE_DRAG, STATE_ACCESSIBLE_DRAG_IN_PROGRESS, STATE_DRAG, STATE_DRAG_IN_PROGRESS, STATE_INITIAL, STATE_INVALID, STATE_TERMINAL
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
Modifier | Constructor and Description |
---|---|
protected |
SimpleDragTracker()
Null constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Cursor |
calculateCursor()
Returns the appropriate cursor for the tools current state.
|
void |
commitDrag()
Added for compatibility.
|
protected Request |
createSourceRequest()
Creates and returns a new Request that is used during the drag.
|
void |
deactivate()
Deactivates the tool.
|
protected void |
eraseSourceFeedback()
Show the source drag feedback for the drag occurring within the viewer.
|
protected Request |
getSourceRequest()
Returns the request for the source of the drag, creating it if necessary.
|
protected boolean |
handleButtonDown(int button)
Looks for button 1, and goes into the drag state.
|
protected boolean |
handleButtonUp(int button)
If dragging is in progress, cleans up feedback and calls performDrag().
|
protected boolean |
handleDragInProgress()
Called whenever a mouse is being dragged and the drag threshold has been
exceeded.
|
protected boolean |
handleDragStarted()
Transitions Drag to Drag in progress state.
|
protected boolean |
handleInvalidInput()
Called when the mouse and/or keyboard input is invalid.
|
protected boolean |
handleKeyDown(KeyEvent e)
Looks for keys which are used during accessible drags.
|
protected boolean |
handleKeyUp(KeyEvent e)
Handles high-level processing of a key up event.
|
protected boolean |
isShowingFeedback()
Returns
true if feedback is being shown. |
protected void |
performDrag()
Called once the drag has been interpreted.
|
protected void |
showSourceFeedback()
Show the source drag feedback for the drag occurring within the viewer.
|
protected void |
updateSourceRequest()
Updates the source request.
|
acceptArrowKey, activate, addFeedback, applyProperty, createOperationSet, debug, executeCommand, executeCurrentCommand, focusGained, focusLost, getCommand, getCommandName, getCurrentCommand, getCurrentInput, getCurrentViewer, getDebugName, getDebugNameForState, getDefaultCursor, getDisabledCursor, getDomain, getDragMoveDelta, getLocation, getOperationSet, getStartLocation, getState, handleCommandStackChanged, handleDoubleClick, handleDrag, handleFinished, handleFocusGained, handleFocusLost, handleHover, handleKeyTraversed, handleMove, handleNativeDragFinished, handleNativeDragStarted, handleViewerEntered, handleViewerExited, isActive, isHoverActive, isInState, isViewerImportant, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, movedPastThreshold, nativeDragFinished, nativeDragStarted, performViewerMouseWheel, placeMouseInViewer, reactivate, refreshCursor, releaseToolCapture, removeFeedback, resetFlags, setCurrentCommand, setCursor, setDefaultCursor, setDisabledCursor, setEditDomain, setHoverActive, setProperties, setStartLocation, setState, setToolCapture, setUnloadWhenFinished, setViewer, stateTransition, unloadWhenFinished, viewerEntered, viewerExited
getFlag, setFlag
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
activate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, setViewer, viewerEntered, viewerExited
protected static final int MAX_FLAG
protected Cursor calculateCursor()
AbstractTool
null
is returned. Otherwise,
either the default or disabled cursor is returned, based on the existence
of a current command, and whether that current command is executable.
Subclasses may override or extend this method to calculate the appropriate cursor based on other conditions.
calculateCursor
in class AbstractTool
null
or a cursor to be displayed.AbstractTool.calculateCursor()
public void commitDrag()
AbstractTool
DragTracker.commitDrag()
was added for
accessibility reasons. Since all tool implementations must inherit from
this base class, then implementing this method here avoids breaking
subclasses that implemented the DragTracker
interface.commitDrag
in interface DragTracker
commitDrag
in class AbstractTool
DragTracker.commitDrag()
protected Request createSourceRequest()
public void deactivate()
AbstractTool
deactivate
in interface Tool
deactivate
in class AbstractTool
Tool.deactivate()
protected void eraseSourceFeedback()
protected Request getSourceRequest()
protected boolean handleButtonDown(int button)
handleButtonDown
in class AbstractTool
button
- which button went downtrue
if the buttonDown was handledAbstractTool.handleButtonDown(int)
protected boolean handleButtonUp(int button)
handleButtonUp
in class AbstractTool
button
- the button being releasedtrue
if the button up was handledAbstractTool.handleButtonUp(int)
protected boolean handleDragInProgress()
AbstractTool
AbstractTool.handleDrag()
is called. This method gets called repeatedly for
every mouse move during the drag. By default, nothing happens and
false
is returned. Subclasses may override this method to
interpret the drag. Returning true
indicates that the drag
was handled.handleDragInProgress
in class AbstractTool
true
if the drag was handledAbstractTool.handleDragInProgress()
protected boolean handleDragStarted()
handleDragStarted
in class AbstractTool
AbstractTool.handleDragStarted()
protected boolean handleInvalidInput()
handleInvalidInput
in class AbstractTool
true
protected boolean handleKeyDown(KeyEvent e)
handleKeyDown
in class AbstractTool
e
- the key eventtrue
if the key down was handled.AbstractTool.handleKeyDown(org.eclipse.swt.events.KeyEvent)
protected boolean handleKeyUp(KeyEvent e)
AbstractTool
false
. Subclasses may extend this method to
process key up events. Returns true
if the key up was
processed in some way.handleKeyUp
in class AbstractTool
e
- the key eventtrue
if the event was handledAbstractTool.handleKeyUp(org.eclipse.swt.events.KeyEvent)
protected boolean isShowingFeedback()
true
if feedback is being shown.true
if feedback is showingprotected void performDrag()
protected void showSourceFeedback()
protected void updateSourceRequest()
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.