Class SwingDragger

java.lang.Object
com.inductiveautomation.snap.swing.SwingDragger
All Implemented Interfaces:
DragSourceListener, DragSourceMotionListener, EventListener

public class SwingDragger extends Object implements DragSourceListener, DragSourceMotionListener
A class to manage dragging.
  • Constructor Details

    • SwingDragger

      public SwingDragger()
  • Method Details

    • getDragItem

      public Object getDragItem()
      Returns the item really being dragged.
    • setDragItem

      public void setDragItem(Object anItem)
      Sets the item really being dragged.
    • getDragItem

      public <T> T getDragItem(Class<T> aClass)
      Returns the drag item as given class.
    • getDragItemString

      public String getDragItemString()
      Returns the drag item as string.
    • getDragGestureEvent

      public DragGestureEvent getDragGestureEvent()
      Returns the DragGestureEvent.
    • setDragGestureEvent

      public void setDragGestureEvent(DragGestureEvent anEvent)
      Sets the DragGestureEvent.
    • getDragImage

      public Image getDragImage()
      Returns the image to be dragged.
    • setDragImage

      public void setDragImage(Image anImage)
      Sets the image to be dragged.
    • setDragImageFromString

      public void setDragImageFromString(String aString, Font aFont)
      Sets the drag image from given string and font.
    • getDragImagePoint

      public Point getDragImagePoint()
      Returns the point that the drag image should be dragged by.
    • setDragImagePoint

      public void setDragImagePoint(Point aPoint)
      Returns the point that the drag image should be dragged by.
    • setDragImagePoint

      public void setDragImagePoint(double anX, double aY)
      Returns the point that the drag image should be dragged by.
    • getDragImageOffset

      protected Point getDragImageOffset()
      Returns the drag image offset point.
    • getTransferable

      public Transferable getTransferable()
      Sets the transferable.
    • setTransferable

      public void setTransferable(Transferable aTrans)
      Sets the transferable.
    • setTransferable

      public void setTransferable(String aString)
      Sets the transferable from string.
    • createTransferable

      protected Transferable createTransferable()
      Creates a transferable for DragItem.
    • createTransferable

      public static Transferable createTransferable(Object anItem)
      Creates a transferable for given object.
    • getDragSourceListener

      public DragSourceListener getDragSourceListener()
      Returns the optional DragSourceListener.
    • setDragSourceListener

      public void setDragSourceListener(DragSourceListener aListener)
      Sets an optional DragSourceListener.
    • getComponent

      protected JComponent getComponent()
      Returns the component.
    • getDragSource

      public DragSource getDragSource()
      Returns the DragSource.
    • startDrag

      public void startDrag()
      Starts the drag.
    • getActiveDragger

      public static SwingDragger getActiveDragger()
      Returns the currently active dragger.
    • createDragWindow

      protected void createDragWindow()
      Creates new drag source listener.
    • dragEnter

      public void dragEnter(DragSourceDragEvent anEvent)
      DragSourceListener method.
      Specified by:
      dragEnter in interface DragSourceListener
    • dragMouseMoved

      public void dragMouseMoved(DragSourceDragEvent anEvent)
      DragSourceMotionListener method.
      Specified by:
      dragMouseMoved in interface DragSourceMotionListener
    • dragDropEnd

      public void dragDropEnd(DragSourceDropEvent anEvent)
      DragSourceListener method.
      Specified by:
      dragDropEnd in interface DragSourceListener
    • dragOver

      public void dragOver(DragSourceDragEvent anEvent)
      DragSourceListener method.
      Specified by:
      dragOver in interface DragSourceListener
    • dragExit

      public void dragExit(DragSourceEvent anEvent)
      DragSourceListener method.
      Specified by:
      dragExit in interface DragSourceListener
    • dropActionChanged

      public void dropActionChanged(DragSourceDragEvent anEvent)
      DragSourceListener method.
      Specified by:
      dropActionChanged in interface DragSourceListener