org.nakedobjects.plugins.dnd
Class ViewDrag

java.lang.Object
  extended by org.nakedobjects.plugins.dnd.PointerEvent
      extended by org.nakedobjects.plugins.dnd.Drag
          extended by org.nakedobjects.plugins.dnd.ViewDrag

public class ViewDrag
extends Drag

Details a drag event that affects a view. The target of a ViewDrag is always the workspace of the source view.

An overlay view, as returned by the pickup() method on the source view, is moved by this drag objects so its location follows the pointer by an offset equivalent to the mouse location within the view.


Field Summary
 
Fields inherited from class org.nakedobjects.plugins.dnd.PointerEvent
mods
 
Constructor Summary
ViewDrag(View view, Offset offset, View dragView)
          Creates a new drag event.
 
Method Summary
 void cancel(Viewer viewer)
          Cancel drag by changing cursor back to pointer.
protected  void drag(Viewer viewer)
          Moves the overlay view so it follows the pointer
 void drag(View target, Location location, int mods)
          Indicates that the drag state has changed.
 void end(Viewer viewer)
          Ends the drag by calling drop() on the workspace.
 Location getLocation()
           
 View getOverlay()
           
 View getSourceView()
           
 Location getViewDropLocation()
           
 void subtract(int x, int y)
           
 void subtract(Location location)
           
 java.lang.String toString()
           
 
Methods inherited from class org.nakedobjects.plugins.dnd.PointerEvent
button1, button2, button3, isAlt, isCtrl, isMeta, isShift
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ViewDrag

public ViewDrag(View view,
                Offset offset,
                View dragView)
Creates a new drag event. The source view has its pickup(), and then, exited() methods called on it. The view returned by the pickup method becomes this event overlay view, which is moved continuously so that it tracks the pointer.

Parameters:
view - the view over which the pointer was when this event started
Method Detail

cancel

public void cancel(Viewer viewer)
Cancel drag by changing cursor back to pointer.

Specified by:
cancel in class Drag

drag

protected void drag(Viewer viewer)
Moves the overlay view so it follows the pointer


drag

public void drag(View target,
                 Location location,
                 int mods)
Description copied from class: Drag
Indicates that the drag state has changed.

Specified by:
drag in class Drag

end

public void end(Viewer viewer)
Ends the drag by calling drop() on the workspace.

Specified by:
end in class Drag

getOverlay

public View getOverlay()
Specified by:
getOverlay in class Drag

getLocation

public Location getLocation()

getSourceView

public View getSourceView()

getViewDropLocation

public Location getViewDropLocation()

subtract

public void subtract(Location location)

toString

public java.lang.String toString()
Overrides:
toString in class PointerEvent

subtract

public void subtract(int x,
                     int y)


Copyright © 2001-2009 Naked Objects Group Ltd.. All Rights Reserved.