org.scijava.ui.dnd
Interface DragAndDropHandler<D>

All Superinterfaces:
Comparable<Prioritized>, Contextual, HandlerPlugin<D>, HasPluginInfo, Prioritized, RichPlugin, SciJavaPlugin, SingletonPlugin, Typed<D>, TypedPlugin<D>
All Known Implementing Classes:
AbstractDragAndDropHandler, FileDragAndDropHandler, ListDragAndDropHandler, ScriptFileDragAndDropHandler

public interface DragAndDropHandler<D>
extends HandlerPlugin<D>

Interface for drag-and-drop handlers. A drag-and-drop handler defines behavior for drag-and-drop operations with respect to a specific sort of objects.

Drag-and-drop handlers discoverable at runtime must implement this interface and be annotated with @Plugin with attribute Plugin.type() = DragAndDropHandler.class. While it possible to create a drag-and-drop handler merely by implementing this interface, it is encouraged to instead extend AbstractDragAndDropHandler, for convenience.

Author:
Curtis Rueden
See Also:
Plugin, DragAndDropService

Method Summary
 D convertData(DragAndDropData data)
          Converts the given DragAndDropData to the type of data object supported by this handler.
 D convertObject(Object object)
          Converts the given object to the type of data object supported by this handler.
 boolean drop(D dataObject, Display<?> display)
          Performs a drop operation with the given data object in the specified Display.
 boolean dropData(DragAndDropData data, Display<?> display)
          Performs a drop operation with the given data in the specified Display.
 boolean dropObject(Object object, Display<?> display)
          Performs a drop operation with the given data in the specified Display.
 boolean supports(D dataObject)
          Gets whether this handler supports dropping the given data object onto a compatible display.
 boolean supports(D dataObject, Display<?> display)
          Gets whether this handler supports dropping the given data object onto the specified display.
 boolean supportsData(DragAndDropData data)
          Gets whether this handler supports dropping the given DragAndDropData onto a compatible display.
 boolean supportsData(DragAndDropData data, Display<?> display)
          Gets whether this handler supports dropping the given DragAndDropData onto the specified display.
 boolean supportsDisplay(Display<?> display)
          Gets whether this handler supports dropping an assumed-to-be-compatible data object onto the given Display.
 boolean supportsObject(Object object)
          Gets whether this handler supports dropping the given object onto a compatible display.
 boolean supportsObject(Object object, Display<?> display)
          Gets whether this handler supports dropping the given object onto the specified display.
 
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
 
Methods inherited from interface org.scijava.Prioritized
getPriority, setPriority
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
 
Methods inherited from interface org.scijava.Typed
getType
 

Method Detail

supports

boolean supports(D dataObject,
                 Display<?> display)
Gets whether this handler supports dropping the given data object onto the specified display.


supportsData

boolean supportsData(DragAndDropData data)
Gets whether this handler supports dropping the given DragAndDropData onto a compatible display.


supportsData

boolean supportsData(DragAndDropData data,
                     Display<?> display)
Gets whether this handler supports dropping the given DragAndDropData onto the specified display.


supportsObject

boolean supportsObject(Object object)
Gets whether this handler supports dropping the given object onto a compatible display.


supportsObject

boolean supportsObject(Object object,
                       Display<?> display)
Gets whether this handler supports dropping the given object onto the specified display.


supportsDisplay

boolean supportsDisplay(Display<?> display)
Gets whether this handler supports dropping an assumed-to-be-compatible data object onto the given Display.


convertData

D convertData(DragAndDropData data)
Converts the given DragAndDropData to the type of data object supported by this handler.

Throws:
IllegalArgumentException - if the handler does not support the given DragAndDropData.

convertObject

D convertObject(Object object)
Converts the given object to the type of data object supported by this handler.

Throws:
IllegalArgumentException - if the handler does not support the given object.

drop

boolean drop(D dataObject,
             Display<?> display)
Performs a drop operation with the given data object in the specified Display.

Throws:
IllegalArgumentException - if the handler is not compatible with the given data/display combination.

dropData

boolean dropData(DragAndDropData data,
                 Display<?> display)
Performs a drop operation with the given data in the specified Display.

Throws:
IllegalArgumentException - if the handler is not compatible with the given data/display combination.

dropObject

boolean dropObject(Object object,
                   Display<?> display)
Performs a drop operation with the given data in the specified Display.

Throws:
IllegalArgumentException - if the handler is not compatible with the given data/display combination.

supports

boolean supports(D dataObject)
Gets whether this handler supports dropping the given data object onto a compatible display.

Specified by:
supports in interface Typed<D>


Copyright © 2009–2015 SciJava. All rights reserved.