OpenTwin 0.1
OpenTwin
 
Loading...
Searching...
No Matches
ot::WidgetPropertyManager Class Reference

The WidgetPropertyManager class is an extended PropertyManager wrapper. It allows to use frontend component links to the properties enabling build in property handling. More...

#include "WidgetPropertyManager.h"

+ Inheritance diagram for ot::WidgetPropertyManager:

Public Member Functions

 WidgetPropertyManager (ManagedWidgetPropertyObject *_object=(ManagedWidgetPropertyObject *) nullptr)
 Constructor. Creates a default PropertyManager.
 
 WidgetPropertyManager (WidgetPropertyManager &&_other) noexcept
 Move constructor.
 
virtual ~WidgetPropertyManager ()
 Destructor.
 
WidgetPropertyManageroperator= (WidgetPropertyManager &&_other) noexcept
 Assignment move operator.
 
virtual void propertyChanged (const Property *_property) override
 Will be called whenever a property has been changed.
 
virtual void readingProperty (const std::string &_propertyGroupName, const std::string &_propertyName) const override
 Will be called before a property will be read.
 
void addPropertyLink (ManagedPropertyLink *_link)
 Add property link to list.
 
void forgetPropertyLink (ManagedPropertyLink *_link)
 Remove the property link from the lists.
 
const std::list< ManagedPropertyLink * > & getPropertyLinks (void) const
 Return all currently registered propery links.
 
void setManagedObject (ManagedWidgetPropertyObject *_object)
 Set the managed property object that owns this manager.
 
ManagedWidgetPropertyObjectgetManagedObject (void) const
 Returns the managed property object that owns this manager.
 
- Public Member Functions inherited from ot::PropertyManager
 PropertyManager ()
 Default constructor.
 
 PropertyManager (const ConstJsonObject &_jsonObject)
 Deserialize constructor.
 
 PropertyManager (PropertyManager &&_other) noexcept
 Move constructor.
 
virtual ~PropertyManager ()
 Destructor.
 
PropertyManageroperator= (PropertyManager &&_other) noexcept
 Move assignment operator.
 
virtual void addToJsonObject (ot::JsonValue &_object, ot::JsonAllocator &_allocator) const override
 Serializes the object to a JSON structure.
 
virtual void setFromJsonObject (const ot::ConstJsonObject &_object) override
 Deserializes the object from a JSON structure.
 
void setSilenceNotifications (bool _silence)
 Set the notifications silenced. If set property access won't trigger any notification.
 
bool getSilenceNotifications (void) const
 
void notifyAllChanged (void)
 Will call PropertyManager::propertyChanged for every property that is currently registered. Calling this method if the manager is currently silenced will have no effect.
 
ot::PropertyaddProperty (const std::string &_groupName, Property *_property)
 Adds the property to the specified group. The property should not exist, an existing one will be replaced.
 
void updateProperty (const std::string &_groupName, Property *_property)
 Updates an existing property or creates a new one.
 
void mergeWith (const PropertyManager &_other, const PropertyBase::MergeMode &_mergeMode=PropertyBase::MergeValues)
 Merge the properties with the other manager.
 
void updateProperty (const std::string &_groupName, const Property *_property, bool _deleteProvidedProperty)
 Updates an existing property or creates a new one.
 
PropertyBoolsetBool (const std::string &_groupName, const std::string &_valueName, bool _value)
 Sets boolean property.
 
PropertyIntsetInt (const std::string &_groupName, const std::string &_valueName, int _value)
 Sets integer property.
 
PropertyDoublesetDouble (const std::string &_groupName, const std::string &_valueName, double _value)
 Sets double property.
 
PropertyStringsetString (const std::string &_groupName, const std::string &_valueName, const std::string &_value)
 Sets string property.
 
PropertyStringListsetStringList (const std::string &_groupName, const std::string &_valueName, const std::string &_value)
 Sets string property.
 
PropertyColorsetColor (const std::string &_groupName, const std::string &_valueName, const Color &_value)
 Sets color property.
 
PropertyPainter2DsetPainter2D (const std::string &_groupName, const std::string &_valueName, Painter2D *_painter)
 Sets painter property.
 
PropertyPainter2DsetPainter2D (const std::string &_groupName, const std::string &_valueName, const Painter2D *_painter)
 Sets painter property.
 
PropertyPathsetPath (const std::string &_groupName, const std::string &_valueName, const std::string &_path)
 Sets path property.
 
PropertyfindProperty (const std::string &_groupName, const std::string &_valueName)
 Finds a property by group and name.
 
const PropertyfindProperty (const std::string &_groupName, const std::string &_valueName) const
 Finds a property by group and name.
 
bool getBool (const std::string &_groupName, const std::string &_valueName) const
 Retrieves boolean property value.
 
int getInt (const std::string &_groupName, const std::string &_valueName) const
 Retrieves int property value.
 
double getDouble (const std::string &_groupName, const std::string &_valueName) const
 Retrieves double property value.
 
const std::string & getString (const std::string &_groupName, const std::string &_valueName) const
 Retrieves string property value.
 
const ColorgetColor (const std::string &_groupName, const std::string &_valueName) const
 Retrieves color property value.
 
const Painter2DgetPainter2D (const std::string &_groupName, const std::string &_valueName) const
 Retrieves Painter2D property value.
 
const std::string & getPath (const std::string &_groupName, const std::string &_valueName) const
 Retrieves path property value.
 
template<class T >
T * getProperty (const std::string &_groupName, const std::string &_valueName)
 Finds a property by group and name. The found property will be casted to the specified type.
 
template<class T >
const T * getProperty (const std::string &_groupName, const std::string &_valueName) const
 Finds a property by group and name. The found property will be casted to the specified type.
 
PropertyGridCfg createGridConfiguration (void) const
 Creates a grid configuration that can be used to serialize or visualize the properties.
 
void clear (void)
 Removes all groups and properties.
 
const std::map< std::string, PropertyGroup * > & getData (void) const
 Return data that is managed by this property manager.
 
void addNotifier (PropertyManagerNotifier *_notifier)
 Register property manager notifier.
 
PropertyManagerNotifierremoveNotifier (PropertyManagerNotifier *_notifier, bool _destroyObject)
 Remove given notifier from this manager.
 
void addReadCallbackNotifier (PropertyReadCallbackNotifier *_notifier)
 Add read callback notifier. The read callback notifier will receive read callbacks for the property under the currently set property path. The callback method is called before the property read operation starts.
 
void removeReadCallbackNotifier (PropertyReadCallbackNotifier *_notifier)
 
void addWriteCallbackNotifier (PropertyWriteCallbackNotifierBase *_notifier)
 Add write callback notifier. The write callback notifier will receive write callbacks for the property under the currently set property path. The callback method is called after the property write operation finishes and before the.
 
void removeWriteCallbackNotifier (PropertyWriteCallbackNotifierBase *_notifier)
 Remove write callback notifier.
 
- Public Member Functions inherited from ot::Serializable
 Serializable ()
 
 Serializable (const Serializable &)
 
 Serializable (Serializable &&) noexcept
 
virtual ~Serializable ()
 
Serializableoperator= (const Serializable &)
 
Serializableoperator= (Serializable &&) noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from ot::PropertyManager
virtual PropertystoreProperty (const std::string &_groupName, Property *_property)
 Stores a property within a specified group.
 
PropertyGroupfindGroup (const std::string &_group) const
 Find an existing group by name.
 
PropertyGroupfindOrCreateGroup (const std::string &_group)
 Find or create a group by name.
 

Detailed Description

The WidgetPropertyManager class is an extended PropertyManager wrapper. It allows to use frontend component links to the properties enabling build in property handling.

Constructor & Destructor Documentation

◆ WidgetPropertyManager() [1/2]

ot::WidgetPropertyManager::WidgetPropertyManager ( ManagedWidgetPropertyObject * _object = (ManagedWidgetPropertyObject*)nullptr)

Constructor. Creates a default PropertyManager.

Parameters
_objectThe object that owns this manager. May be null.

◆ WidgetPropertyManager() [2/2]

ot::WidgetPropertyManager::WidgetPropertyManager ( WidgetPropertyManager && _other)
noexcept

Move constructor.

Parameters
_otherOther object to move data from.

◆ ~WidgetPropertyManager()

virtual ot::WidgetPropertyManager::~WidgetPropertyManager ( )
inlinevirtual

Destructor.

Member Function Documentation

◆ addPropertyLink()

void ot::WidgetPropertyManager::addPropertyLink ( ManagedPropertyLink * _link)

Add property link to list.

Parameters
_linkLink to add.

References OTAssert, and OTAssertNullptr.

◆ forgetPropertyLink()

void ot::WidgetPropertyManager::forgetPropertyLink ( ManagedPropertyLink * _link)

Remove the property link from the lists.

Parameters
_linkLink to remove.

◆ getManagedObject()

ManagedWidgetPropertyObject * ot::WidgetPropertyManager::getManagedObject ( void ) const
inline

Returns the managed property object that owns this manager.

◆ getPropertyLinks()

const std::list< ManagedPropertyLink * > & ot::WidgetPropertyManager::getPropertyLinks ( void ) const
inline

Return all currently registered propery links.

◆ operator=()

ot::WidgetPropertyManager & ot::WidgetPropertyManager::operator= ( WidgetPropertyManager && _other)
noexcept

Assignment move operator.

Parameters
_otherOther object to move data from.
Returns
Reference to this object.

References ot::PropertyManager::operator=().

◆ propertyChanged()

void ot::WidgetPropertyManager::propertyChanged ( const Property * _property)
overridevirtual

Will be called whenever a property has been changed.

Parameters
_propertyProperty that has been changed.

Reimplemented from ot::PropertyManager.

References ot::PropertyManager::propertyChanged().

◆ readingProperty()

void ot::WidgetPropertyManager::readingProperty ( const std::string & _propertyGroupName,
const std::string & _propertyName ) const
overridevirtual

Will be called before a property will be read.

Parameters
_propertyGroupNameName of the group where the property should be located at.
_propertyNameName of the property. The name should be unique inside a group.

Reimplemented from ot::PropertyManager.

References ot::PropertyManager::readingProperty().

◆ setManagedObject()

void ot::WidgetPropertyManager::setManagedObject ( ManagedWidgetPropertyObject * _object)
inline

Set the managed property object that owns this manager.


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