public class DefaultWidgetModel extends AbstractContextual implements WidgetModel
InputWidget
.Constructor and Description |
---|
DefaultWidgetModel(Context context,
InputPanel<?,?> inputPanel,
Module module,
ModuleItem<?> item,
List<?> objectPool) |
Modifier and Type | Method and Description |
---|---|
void |
callback()
Executes the callback associated with this widget's associated input.
|
String[] |
getChoices()
Gets the multiple choice list for the module input.
|
ModuleItem<?> |
getItem()
Gets the module input's associated item descriptor.
|
Number |
getMax()
Gets the maximum value for the module input.
|
Number |
getMin()
Gets the minimum value for the module input.
|
Module |
getModule()
Gets the module's associated module instance.
|
List<?> |
getObjectPool()
Gets the available objects for use with the widget.
|
InputPanel<?,?> |
getPanel()
Gets the input panel intended to house the widget.
|
Number |
getSoftMax()
Gets the "soft" maximum value for the module input.
|
Number |
getSoftMin()
Gets the "soft" minimum value for the module input.
|
Number |
getStepSize()
Gets the step size between values for the module input.
|
String |
getText()
Gets the input's value rendered as a string.
|
Object |
getValue()
Gets the current value of the module input.
|
String |
getWidgetLabel()
Gets the text to use when labeling this widget.
|
boolean |
isBoolean()
Gets whether the input is a boolean type (i.e.,
Boolean or
boolean ). |
boolean |
isCharacter()
Gets whether the input is a character type (i.e.,
Character or
char ). |
boolean |
isInitialized()
Gets the widget's initialization state.
|
boolean |
isMessage()
Gets whether the input is a message.
|
boolean |
isMultipleChoice()
Gets whether the input provides a restricted set of choices.
|
boolean |
isNumber()
|
boolean |
isStyle(String style)
Gets whether the widget is the given style.
|
boolean |
isText()
|
boolean |
isType(Class<?> type)
Gets whether the input is compatible with the given type.
|
void |
setInitialized(boolean initialized)
Toggles the widget's initialization state.
|
void |
setValue(Object value)
Sets the current value of the module input.
|
context, getContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
context, getContext, setContext
public DefaultWidgetModel(Context context, InputPanel<?,?> inputPanel, Module module, ModuleItem<?> item, List<?> objectPool)
public InputPanel<?,?> getPanel()
WidgetModel
getPanel
in interface WidgetModel
public Module getModule()
WidgetModel
getModule
in interface WidgetModel
public ModuleItem<?> getItem()
WidgetModel
getItem
in interface WidgetModel
public List<?> getObjectPool()
WidgetModel
ObjectWidget
s typically display a dropdown combo box providing
multiple choice selection between these objects.
Note that this list does not represent a constraint in allowed widget values, but rather provides a list of possibilities in cases where the realm of values is not defined by the type in some other way.
getObjectPool
in interface WidgetModel
ObjectWidget
public String getWidgetLabel()
WidgetModel
BasicDetails.getLabel()
).
Otherwise, a capitalized version of the item's name is given (i.e.,
Named.getName()
).getWidgetLabel
in interface WidgetModel
public boolean isStyle(String style)
WidgetModel
style.equals(getItem().getWidgetStyle())
.isStyle
in interface WidgetModel
public Object getValue()
WidgetModel
In the case of inputs with a limited set of choices (i.e.,
ChoiceWidget
s and ObjectWidget
s), this method ensures the
value is in the set; if not, it returns the first item of the set.
getValue
in interface WidgetModel
public void setValue(Object value)
WidgetModel
setValue
in interface WidgetModel
public void callback()
WidgetModel
callback
in interface WidgetModel
public Number getMin()
WidgetModel
getMin
in interface WidgetModel
public Number getMax()
WidgetModel
getMax
in interface WidgetModel
public Number getSoftMin()
WidgetModel
getSoftMin
in interface WidgetModel
WidgetModel.getMin()
if none.ModuleItem.getSoftMinimum()
public Number getSoftMax()
WidgetModel
getSoftMax
in interface WidgetModel
WidgetModel.getMax()
if none.ModuleItem.getSoftMaximum()
public Number getStepSize()
WidgetModel
getStepSize
in interface WidgetModel
public String[] getChoices()
WidgetModel
getChoices
in interface WidgetModel
ChoiceWidget
public String getText()
WidgetModel
getText
in interface WidgetModel
public boolean isMessage()
WidgetModel
isMessage
in interface WidgetModel
ItemVisibility.MESSAGE
public boolean isText()
WidgetModel
isText
in interface WidgetModel
public boolean isCharacter()
WidgetModel
Character
or
char
).isCharacter
in interface WidgetModel
public boolean isNumber()
WidgetModel
isNumber
in interface WidgetModel
public boolean isBoolean()
WidgetModel
Boolean
or
boolean
).isBoolean
in interface WidgetModel
public boolean isMultipleChoice()
WidgetModel
isMultipleChoice
in interface WidgetModel
public boolean isType(Class<?> type)
WidgetModel
isType
in interface WidgetModel
public void setInitialized(boolean initialized)
WidgetModel
InputPanel
.setInitialized
in interface WidgetModel
public boolean isInitialized()
WidgetModel
InputPanel
.isInitialized
in interface WidgetModel
Copyright © 2015–2022 SciJava. All rights reserved.