Project

General

Profile

Revision 2bd924ce

ID2bd924ce9809391592c064c8ff581226c3728f5f
Parent 03b1edf8
Child 97107e7d

Added by Katja Luther over 1 year ago

ref #6429: namedetails view configuration in admin preferences

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ChecklistEditorGeneralPreference.java
17 17
import org.eclipse.swt.widgets.Composite;
18 18
import org.eclipse.swt.widgets.Control;
19 19

  
20
import eu.etaxonomy.cdm.api.application.ICdmRepository;
21
import eu.etaxonomy.cdm.api.service.IPreferenceService;
22
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
23
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
20 24
import eu.etaxonomy.taxeditor.l10n.Messages;
21 25
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
22 26
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
......
43 47

  
44 48
        Composite composite = new Composite(parent, SWT.NULL);
45 49
        composite.setLayout(new GridLayout());
46
        isEditorActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
50
        CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated);
51
        if (pref != null){
52
            isEditorActivated = Boolean.valueOf(pref.getValue());
53
        }else{
54
            isEditorActivated = false;
55
        }
47 56
        final Button activateCheckButton = new Button(composite, SWT.CHECK);
48 57
        activateCheckButton.setText(Messages.ChecklistEditorGeneralPreference_enable);
49 58
        activateCheckButton.setSelection(isEditorActivated);
......
68 77
        child.setVisible(isEditorActivated);
69 78
        final CLabel label = new CLabel(child, SWT.NULL);
70 79
        label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard + Messages.ChecklistEditorGeneralPreference_2);
71
        final CommandHandlerButton button_openFeatureTree = new CommandHandlerButton(child, SWT.PUSH,
80
        final CommandHandlerButton button_openWizard = new CommandHandlerButton(child, SWT.PUSH,
72 81
                Messages.ChecklistEditorGeneralPreference_3);
73 82

  
74
        button_openFeatureTree.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
83
        button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
75 84
        final Button showIdInVocabulary = new Button(child, SWT.CHECK);
76
        isShowIdInVocabulary = PreferencesUtil.isShowIdInVocabularyInChecklistEditor();
85
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowIdInVocabulary);
86
        if (pref != null){
87
            isShowIdInVocabulary = Boolean.valueOf(pref.getValue());
88
        }else{
89
            isShowIdInVocabulary = false;
90
        }
77 91
        showIdInVocabulary.setText(Messages.ChecklistEditorGeneralPreference_show_id_in_voc);
78 92
        showIdInVocabulary.setSelection(isShowIdInVocabulary);
79 93
        showIdInVocabulary.addSelectionListener(new SelectionAdapter(){
......
85 99
        });
86 100

  
87 101
        final Button showSymbol = new Button(child, SWT.CHECK);
88
        isShowSymbol = PreferencesUtil.isShowSymbolInChecklistEditor();
102
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSymbol);
103
        if (pref != null){
104
            isShowSymbol = Boolean.valueOf(pref.getValue());
105
        }else{
106
            isShowSymbol = false;
107
        }
108

  
89 109
        showSymbol.setText(Messages.ChecklistEditorGeneralPreference_show_symbol);
90 110
        showSymbol.setSelection(isShowSymbol);
91 111
        showSymbol.addSelectionListener(new SelectionAdapter(){
......
94 114
                isShowSymbol = showSymbol.getSelection();
95 115
             }
96 116
        });
97
        PreferencesUtil.recursiveSetEnabled(button_openFeatureTree, CdmStore.isActive());
98
        isShowRank = PreferencesUtil.isShowRankInChecklistEditor();
117
//        PreferencesUtil.recursiveSetEnabled(button_openWizard, CdmStore.isActive());
118
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowRankInDistributionEditor);
119
        if (pref != null){
120
            isShowRank = Boolean.valueOf(pref.getValue());
121
        }else{
122
            isShowRank = false;
123
        }
124

  
99 125
        final Button activateRankButton = new Button(child, SWT.CHECK);
100 126
        activateRankButton.setText(Messages.ChecklistEditorGeneralPreference_show_rank);
101 127
        activateRankButton.setSelection(isShowRank);
......
106 132
            }
107 133
        });
108 134
        final Button sortNamedAreaByVocabularyOrder = new Button(child, SWT.CHECK);
109
        isSortByVocabularyOrder = PreferencesUtil.isSortNamedAreaByOrderInVocabulary();
135

  
136
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AreasSortedByIdInVocabulary);
137
        if (pref != null){
138
            isSortByVocabularyOrder = Boolean.valueOf(pref.getValue());
139
        }else{
140
            isSortByVocabularyOrder = false;
141
        }
142

  
110 143
        sortNamedAreaByVocabularyOrder.setText(Messages.ChecklistEditorGeneralPreference_sort_areas);
111 144
        sortNamedAreaByVocabularyOrder.setSelection(isSortByVocabularyOrder);
112 145
        sortNamedAreaByVocabularyOrder.addSelectionListener(new SelectionAdapter(){
......
127 160

  
128 161
    @Override
129 162
    public boolean performOk() {
163
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
164
        if (controller == null){
165
            return false;
166
        }
167
        IPreferenceService service = controller.getPreferenceService();
168

  
169
        CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.DistributionEditorActivated, Boolean.toString(isEditorActivated));
170
        //ToDo
171
        pref.setAllowOverride(false);
172
        service.set(pref);
173

  
174
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowIdInVocabulary, Boolean.toString(isShowIdInVocabulary));
175
        //ToDo
176
        pref.setAllowOverride(false);
177
        service.set(pref);
178

  
179
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowSymbol, Boolean.toString(isShowSymbol));
180
        //ToDo
181
        pref.setAllowOverride(false);
182
        service.set(pref);
183

  
184
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowRankInDistributionEditor, Boolean.toString(isShowRank));
185
        //ToDo
186
        pref.setAllowOverride(false);
187
        service.set(pref);
188
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.AreasSortedByIdInVocabulary, Boolean.toString(isSortByVocabularyOrder));
189
        //ToDo
190
        pref.setAllowOverride(false);
191
        service.set(pref);
192

  
130 193
        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, isEditorActivated);
131 194
        PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder);
132 195
        PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewConfiguration.java
52 52
    protected Control createContents(Composite parent) {
53 53
        final CLabel description = new CLabel(parent, SWT.NULL);
54 54
        description.setText(Messages.NameDetailsViewConfiguration_description);
55
        CdmPreference nameDetailsPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
56
        isAllowOverride = false;
57
        if (nameDetailsPref != null){
58
            //TODO: create checkbox
55
        NameDetailsConfigurator nameDetailsConfig = PreferencesUtil.setPreferredNameDetailsConfiguration(false);
59 56

  
60
            isAllowOverride = nameDetailsPref.isAllowOverride();
61
        }
62

  
63

  
64

  
65
        isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
66 57

  
67 58
        final Button activateCheckButton = new Button(parent, SWT.CHECK);
68 59
        activateCheckButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
69 60
        activateCheckButton.setText(Messages.NameDetailsViewConfiguration_activateSimpleDetailsView);
61
        isSimpleDetailsViewActivated = nameDetailsConfig.isSimpleDetailsViewActivated();
70 62
        activateCheckButton.setSelection(isSimpleDetailsViewActivated);
71 63
        activateCheckButton.addSelectionListener(new SelectionAdapter(){
72 64
        @Override
......
98 90
        final Button allowLocalPreference = new Button(dbSettings, SWT.CHECK);
99 91
//      boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
100 92
      allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
93
      isAllowOverride = nameDetailsConfig.isAllowOverride();
101 94
      allowLocalPreference.setSelection(isAllowOverride);
102 95
      allowLocalPreference.addSelectionListener(new SelectionAdapter(){
103 96
           @Override
......
109 102
        Label separator= new Label(dbSettings, SWT.HORIZONTAL | SWT.SEPARATOR);
110 103
        separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
111 104
        final Button showTaxon = new Button(dbSettings, SWT.CHECK);
112
        isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
113 105
        showTaxon.setText(Messages.NameDetailsViewComposite_Show_Taxon);
106
        isShowTaxon = nameDetailsConfig.isTaxonSectionActivated();
114 107
        showTaxon.setSelection(isShowTaxon);
115 108
        showTaxon.addSelectionListener(new SelectionAdapter(){
116 109
             @Override
......
121 114
         });
122 115

  
123 116
        final Button showLsid = new Button(dbSettings, SWT.CHECK);
124
        isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
125 117
        showLsid.setText(Messages.NameDetailsViewComposite_Show_LSID);
118
        isShowLSID = nameDetailsConfig.isLSIDActivated();
126 119
        showLsid.setSelection(isShowLSID);
127 120
        showLsid.addSelectionListener(new SelectionAdapter(){
128 121
             @Override
......
133 126
         });
134 127

  
135 128
        final Button showNomenclaturalCode = new Button(dbSettings, SWT.CHECK);
136
        isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
137 129
        showNomenclaturalCode.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalCode);
130
        isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived();
138 131
        showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
139 132
        showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
140 133
             @Override
......
145 138
         });
146 139

  
147 140
        final Button showNameCache = new Button(dbSettings, SWT.CHECK);
148
        isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
149 141
        showNameCache.setText(Messages.NameDetailsViewComposite_Show_NameCache);
142
        isShowNameCache = nameDetailsConfig.isNameCacheActivated();
150 143
        showNameCache.setSelection(isShowNameCache);
151 144
        showNameCache.addSelectionListener(new SelectionAdapter(){
152 145
             @Override
......
156 149
              }
157 150
         });
158 151
        final Button showAppendedPhrase = new Button(dbSettings, SWT.CHECK);
159
        isShowAppendedPhrase= PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
152
        isShowAppendedPhrase= nameDetailsConfig.isAppendedPhraseActivated();
160 153
        showAppendedPhrase.setText(Messages.NameDetailsViewComposite_Show_AppendedPhrase);
161 154
        showAppendedPhrase.setSelection(isShowAppendedPhrase);
162 155
        showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
......
168 161
         });
169 162

  
170 163
        final Button showRank = new Button(dbSettings, SWT.CHECK);
171
        isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
164
        isShowRank = nameDetailsConfig.isRankActivated();
172 165
        showRank.setText(Messages.NameDetailsViewComposite_Show_Rank);
173 166
        showRank.setSelection(isShowRank);
174 167
        showRank.addSelectionListener(new SelectionAdapter(){
......
179 172
              }
180 173
         });
181 174
        final Button showEpithets = new Button(dbSettings, SWT.CHECK);
182
        isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
175
        isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated();
183 176
        showEpithets.setText(Messages.NameDetailsViewComposite_Show_AtomisedEpithets);
184 177
        showEpithets.setSelection(isShowEpithets);
185 178
        showEpithets.addSelectionListener(new SelectionAdapter(){
......
191 184
         });
192 185

  
193 186
        final Button showAuthorCache = new Button(dbSettings, SWT.CHECK);
194
        isShowAuthorCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE);
187
        isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated();
195 188
        showAuthorCache.setText(Messages.NameDetailsViewComposite_Show_AuthorCache);
196 189
        showAuthorCache.setSelection(isShowAuthorCache);
197 190
        showAuthorCache.addSelectionListener(new SelectionAdapter(){
......
203 196
         });
204 197

  
205 198
        final Button showAuthorship = new Button(dbSettings, SWT.CHECK);
206
        isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
199
        isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated();
207 200
        showAuthorship.setText(Messages.NameDetailsViewComposite_Show_Author);
208 201
        showAuthorship.setSelection(isShowAuthorship);
209 202
        showAuthorship.addSelectionListener(new SelectionAdapter(){
......
215 208
         });
216 209

  
217 210
        final Button showNomenclaturalRef = new Button(dbSettings, SWT.CHECK);
218
        isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
211
        isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated();
219 212
        showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference);
220 213
        showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
221 214
        showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
......
227 220
         });
228 221

  
229 222
        final Button showNomenclaturalStatus = new Button(dbSettings, SWT.CHECK);
230
        isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
223
        isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated();
231 224
        showNomenclaturalStatus.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus);
232 225
        showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
233 226
        showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
......
239 232
         });
240 233

  
241 234
        final Button showProtologue = new Button(dbSettings, SWT.CHECK);
242
        isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
235
        isShowProtologue = nameDetailsConfig.isProtologueActivated();
243 236
        showProtologue.setText(Messages.NameDetailsViewComposite_Show_Protologue);
244 237
        showProtologue.setSelection(isShowProtologue);
245 238
        showProtologue.addSelectionListener(new SelectionAdapter(){
......
251 244
         });
252 245

  
253 246
        final Button showTypeDesignation = new Button(dbSettings, SWT.CHECK);
254
        isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
247
        isShowTypeDesignation = nameDetailsConfig.isTypeDesignationSectionActivated();
255 248
        showTypeDesignation.setText(Messages.NameDetailsViewComposite_Show_TypeDesignation);
256 249
        showTypeDesignation.setSelection(isShowTypeDesignation);
257 250
        showTypeDesignation.addSelectionListener(new SelectionAdapter(){
......
264 257

  
265 258

  
266 259
        final Button showNameRelationship = new Button(dbSettings, SWT.CHECK);
267
        isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
260
        isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated();
268 261
        showNameRelationship.setText(Messages.NameDetailsViewComposite_Show_Namerelationships);
269 262
        showNameRelationship.setSelection(isShowNameRelationship);
270 263
        showNameRelationship.addSelectionListener(new SelectionAdapter(){
......
276 269
         });
277 270

  
278 271
        final Button showHybrid = new Button(dbSettings, SWT.CHECK);
279
        isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
272
        isShowHybrid = nameDetailsConfig.isHybridActivated();
280 273
        showHybrid.setText(Messages.NameDetailsViewComposite_Show_Hybrid);
281 274
        showHybrid.setSelection(isShowHybrid);
282 275
        showHybrid.addSelectionListener(new SelectionAdapter(){
......
287 280
              }
288 281
         });
289 282
        final Button showNameApprobiation = new Button(dbSettings, SWT.CHECK);
290
        isShowNameApprobiation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION);
283
        isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated();
291 284
        showNameApprobiation.setText(Messages.NameDetailsViewComposite_Show_NameApprobiation);
292 285
        showNameApprobiation.setSelection(isShowNameApprobiation);
293 286
        showNameApprobiation.addSelectionListener(new SelectionAdapter(){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/PublishFlagPreference.java
33 33
 */
34 34
public class PublishFlagPreference extends CdmPreferencePage implements IE4AdminPreferencePage{
35 35

  
36
   boolean setPublish = true;
37
   boolean setNotPublish = false;
38
   boolean inheritFromParent = false;
36
   boolean setPublish;
37
   boolean setNotPublish;
38
   boolean inheritFromParent;
39 39

  
40 40
   @Override
41 41
   public void init() {
42 42
       super.init();
43 43
       CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DefaultBehaviourForPublishFlag);
44
       if (pref != null){
45
           if (pref.getValue().equals(Messages.PublishFlagPreference_do_not_set)){
46
               setNotPublish = true;
47
               setPublish = false;
48
               inheritFromParent = false;
49
           }
50

  
51
           if (pref.getValue().equals(Messages.PublishFlagPreference_inherit)){
52
               setNotPublish = false;
53
               setPublish = false;
54
               inheritFromParent = true;
55
           }
56

  
57
           if (pref.getValue().equals(Messages.PublishFlagPreference_set)){
58
               setNotPublish = false;
59
               setPublish = true;
60
               inheritFromParent = false;
61
           }
62
       }else{
63
           setNotPublish = false;
64
           setPublish = true;
65
           inheritFromParent = false;
66
       }
44 67

  
45 68
   }
46 69
    /**
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsConfigurator.java
15 15
 */
16 16
public class NameDetailsConfigurator {
17 17

  
18
    private boolean isAllowOverride = true;
18 19
    private boolean isSimpleDetailsViewActivated = true;
19 20

  
20 21
    private boolean isTaxonSectionActivated = true;
......
227 228
      return result.toString();
228 229
    }
229 230

  
230
    
231

  
231 232

  
232 233
    /**
233 234
     * @return the isAuthorCacheActivated
......
253 254

  
254 255
	public void setNameApprobiationActivated(boolean isNameApprobiationActivated) {
255 256
		this.isNameApprobiationActivated  = isNameApprobiationActivated;
256
		
257

  
257 258
	}
258 259
	public boolean isNameApprobiationActivated() {
259 260
		return isNameApprobiationActivated;
260
		
261

  
261 262
	}
262 263

  
264
    public boolean isAllowOverride() {
265
        return isAllowOverride;
266
    }
267

  
268
    public void setAllowOverride(boolean isAllowOverride) {
269
        this.isAllowOverride = isAllowOverride;
270
    }
271

  
263 272
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
276 276

  
277 277
    }
278 278

  
279
    public static void setPreferenceToDB(CdmPreference preference){
280
        ICdmRepository controller;
281
        try{
282
            if(CdmStore.isActive()){
283
                controller = CdmStore.getCurrentApplicationConfiguration();
284
                controller.getPreferenceService().set(preference);
285
            }
286
        }catch(Exception e){
287
            e.printStackTrace();
288
        }
289

  
290
    }
291

  
292

  
279 293

  
280 294
	public static String getPreferredDefaultLangugae(){
281 295
	    String preferredLanguage = getPreferenceStore().getString(DEFAULT_LANGUAGE_EDITOR);
......
1062 1076

  
1063 1077
        if (!local) {
1064 1078
            preference = getPreferenceFromDB(PreferencePredicate.NameDetailsView);
1065
        }
1066
        if (preference == null){
1067
            return null;
1068
        }
1079
            if (preference == null){
1080
                return null;
1081
            }
1069 1082

  
1070
        getPreferenceStore().setValue(ALLOW_OVERRIDE_NAME_DETAILS, preference.isAllowOverride());
1083
            getPreferenceStore().setValue(ALLOW_OVERRIDE_NAME_DETAILS, preference.isAllowOverride());
1071 1084

  
1072
        //the preference value is build like this:
1073
        //<section1>:true;<section2>:false....
1085
            //the preference value is build like this:
1086
            //<section1>:true;<section2>:false....
1074 1087

  
1075
        String value = preference.getValue();
1076
        String [] sections = value.split(";");
1077
        Map<String, Boolean> sectionMap = new HashMap<String, Boolean>();
1078
        String[] sectionValues;
1079
        for (String sectionValue: sections){
1080
            sectionValues = sectionValue.split(":");
1081
            sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1]));
1088
            String value = preference.getValue();
1089
            String [] sections = value.split(";");
1090
            Map<String, Boolean> sectionMap = new HashMap<String, Boolean>();
1091
            String[] sectionValues;
1092
            for (String sectionValue: sections){
1093
                sectionValues = sectionValue.split(":");
1094
                sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1]));
1095
            }
1096
            config.setAllowOverride(preference.isAllowOverride());
1097
            config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated"));
1098

  
1099
    //        getPreferenceStore().setValue(SHOW_SIMPLE_NAME_DETAILS_TAXON,
1100
    //                (getValue(sectionMap, "taxon")));
1101
            config.setTaxonSectionActivated(getValue(sectionMap, "taxon"));
1102

  
1103
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_LSID,
1104
    //                (getValue(sectionMap, "lsid")));
1105
            config.setLSIDActivated(getValue(sectionMap, "lsid"));
1106

  
1107
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
1108
    //                (getValue(sectionMap, "nc")));
1109
            config.setNomenclaturalCodeActived(getValue(sectionMap, "nc"));
1110

  
1111
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
1112
    //                (getValue(sectionMap, "ap")));
1113
            config.setAppendedPhraseActivated(getValue(sectionMap, "ap"));
1114

  
1115
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_RANK,
1116
    //                (getValue(sectionMap, "rank")));
1117
            config.setRankActivated(getValue(sectionMap, "rank"));
1118

  
1119

  
1120
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
1121
    //                (getValue(sectionMap, "atomisedEpithets")));
1122
            config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets"));
1123

  
1124
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
1125
    //                (getValue(sectionMap,"author")));
1126
            config.setAuthorshipSectionActivated(getValue(sectionMap,"author"));
1127

  
1128
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
1129
    //                (getValue(sectionMap, "nomRef")));
1130
            config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef"));
1131

  
1132
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
1133
    //                (getValue(sectionMap, "nomStat")));
1134
            config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat"));
1135

  
1136

  
1137
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
1138
    //                (getValue(sectionMap,"protologue")));
1139
            config.setProtologueActivated(getValue(sectionMap,"protologue"));
1140

  
1141
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
1142
    //                (getValue(sectionMap,"typeDes")));
1143
            config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes"));
1144

  
1145
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
1146
    //                (getValue(sectionMap,"nameRelation")));
1147
            config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation"));
1148

  
1149
    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_HYBRID,
1150
    //                (getValue(sectionMap, "hybrid")));
1151
            config.setHybridActivated(getValue(sectionMap,"hybrid"));
1152
        }else{
1153
            config.setSimpleDetailsViewActivated(getPreferenceStore().getBoolean(SHOW_SIMPLE_NAME_DETAILS_SECTION));
1154
            config.setTaxonSectionActivated(getPreferenceStore().getBoolean(SHOW_SIMPLE_NAME_DETAILS_TAXON));
1155
            config.setLSIDActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_LSID));
1156
            config.setNomenclaturalCodeActived(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
1157
            config.setAppendedPhraseActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
1158
            config.setRankActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_RANK));
1159
            config.setAtomisedEpithetsActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
1160
            config.setAuthorshipSectionActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
1161
            config.setNomenclaturalReferenceSectionActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
1162
            config.setNomenclaturalStatusSectionActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
1163
            config.setProtologueActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
1164
            config.setTypeDesignationSectionActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
1165
            config.setNameRelationsSectionActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
1166
            config.setHybridActivated(getPreferenceStore().getBoolean(SHOW_NAME_DETAILS_SECTION_HYBRID));
1082 1167
        }
1083

  
1084
        config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated"));
1085

  
1086
//        getPreferenceStore().setValue(SHOW_SIMPLE_NAME_DETAILS_TAXON,
1087
//                (getValue(sectionMap, "taxon")));
1088
        config.setTaxonSectionActivated(getValue(sectionMap, "taxon"));
1089

  
1090
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_LSID,
1091
//                (getValue(sectionMap, "lsid")));
1092
        config.setLSIDActivated(getValue(sectionMap, "lsid"));
1093

  
1094
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
1095
//                (getValue(sectionMap, "nc")));
1096
        config.setNomenclaturalCodeActived(getValue(sectionMap, "nc"));
1097

  
1098
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
1099
//                (getValue(sectionMap, "ap")));
1100
        config.setAppendedPhraseActivated(getValue(sectionMap, "ap"));
1101

  
1102
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_RANK,
1103
//                (getValue(sectionMap, "rank")));
1104
        config.setRankActivated(getValue(sectionMap, "rank"));
1105

  
1106

  
1107
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
1108
//                (getValue(sectionMap, "atomisedEpithets")));
1109
        config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets"));
1110

  
1111
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
1112
//                (getValue(sectionMap,"author")));
1113
        config.setAuthorshipSectionActivated(getValue(sectionMap,"author"));
1114

  
1115
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
1116
//                (getValue(sectionMap, "nomRef")));
1117
        config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef"));
1118

  
1119
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
1120
//                (getValue(sectionMap, "nomStat")));
1121
        config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat"));
1122

  
1123

  
1124
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
1125
//                (getValue(sectionMap,"protologue")));
1126
        config.setProtologueActivated(getValue(sectionMap,"protologue"));
1127

  
1128
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
1129
//                (getValue(sectionMap,"typeDes")));
1130
        config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes"));
1131

  
1132
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
1133
//                (getValue(sectionMap,"nameRelation")));
1134
        config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation"));
1135

  
1136
//        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_HYBRID,
1137
//                (getValue(sectionMap, "hybrid")));
1138
        config.setHybridActivated(getValue(sectionMap,"hybrid"));
1139

  
1140 1168
        return config;
1141 1169
    }
1142 1170

  
......
1391 1419

  
1392 1420

  
1393 1421

  
1422

  
1394 1423
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/AvailableDistributionWizard.java
82 82
            String saveCheckedElements = StringUtils.join(listUIIDChecked, ",");
83 83
            String saveGrayedElements = StringUtils.join(listUIIDGrayed, ",");
84 84
            IPreferenceStore preferenceStore = PreferencesUtil.getPreferenceStore();
85
            //ToDo, if whole vocabulary is selected, save the vocabulary not all areas
85 86
            PreferencesUtil.setPreferredNamedAreasForDistributionEditor(saveCheckedElements, saveGrayedElements, false);
86 87
//            preferenceStore.setValue(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS, saveCheckedElements);
87 88
            preferenceStore.setValue(PreferencesUtil.DISTRIBUTION_AREA_OCCURENCE_STATUS_GRAYED, saveGrayedElements);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
26 26
import eu.etaxonomy.cdm.model.name.Rank;
27 27
import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
28 28
import eu.etaxonomy.cdm.strategy.parser.ParserProblem;
29
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
29
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
30 30
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
31 31
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
32 32
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
......
64 64
	//private NumberWithLabelElement text_originalPublicationYear;
65 65
	private int cursorPosition;
66 66

  
67
	NameDetailsConfigurator config;
67 68

  
68 69
	/**
69 70
	 * <p>Constructor for NameDetailElement.</p>
......
77 78
		super(cdmFormFactory, formElement);
78 79
		// make this element selectable
79 80

  
81

  
80 82
	}
81 83

  
82 84
	/** {@inheritDoc} */
83 85
	@Override
84 86
	protected void createControls(ICdmFormElement formElement, INonViralName nonViralName, int style) {
85 87
		Comparator<Rank> comparator = null;
88
		config = PreferencesUtil.setPreferredNameDetailsConfiguration(false);
89
        if ( PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.ALLOW_OVERRIDE_NAME_DETAILS)){
90
            config = PreferencesUtil.setPreferredNameDetailsConfiguration(true);
91
        }
86 92
		if(PreferencesUtil.getSortRanksHierarchichally()){
87 93
			comparator = new Comparator<Rank>(){
88 94

  
......
104 110
            createSpecificNameParts(this, nonViralName, style);
105 111
            text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
106 112
	    }else{
107
	    	if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE)){
113
	    	if (config.isNameCacheActivated()){
108 114
	    		toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
109 115
        	}
110 116

  
111
    	    if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK)){
117
    	    if (config.isRankActivated()){
112 118
    	        combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style, comparator);
113 119
    	    }
114 120

  
115
    		if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS)){
121
    		if (config.isAtomisedEpithetsActivated()){
116 122
    			createGenusOrUninomialControls(this, nonViralName, style);
117 123
    			createInfragenerericEpithetControls(this, nonViralName, style);
118 124
    			createSpecificEpithetControls(this, nonViralName, style);
119 125
    			createInfraSpecificEpithetControls(this, nonViralName, style);
120 126
    			createSpecificNameParts(this, nonViralName, style);
121 127
    		}
122
    		if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE)){
128
    		if (config.isAppendedPhraseActivated()){
123 129
    				text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
124 130
           	}
125 131
	    }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)