Package io.guise.framework.model
Interface ValueModel<V>
- Type Parameters:
V
- The type of value contained in the model.
- All Superinterfaces:
Model
,com.globalmentor.model.MutableValued<V>
,com.globalmentor.beans.PropertyBindable
,com.globalmentor.beans.PropertyConstrainable
,com.globalmentor.model.Valued<V>
- All Known Subinterfaces:
ActionValueControl<V>
,CardControl
,DialogFrame<V>
,ListSelectControl<V>
,ListSelectModel<V>
,OptionDialogFrame<O>
,SelectControl<V>
,SelectModel<V>
,TreeNodeModel<V>
,ValueControl<V>
- All Known Implementing Classes:
AbstractActionValueControl
,AbstractBooleanSelectActionControl
,AbstractCardPanel
,AbstractContainerValueControl
,AbstractDialogFrame
,AbstractEditValueControl
,AbstractLayoutValueControl
,AbstractListSelectContainerControl
,AbstractListSelectControl
,AbstractListSelectTableModel
,AbstractOptionDialogFrame
,AbstractSelectActionValueControl
,AbstractTextControl
,AbstractValueControl
,AbstractValueLayout
,AbstractValueModel
,BooleanSelectButton
,BooleanSelectLink
,BooleanSelectToolButton
,BooleanValueControlSelectControl
,CalendarControl
,CalendarDialogFrame
,CardLayout
,CardPanel
,CardTabControl
,CheckControl
,DateTimeControl
,DateTimeFieldsControl
,DefaultDialogFrame
,DefaultListSelectModel
,DefaultTreeNodeModel
,DefaultValueModel
,DummyTreeNodeModel
,DynamicTreeNodeModel
,ImageBooleanSelectActionControl
,ListControl
,MessageOptionDialogFrame
,NotificationOptionDialogFrame
,ResourceImportControl
,SequenceCardPanel
,SliderControl
,SpinnerControl
,TabbedPanel
,TabContainerControl
,TabControl
,TabLayout
,Table.DefaultCellValueModel
,TaskStateSelectLink
,TextControl
,TogglePrototype
,ValuePrototype
,ValueSelectButton
,ValueSelectLink
A model for user input of a value.
- Author:
- Garret Wilson
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the value by setting the value tonull
, which may be invalid according to any installed validators.getValue()
boolean
Determines whether the value of this model is valid.void
Resets the value to a default value, which may be invalid according to any installed validators.void
setValidator
(Validator<V> newValidator) Sets the validator.void
Sets the new value.void
Validates the value of this model, throwing an exception if the model is not valid.Methods inherited from interface com.globalmentor.beans.PropertyBindable
addPropertyChangeListener, addPropertyChangeListener, getPropertyChangeListeners, getPropertyChangeListeners, hasPropertyChangeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from interface com.globalmentor.beans.PropertyConstrainable
addVetoableChangeListener, addVetoableChangeListener, getVetoableChangeListeners, getVetoableChangeListeners, hasVetoableChangeListeners, removeVetoableChangeListener, removeVetoableChangeListener
-
Field Details
-
VALIDATOR_PROPERTY
The validator bound property. -
VALUE_PROPERTY
The value bound property.
-
-
Method Details
-
getDefaultValue
V getDefaultValue()- Returns:
- The default value.
-
getValue
V getValue()- Specified by:
getValue
in interfacecom.globalmentor.model.Valued<V>
- Returns:
- The input value, or
null
if there is no input value.
-
setValue
Sets the new value. This is a bound property that only fires a change event when the new value is different via theequals()
method. If a validator is installed, the value will first be validated before the current value is changed. Validation always occurs if a validator is installed, even if the value is not changing. If the value change is vetoed by the installed validator, the validation exception will be accessible viaThrowable.getCause()
.- Specified by:
setValue
in interfacecom.globalmentor.model.MutableValued<V>
- Parameters:
newValue
- The new value.- Throws:
PropertyVetoException
- if the provided value is not valid or the change has otherwise been vetoed.- See Also:
-
clearValue
void clearValue()Clears the value by setting the value tonull
, which may be invalid according to any installed validators. No validation occurs.- See Also:
-
resetValue
void resetValue()Resets the value to a default value, which may be invalid according to any installed validators. No validation occurs.- See Also:
-
getValidator
- Returns:
- The validator for this model, or
null
if no validator is installed.
-
setValidator
Sets the validator. This is a bound property- Parameters:
newValidator
- The validator for this model, ornull
if no validator should be used.- See Also:
-
isValidValue
boolean isValidValue()Determines whether the value of this model is valid.- Returns:
- Whether the value of this model is valid.
-
validateValue
Validates the value of this model, throwing an exception if the model is not valid.- Throws:
ValidationException
- if the value of this model is not valid.
-
getValueClass
- Returns:
- The class representing the type of value this model can hold.
-