T
- The input type of the widget.W
- The type of UI component housing the widget.public interface InputWidget<T,W> extends WrapperPlugin<WidgetModel>, UIComponent<W>
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.
Plugin
,
WidgetService
,
InputHarvester
,
InputPanel
Modifier and Type | Method and Description |
---|---|
WidgetModel |
get()
Gets the model object backing this widget.
|
default Class<WidgetModel> |
getType()
Gets the type associated with the object.
|
T |
getValue()
Gets the current widget value.
|
default boolean |
isLabeled()
Returns true iff the widget should be labeled with the parameter label.
|
default 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.
|
default 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.
|
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
getComponent, getComponentType
void updateModel()
T getValue()
void refreshWidget()
default boolean isLabeled()
MessageWidget
s.WidgetModel.getWidgetLabel()
default boolean isMessage()
InputPanel.isMessageOnly()
method will return true iff this method
returns true for all of its widgets.void set(WidgetModel model)
UIComponent.getComponent()
.set
in interface WrapperPlugin<WidgetModel>
model
- The data object to associate with the plugin.WidgetModel get()
get
in interface WrapperPlugin<WidgetModel>
default boolean supports(WidgetModel model)
supports
in interface Typed<WidgetModel>
default Class<WidgetModel> getType()
Typed
getType
in interface Typed<WidgetModel>
Copyright © 2015–2022 SciJava. All rights reserved.