org.scijava
Class AbstractContextual

java.lang.Object
  extended by org.scijava.AbstractContextual
All Implemented Interfaces:
Contextual
Direct Known Subclasses:
AbstractDragAndDropData, AbstractInputHarvester, AbstractPostprocessorPlugin, AbstractPreprocessorPlugin, AbstractRichPlugin, ContextCommand, ModuleRunner, SciJavaEvent, ScriptFinder, ServiceHelper, ShadowMenu, WidgetModel

public abstract class AbstractContextual
extends Object
implements Contextual

Abstract base class for Contextual objects.

Delegates to Context.inject(Object) to do the actual work of setting the context, injecting service parameters, and registering EventHandler methods as event subscribers.

Author:
Curtis Rueden
See Also:
Context.inject(Object)

Constructor Summary
AbstractContextual()
           
 
Method Summary
 Context context()
          Gets the application context to which the object belongs.
 Context getContext()
          Gets the application context to which the object belongs, or null if Contextual.setContext(Context) has not yet been called on this object.
 void setContext(Context context)
          Sets the application context to which the object belongs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractContextual

public AbstractContextual()
Method Detail

context

public Context context()
Description copied from interface: Contextual
Gets the application context to which the object belongs.

Specified by:
context in interface Contextual
See Also:
Contextual.getContext()

getContext

public Context getContext()
Description copied from interface: Contextual
Gets the application context to which the object belongs, or null if Contextual.setContext(Context) has not yet been called on this object.

Specified by:
getContext in interface Contextual
See Also:
Contextual.context()

setContext

public void setContext(Context context)
Description copied from interface: Contextual
Sets the application context to which the object belongs.

Typically this method simply delegates to Context.inject(Object), and should be called only once to populate the context. Most contextual objects do not support later alteration of the context, and will throw IllegalStateException if this method is invoked again.

Specified by:
setContext in interface Contextual
See Also:
Context.inject(Object), for an example of how to implement this interface


Copyright © 2009–2014 SciJava. All rights reserved.