Mantid
|
#include <EnabledWhenProperty.h>
Classes | |
struct | ComparisonDetails |
Struct which holds details for comparison between two EnabledWhenPropertyObjects. More... | |
struct | PropertyDetails |
Struct which holds associated property details for comparison. More... | |
Public Member Functions | |
virtual bool | checkComparison (const IPropertyManager *algo) const |
Checks two EnabledWhenProperty objects match the logic operator specified and returns the result of both of them. More... | |
virtual bool | checkCriterion (const IPropertyManager *algo) const |
Checks that the specified property matches the criteria given. More... | |
IPropertySettings * | clone () const override |
Make a copy of the present type of validator. More... | |
EnabledWhenProperty (const EnabledWhenProperty &conditionOne, const EnabledWhenProperty &conditionTwo, eLogicOperator logicOperator) | |
Constructs a EnabledWhenProperty object which copies two already constructed EnabledWhenProperty objects and returns the result of both of them with the specified logic operator. More... | |
EnabledWhenProperty (const EnabledWhenProperty &other) | |
Copy constructor. More... | |
EnabledWhenProperty (const std::string &otherPropName, const ePropertyCriterion when, const std::string &value="") | |
Constructs a EnabledWhenProperty object which checks the property with name given and if it matches the criteria enables it. More... | |
EnabledWhenProperty (std::shared_ptr< EnabledWhenProperty > &&conditionOne, std::shared_ptr< EnabledWhenProperty > &&conditionTwo, eLogicOperator logicOperator) | |
Constructs a EnabledWhenProperty object which takes ownership of two already constructed EnabledWhenProperty objects and returns the result of both of them with the specified logic operator. More... | |
bool | isEnabled (const IPropertyManager *algo) const override |
Return true/false based on whether the other property satisfies the criterion. More... | |
bool | isVisible (const IPropertyManager *algo) const override |
Return true always. More... | |
void | modify_allowed_values (Property *const) |
Stub function to satisfy the interface. 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... | |
Protected Member Functions | |
EnabledWhenProperty ()=default | |
Protected Constructor for derived classes to skip setting up the comparator in the base class as they will handle it. 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... | |
Protected Member Functions inherited from Mantid::Kernel::IPropertySettings | |
IPropertySettings (const IPropertySettings &)=default | |
Protected Attributes | |
std::shared_ptr< PropertyDetails > | m_propertyDetails = nullptr |
Holds the various details used within the comparison. More... | |
Private Attributes | |
std::shared_ptr< ComparisonDetails< EnabledWhenProperty > > | m_comparisonDetails = nullptr |
Holds an object containing details of multiple comparisons. More... | |
Definition at line 62 of file EnabledWhenProperty.h.
Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty | ( | const std::string & | otherPropName, |
const ePropertyCriterion | when, | ||
const std::string & | value = "" |
||
) |
Constructs a EnabledWhenProperty object which checks the property with name given and if it matches the criteria enables it.
Constructor.
otherPropName | :: Name of the OTHER property that we will check. |
when | :: Criterion to evaluate |
value | :: For the IS_EQUAL_TO or IS_NOT_EQUAL_TO condition, the value (as string) to check for |
Definition at line 28 of file EnabledWhenProperty.cpp.
Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty | ( | const EnabledWhenProperty & | conditionOne, |
const EnabledWhenProperty & | conditionTwo, | ||
eLogicOperator | logicOperator | ||
) |
Constructs a EnabledWhenProperty object which copies two already constructed EnabledWhenProperty objects and returns the result of both of them with the specified logic operator.
Multiple conditions constructor - takes two enable when property objects and returns the product of of the with the specified logic operator.
conditionOne | :: First EnabledWhenProperty object to use |
conditionTwo | :: Second EnabledWhenProperty object to use |
logicOperator | :: The logic operator to apply across both conditions |
Definition at line 42 of file EnabledWhenProperty.cpp.
Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty | ( | std::shared_ptr< EnabledWhenProperty > && | conditionOne, |
std::shared_ptr< EnabledWhenProperty > && | conditionTwo, | ||
eLogicOperator | logicOperator | ||
) |
Constructs a EnabledWhenProperty object which takes ownership of two already constructed EnabledWhenProperty objects and returns the result of both of them with the specified logic operator.
Multiple conditions constructor - takes two shared pointers to EnabledWhenProperty objects and returns the product of them with the specified logic operator.
conditionOne | :: First EnabledWhenProperty object to use |
conditionTwo | :: Second EnabledWhenProperty object to use |
logicOperator | :: The logic operator to apply across both conditions |
Definition at line 60 of file EnabledWhenProperty.cpp.
Mantid::Kernel::EnabledWhenProperty::EnabledWhenProperty | ( | const EnabledWhenProperty & | other | ) |
Copy constructor.
Definition at line 67 of file EnabledWhenProperty.cpp.
|
protecteddefault |
Protected Constructor for derived classes to skip setting up the comparator in the base class as they will handle it.
Referenced by clone().
|
virtual |
Checks two EnabledWhenProperty objects match the logic operator specified and returns the result of both of them.
Checks if the user specified combination of enabled criterion returns a true or false value.
algo | :: The algorithm containing the property to check |
: | If any problems was found |
Reimplemented in Mantid::Kernel::VisibleWhenProperty.
Definition at line 78 of file EnabledWhenProperty.cpp.
References Mantid::Kernel::AND, m_comparisonDetails, Mantid::Kernel::OR, and Mantid::Kernel::XOR.
Referenced by isEnabled().
|
virtual |
Checks that the specified property matches the criteria given.
Does the validator fulfill the criterion based on the other property values?
algo | :: The pointer to the algorithm to check the property values of |
: | Throws on any problems (e.g. property missing from algorithm) |
Reimplemented in Mantid::MDAlgorithms::DisabledProperty.
Definition at line 105 of file EnabledWhenProperty.cpp.
References Mantid::Kernel::IPropertyManager::getPointerToProperty(), getPropertyValue(), Mantid::Kernel::IS_DEFAULT, Mantid::Kernel::IS_EQUAL_TO, Mantid::Kernel::IS_MORE_OR_EQ, Mantid::Kernel::IS_NOT_DEFAULT, Mantid::Kernel::IS_NOT_EQUAL_TO, and m_propertyDetails.
Referenced by isEnabled(), and Mantid::Kernel::VisibleWhenProperty::isVisible().
|
overridevirtual |
Make a copy of the present type of validator.
Clones the current EnabledWhenProperty object and returns a pointer to the new object.
The caller is responsible for deleting this pointer when finished
Implements Mantid::Kernel::IPropertySettings.
Reimplemented in Mantid::Kernel::VisibleWhenProperty.
Definition at line 204 of file EnabledWhenProperty.cpp.
References EnabledWhenProperty().
|
protected |
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 146 of file EnabledWhenProperty.cpp.
References Mantid::Kernel::IPropertyManager::getPointerToProperty(), m_propertyDetails, and Mantid::Kernel::Property::value().
Referenced by checkCriterion().
|
overridevirtual |
Return true/false based on whether the other property satisfies the criterion.
Returns whether the property should be enabled or disabled based on the property conditions.
algo | :: The algorithm containing the property |
: | Throws on any error (e.g. missing property) |
Reimplemented from Mantid::Kernel::IPropertySettings.
Reimplemented in Mantid::Kernel::VisibleWhenProperty.
Definition at line 170 of file EnabledWhenProperty.cpp.
References checkComparison(), checkCriterion(), m_comparisonDetails, and m_propertyDetails.
|
overridevirtual |
Return true always.
Always returns true as EnabledWhenProperty always sets the visibility on while altering whether the property is Enabled or disabled.
algo | :: Pointer to the algorithm containing the property |
Reimplemented from Mantid::Kernel::IPropertySettings.
Reimplemented in Mantid::Kernel::VisibleWhenProperty.
Definition at line 188 of file EnabledWhenProperty.cpp.
References UNUSED_ARG.
void Mantid::Kernel::EnabledWhenProperty::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 195 of file EnabledWhenProperty.cpp.
|
private |
Holds an object containing details of multiple comparisons.
Definition at line 136 of file EnabledWhenProperty.h.
Referenced by checkComparison(), and isEnabled().
|
protected |
Holds the various details used within the comparison.
Definition at line 132 of file EnabledWhenProperty.h.
Referenced by checkCriterion(), getPropertyValue(), isEnabled(), and Mantid::Kernel::VisibleWhenProperty::isVisible().