Changes between Version 12 and Version 13 of Grits_ProjectPreferenceStore
- Timestamp:
- 03/09/2017 09:52:30 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Grits_ProjectPreferenceStore
v12 v13 22 22 Currently there are four types of preferences for projects. Each of these preference is an enum and has all the information needed to get a preference value. 23 23 24 - ''StringPreference'' - Simplest type of preference that has a '''string''' value . All the information is available in the enum object24 - ''StringPreference'' - Simplest type of preference that has a '''string''' value (all the information is available in the enum object) 25 25 26 26 - ''Preference'' - Type of preference whose values are a '''list of string''' … … 30 30 - ''IntegerPreference'' - A special case of ''ParameterizedPreference'' whose values are a '''list of integer''' 31 31 32 By using the above enum objects as parameter, the need of knowing the preference variable name or the need of knowing filename for default values (when a preference is not found in the preference file) is removed. When one of the above enum is passed as a parameter then user can get a generic''SingleChoicePreference'' or ''MultiChoicePreference'' (or its special case ''MultiChoiceInteger'') object.32 By using the above enum objects as parameter, the need of knowing the preference variable name or the need of knowing filename for default values (when a preference is not found in the preference file) is removed. When one of the above enum is passed as a parameter then user can get ''SingleChoicePreference'' or ''MultiChoicePreference'' (or its special case ''MultiChoiceInteger'') object. 33 33 34 34 - ''SingleChoicePreference'' … … 42 42 - a special case of MultiChoicePreference 43 43 44 45 46 {{{preference enum object (as parameter)}}} -> {{{PROJECT PREFERENCE STORE}}} -> {{{preference values (returned)}}} 47 44 48 __Note:__ The simplest ''StringPreference'' is self-contained. It has a single string value that is available in the enum object itself. 45 49 === ProjectPreferenceStore class === … … 51 55 52 56 === Preference and their values === 57 53 58 Currently it happens to be the case that certain preference types have certain preference values. Here is the mapping of current preference type and their values: 54 59 … … 59 64 || IntegerPreference || MultiChoiceInteger || 60 65 61 62 66 __Note:__ Currently ''SingleChoicePreference'' is not generic and only supports string preference values. If later some ''ParameterizedPreference'' have ''SingleChoicePreference'' values then ''SingleChoicePreference'' should be made a generic class. 63 67 68 69 === Working with GritsPreferenceStore === 70 {{{Classes using preference values}}} call-> {{{PROJECT PREFERENCE STORE}}} calls-> {{{GRITS PREFERENCE STORE}}} 71 72 In GRITS wherever a preference value related to a project is used, ''ProjectPreferenceStore'' is to be called. ''ProjectPreferenceStore'' would first look into its cache and if it is not found then it would call ''GritsPreferenceStore''. It would add these value to its cache so that next time it need not to call ''GritsPreferenceStore''. 73 74 75 === Saving Preference values === 76 The preference values returned by the ''ProjectPreferenceStore'' are self editable and saveable. One can add/remove values from the existing values of the preference value object and then call '''savePreference()''' on each of the preference value objects. 64 77 65 78 == Example Code ==