- java.lang.Object
-
- org.tentackle.bind.AbstractBinder
-
- org.tentackle.fx.bind.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
-
-
Constructor Summary
Constructors Constructor Description DefaultFxComponentBinder(FxController controller)Creates a binder for a controller.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBinding(org.tentackle.bind.Binding binding)protected voidaddChangeableBinding(org.tentackle.bind.Binding changeableBinding)Adds a changeable binding.protected voidaddMandatoryBinding(org.tentackle.bind.Binding mandatoryBinding)Adds a mandatory binding.voidassertAllBound()intbind()intbindAllInherited()intbindWithInheritedBindables()Binds including inherited bindables.intbindWithInheritedComponents()Binds including inherited components.protected intdoBind(org.tentackle.bind.BindingMember[] parents, java.lang.String parentMemberPath, java.lang.Class<?> parentClass, boolean declaredOnly)voidfireToModel(org.tentackle.bind.Binding binding, java.lang.Object parent, java.lang.Object viewValue)voidfireToView(org.tentackle.bind.Binding binding, java.lang.Object parent, java.lang.Object modelValue)FxComponentBindinggetBinding(java.lang.String bindingPath)FxComponentBindinggetBinding(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.FxControllergetController()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.booleanisUnboundPending()Checks whether some components are still unbound.FxComponentBindingremoveBinding(java.lang.String bindingPath)FxComponentBindingremoveBinding(FxComponent component)Programmatically removes a binding from this view.voidrequestChangeableUpdate()Request to update the changeable attribute of all dynamically mandatory components.voidrequestMandatoryUpdate()Request to update the mandatory attribute of all dynamically mandatory components.voidunbind()-
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
-
-
-
-
Constructor Detail
-
DefaultFxComponentBinder
public DefaultFxComponentBinder(FxController controller)
Creates a binder for a controller.- Parameters:
controller- the controller to bind
-
-
Method Detail
-
getController
public FxController getController()
Description copied from interface:FxComponentBinderGets the controller bound by this binder.- Specified by:
getControllerin interfaceFxComponentBinder- Returns:
- the controller
-
fireToView
public void fireToView(org.tentackle.bind.Binding binding, java.lang.Object parent, java.lang.Object modelValue) throws org.tentackle.bind.BindingVetoException- Specified by:
fireToViewin interfaceorg.tentackle.bind.Binder- Overrides:
fireToViewin classorg.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:
fireToModelin interfaceorg.tentackle.bind.Binder- Overrides:
fireToModelin classorg.tentackle.bind.AbstractBinder- Throws:
org.tentackle.bind.BindingVetoException
-
requestMandatoryUpdate
public void requestMandatoryUpdate()
Description copied from interface:FxComponentBinderRequest to update the mandatory attribute of all dynamically mandatory components.- Specified by:
requestMandatoryUpdatein interfaceFxComponentBinder
-
getMandatoryBindings
public java.util.List<? extends org.tentackle.bind.Binding> getMandatoryBindings()
Description copied from interface:FxComponentBinderGets the dynamically mandatory bindings.- Specified by:
getMandatoryBindingsin interfaceFxComponentBinder- Returns:
- the mandatory bindings
-
requestChangeableUpdate
public void requestChangeableUpdate()
Description copied from interface:FxComponentBinderRequest to update the changeable attribute of all dynamically mandatory components.- Specified by:
requestChangeableUpdatein interfaceFxComponentBinder
-
getChangeableBindings
public java.util.List<? extends org.tentackle.bind.Binding> getChangeableBindings()
Description copied from interface:FxComponentBinderGets the dynamically changeable bindings.- Specified by:
getChangeableBindingsin interfaceFxComponentBinder- Returns:
- the changaeble bindings
-
bindAllInherited
public int bindAllInherited()
- Specified by:
bindAllInheritedin interfaceorg.tentackle.bind.Binder
-
bindWithInheritedBindables
public int bindWithInheritedBindables()
Description copied from interface:FxComponentBinderBinds 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:
bindWithInheritedBindablesin interfaceFxComponentBinder- Returns:
- number of members bound
-
bindWithInheritedComponents
public int bindWithInheritedComponents()
Description copied from interface:FxComponentBinderBinds 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:
bindWithInheritedComponentsin interfaceFxComponentBinder- Returns:
- number of members bound
-
bind
public int bind()
- Specified by:
bindin interfaceorg.tentackle.bind.Binder
-
unbind
public void unbind()
- Specified by:
unbindin interfaceorg.tentackle.bind.Binder
-
getBindings
public java.util.Collection<FxComponentBinding> getBindings()
- Specified by:
getBindingsin interfaceorg.tentackle.bind.Binder
-
getBoundComponents
public java.util.Collection<FxComponent> getBoundComponents()
Description copied from interface:FxComponentBinderGets the list of all bound components of this form.- Specified by:
getBoundComponentsin interfaceFxComponentBinder- Returns:
- the list of bound components, never null
-
getUnboundComponents
public java.util.Collection<FxComponent> getUnboundComponents()
Description copied from interface:FxComponentBinderGets the list of all unbound components of this form.- Specified by:
getUnboundComponentsin interfaceFxComponentBinder- Returns:
- the list of unbound components, never null
-
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:
assertAllBoundin interfaceorg.tentackle.bind.Binder
-
addBinding
public void addBinding(org.tentackle.bind.Binding binding)
- Specified by:
addBindingin interfaceorg.tentackle.bind.Binder
-
getBinding
public FxComponentBinding getBinding(FxComponent component)
Description copied from interface:FxComponentBinderGets a binding by component.- Specified by:
getBindingin interfaceFxComponentBinder- Parameters:
component- the component assigned to the binding- Returns:
- the binding, null if component not bound
-
getBinding
public FxComponentBinding getBinding(java.lang.String bindingPath)
Description copied from interface:FxComponentBinderOverridden to cast.
- Specified by:
getBindingin interfaceorg.tentackle.bind.Binder- Specified by:
getBindingin interfaceFxComponentBinder
-
removeBinding
public FxComponentBinding removeBinding(FxComponent component)
Description copied from interface:FxComponentBinderProgrammatically removes a binding from this view.- Specified by:
removeBindingin interfaceFxComponentBinder- Parameters:
component- the component assigned to the binding- Returns:
- the removed binding, null if no such binding found
-
removeBinding
public FxComponentBinding removeBinding(java.lang.String bindingPath)
Description copied from interface:FxComponentBinderOverridden to cast.
- Specified by:
removeBindingin interfaceorg.tentackle.bind.Binder- Specified by:
removeBindingin interfaceFxComponentBinder
-
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:
doBindin classorg.tentackle.bind.AbstractBinder
-
-