Module org.tentackle.fx.rdc
Package org.tentackle.fx.rdc.translate
Class PdoStringTranslator<T extends org.tentackle.pdo.PersistentDomainObject<T>>
- java.lang.Object
-
- org.tentackle.fx.translate.AbstractValueTranslator<M,java.lang.String>
-
- org.tentackle.fx.translate.ValueStringTranslator<T>
-
- org.tentackle.fx.rdc.translate.PdoStringTranslator<T>
-
- Type Parameters:
T- the PDO type
- All Implemented Interfaces:
org.tentackle.fx.ValueTranslator<T,java.lang.String>
@ValueTranslatorService(modelClass=org.tentackle.pdo.PersistentDomainObject.class, viewClass=java.lang.String.class) public class PdoStringTranslator<T extends org.tentackle.pdo.PersistentDomainObject<T>> extends org.tentackle.fx.translate.ValueStringTranslator<T>PDO to String translator. TODO: DnD support- Author:
- harald
-
-
Constructor Summary
Constructors Constructor Description PdoStringTranslator(org.tentackle.fx.FxTextComponent component)Creates a translator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TcreatePdo()Creates a new PDO.protected voidedit()Edit or view current pdo.protected org.tentackle.bind.BindablegetBindableAnnotation(T proxy)Gets theBindableannotation of the unique domain key.protected TgetPdo()Gets the PDO via binding.
For non-editable comboboxes this translator isnt used, but registered, because it could be changed to editable.protected voidpresetSearchCriteria(T proxy, java.lang.Class<?> udkClass, java.lang.String v)Preset the given proxy with the string from the component.protected voidsearch()Search for a PDO.protected TsearchPdo(T proxy)Modal search of the pdo.java.util.function.Function<java.lang.String,T>toModelFunction()java.util.function.Function<T,java.lang.String>toViewFunction()-
Methods inherited from class org.tentackle.fx.translate.ValueStringTranslator
getComponent, getValidChars, toModel
-
Methods inherited from class org.tentackle.fx.translate.AbstractValueTranslator
isLenient, setLenient
-
-
-
-
Method Detail
-
getPdo
protected T getPdo()
Gets the PDO via binding.
For non-editable comboboxes this translator isnt used, but registered, because it could be changed to editable.- Returns:
- the model value
-
edit
protected void edit()
Edit or view current pdo.
-
search
protected void search()
Search for a PDO.
-
toViewFunction
public java.util.function.Function<T,java.lang.String> toViewFunction()
-
toModelFunction
public java.util.function.Function<java.lang.String,T> toModelFunction()
-
createPdo
protected T createPdo()
Creates a new PDO.- Returns:
- the pdo
-
searchPdo
protected T searchPdo(T proxy)
Modal search of the pdo.- Parameters:
proxy- the proxy pdo (possibly presetted with partial search criteria)- Returns:
- the selected pdo, null if none
-
presetSearchCriteria
protected void presetSearchCriteria(T proxy, java.lang.Class<?> udkClass, java.lang.String v)
Preset the given proxy with the string from the component.- Parameters:
proxy- the proxy pdoudkClass- the class of the unique domain keyv- the view value
-
getBindableAnnotation
protected org.tentackle.bind.Bindable getBindableAnnotation(T proxy)
Gets theBindableannotation of the unique domain key.If the UDK consists of more than one member, the first Bindable annotation is returned.
- Parameters:
proxy- the PDO class to inspect- Returns:
- the annotation, null if not annotated with Bindable
-
-