- // 1. saves the previous attribute values
- bool isObject = aRefAttr->isObject();
- ObjectPtr aPrevObject = aRefAttr->object();
- AttributePtr aPrevAttr = aRefAttr->attr();
-
- // 2. store the current values, disable the model's update
- aData->blockSendAttributeUpdated(true);
- ObjectPtr aPrevSelectedObject = mySelectedObject;
- GeomShapePtr aPrevShape = myShape;
-
- storeAttributeValues(theObj, theShape);
-
- // 3. check the acceptability of the current values
- std::list<ModelAPI_Validator*>::iterator aValidator = aValidators.begin();
- std::list<std::list<std::string> >::iterator aArgs = anArguments.begin();
- bool aValid = true;
- for (; aValidator != aValidators.end() && aValid; aValidator++, aArgs++) {
- const ModelAPI_RefAttrValidator* aAttrValidator =
- dynamic_cast<const ModelAPI_RefAttrValidator*>(*aValidator);
- if (aAttrValidator) {
- aValid = aAttrValidator->isValid(aRefAttr, *aArgs);
- }
- }
-
- // 4. if the values are not valid, restore the previous values to the attribute
- //if (!aValid) {
- if (isObject)
- aRefAttr->setObject(aPrevObject);
- else
- aRefAttr->setAttr(aPrevAttr);
- //}
- // 5. enable the model's update
- aData->blockSendAttributeUpdated(false);
- //updateObject(myFeature);
-
- return aValid;