Class DefaultFxComponentBinding

  • All Implemented Interfaces:
    org.tentackle.bind.Binding, FxComponentBinding

    public class DefaultFxComponentBinding
    extends org.tentackle.bind.AbstractBinding
    implements FxComponentBinding
    Common implemenation of a binding.
    Author:
    harald
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultFxComponentBinding​(FxComponentBinder binder, org.tentackle.bind.BindingMember[] parents, org.tentackle.bind.BindingMember member, FxComponent component, java.lang.String componentOptions)
      Creates a binding.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void applyType()
      Applies the model's type to the component.
      protected void determineValidators()  
      void fireToView​(java.lang.Object parent, java.lang.Object modelValue)  
      FxComponentBinder getBinder()  
      protected java.lang.Object getBoundRootObject()  
      FxComponent getComponent()
      Gets the component which is bound to the member.
      protected java.lang.Class<?> getViewType()
      Determines the component's type.
      This is an estimation derived from the getter and setter methods, usually setViewValue and getViewValue.
      java.lang.Object getViewValue()  
      boolean isChangeable()  
      boolean isMandatory()  
      protected boolean isValidationRequired()  
      void setChangeable​(boolean changeable)  
      void setMandatory​(boolean mandatory)  
      protected void updateComponentName()
      Sets the component name to some meaningful value.
      Required by some GUI testing tools.
      protected void updateView​(java.lang.Object value)  
      protected java.lang.String viewComponentToString()  
      • Methods inherited from class org.tentackle.bind.AbstractBinding

        addToModelListener, addToViewListener, addValidationListener, addValidator, createBindingEvent, createValidationContext, createValidationEvent, fireToModel, fireValidated, getMember, getModelValue, getModelValue, getParentObject, getParents, getToModelListeners, getToViewListeners, getValidationListeners, getValidators, removeToModelListener, removeToViewListener, removeValidationListener, removeValidator, setModelValue, setModelValue, setViewValue, toString, updateView, validate
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.tentackle.bind.Binding

        addToModelListener, addToViewListener, addValidationListener, addValidator, createBindingEvent, createValidationContext, createValidationEvent, fireToModel, fireValidated, getMember, getModelValue, getParentObject, getParents, getToModelListeners, getToViewListeners, getValidationListeners, getValidators, removeToModelListener, removeToViewListener, removeValidationListener, removeValidator, setModelValue, setViewValue, validate
    • Constructor Detail

      • DefaultFxComponentBinding

        public DefaultFxComponentBinding​(FxComponentBinder binder,
                                         org.tentackle.bind.BindingMember[] parents,
                                         org.tentackle.bind.BindingMember member,
                                         FxComponent component,
                                         java.lang.String componentOptions)
        Creates a binding.
        Parameters:
        binder - the binder managing this binding
        component - the GUI-component to bind
        componentOptions - options to configure the component.
        Currently defined are:
        • UC: convert to uppercase
        • LC: convert to lowercase
        • COLS=n: width in columns
        • MAXCOLS=n: limit input to max. columns
        • LINESS=n: number of lines in textareas
        • [-]AUTOSELECT: turn autoselect on/off
        • UTC: utc timestamps
        • SCALE=n: numeric scale
        • UNSIGNED: unsigned numeric value.
        parents - the members building the declaration chain to this member, null if this binding's member is in controller
        member - the member field to bind
        See Also:
        Constants
    • Method Detail

      • getBinder

        public FxComponentBinder getBinder()
        Specified by:
        getBinder in interface org.tentackle.bind.Binding
        Specified by:
        getBinder in interface FxComponentBinding
        Overrides:
        getBinder in class org.tentackle.bind.AbstractBinding
      • getViewValue

        public java.lang.Object getViewValue()
        Specified by:
        getViewValue in interface org.tentackle.bind.Binding
      • fireToView

        public void fireToView​(java.lang.Object parent,
                               java.lang.Object modelValue)
                        throws org.tentackle.bind.BindingVetoException
        Specified by:
        fireToView in interface org.tentackle.bind.Binding
        Overrides:
        fireToView in class org.tentackle.bind.AbstractBinding
        Throws:
        org.tentackle.bind.BindingVetoException
      • determineValidators

        protected void determineValidators()
        Overrides:
        determineValidators in class org.tentackle.bind.AbstractBinding
      • getViewType

        protected java.lang.Class<?> getViewType()
        Determines the component's type.
        This is an estimation derived from the getter and setter methods, usually setViewValue and getViewValue.
        Specified by:
        getViewType in class org.tentackle.bind.AbstractBinding
        Returns:
        the component's type
      • applyType

        protected void applyType()
        Applies the model's type to the component.
        Throws:
        org.tentackle.bind.BindingException - if component does not accept type
      • updateComponentName

        protected void updateComponentName()
        Sets the component name to some meaningful value.
        Required by some GUI testing tools.

        The component name will be the memberPath prepended with the names of the parent components, each separated by a slash.
        Example:

         "Shipment/ShipmentFile/Booking/shipment.customer.addressNumber"
         
      • setMandatory

        public void setMandatory​(boolean mandatory)
        Specified by:
        setMandatory in interface org.tentackle.bind.Binding
      • isMandatory

        public boolean isMandatory()
        Specified by:
        isMandatory in interface org.tentackle.bind.Binding
      • setChangeable

        public void setChangeable​(boolean changeable)
        Specified by:
        setChangeable in interface org.tentackle.bind.Binding
      • isChangeable

        public boolean isChangeable()
        Specified by:
        isChangeable in interface org.tentackle.bind.Binding
      • getBoundRootObject

        protected java.lang.Object getBoundRootObject()
        Specified by:
        getBoundRootObject in class org.tentackle.bind.AbstractBinding
      • isValidationRequired

        protected boolean isValidationRequired()
        Specified by:
        isValidationRequired in class org.tentackle.bind.AbstractBinding
      • viewComponentToString

        protected java.lang.String viewComponentToString()
        Specified by:
        viewComponentToString in class org.tentackle.bind.AbstractBinding
      • updateView

        protected void updateView​(java.lang.Object value)
        Specified by:
        updateView in class org.tentackle.bind.AbstractBinding