org.scijava.ui.dnd
Class DefaultDragAndDropService

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.plugin.AbstractRichPlugin
          extended by org.scijava.service.AbstractService
              extended by org.scijava.plugin.AbstractPTService<PT>
                  extended by org.scijava.plugin.AbstractSingletonService<PT>
                      extended by org.scijava.plugin.AbstractHandlerService<Object,DragAndDropHandler<Object>>
                          extended by org.scijava.ui.dnd.DefaultDragAndDropService
All Implemented Interfaces:
Comparable<Prioritized>, Contextual, Disposable, HandlerService<Object,DragAndDropHandler<Object>>, HasPluginInfo, PTService<DragAndDropHandler<Object>>, RichPlugin, SciJavaPlugin, SingletonService<DragAndDropHandler<Object>>, TypedService<Object,DragAndDropHandler<Object>>, Prioritized, SciJavaService, Service, Typed<Object>, DragAndDropService

public class DefaultDragAndDropService
extends AbstractHandlerService<Object,DragAndDropHandler<Object>>
implements DragAndDropService

Default service for handling drag and drop events.

Author:
Curtis Rueden

Constructor Summary
DefaultDragAndDropService()
           
 
Method Summary
 boolean drop(DragAndDropData data, Display<?> display)
          Performs a drag-and-drop operation in the given display with the specified DragAndDropData, using the first available compatible handler.
 boolean drop(Object data, Display<?> display)
          Performs a drag-and-drop operation in the given display with the specified data object, using the first available compatible handler.
 DragAndDropHandler<?> getHandler(DragAndDropData data, Display<?> display)
          Gets the drag-and-drop handler which will be used to handle the given DragAndDropData dragged onto the specified display.
 DragAndDropHandler<?> getHandler(Object object, Display<?> display)
          Gets the drag-and-drop handler which will be used to handle the given object dragged onto the specified display.
 Class<DragAndDropHandler<Object>> getPluginType()
          Gets the type of plugins managed by this service.
 Class<Object> getType()
          Gets the type associated with the object.
protected  void onEvent(DragEnterEvent e)
           
protected  void onEvent(DragExitEvent e)
           
protected  void onEvent(DragOverEvent e)
           
protected  void onEvent(DropEvent e)
           
 boolean supports(DragAndDropData data, Display<?> display)
          Checks whether the given DragAndDropData can be dropped onto the specified display.
 boolean supports(Object object, Display<?> display)
          Checks whether the given object can be dropped onto the specified display.
 
Methods inherited from class org.scijava.plugin.AbstractHandlerService
getHandler, supports
 
Methods inherited from class org.scijava.plugin.AbstractSingletonService
filterInstances, getInstance, getInstances, initialize
 
Methods inherited from class org.scijava.plugin.AbstractPTService
getPlugins, getPluginService
 
Methods inherited from class org.scijava.service.AbstractService
dispose, getContext, registerEventHandlers, setContext, toString
 
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
compareTo, getInfo, getPriority, setInfo, setPriority
 
Methods inherited from class org.scijava.AbstractContextual
context
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.scijava.ui.dnd.DragAndDropService
getInstances
 
Methods inherited from interface org.scijava.plugin.HandlerService
getHandler, supports
 
Methods inherited from interface org.scijava.plugin.SingletonService
getInstance
 
Methods inherited from interface org.scijava.plugin.PTService
getPlugins, getPluginService
 
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
 
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.Disposable
dispose
 

Constructor Detail

DefaultDragAndDropService

public DefaultDragAndDropService()
Method Detail

supports

public boolean supports(DragAndDropData data,
                        Display<?> display)
Description copied from interface: DragAndDropService
Checks whether the given DragAndDropData can be dropped onto the specified display. A (data, display) pair is deemed compatible if a compatible handler exists for them.

Specified by:
supports in interface DragAndDropService
See Also:
DragAndDropHandler

supports

public boolean supports(Object object,
                        Display<?> display)
Description copied from interface: DragAndDropService
Checks whether the given object can be dropped onto the specified display. An (object, display) pair is deemed compatible if a compatible handler exists for them.

Specified by:
supports in interface DragAndDropService
See Also:
DragAndDropHandler

drop

public boolean drop(DragAndDropData data,
                    Display<?> display)
Description copied from interface: DragAndDropService
Performs a drag-and-drop operation in the given display with the specified DragAndDropData, using the first available compatible handler.

Specified by:
drop in interface DragAndDropService
Returns:
true if the drop operation was successful
See Also:
DragAndDropHandler

drop

public boolean drop(Object data,
                    Display<?> display)
Description copied from interface: DragAndDropService
Performs a drag-and-drop operation in the given display with the specified data object, using the first available compatible handler.

Specified by:
drop in interface DragAndDropService
Returns:
true if the drop operation was successful
See Also:
DragAndDropHandler

getHandler

public DragAndDropHandler<?> getHandler(DragAndDropData data,
                                        Display<?> display)
Description copied from interface: DragAndDropService
Gets the drag-and-drop handler which will be used to handle the given DragAndDropData dragged onto the specified display.

Specified by:
getHandler in interface DragAndDropService
Returns:
The first compatible drag-and-drop handler, or null if none available.

getHandler

public DragAndDropHandler<?> getHandler(Object object,
                                        Display<?> display)
Description copied from interface: DragAndDropService
Gets the drag-and-drop handler which will be used to handle the given object dragged onto the specified display.

Specified by:
getHandler in interface DragAndDropService
Returns:
The first compatible drag-and-drop handler, or null if none available.

getPluginType

public Class<DragAndDropHandler<Object>> getPluginType()
Description copied from interface: PTService
Gets the type of plugins managed by this service.

Specified by:
getPluginType in interface PTService<DragAndDropHandler<Object>>

getType

public Class<Object> getType()
Description copied from interface: Typed
Gets the type associated with the object.

Specified by:
getType in interface Typed<Object>

onEvent

protected void onEvent(DragEnterEvent e)

onEvent

protected void onEvent(DragExitEvent e)

onEvent

protected void onEvent(DragOverEvent e)

onEvent

protected void onEvent(DropEvent e)


Copyright © 2009–2014 SciJava. All rights reserved.