Files
create/src/App
Abdullah Tahiri 4dea0df06c App: Extension/ExtensionContainer - handle property change
==========================================================

Currently changes of name or type of properties in a property container are handled by:
void PropertyContainer::handleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName)
void PropertyContainer::changedPropertyType(Base::XMLReader &reader, const char * TypeName, Property * prop)

There is no mechanism for handling property changes by extensions. Sometimes the solution is to explicitly call the extension
from the container. However, this is a breach of the SRP, as the container should not be in a position to decide whether the
extension needs or not handle property changes. The handling code of the container changes for two different reasons, for
adapting the container to a property change of its own, and for adapting that of a property of the extension.

Illustrating it with an example, following inheritance, it goes like this:
PropertyContainer => ExtensionContainer => TransactionalObject => ViewProvider
App::Extension => ViewProviderExtension

The extension is currently not notified by the ExtensionContainer that a property needs handling. So a change in a property of
a ViewProviderExtension needs code at the ViewProvider it was added to.

This commit provides a mechanism in ExtensionContainer to call the extensions so that they can handle property changes. This
functions:

  virtual bool extensionHandleChangedPropertyName(Base::XMLReader &reader, const char * TypeName, const char *PropName);
  virtual bool extensionHandleChangedPropertyType(Base::XMLReader &reader, const char * TypeName, Property * prop);

Containers should always call the base class for any unhandled property change. If a sub-class container of ExtensionContainer
handles property changes itself, but not the ones of the extensions, this call to the base class ultimately ensures that if the
property was not handled by the container hierarchy, any extension is given an opportunity to handle it.

Some examples:

* A container handles the extension property change or its own:

void ContainerSubClass::handleChangedPropertyType(...)
{
    if (prop == &PropertyOfExt) {

    }
    else if (prop == &PropertyOfCont) {

    }
    else {
        ContainerBaseClass::handleChangedPropertyType(...);
    }
}

* A container and the extension handle their own:

void ContainerSubClass::handleChangedPropertyType(...)
{
    if (prop == &PropertyOfCont) {

    }
    else {
        // This will call ExtensionContainer::handleChangedPropertyType
        ContainerBaseClass::handleChangedPropertyType(...);
    }
}

bool ExtensionSubClass::extensionHandleChangedPropertyType(...)
{
    if (prop == &PropertyOfCont) {

        return true;
    }
    return false;
}
2023-02-25 23:13:55 +01:00
..
2022-12-20 09:31:25 +01:00
2022-08-01 01:29:47 +02:00
2022-03-23 17:29:23 +01:00
2022-08-06 19:29:59 +02:00
2022-08-01 01:29:47 +02:00
2022-03-23 17:29:23 +01:00
2022-10-23 09:14:44 -05:00
2022-08-06 19:29:59 +02:00
2022-12-02 19:19:17 -06:00
2022-07-31 10:27:44 +02:00
2022-03-13 12:12:49 +01:00
2022-07-31 10:27:44 +02:00
2022-07-31 10:27:44 +02:00
2022-08-01 00:34:46 +02:00
2022-12-02 19:19:17 -06:00
2022-07-31 10:27:44 +02:00
2022-08-24 10:43:56 +02:00
2022-12-02 19:19:17 -06:00