Manual binding is a one-to-one binding that caches the value that was written to the target. More...
#include <kanzi/core.ui/binding/manual_binding.hpp>
Static Public Member Functions | |
static ManualBindingSharedPtr | create (BindingSourcePtr source) |
Creates a manual binding. | |
static ManualBindingSharedPtr | create (string_view sourcePath, AbstractPropertyType sourcePropertyType, PropertyField sourceField) |
Creates a manual binding. | |
Additional Inherited Members | |
Public Types inherited from kanzi::AbstractBinding | |
using | BindingProcessorConstIterator |
Binding processor iterator type. | |
using | BindingProcessorContainer |
Binding processor container type. | |
Public Member Functions inherited from kanzi::AbstractBinding | |
void | addProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor. | |
void | addReverseProcessor (BindingProcessorSharedPtr processor) |
Add a binding processor (reverse direction). | |
BindingProcessorConstIterator | beginProcessors () const |
Gets an iterator to the beginning of binding processors. | |
BindingProcessorConstIterator | beginReverseProcessors () const |
Gets an iterator to the beginning of reverse direction binding processors. | |
AbstractBindingRuntimeSharedPtr | createRuntime (AbstractBindingSharedPtr binding, BindingLookupContextPtr sourceLookupContext, BindingTargetRuntimePtr targetRuntime) |
Creates a binding runtime for this binding. | |
BindingProcessorConstIterator | endProcessors () const |
Gets an iterator to the end of binding processors. | |
BindingProcessorConstIterator | endReverseProcessors () const |
Gets an iterator to the end of reverse direction binding processors. | |
BindingSource * | getSource () |
Gets the binding source for this binding. | |
bool | isCreatedFromKZB () const |
Indicates whether the binding is sourced from a KZB? Used to check whether or not to remove the binding during patching. | |
void | removeProcessor (BindingProcessor &processor) |
Remove a binding processor. | |
void | removeReverseProcessor (BindingProcessor &processor) |
Remove a binding processor (reverse direction). | |
void | setCreatedFromKZB (bool flag) |
Sets the created from KZB flag. | |
virtual | ~AbstractBinding ()=default |
Destructor. | |
Protected Attributes inherited from kanzi::AbstractBinding | |
bool | m_createdFromKZB |
Is the binding sourced from a KZB? This field is used to determine if the binding should be removed during patching. | |
BindingProcessorContainer | m_processors |
Binding processor (forward direction). | |
BindingSourcePtr | m_source |
Binding source. | |
Manual binding is a one-to-one binding that caches the value that was written to the target.
Kanzi Engine uses manual bindings internally in triggers and actions.
In a manual binding you can either:
To create a manual binding, first create a manual binding source:
Then create a manual binding:
You can also use manual bindings with a regular ObjectPropertyBindingSource or DataSourceBindingSource. In that case the only difference to a regular Binding is that manual bindings cache the value within the binding. This is not always desired, because it can alter the lifetime of resources in the case of resource bindings.
You can explicitly run update() on any binding, but it makes most sense when using manual bindings and sources that otherwise do not update automatically.
To execute a binding:
With manual bindings, you can split the update into read and write parts. To first read, then write:
Delayed actions internally first call read and then write.
|
inlineexplicitprotected |
Constructor.
source | Binding source. |
|
static |
|
static |
Creates a manual binding.
sourcePath | Path to source object. |
sourcePropertyType | Source property type from which to bind. |
sourceField | Field of the source property type from which to bind. PropertyFieldWhole for the whole property. |
|
overrideprotectedvirtual |
AbstractBinding::createRuntime() implementation.
Implements kanzi::AbstractBinding.