Ticket #150 (closed: fixed)

Opened 12 years ago

Last modified 5 years ago

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:

  1. Set and Extract all of the possible values
  2. Validate that the selected value is one of the values
  3. Set and extract the seleected value (in the same way all other parameters do)
  4. Extract a default initial value.

Could this be done with a Validator?

Change History

comment:1 Changed 12 years ago by Nick Draper

  • Description modified (diff)

comment:2 Changed 12 years ago by Nick Draper

  • Owner set to Russell Taylor

comment:3 Changed 12 years ago by Russell Taylor

  • Status changed from new to assigned

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:5 Changed 12 years ago by Russell Taylor

(In [1106]) Tests for ListValidator. Re #150.

comment:6 Changed 12 years ago by Russell Taylor

(In [1107]) Checked in in error. Re #150.

comment:7 Changed 12 years ago by Russell Taylor

(In [1108]) More that I didn't mean to check in. And ConvertUnitsTest slimmed down because it was taking ages to run on the Windows Build Server. Re #150.

comment:8 Changed 12 years ago by Russell Taylor

(In [1113]) Added an allowedValues override to WorkspaceProperty, which returns the current contents of the ADS. Changed return type of allowedValues to vector (was set). Modified WorkspaceProperty::isValid so that it fetches output workspaces if they already exist in the ADS. Re #150.

comment:9 Changed 12 years ago by Russell Taylor

(In [1114]) Checked in my main by mistake (again). Re #150.

comment:10 Changed 12 years ago by Russell Taylor

(In [1117]) Small doxygen update. Re #150.

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

Note: See TracTickets for help on using tickets.