Mantid
|
#include <SetValueWhenProperty.h>
Public Member Functions | |
void | applyChanges (const Mantid::Kernel::IPropertyManager *algo, Kernel::Property *const pProp) override |
If a new value should be set, the change is applied here. More... | |
IPropertySettings * | clone () const override |
Make a copy of the present type of IPropertySettings. More... | |
std::string | getPropertyValue (const IPropertyManager *algo) const |
Checks the algorithm and property are both valid and attempts to get the value associated with the property. More... | |
bool | isConditionChanged (const IPropertyManager *algo, const std::string &changedPropName) const override |
Return true always. More... | |
void | modify_allowed_values (Property *const) |
Stub function to satisfy the interface. More... | |
SetValueWhenProperty (const std::string &watchedPropName, const std::function< std::string(std::string, std::string)> &changeCriterion) | |
Constructs an SetValueWhenProperty object which checks the watched property with name given and uses the given function to check if changes should be applied. More... | |
Public Member Functions inherited from Mantid::Kernel::IPropertySettings | |
virtual void | applyChanges (const IPropertyManager *, Property *const) |
The function user have to overload it in their custom code to modify the property according to the changes to other properties. More... | |
virtual IPropertySettings * | clone () const =0 |
Make a copy of the present type of IPropertySettings. More... | |
IPropertySettings ()=default | |
Constructor. More... | |
virtual bool | isConditionChanged (const IPropertyManager *algo, const std::string &changedPropName="") const |
to verify if the properties, this one depends on have changed or other special condition occurs which needs the framework to react to More... | |
virtual bool | isEnabled (const IPropertyManager *algo) const |
Is the property to be shown as "enabled" in the GUI. More... | |
virtual bool | isVisible (const IPropertyManager *algo) const |
Is the property to be shown in the GUI? Default true. More... | |
virtual | ~IPropertySettings ()=default |
Destructor. More... | |
Private Attributes | |
std::function< std::string(std::string, std::string)> | m_changeCriterion |
Function to check if changes should be applied. More... | |
std::string | m_watchedPropName |
Name of the watched property, based on which we may set the value of the current property. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Mantid::Kernel::IPropertySettings | |
IPropertySettings (const IPropertySettings &)=default | |
Definition at line 21 of file SetValueWhenProperty.h.
|
inline |
Constructs an SetValueWhenProperty object which checks the watched property with name given and uses the given function to check if changes should be applied.
Definition at line 26 of file SetValueWhenProperty.h.
|
overridevirtual |
If a new value should be set, the change is applied here.
Reimplemented from Mantid::Kernel::IPropertySettings.
Definition at line 65 of file SetValueWhenProperty.cpp.
References getPropertyValue(), m_changeCriterion, Mantid::Kernel::Property::setValue(), and Mantid::Kernel::Property::value().
|
overridevirtual |
Make a copy of the present type of IPropertySettings.
Implements Mantid::Kernel::IPropertySettings.
Definition at line 75 of file SetValueWhenProperty.cpp.
std::string Mantid::Kernel::SetValueWhenProperty::getPropertyValue | ( | const IPropertyManager * | algo | ) | const |
Checks the algorithm and property are both valid and attempts to get the value associated with the property.
Checks the algorithm given is in a valid state and the property exists then proceeds to try to get the value associated.
algo | :: The pointer to the algorithm to process |
: | Throws if anything is wrong with the property or algorithm |
Definition at line 31 of file SetValueWhenProperty.cpp.
References Mantid::Kernel::IPropertyManager::getPointerToProperty(), m_watchedPropName, and Mantid::Kernel::Property::value().
Referenced by applyChanges().
|
overridevirtual |
Return true always.
Always returns true as SetValueWhenProperty always wants to check if the property it depends on has changed.
algo | :: Pointer to the algorithm containing the property |
changedPropName | :: Name of the property that has just been changed by the user |
Reimplemented from Mantid::Kernel::IPropertySettings.
Definition at line 55 of file SetValueWhenProperty.cpp.
References Mantid::Kernel::IPropertyManager::getPointerToProperty(), and m_watchedPropName.
void Mantid::Kernel::SetValueWhenProperty::modify_allowed_values | ( | Property * const | ) |
Stub function to satisfy the interface.
Does nothing in this case and put here to satisfy the interface.
Definition at line 73 of file SetValueWhenProperty.cpp.
|
private |
Function to check if changes should be applied.
Definition at line 50 of file SetValueWhenProperty.h.
Referenced by applyChanges().
|
private |
Name of the watched property, based on which we may set the value of the current property.
Definition at line 48 of file SetValueWhenProperty.h.
Referenced by getPropertyValue(), and isConditionChanged().