public final class DefaultObjectService extends AbstractService implements ObjectService
ObjectCreatedEvent
s, and removes objects
from ObjectDeletedEvent
s.
This is useful to retrieve available objects of a particular type. For
example, the InputHarvester
infrastructure uses it
to provide a pool of available objects for widgets such as the
ObjectWidget
, which provide the user with a
multiple-choice selection.
Constructor and Description |
---|
DefaultObjectService() |
Modifier and Type | Method and Description |
---|---|
void |
addObject(Object obj)
Registers an object with the object service.
|
EventService |
getEventService() |
ObjectIndex<Object> |
getIndex()
Gets the index of available objects.
|
<T> List<T> |
getObjects(Class<T> type)
Gets a list of all registered objects compatible with the given type.
|
void |
initialize()
Performs any needed initialization when the service is first loaded.
|
protected void |
onEvent(ObjectCreatedEvent event) |
protected void |
onEvent(ObjectDeletedEvent event) |
void |
removeObject(Object obj)
Deregisters an object with the object service.
|
dispose, getContext, registerEventHandlers, setContext, toString
compareTo, getInfo, getPriority, setInfo, setPriority
context
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
registerEventHandlers
context, getContext, setContext
getPriority, setPriority
compareTo
getInfo, setInfo
dispose
public EventService getEventService()
getEventService
in interface ObjectService
public ObjectIndex<Object> getIndex()
ObjectService
getIndex
in interface ObjectService
public <T> List<T> getObjects(Class<T> type)
ObjectService
getObjects
in interface ObjectService
public void addObject(Object obj)
ObjectService
addObject
in interface ObjectService
public void removeObject(Object obj)
ObjectService
removeObject
in interface ObjectService
public void initialize()
Service
NB: This method is not intended to be called directly. It is called by
the service framework itself (specifically by the ServiceHelper
)
when initializing the service. It should not be called a second time.
initialize
in interface Service
initialize
in class AbstractService
protected void onEvent(ObjectCreatedEvent event)
protected void onEvent(ObjectDeletedEvent event)
Copyright © 2009–2015 SciJava. All rights reserved.