Ticket #150 (closed: fixed)
List Parameters
Reported by: | Nick Draper | Owned by: | Russell Taylor |
---|---|---|---|
Priority: | major | Milestone: | Iteration 9 |
Component: | Keywords: | ||
Cc: | Blocked By: | ||
Blocking: | Tester: |
Description (last modified by Nick Draper) (diff)
We seem to need the concept of a List Parameter where the user needs to specify which of a defined list of possibilities he sets as the parameter.
The best example at the moment is the selection of the Target Unit in the Unit Conversion Algorithm. The list is defined (the current contents of the AlgorithmFactory), and the user needs to select one member of the list. Also etype may well fint into this type of paramter. From the user interface side we would need enough information to be able to use a drop down list box.
Therefore we would need to:
- Set and Extract all of the possible values
- Validate that the selected value is one of the values
- Set and extract the seleected value (in the same way all other parameters do)
- Extract a default initial value.
Could this be done with a Validator?
Change History
comment:4 Changed 12 years ago by Russell Taylor
(In [1102]) Added a ListValidator, which allows a (string type) property to be restricted to a set of values. Changed the "Target" property on ConvertUnits to use this. The Property class now has an allowedValues method which returns the set of allowed values if a ListValidator is attached to the property, or an empty set otherwise. Also modifies the PropertyWithValue class so that it is no longer possible to set a property's value to an invalid value. Re #150.
comment:10 Changed 12 years ago by Russell Taylor
comment:11 Changed 12 years ago by Russell Taylor
- Status changed from assigned to closed
- Resolution set to fixed
This is complete now. One small caveat is that I don't much like the fact that I've polluted PropertyWithValue by referring to a specific type of validator. The alternative would be to move the functionality into the validators, but then you'd need to add a method to IValidator and have it implemented by all the other validators, returning empty vectors.
At the moment, I couldn't spot any properties other than ConvertUnit's 'Target' property that should have a ListValidator.
comment:12 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 998