Changes between Version 12 and Version 13 of Grits_ProjectPreferenceStore


Ignore:
Timestamp:
03/09/2017 09:52:30 PM (5 years ago)
Author:
shan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Grits_ProjectPreferenceStore

    v12 v13  
    2222Currently 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.
    2323
    24 - ''StringPreference'' - Simplest type of preference that has a '''string''' value. All the information is available in the enum object
     24- ''StringPreference'' - Simplest type of preference that has a '''string''' value (all the information is available in the enum object)
    2525
    2626- ''Preference'' - Type of preference whose values are a '''list of string'''
     
    3030- ''IntegerPreference'' - A special case of ''ParameterizedPreference'' whose values are a '''list of integer'''
    3131
    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.
     32By 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.
    3333
    3434- ''SingleChoicePreference''
     
    4242 - a special case of MultiChoicePreference
    4343
     44
     45
     46{{{preference enum object (as parameter)}}} -> {{{PROJECT PREFERENCE STORE}}} -> {{{preference values (returned)}}}
     47
    4448__Note:__ The simplest ''StringPreference'' is self-contained. It has a single string value that is available in the enum object itself.
    4549=== ProjectPreferenceStore class ===
     
    5155
    5256=== Preference and their values ===
     57
    5358Currently 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:
    5459
     
    5964|| IntegerPreference       || MultiChoiceInteger      ||
    6065
    61 
    6266__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.
    6367
     68
     69=== Working with GritsPreferenceStore ===
     70{{{Classes using preference values}}} call-> {{{PROJECT PREFERENCE STORE}}} calls-> {{{GRITS PREFERENCE STORE}}}
     71
     72In 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 ===
     76The 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.
    6477
    6578== Example Code ==