Package org.scijava.display
Class DefaultDisplayService
- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.service.AbstractService
-
- org.scijava.display.DefaultDisplayService
-
- All Implemented Interfaces:
Comparable<Prioritized>,Contextual,DisplayService,Disposable,Identifiable,Initializable,Locatable,Logged,HasPluginInfo,RichPlugin,SciJavaPlugin,Prioritized,SciJavaService,Service,Versioned
public final class DefaultDisplayService extends AbstractService implements DisplayService
Default service for working withDisplays.- Author:
- Barry DeZonia, Curtis Rueden, Grant Harris
-
-
Constructor Summary
Constructors Constructor Description DefaultDisplayService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Display<?>createDisplay(Object o)Creates a display for the given object, publishing aDisplayCreatedEventto notify interested parties.Display<?>createDisplay(String name, Object o)Creates a display for the given object, publishing aDisplayCreatedEventto notify interested parties.Display<?>createDisplayQuietly(Object o)Creates a display for the given object, without publishing aDisplayCreatedEvent.EventServiceeventService()Display<?>getActiveDisplay()Gets the currently active display (of any Display type).<D extends Display<?>>
DgetActiveDisplay(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).booleanisUniqueName(String name)Checks whether the given name is already taken by an existing display.ObjectServiceobjectService()protected voidonEvent(DisplayDeletedEvent evt)Removes a display from the display list when it is deletedprotected voidonEvent(WinActivatedEvent event)Sets the display to active when its window is activated.protected voidonEvent(WinClosedEvent event)Deletes the display when display window is closed.PluginServicepluginService()voidsetActiveDisplay(Display<?> display)Set the active display.-
Methods inherited from class org.scijava.service.AbstractService
getContext, setContext, toString
-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
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.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.display.DisplayService
getEventService, getObjectService, getPluginService
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
initialize, registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
eventService
public EventService eventService()
- Specified by:
eventServicein interfaceDisplayService
-
objectService
public ObjectService objectService()
- Specified by:
objectServicein interfaceDisplayService
-
pluginService
public PluginService pluginService()
- Specified by:
pluginServicein interfaceDisplayService
-
getActiveDisplay
public Display<?> getActiveDisplay()
Description copied from interface:DisplayServiceGets the currently active display (of any Display type).- Specified by:
getActiveDisplayin interfaceDisplayService
-
getActiveDisplay
public <D extends Display<?>> D getActiveDisplay(Class<D> displayClass)
Description copied from interface:DisplayServiceGets the most recently active display (of the specified Display type).- Specified by:
getActiveDisplayin interfaceDisplayService
-
setActiveDisplay
public void setActiveDisplay(Display<?> display)
Description copied from interface:DisplayServiceSet the active display.- Specified by:
setActiveDisplayin interfaceDisplayService
-
getDisplayPlugins
public List<PluginInfo<Display<?>>> getDisplayPlugins()
Description copied from interface:DisplayServiceGets the list of known display plugins.- Specified by:
getDisplayPluginsin interfaceDisplayService
-
getDisplayPlugin
public <D extends Display<?>> PluginInfo<Display<?>> getDisplayPlugin(Class<D> pluginClass)
Description copied from interface:DisplayServiceGets the display plugin of the given class, or null if none.- Specified by:
getDisplayPluginin interfaceDisplayService
-
getDisplayPlugin
public PluginInfo<Display<?>> getDisplayPlugin(String className)
Description copied from interface:DisplayServiceGets the display plugin of the given class name, or null if none.- Specified by:
getDisplayPluginin interfaceDisplayService
-
getDisplayPluginsOfType
public <D extends Display<?>> List<PluginInfo<D>> getDisplayPluginsOfType(Class<D> type)
Description copied from interface:DisplayServiceGets the list of display plugins of the given type (e.g.,ImageDisplay.class).- Specified by:
getDisplayPluginsOfTypein interfaceDisplayService
-
getDisplays
public List<Display<?>> getDisplays()
Description copied from interface:DisplayServiceGets a list of all available displays.- Specified by:
getDisplaysin interfaceDisplayService
-
getDisplaysOfType
public <D extends Display<?>> List<D> getDisplaysOfType(Class<D> type)
Description copied from interface:DisplayServiceGets a list of all available displays of the given type (e.g.,ImageDisplay.class).- Specified by:
getDisplaysOfTypein interfaceDisplayService
-
getDisplay
public Display<?> getDisplay(String name)
Description copied from interface:DisplayServiceGets a display by its name.- Specified by:
getDisplayin interfaceDisplayService
-
getDisplays
public List<Display<?>> getDisplays(Object o)
Description copied from interface:DisplayServiceGets a list of displays currently visualizing the given object.- Specified by:
getDisplaysin interfaceDisplayService
-
isUniqueName
public boolean isUniqueName(String name)
Description copied from interface:DisplayServiceChecks whether the given name is already taken by an existing display.- Specified by:
isUniqueNamein interfaceDisplayService- 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:DisplayServiceCreates a display for the given object, publishing aDisplayCreatedEventto notify interested parties. In particular:- Visible UIs will respond to this event by showing the display.
- The
ObjectServicewill add the new display to its index, until a correspondingDisplayDeletedEventis later published.
To create a
Displaywithout publishing an event, seeDisplayService.createDisplayQuietly(java.lang.Object).- Specified by:
createDisplayin interfaceDisplayService- 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 aDisplay<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:DisplayServiceCreates a display for the given object, publishing aDisplayCreatedEventto notify interested parties. In particular:- Visible UIs will respond to this event by showing the display.
- The
ObjectServicewill add the new display to its index, until a correspondingDisplayDeletedEventis later published.
To create a
Displaywithout publishing an event, seeDisplayService.createDisplayQuietly(java.lang.Object).- Specified by:
createDisplayin interfaceDisplayService- 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 aDisplay<DataView>with the DataView wrapping a Dataset, yet the ImageDisplay supports adding Datasets directly, taking care of wrapping them in a DataView as needed.
-
createDisplayQuietly
public Display<?> createDisplayQuietly(Object o)
Description copied from interface:DisplayServiceCreates a display for the given object, without publishing aDisplayCreatedEvent. Hence, the display will not be automatically shown or tracked.- Specified by:
createDisplayQuietlyin interfaceDisplayService- 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 aDisplay<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
-
-