Class PdoStringTranslator<T extends org.tentackle.pdo.PersistentDomainObject<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 PdoComponentAddon<T> createPdoAddon()
      Creates the PDO style implementation.
      protected org.tentackle.bind.Bindable getBindableAnnotation​(T proxy)
      Gets the Bindable annotation of the unique domain key.
      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.
      PdoComponentAddon<T> getPdoAddon()
      Gets the PDO addon.
      protected void presetSearchCriteria​(T proxy, java.lang.Class<?> udkClass, java.lang.String v)
      Preset the given proxy with the string from the component.
      void setPdoAddon​(PdoComponentAddon<T> pdoAddon)
      Sets the PDO addon.
      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
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.tentackle.fx.ValueTranslator

        needsToModelTwice, toView
    • Constructor Detail

      • PdoStringTranslator

        public PdoStringTranslator​(org.tentackle.fx.FxTextComponent component)
        Creates a translator.
        Parameters:
        component - the text component
    • Method Detail

      • getPdoAddon

        public PdoComponentAddon<T> getPdoAddon()
        Gets the PDO addon.
        Returns:
        the addon
      • setPdoAddon

        public void setPdoAddon​(PdoComponentAddon<T> pdoAddon)
        Sets the PDO addon.
        Parameters:
        pdoAddon - the addon
      • toViewFunction

        public java.util.function.Function<T,​java.lang.String> toViewFunction()
      • toModelFunction

        public java.util.function.Function<java.lang.String,​T> toModelFunction()
      • createPdoAddon

        protected PdoComponentAddon<T> createPdoAddon()
        Creates the PDO style implementation.
        Returns:
        the implementation
      • 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
      • 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 pdo
        udkClass - the class of the unique domain key
        v - the view value
      • getBindableAnnotation

        protected org.tentackle.bind.Bindable getBindableAnnotation​(T proxy)
        Gets the Bindable annotation 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