java.lang.Object
org.tentackle.fx.translate.AbstractValueTranslator<M,V>
- Type Parameters:
M- the model's typeV- the view's type
- All Implemented Interfaces:
ValueTranslator<M,V>
- Direct Known Subclasses:
CollectionTreeItemTranslator,EnumStringTranslator,IdentityTranslator,ObservableListTranslator,StringColorTranslator,TreeItemTranslator,ValueStringTranslator
Base class of a value translator.
- Author:
- harald
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractValueTranslator(FxComponent component) Creates a string translator for a given text component. -
Method Summary
Modifier and TypeMethodDescriptionGets the component.booleanReturns whether parsing to model should be lenient.booleanReturns whether the model value is only mapped partially to the view.
Such data types may hold more data that could have changed by the translator, but the view object still looks unchanged.
An example for such a type isI18NText.booleanReturns whether the model is modified compared to value saved viaValueTranslator.saveModelValue(Object).
Only invoked ifValueTranslator.isMappingIncomplete()istrue.voidsaveModelValue(M modelValue) Remembers the model value for later check if changed.
Only invoked ifValueTranslator.isMappingIncomplete()istrue.voidsetLenient(boolean lenient) Sets whether parsing to model should be lenient.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.tentackle.fx.ValueTranslator
bindingPropertiesUpdated, needsToModelTwice, toModel, toModelFunction, toView, toViewFunction
-
Constructor Details
-
AbstractValueTranslator
Creates a string translator for a given text component.- Parameters:
component- the component
-
-
Method Details
-
getComponent
Description copied from interface:ValueTranslatorGets the component.- Specified by:
getComponentin interfaceValueTranslator<M,V> - Returns:
- the component
-
isLenient
public boolean isLenient()Description copied from interface:ValueTranslatorReturns whether parsing to model should be lenient.- Specified by:
isLenientin interfaceValueTranslator<M,V> - Returns:
- true if lenient, false is default
-
setLenient
public void setLenient(boolean lenient) Sets whether parsing to model should be lenient.- Parameters:
lenient- true if lenient
-
isMappingIncomplete
public boolean isMappingIncomplete()Description copied from interface:ValueTranslatorReturns whether the model value is only mapped partially to the view.
Such data types may hold more data that could have changed by the translator, but the view object still looks unchanged.
An example for such a type isI18NText.- Specified by:
isMappingIncompletein interfaceValueTranslator<M,V> - Returns:
- true if view may look unchanged but the model could be modified
-
saveModelValue
Description copied from interface:ValueTranslatorRemembers the model value for later check if changed.
Only invoked ifValueTranslator.isMappingIncomplete()istrue.- Specified by:
saveModelValuein interfaceValueTranslator<M,V> - Parameters:
modelValue- the model value
-
isModelModified
public boolean isModelModified()Description copied from interface:ValueTranslatorReturns whether the model is modified compared to value saved viaValueTranslator.saveModelValue(Object).
Only invoked ifValueTranslator.isMappingIncomplete()istrue.- Specified by:
isModelModifiedin interfaceValueTranslator<M,V> - Returns:
- true if model is modified
-