org.scijava.widget
Interface InputWidget<T,W>

Type Parameters:
T - The input type of the widget.
W - The type of UI component housing the widget.
All Superinterfaces:
Comparable<Prioritized>, Contextual, HasPluginInfo, Prioritized, RichPlugin, SciJavaPlugin, Typed<WidgetModel>, TypedPlugin<WidgetModel>, UIComponent<W>, WrapperPlugin<WidgetModel>
All Known Subinterfaces:
ButtonWidget<U>, ChoiceWidget<U>, ColorWidget<U>, DateWidget<U>, FileWidget<U>, MessageWidget<U>, NumberWidget<U>, ObjectWidget<U>, TextWidget<U>, ToggleWidget<U>
All Known Implementing Classes:
AbstractInputWidget, AbstractUIInputWidget

public interface InputWidget<T,W>
extends WrapperPlugin<WidgetModel>, UIComponent<W>

Interface for input widgets. An input widget is intended to harvest user input for a particular ModuleItem. They are used by the InputHarvester preprocessor to collect module input values.

Widgets discoverable at runtime must implement this interface and be annotated with @Plugin with attribute Plugin.type() = InputWidget.class. While it possible to create a widget merely by implementing this interface, it is encouraged to instead extend AbstractInputWidget, for convenience.

Author:
Curtis Rueden
See Also:
Plugin, WidgetService, InputHarvester, InputPanel

Method Summary
 WidgetModel get()
          Gets the model object backing this widget.
 T getValue()
          Gets the current widget value.
 boolean isLabeled()
          Returns true iff the widget should be labeled with the parameter label.
 boolean isMessage()
          Returns true iff the widget should be considered a read-only "message" rather than a bidirectional input widget.
 void refreshWidget()
          Refreshes the widget to reflect the latest model value(s).
 void set(WidgetModel model)
          Initializes the widget to use the given widget model.
 boolean supports(WidgetModel model)
          Gets whether this widget would be appropriate for the given model.
 void updateModel()
          Updates the model to reflect the latest widget state.
 
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.Typed
getType
 
Methods inherited from interface org.scijava.widget.UIComponent
getComponent, getComponentType
 

Method Detail

updateModel

void updateModel()
Updates the model to reflect the latest widget state.


getValue

T getValue()
Gets the current widget value.


refreshWidget

void refreshWidget()
Refreshes the widget to reflect the latest model value(s).


isLabeled

boolean isLabeled()
Returns true iff the widget should be labeled with the parameter label. Most widgets are labeled this way, though some may not be; e.g., MessageWidgets.

See Also:
WidgetModel.getWidgetLabel()

isMessage

boolean isMessage()
Returns true iff the widget should be considered a read-only "message" rather than a bidirectional input widget. The InputPanel.isMessageOnly() method will return true iff this method returns true for all of its widgets.


set

void set(WidgetModel model)
Initializes the widget to use the given widget model. Once initialized, the widget's UI pane will be accessible via UIComponent.getComponent().

Specified by:
set in interface WrapperPlugin<WidgetModel>
Parameters:
model - The data object to associate with the plugin.

get

WidgetModel get()
Gets the model object backing this widget.

Specified by:
get in interface WrapperPlugin<WidgetModel>

supports

boolean supports(WidgetModel model)
Gets whether this widget would be appropriate for the given model.

Specified by:
supports in interface Typed<WidgetModel>


Copyright © 2009–2014 SciJava. All rights reserved.