org.scijava.display
Class DefaultDisplayService

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.plugin.AbstractRichPlugin
          extended by org.scijava.service.AbstractService
              extended by org.scijava.display.DefaultDisplayService
All Implemented Interfaces:
Comparable<Prioritized>, Contextual, DisplayService, Disposable, HasPluginInfo, RichPlugin, SciJavaPlugin, Prioritized, SciJavaService, Service

public final class DefaultDisplayService
extends AbstractService
implements DisplayService

Default service for working with Displays.

Author:
Barry DeZonia, Curtis Rueden, Grant Harris

Constructor Summary
DefaultDisplayService()
           
 
Method Summary
 Display<?> createDisplay(Object o)
          Creates a display for the given object.
 Display<?> createDisplay(String name, Object o)
          Creates a display for the given object.
 Display<?> getActiveDisplay()
          Gets the currently active display (of any Display type).
<D extends Display<?>>
D
getActiveDisplay(Class<D> displayClass)
          Gets the most recently active display (of the specified Display type).
 Display<?> getDisplay(String name)
          Gets a display by its name.
<D extends Display<?>>
PluginInfo<Display<?>>
getDisplayPlugin(Class<D> pluginClass)
          Gets the display plugin of the given class, or null if none.
 PluginInfo<Display<?>> getDisplayPlugin(String className)
          Gets the display plugin of the given class name, or null if none.
 List<PluginInfo<Display<?>>> getDisplayPlugins()
          Gets the list of known display plugins.
<D extends Display<?>>
List<PluginInfo<D>>
getDisplayPluginsOfType(Class<D> type)
          Gets the list of display plugins of the given type (e.g., ImageDisplay.class).
 List<Display<?>> getDisplays()
          Gets a list of all available displays.
 List<Display<?>> getDisplays(Object o)
          Gets a list of displays currently visualizing the given object.
<D extends Display<?>>
List<D>
getDisplaysOfType(Class<D> type)
          Gets a list of all available displays of the given type (e.g., ImageDisplay.class).
 EventService getEventService()
           
 ObjectService getObjectService()
           
 PluginService getPluginService()
           
 boolean isUniqueName(String name)
          Checks whether the given name is already taken by an existing display.
protected  void onEvent(DisplayDeletedEvent evt)
          Removes a display from the display list when it is deleted
protected  void onEvent(WinActivatedEvent event)
          Sets the display to active when its window is activated.
protected  void onEvent(WinClosedEvent event)
          Deletes the display when display window is closed.
 void setActiveDisplay(Display<?> display)
          Set the active display.
 
Methods inherited from class org.scijava.service.AbstractService
dispose, getContext, initialize, 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.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

DefaultDisplayService

public DefaultDisplayService()
Method Detail

getEventService

public EventService getEventService()
Specified by:
getEventService in interface DisplayService

getObjectService

public ObjectService getObjectService()
Specified by:
getObjectService in interface DisplayService

getPluginService

public PluginService getPluginService()
Specified by:
getPluginService in interface DisplayService

getActiveDisplay

public Display<?> getActiveDisplay()
Description copied from interface: DisplayService
Gets the currently active display (of any Display type).

Specified by:
getActiveDisplay in interface DisplayService

getActiveDisplay

public <D extends Display<?>> D getActiveDisplay(Class<D> displayClass)
Description copied from interface: DisplayService
Gets the most recently active display (of the specified Display type).

Specified by:
getActiveDisplay in interface DisplayService

setActiveDisplay

public void setActiveDisplay(Display<?> display)
Description copied from interface: DisplayService
Set the active display.

Specified by:
setActiveDisplay in interface DisplayService

getDisplayPlugins

public List<PluginInfo<Display<?>>> getDisplayPlugins()
Description copied from interface: DisplayService
Gets the list of known display plugins.

Specified by:
getDisplayPlugins in interface DisplayService

getDisplayPlugin

public <D extends Display<?>> PluginInfo<Display<?>> getDisplayPlugin(Class<D> pluginClass)
Description copied from interface: DisplayService
Gets the display plugin of the given class, or null if none.

Specified by:
getDisplayPlugin in interface DisplayService

getDisplayPlugin

public PluginInfo<Display<?>> getDisplayPlugin(String className)
Description copied from interface: DisplayService
Gets the display plugin of the given class name, or null if none.

Specified by:
getDisplayPlugin in interface DisplayService

getDisplayPluginsOfType

public <D extends Display<?>> List<PluginInfo<D>> getDisplayPluginsOfType(Class<D> type)
Description copied from interface: DisplayService
Gets the list of display plugins of the given type (e.g., ImageDisplay.class).

Specified by:
getDisplayPluginsOfType in interface DisplayService

getDisplays

public List<Display<?>> getDisplays()
Description copied from interface: DisplayService
Gets a list of all available displays.

Specified by:
getDisplays in interface DisplayService

getDisplaysOfType

public <D extends Display<?>> List<D> getDisplaysOfType(Class<D> type)
Description copied from interface: DisplayService
Gets a list of all available displays of the given type (e.g., ImageDisplay.class).

Specified by:
getDisplaysOfType in interface DisplayService

getDisplay

public Display<?> getDisplay(String name)
Description copied from interface: DisplayService
Gets a display by its name.

Specified by:
getDisplay in interface DisplayService

getDisplays

public List<Display<?>> getDisplays(Object o)
Description copied from interface: DisplayService
Gets a list of displays currently visualizing the given object.

Specified by:
getDisplays in interface DisplayService

isUniqueName

public boolean isUniqueName(String name)
Description copied from interface: DisplayService
Checks whether the given name is already taken by an existing display.

Specified by:
isUniqueName in interface DisplayService
Parameters:
name - The name to check.
Returns:
true if the name is available, false if already taken.

createDisplay

public Display<?> createDisplay(Object o)
Description copied from interface: DisplayService
Creates a display for the given object.

Specified by:
createDisplay in interface DisplayService
Parameters:
o - The object for which a display should be created. The object is then added to the display.
Returns:
Newly created Display<?> containing the given object. The Display is typed with ? rather than T matching the Object because it is possible for the Display to be a collection of some other sort of object than the one being added. For example, ImageDisplay is a Display<DataView> with the DataView wrapping a Dataset, yet the ImageDisplay supports adding Datasets directly, taking care of wrapping them in a DataView as needed.

createDisplay

public Display<?> createDisplay(String name,
                                Object o)
Description copied from interface: DisplayService
Creates a display for the given object.

Specified by:
createDisplay in interface DisplayService
Parameters:
name - The name to be assigned to the display.
o - The object for which a display should be created. The object is then added to the display.
Returns:
Newly created Display<?> containing the given object. The Display is typed with ? rather than T matching the Object because it is possible for the Display to be a collection of some other sort of object than the one being added. For example, ImageDisplay is a Display<DataView> with the DataView wrapping a Dataset, yet the ImageDisplay supports adding Datasets directly, taking care of wrapping them in a DataView as needed.

onEvent

protected void onEvent(WinClosedEvent event)
Deletes the display when display window is closed.


onEvent

protected void onEvent(WinActivatedEvent event)
Sets the display to active when its window is activated.


onEvent

protected void onEvent(DisplayDeletedEvent evt)
Removes a display from the display list when it is deleted



Copyright © 2009–2014 SciJava. All rights reserved.