Class DragDropImportListener

java.lang.Object
qupath.lib.gui.viewer.DragDropImportListener
All Implemented Interfaces:
EventListener, EventHandler<DragEvent>

public class DragDropImportListener extends Object implements EventHandler<DragEvent>
Drag and drop support for main QuPath application, which can support a range of different object types (Files, URLs, Strings,..)
  • Constructor Details

    • DragDropImportListener

      public DragDropImportListener(QuPathGUI qupath)
      Constructor.
      Parameters:
      qupath - the current QuPath instance
  • Method Details

    • setupTarget

      public void setupTarget(Node target)
      Prepare a target node to accept drag and drop events.
      Parameters:
      target -
    • setupTarget

      public void setupTarget(Scene target)
      Prepare a target scene to accept drag and drop events.
      Parameters:
      target -
    • handle

      public void handle(DragEvent event)
      Specified by:
      handle in interface EventHandler<DragEvent>
    • addFileDropHandler

      public void addFileDropHandler(DragDropImportListener.DropHandler<File> handler)
      Add a new File DropHandler.

      This may be called on a drag-and-drop application on the main window, if no other handler deals with the event.

      Parameters:
      handler -
    • removeFileDropHandler

      public void removeFileDropHandler(DragDropImportListener.DropHandler<File> handler)
      Remove a File DropHandler.
      Parameters:
      handler -
    • addJsonDropHandler

      public void addJsonDropHandler(DragDropImportListener.DropHandler<JsonElement> handler)
      Add a new DropHandler specifically for JSON elements.

      This may be called when a json file is dropped on the main QuPath window. Handlers should quickly inspect the element and return if they cannot handle it.

      Parameters:
      handler -
    • removeJsonDropHandler

      public void removeJsonDropHandler(DragDropImportListener.DropHandler<JsonElement> handler)
      Remove a JSON DropHandler.
      Parameters:
      handler -