Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse GEF
3.3

org.eclipse.gef.tools
Class SimpleDragTracker

java.lang.Object
  extended by

org.eclipse.gef.util.FlagSupport
      extended by

org.eclipse.gef.tools.AbstractTool
          extended by
org.eclipse.gef.tools.SimpleDragTracker
All Implemented Interfaces:
DragTracker, RequestConstants, Tool
Direct Known Subclasses:
ConnectionBendpointTracker, ResizeTracker

public abstract class SimpleDragTracker
extends AbstractTool
implements DragTracker

A simple drag tracker implementation that does not perform targeting. For example, resizing a shape or bendpoint does not involve any target editpart.


Nested Class Summary
 
Nested classes inherited from class org.eclipse.gef.tools. AbstractTool
AbstractTool.Input
 
Field Summary
protected static int MAX_FLAG
          The maximum bit-mask used as a flag constant.
 
Fields inherited from class org.eclipse.gef.tools. AbstractTool
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
 
Fields inherited from interface org.eclipse.gef. RequestConstants
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
 
Constructor Summary
protected SimpleDragTracker ()
          Null constructor.
 
Method Summary
protected  Cursor calculateCursor ()
          Returns the appropriate cursor for the tools current state.
 void commitDrag ()
          The SelectionTool supports keyboard accessible drags.
protected   Request createSourceRequest ()
          Creates and returns a new Request that is used during the drag.
 void deactivate ()
          Called when another Tool becomes the active tool for the EditDomain.
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.
 
Methods inherited from class org.eclipse.gef.tools. AbstractTool
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
 
Methods inherited from class org.eclipse.gef.util. FlagSupport
getFlag, setFlag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef. Tool
activate, focusGained, focusLost, keyDown, keyTraversed, keyUp, mouseDoubleClick, mouseDown, mouseDrag, mouseHover, mouseMove, mouseUp, mouseWheelScrolled, nativeDragFinished, nativeDragStarted, setEditDomain, setProperties, setViewer, viewerEntered, viewerExited
 

Field Detail

MAX_FLAG

protected static final int MAX_FLAG
The maximum bit-mask used as a flag constant. Subclasses should start using the next highest bitmask.

See Also:
Constant Field Values
Constructor Detail

SimpleDragTracker

protected SimpleDragTracker()
Null constructor.

Method Detail

calculateCursor

protected Cursor calculateCursor()
Description copied from class: AbstractTool
Returns the appropriate cursor for the tools current state. If the tool is in its terminal state, 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.

Overrides:
calculateCursor in class AbstractTool
Returns:
null or a cursor to be displayed.
See Also:
AbstractTool.calculateCursor()

commitDrag

public void commitDrag()
Description copied from interface: DragTracker
The SelectionTool supports keyboard accessible drags. In such scenarios it is up to the SelectionTool to interpret commit and abort keystrokes. Since the DragTracker cannot do this, this method is used to indicate that the User has committed the drag using the keyboard. Abort is not handled specially, and the DragTracker should peform the usual cleanup in its Tool.deactivate() method.

Specified by:
commitDrag in interface DragTracker
Overrides:
commitDrag in class AbstractTool
See Also:
DragTracker.commitDrag()

createSourceRequest

protected 
Request createSourceRequest()
Creates and returns a new Request that is used during the drag.

Returns:
a new source request

deactivate

public void deactivate()
Description copied from interface: Tool
Called when another Tool becomes the active tool for the EditDomain. implementors can perform state clean-up or to free resources.

Specified by:
deactivate in interface Tool
Overrides:
deactivate in class AbstractTool
See Also:
Tool.deactivate()

eraseSourceFeedback

protected void eraseSourceFeedback()
Show the source drag feedback for the drag occurring within the viewer.


getSourceRequest

protected 
Request getSourceRequest()
Returns the request for the source of the drag, creating it if necessary.

Returns:
the source request

handleButtonDown

protected boolean handleButtonDown(int button)
Looks for button 1, and goes into the drag state. Any other button is invalid input.

Overrides:
handleButtonDown in class AbstractTool
Parameters:
button - which button went down
Returns:
true if the buttonDown was handled
See Also:
AbstractTool.handleButtonDown(int)

handleButtonUp

protected boolean handleButtonUp(int button)
If dragging is in progress, cleans up feedback and calls performDrag().

Overrides:
handleButtonUp in class AbstractTool
Parameters:
button - the button being released
Returns:
true if the button up was handled
See Also:
AbstractTool.handleButtonUp(int)

handleDragInProgress

protected boolean handleDragInProgress()
Description copied from class: AbstractTool
Called whenever a mouse is being dragged and the drag threshold has been exceeded. Prior to the drag threshold being exceeded, only 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.

Overrides:
handleDragInProgress in class AbstractTool
Returns:
true if the drag was handled
See Also:
AbstractTool.handleDragInProgress()

handleDragStarted

protected boolean handleDragStarted()
Transitions Drag to Drag in progress state.

Overrides:
handleDragStarted in class AbstractTool
Returns:
true if the drag starting was handled
See Also:
AbstractTool.handleDragStarted()

handleInvalidInput

protected boolean handleInvalidInput()
Called when the mouse and/or keyboard input is invalid.

Overrides:
handleInvalidInput in class AbstractTool
Returns:
true

handleKeyDown

protected boolean handleKeyDown(KeyEvent e)
Looks for keys which are used during accessible drags.

Overrides:
handleKeyDown in class AbstractTool
Parameters:
e - the key event
Returns:
true if the key down was handled.
See Also:
org.eclipse.gef.tools.AbstractTool#handleKeyDown(org.eclipse.swt.events.KeyEvent)

handleKeyUp

protected boolean handleKeyUp(KeyEvent e)
Description copied from class: AbstractTool
Handles high-level processing of a key up event. By default, does nothing and returns false. Subclasses may extend this method to process key up events. Returns true if the key up was processed in some way.

Overrides:
handleKeyUp in class AbstractTool
Parameters:
e - the key event
Returns:
true if the event was handled
See Also:
org.eclipse.gef.tools.AbstractTool#handleKeyUp(org.eclipse.swt.events.KeyEvent)

isShowingFeedback

protected boolean isShowingFeedback()
Returns true if feedback is being shown.

Returns:
true if feedback is showing

performDrag

protected void performDrag()
Called once the drag has been interpreted. This is where the real work of the drag is carried out. By default, the current command is executed.


showSourceFeedback

protected void showSourceFeedback()
Show the source drag feedback for the drag occurring within the viewer.


updateSourceRequest

protected void updateSourceRequest()
Updates the source request.


Eclipse GEF
3.3

Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire