Class DefaultFxComponentBinder

  • All Implemented Interfaces:
    java.lang.Comparable<org.tentackle.bind.Binder>, org.tentackle.bind.Binder, FxComponentBinder

    public class DefaultFxComponentBinder
    extends org.tentackle.bind.AbstractBinder
    implements FxComponentBinder
    Binding Workhorse.
    Author:
    harald
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBinding​(org.tentackle.bind.Binding binding)  
      protected void addChangeableBinding​(org.tentackle.bind.Binding changeableBinding)
      Adds a changeable binding.
      protected void addMandatoryBinding​(org.tentackle.bind.Binding mandatoryBinding)
      Adds a mandatory binding.
      void assertAllBound()  
      int bind()  
      int bindAllInherited()  
      int bindWithInheritedBindables()
      Binds including inherited bindables.
      int bindWithInheritedComponents()
      Binds including inherited components.
      protected int doBind​(org.tentackle.bind.BindingMember[] parents, java.lang.String parentMemberPath, java.lang.Class<?> parentClass, boolean declaredOnly)  
      void fireToModel​(org.tentackle.bind.Binding binding, java.lang.Object parent, java.lang.Object viewValue)  
      void fireToView​(org.tentackle.bind.Binding binding, java.lang.Object parent, java.lang.Object modelValue)  
      FxComponentBinding getBinding​(java.lang.String bindingPath)
      FxComponentBinding getBinding​(FxComponent component)
      Gets a binding by component.
      java.util.Collection<FxComponentBinding> getBindings()  
      java.util.Collection<FxComponent> getBoundComponents()
      Gets the list of all bound components of this form.
      java.util.List<? extends org.tentackle.bind.Binding> getChangeableBindings()
      Gets the dynamically changeable bindings.
      FxController getController()
      Gets the controller bound by this binder.
      java.util.List<? extends org.tentackle.bind.Binding> getMandatoryBindings()
      Gets the dynamically mandatory bindings.
      java.util.Collection<FxComponent> getUnboundComponents()
      Gets the list of all unbound components of this form.
      boolean isUnboundPending()
      Checks whether some components are still unbound.
      FxComponentBinding removeBinding​(java.lang.String bindingPath)
      FxComponentBinding removeBinding​(FxComponent component)
      Programmatically removes a binding from this view.
      void requestChangeableUpdate()
      Request to update the changeable attribute of all dynamically mandatory components.
      void requestMandatoryUpdate()
      Request to update the mandatory attribute of all dynamically mandatory components.
      void unbind()  
      • Methods inherited from class org.tentackle.bind.AbstractBinder

        addToModelListener, addToViewListener, addValidationListener, compareTo, equals, fireValidated, getBindingProperty, getBindingProperty, getInstanceNumber, getToModelListeners, getToViewListeners, getValidationListeners, getValidationScope, hashCode, putBindingProperty, removeToModelListener, removeToViewListener, removeValidationListener, setValidationScope
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface org.tentackle.bind.Binder

        addToModelListener, addToViewListener, addValidationListener, fireValidated, getBindingProperty, getBindingProperty, getInstanceNumber, getToModelListeners, getToViewListeners, getValidationListeners, getValidationScope, putBindingProperty, removeToModelListener, removeToViewListener, removeValidationListener, setValidationScope
      • Methods inherited from interface java.lang.Comparable

        compareTo
    • Constructor Detail

      • DefaultFxComponentBinder

        public DefaultFxComponentBinder​(FxController controller)
        Creates a binder for a controller.
        Parameters:
        controller - the controller to bind
    • Method Detail

      • fireToView

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

        public void fireToModel​(org.tentackle.bind.Binding binding,
                                java.lang.Object parent,
                                java.lang.Object viewValue)
                         throws org.tentackle.bind.BindingVetoException
        Specified by:
        fireToModel in interface org.tentackle.bind.Binder
        Overrides:
        fireToModel in class org.tentackle.bind.AbstractBinder
        Throws:
        org.tentackle.bind.BindingVetoException
      • getMandatoryBindings

        public java.util.List<? extends org.tentackle.bind.Binding> getMandatoryBindings()
        Description copied from interface: FxComponentBinder
        Gets the dynamically mandatory bindings.
        Specified by:
        getMandatoryBindings in interface FxComponentBinder
        Returns:
        the mandatory bindings
      • getChangeableBindings

        public java.util.List<? extends org.tentackle.bind.Binding> getChangeableBindings()
        Description copied from interface: FxComponentBinder
        Gets the dynamically changeable bindings.
        Specified by:
        getChangeableBindings in interface FxComponentBinder
        Returns:
        the changaeble bindings
      • bindAllInherited

        public int bindAllInherited()
        Specified by:
        bindAllInherited in interface org.tentackle.bind.Binder
      • bindWithInheritedBindables

        public int bindWithInheritedBindables()
        Description copied from interface: FxComponentBinder
        Binds including inherited bindables.

        The controller will be scanned for members or submembers annotated with the Bindable-annotation. Inherited members of the controller's parent classes will be included as well.

        CAUTION: expensive operation!

        Specified by:
        bindWithInheritedBindables in interface FxComponentBinder
        Returns:
        number of members bound
      • bindWithInheritedComponents

        public int bindWithInheritedComponents()
        Description copied from interface: FxComponentBinder
        Binds including inherited components.

        The controller will be scanned for members or submembers annotated with the Bindable-annotation. Inherited components declared in parent controllers are included.

        CAUTION: expensive operation!

        Specified by:
        bindWithInheritedComponents in interface FxComponentBinder
        Returns:
        number of members bound
      • bind

        public int bind()
        Specified by:
        bind in interface org.tentackle.bind.Binder
      • unbind

        public void unbind()
        Specified by:
        unbind in interface org.tentackle.bind.Binder
      • getBindings

        public java.util.Collection<FxComponentBinding> getBindings()
        Specified by:
        getBindings in interface org.tentackle.bind.Binder
      • isUnboundPending

        public boolean isUnboundPending()
        Checks whether some components are still unbound.
        Returns:
        true if unbound pending, false if all bound
      • assertAllBound

        public void assertAllBound()
        Specified by:
        assertAllBound in interface org.tentackle.bind.Binder
      • addBinding

        public void addBinding​(org.tentackle.bind.Binding binding)
        Specified by:
        addBinding in interface org.tentackle.bind.Binder
      • addMandatoryBinding

        protected void addMandatoryBinding​(org.tentackle.bind.Binding mandatoryBinding)
        Adds a mandatory binding.
        Parameters:
        mandatoryBinding - the binding to add
      • addChangeableBinding

        protected void addChangeableBinding​(org.tentackle.bind.Binding changeableBinding)
        Adds a changeable binding.
        Parameters:
        changeableBinding - the binding to add
      • doBind

        protected int doBind​(org.tentackle.bind.BindingMember[] parents,
                             java.lang.String parentMemberPath,
                             java.lang.Class<?> parentClass,
                             boolean declaredOnly)
        Specified by:
        doBind in class org.tentackle.bind.AbstractBinder