Class GridDropTargetEffect

java.lang.Object
org.eclipse.swt.dnd.DropTargetAdapter
org.eclipse.swt.dnd.DropTargetEffect
org.eclipse.nebula.widgets.grid.GridDropTargetEffect
All Implemented Interfaces:
java.util.EventListener, org.eclipse.swt.dnd.DropTargetListener, org.eclipse.swt.internal.SWTEventListener

public class GridDropTargetEffect
extends org.eclipse.swt.dnd.DropTargetEffect
This class provides a default drag under effect (eg. select, insert, scroll and expand) when a drag occurs over a Grid.

Classes that wish to provide their own drag under effect for a Grid can extend the DropTargetAdapter class and override any applicable methods in DropTargetAdapter to display their own drag under effect.

Subclasses that override any methods of this class must call the corresponding super method to get the default drag under effect implementation.

The feedback value is either one of the FEEDBACK constants defined in class DND which is applicable to instances of this class, or it must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those DND effect constants.

Feedback:
FEEDBACK_SELECT, FEEDBACK_INSERT_BEFORE, FEEDBACK_INSERT_AFTER, FEEDBACK_EXPAND, FEEDBACK_SCROLL

Note: Only one of the styles FEEDBACK_SELECT, FEEDBACK_INSERT_BEFORE or FEEDBACK_INSERT_AFTER may be specified.

Since:
3.3
See Also:
DropTargetAdapter, DropTargetEvent
  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) static int EXPAND_HYSTERESIS  
    (package private) static int SCROLL_HYSTERESIS  
  • Constructor Summary

    Constructors 
    Constructor Description
    GridDropTargetEffect​(Grid grid)
    Creates a new GridDropTargetEffect to handle the drag under effect on the specified Grid.
  • Method Summary

    Modifier and Type Method Description
    (package private) int checkEffect​(int effect)  
    void dragEnter​(org.eclipse.swt.dnd.DropTargetEvent event)
    This implementation of dragEnter provides a default drag under effect for the feedback specified in event.feedback.
    void dragLeave​(org.eclipse.swt.dnd.DropTargetEvent event)
    This implementation of dragLeave provides a default drag under effect for the feedback specified in event.feedback.
    void dragOver​(org.eclipse.swt.dnd.DropTargetEvent event)
    This implementation of dragOver provides a default drag under effect for the feedback specified in event.feedback.
    boolean getIgnoreCellSelection()  
    org.eclipse.swt.widgets.Widget getItem​(int x, int y)
    void setIgnoreCellSelection​(boolean ignore)
    Set this value to true to make drop feedback in Grid always behave like the Grid was not in cell selection mode.

    Methods inherited from class org.eclipse.swt.dnd.DropTargetEffect

    getControl

    Methods inherited from class org.eclipse.swt.dnd.DropTargetAdapter

    dragOperationChanged, drop, dropAccept

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • GridDropTargetEffect

      public GridDropTargetEffect​(Grid grid)
      Creates a new GridDropTargetEffect to handle the drag under effect on the specified Grid.
      Parameters:
      grid - the Grid over which the user positions the cursor to drop the data
  • Method Details

    • setIgnoreCellSelection

      public void setIgnoreCellSelection​(boolean ignore)
      Set this value to true to make drop feedback in Grid always behave like the Grid was not in cell selection mode. The default is false.

      A value of true, means that for DND.FEEDBACK_SELECT full rows will be selected instead of cells and for DND.FEEDBACK_INSERT_AFTER and DND.FEEDBACK_INSERT_BEFORE the insert mark will span all columns.

      Parameters:
      ignore -
    • getIgnoreCellSelection

      public boolean getIgnoreCellSelection()
      Returns:
      true if cell selection mode is ignored
      See Also:
      setIgnoreCellSelection(boolean)
    • checkEffect

      int checkEffect​(int effect)
    • getItem

      public org.eclipse.swt.widgets.Widget getItem​(int x, int y)
      Overrides:
      getItem in class org.eclipse.swt.dnd.DropTargetEffect
    • dragEnter

      public void dragEnter​(org.eclipse.swt.dnd.DropTargetEvent event)
      This implementation of dragEnter provides a default drag under effect for the feedback specified in event.feedback. For additional information see DropTargetAdapter.dragEnter. Subclasses that override this method should call super.dragEnter(event) to get the default drag under effect implementation.
      Specified by:
      dragEnter in interface org.eclipse.swt.dnd.DropTargetListener
      Overrides:
      dragEnter in class org.eclipse.swt.dnd.DropTargetAdapter
      Parameters:
      event - the information associated with the drag enter event
      See Also:
      DropTargetAdapter, DropTargetEvent
    • dragLeave

      public void dragLeave​(org.eclipse.swt.dnd.DropTargetEvent event)
      This implementation of dragLeave provides a default drag under effect for the feedback specified in event.feedback. For additional information see DropTargetAdapter.dragLeave. Subclasses that override this method should call super.dragLeave(event) to get the default drag under effect implementation.
      Specified by:
      dragLeave in interface org.eclipse.swt.dnd.DropTargetListener
      Overrides:
      dragLeave in class org.eclipse.swt.dnd.DropTargetAdapter
      Parameters:
      event - the information associated with the drag leave event
      See Also:
      DropTargetAdapter, DropTargetEvent
    • dragOver

      public void dragOver​(org.eclipse.swt.dnd.DropTargetEvent event)
      This implementation of dragOver provides a default drag under effect for the feedback specified in event.feedback. For additional information see DropTargetAdapter.dragOver. Subclasses that override this method should call super.dragOver(event) to get the default drag under effect implementation.
      Specified by:
      dragOver in interface org.eclipse.swt.dnd.DropTargetListener
      Overrides:
      dragOver in class org.eclipse.swt.dnd.DropTargetAdapter
      Parameters:
      event - the information associated with the drag over event
      See Also:
      DropTargetAdapter, DropTargetEvent, DND.FEEDBACK_SELECT, DND.FEEDBACK_INSERT_BEFORE, DND.FEEDBACK_INSERT_AFTER, DND.FEEDBACK_SCROLL, DND.FEEDBACK_EXPAND