Class CustomDragAndDropHandler

java.lang.Object
com.nomagic.magicdraw.ui.dnd.CustomDragAndDropHandler

@OpenApiAll public abstract class CustomDragAndDropHandler extends Object
Drop Diagram Handler interface used to implement drag and drop actions for browser drops

Using this interface you can implement the main methods that are responsible for drag and drop actions. And later register your custom drag and drop action using CustomDropDiagramHandlerFactory

See Also:
  • Constructor Details

    • CustomDragAndDropHandler

      public CustomDragAndDropHandler()
  • Method Details

    • getDescription

      public abstract String getDescription()
      Returns the description of the drop diagram handler
      Returns:
      description of drop diagram handler
    • willAcceptDrop

      public abstract boolean willAcceptDrop(Point location, @CheckForNull PresentationElement elementOver, @CheckForNull List<Element> draggedElements, DiagramPresentationElement diagram)
      Checks if drop can be executed
      Parameters:
      location - drop location
      elementOver - presentation element on which data is dragged
      draggedElements - dragged elements
      diagram - diagram presentation element on which Drag and Drop action is executed
      Returns:
      true if element can accept dragged data, else false
    • drop

      public abstract boolean drop(Point location, @CheckForNull PresentationElement elementOver, @CheckForNull List<Element> draggedElements, DiagramPresentationElement diagram)
      Executes the drop action
      Parameters:
      location - drop location
      elementOver - presentation element on which drop is executed
      draggedElements - dragged elements over drop target
      diagram - diagram presentation element on which Drag and Drop action is executed
      Returns:
      returns true if drop was successful, else false (it is important to return true after successful action, as else this and next Drag and Drop action will be executed)