Kanzi 3.9.10
kanzi::TwoWayBinding Class Reference

Two-way binding causes changes to either the source value or the target value to automatically update the other. More...

#include <kanzi/core.ui/binding/two_way_binding.hpp>

Inheritance diagram for kanzi::TwoWayBinding:
[legend]

Static Public Member Functions

static TwoWayBindingSharedPtr create (BindingSourcePtr source)
 Creates a two-way binding.
 
static TwoWayBindingSharedPtr create (string_view sourcePath, AbstractPropertyType sourcePropertyType)
 Creates a two-way binding.
 
static TwoWayBindingSharedPtr create (string_view sourcePath, AbstractPropertyType sourcePropertyType, PropertyField sourceField)
 Creates a two-way binding.
 

Protected Member Functions

void addReverseProcessorOverride (BindingProcessorSharedPtr processor) override
 AbstractBinding::addReverseBindingProcessorOverride() implementation.
 
BindingProcessorConstIterator beginReverseProcessorsOverride () const override
 AbstractBinding::beginReverseProcessorsOverride() implementation.
 
AbstractBindingRuntimeSharedPtr createRuntimeOverride (AbstractBindingSharedPtr binding, BindingLookupContextPtr lookupContext, BindingTargetRuntimePtr targetRuntime) override
 AbstractBinding::createRuntime() implementation.
 
BindingProcessorConstIterator endReverseProcessorsOverride () const override
 AbstractBinding::endReverseProcessorsOverride() implementation.
 
void removeReverseProcessorOverride (BindingProcessor &processor) override
 AbstractBinding::removeReverseBindingProcessorOverride() implementation.
 
 TwoWayBinding (BindingSourcePtr source)
 Constructor.
 
- Protected Member Functions inherited from kanzi::AbstractBinding
 AbstractBinding (BindingSourcePtr source)
 Constructor.
 

Protected Attributes

BindingProcessorContainer m_reverseProcessors
 Binding processors (reverse direction).
 
- 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.
 

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.
 
BindingSourcegetSource ()
 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.
 

Detailed Description

Two-way binding causes changes to either the source value or the target value to automatically update the other.

In a two-way binding the binding from the source to target works the same way as in a Binding. When the source value is modified, the value is written to the BindingTargetRuntime of the TwoWayBinding.

When anything other than the binding itself modifies the target value, the value is copied to the source. The value is copied to the source using setProperty() to write the property value.

Removing the binding does not erase the value that is written to the source.

See also
AbstractBinding
Since
Kanzi 3.7.0

Constructor & Destructor Documentation

◆ TwoWayBinding()

kanzi::TwoWayBinding::TwoWayBinding ( BindingSourcePtr source)
inlineexplicitprotected

Constructor.

Parameters
sourceBinding source owned by this binding.

Member Function Documentation

◆ create() [1/3]

static TwoWayBindingSharedPtr kanzi::TwoWayBinding::create ( BindingSourcePtr source)
static

Creates a two-way binding.

Parameters
sourceBinding source.
Returns
The created two-way binding.

◆ create() [2/3]

static TwoWayBindingSharedPtr kanzi::TwoWayBinding::create ( string_view sourcePath,
AbstractPropertyType sourcePropertyType,
PropertyField sourceField )
static

Creates a two-way binding.

Parameters
sourcePathPath to source object.
sourcePropertyTypeSource property type from which to bind.
sourceFieldField of the source property type from which to bind. Use PropertyFieldWhole to bind to the whole property.
Returns
The created two-way binding.

◆ create() [3/3]

static TwoWayBindingSharedPtr kanzi::TwoWayBinding::create ( string_view sourcePath,
AbstractPropertyType sourcePropertyType )
inlinestatic

Creates a two-way binding.

Whole property field is used.

Parameters
sourcePathPath to source object.
sourcePropertyTypeSource property type from which to bind.
Returns
The created two-way binding.

◆ createRuntimeOverride()

AbstractBindingRuntimeSharedPtr kanzi::TwoWayBinding::createRuntimeOverride ( AbstractBindingSharedPtr binding,
BindingLookupContextPtr lookupContext,
BindingTargetRuntimePtr targetRuntime )
overrideprotectedvirtual

◆ addReverseProcessorOverride()

void kanzi::TwoWayBinding::addReverseProcessorOverride ( BindingProcessorSharedPtr processor)
overrideprotectedvirtual

AbstractBinding::addReverseBindingProcessorOverride() implementation.

Reimplemented from kanzi::AbstractBinding.

◆ removeReverseProcessorOverride()

void kanzi::TwoWayBinding::removeReverseProcessorOverride ( BindingProcessor & processor)
overrideprotectedvirtual

AbstractBinding::removeReverseBindingProcessorOverride() implementation.

Reimplemented from kanzi::AbstractBinding.

◆ beginReverseProcessorsOverride()

BindingProcessorConstIterator kanzi::TwoWayBinding::beginReverseProcessorsOverride ( ) const
overrideprotectedvirtual

◆ endReverseProcessorsOverride()

BindingProcessorConstIterator kanzi::TwoWayBinding::endReverseProcessorsOverride ( ) const
overrideprotectedvirtual

Member Data Documentation

◆ m_reverseProcessors

BindingProcessorContainer kanzi::TwoWayBinding::m_reverseProcessors
protected

Binding processors (reverse direction).


The documentation for this class was generated from the following file: