Project

General

Profile

Revision 9fe7e119

ID9fe7e119040239957d870405860c71d331f03b5d
Parent 90e556b0
Child 11a57a97

Added by Katja Luther 9 months ago

ref #8045: show possible entries for preferences in combo boxes and show default value

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
481 481

  
482 482
    public static String ChecklistEditorGeneralPreference_enable;
483 483
    public static String GeneralPreference_allowOverride;
484
    public static String GeneralPreference_yes;
485
    public static String GeneralPreference_no;
484 486
    public static String ChecklistEditorGeneralPreference_open_distribution_selection;
485 487
    public static String ChecklistEditorGeneralPreference_open_wizard;
486 488
    public static String ChecklistEditorGeneralPreference_show_id_in_voc;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
394 394
ChecklistEditorGeneralPreference_show_rank=Show rank in Distribution Editor
395 395
ChecklistEditorGeneralPreference_sort_areas=Sort areas by order in vocabulary
396 396
GeneralPreference_allowOverride=Allow override
397
GeneralPreference_yes=Yes
398
GeneralPreference_no=No
399

  
397 400
ChecklistEditorGeneralPreference_show_id_in_voc=ID in Vocabulary
398 401
ChecklistEditorGeneralPreference_show_symbol1=Symbol
399 402
ChecklistEditorGeneralPreference_show_symbol2=Symbol 2
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
394 394
ChecklistEditorGeneralPreference_show_rank=Rang anzeigen
395 395
ChecklistEditorGeneralPreference_sort_areas=Areale gem?? Vokabular sortieren
396 396
GeneralPreference_allowOverride=Erlaube ?berschreiben
397
GeneralPreference_yes=Ja
398
GeneralPreference_no=Nein
399

  
397 400
ChecklistEditorGeneralPreference_show_id_in_voc=ID im Vokabular
398 401
ChecklistEditorGeneralPreference_show_symbol1=Symbol
399 402
ChecklistEditorGeneralPreference_show_symbol2=Symbol 2
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java
39 39
public class ChecklistEditorGeneralPreference extends CdmPreferencePage implements SelectionListener {
40 40

  
41 41
    protected boolean isEditorActivated;
42
    protected boolean allowOverrideActivated;
42

  
43 43
    protected boolean overrideActivated;
44 44
    boolean isUseLocal;
45 45
    protected boolean isShowRank;
......
47 47
    protected String displayStatus;
48 48
    protected String displayArea;
49 49
    protected boolean ownDescriptionForDistributionEditor;
50
    protected boolean allowOverrideOwnDescriptionForDistributionEditor;
50

  
51 51
    protected boolean overrideOwnDescriptionForDistributionEditor;
52
    protected boolean allowOverrideAreaVoc;
53 52
    protected boolean overrideAreaVoc;
54
    protected boolean allowOverrideRank;
55 53
    protected boolean overrideRank;
56
    protected boolean allowOverrideOrderAreas;
57 54
    protected boolean overrideOrderAreas;
58
    protected boolean allowOverrideAreaDisplay;
59 55
    protected boolean overrideAreaDisplay;
60
    protected boolean allowOverrideStatusDisplay;
61 56
    protected boolean overrideStatusDisplay;
62 57

  
63
    protected boolean allowOverrideStatus;
64 58
    protected Combo areaOrderSelectionCombo;
65 59
    protected Button allowOverrideOrderAreasButton;
66 60
    protected Combo statusDisplaySelectionCombo;
......
70 64
    protected String commandHandlerString;
71 65
    protected String commandHandlerStringStatus;
72 66

  
73

  
74

  
75 67
    protected CdmPreference distributionEditorPref;
76
    Composite child ;
77
    protected boolean isAllowOverride;
68
    protected CdmPreference prefStatus;
69
    protected CdmPreference prefAreaVoc;
70
    protected CdmPreference prefAreaDisplay;
71
    protected CdmPreference prefStatusDisplay;
72
    protected CdmPreference prefAreaSort;
73
    protected CdmPreference prefRank;
74
    protected CdmPreference prefOwnDescription;
75
    Composite child;
78 76

  
79 77
    protected Combo activateCombo;
80
   // protected Button allowOverrideActivatedButton;
78
    protected Button allowOverrideActivatedButton;
79
    final String ENABLE = "Enable";
80
    final String DISABLE = "Disable";
81 81

  
82
    protected Button activateRankButton;
82
    protected Combo activateRankCombo;
83 83
    protected Button allowOverrideRankButton;
84
    final String SHOW_RANK = "Show Rank";
85
    final String NO_RANK = "No Rank";
84 86

  
85 87
    protected CdmPreference areaVocPref = null;
86 88
    protected CdmPreference statusPref = null;
87
    private CommandHandlerButton button_openSelectAreas;
89
    private CommandHandlerButton button_openSelectAreaVocabularies;
90

  
88 91
    private CommandHandlerButton button_openStatusWizard;
89 92

  
90 93
    @Override
......
92 95
        getValues();
93 96
        Composite composite = new Composite(parent, SWT.NULL);
94 97
        composite.setLayout(new GridLayout());
95
        if(!isAdminPreference && !isEditorActivated && !isAllowOverride){
98
        if (!isAdminPreference && !distributionEditorPref.isAllowOverride()&& !isEditorActivated ) {
96 99
            Label label = new Label(composite, SWT.NONE);
97
            label.setText("The CDM settings don't allow to set the preferences for using the distribution editor locally. If you need to make local settings, please ask an administrator.");
100
            label.setText(
101
                    "The CDM settings don't allow to set the preferences for using the distribution editor locally. If you need to make local settings, please ask an administrator.");
98 102
            this.setDefaultButtonActivated(false);
99
         }else{
103
        } else {
100 104
            Composite activateComp = createComposite(composite);
101
            Label separator= new Label(activateComp, SWT.HORIZONTAL | SWT.SEPARATOR);
105
            Label separator = new Label(activateComp, SWT.HORIZONTAL | SWT.SEPARATOR);
102 106
            GridData sepGrid = createTextGridData();
103 107
            separator.setLayoutData(sepGrid);
104 108
            separator.setVisible(false);
105
            activateCombo = new Combo(activateComp, SWT.BORDER| SWT.READ_ONLY);
106
            CdmPreference dbPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated);
107
            if (dbPref != null){
108
                if (Boolean.valueOf(dbPref.getValue())){
109
                    activateCombo.add("Enable (default)");
110
                    activateCombo.add("Disable");
111
                }else{
112
                    activateCombo.add("Enable");
113
                    activateCombo.add("Disable (default)");
114
                }
115
            }else{
116
                boolean defaultValue = (Boolean)PreferencePredicate.DistributionEditorActivated.getDefaultValue();
117
                if (defaultValue){
118
                    activateCombo.add("Enable (default)");
119
                    activateCombo.add("Disable");
120
                }else{
121
                    activateCombo.add("Enable");
122
                    activateCombo.add("Disable (default)");
123
                }
124
            }
109
            CdmPreference dbPref;
110
            GridData textGrid = createTextGridData();
111
            textGrid.verticalSpan = 2;
112
            separator.setLayoutData(sepGrid);
125 113

  
126
            if (isEditorActivated){
114
            activateCombo = createBooleanCombo(activateComp, ENABLE, DISABLE, PreferencePredicate.DistributionEditorActivated, Messages.ChecklistEditorGeneralPreference_enable, isAdminPreference);
115
            if (isEditorActivated) {
127 116
                activateCombo.select(0);
128
            }else{
117
            } else {
129 118
                activateCombo.select(1);
130 119
            }
131 120

  
132

  
133 121
            activateCombo.addSelectionListener(this);
134
//            allowOverrideActivatedButton = createAllowOverrideButton(activateComp);
135
//            if (isAdminPreference){
136
//                allowOverrideActivatedButton.setSelection(allowOverrideActivated);
137
//                allowOverrideActivatedButton.addSelectionListener(new SelectionAdapter(){
138
//                    @Override
139
//                    public void widgetSelected(SelectionEvent e) {
140
//                        setApply(true);
141
//                        allowOverrideActivated = allowOverrideActivatedButton.getSelection();
142
//                    }
143
//                });
144
//            }else{
145
//                allowOverrideActivatedButton.setSelection(overrideActivated);
146
//                allowOverrideActivatedButton.addSelectionListener(new SelectionAdapter(){
147
//                    @Override
148
//                    public void widgetSelected(SelectionEvent e) {
149
//                        setApply(true);
150
//                        overrideActivated = allowOverrideActivatedButton.getSelection();
151
//                    }
152
//                });
153
//            }
154

  
155

  
156
            child  = createComposite(composite);
157

  
158
            if(!isAdminPreference){
159
               child.setEnabled(isEditorActivated);
160
            }
161
            separator= new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
162
            sepGrid = createTextGridData();
163

  
164
            GridData textGrid = createTextGridData();
165
            textGrid.verticalSpan = 2;
166
            separator.setLayoutData(sepGrid);
167

  
168

  
169
            activateRankButton = new Button(child, SWT.CHECK);
170
            activateRankButton.setText(Messages.ChecklistEditorGeneralPreference_show_rank);
171
            activateRankButton.setSelection(isShowRank);
172
            activateRankButton.addSelectionListener(new SelectionAdapter(){
173
                @Override
174
                public void widgetSelected(SelectionEvent e) {
175
                    setApply(true);
176
                    isShowRank = activateRankButton.getSelection();
177
                }
178
            });
179
            allowOverrideRankButton = createAllowOverrideButton(child);
180
            if (isAdminPreference){
181
                allowOverrideRankButton.setSelection(allowOverrideRank);
182
                allowOverrideRankButton.addSelectionListener(new SelectionAdapter(){
122
            if (isAdminPreference) {
123
                allowOverrideActivatedButton = createAllowOverrideButton(activateComp);
124
                allowOverrideActivatedButton.setSelection(this.distributionEditorPref.isAllowOverride());
125
                allowOverrideActivatedButton.addSelectionListener(new SelectionAdapter() {
183 126
                    @Override
184 127
                    public void widgetSelected(SelectionEvent e) {
185 128
                        setApply(true);
186
                        allowOverrideRank = allowOverrideRankButton.getSelection();
129
                        distributionEditorPref.setAllowOverride(!distributionEditorPref.isAllowOverride());
187 130
                    }
188 131
                });
189
            }else{
190
                allowOverrideRankButton.setSelection(overrideRank);
191
                allowOverrideRankButton.addSelectionListener(new SelectionAdapter(){
132
            }
133
            child = createComposite(composite);
134

  
135
            if (!isAdminPreference) {
136
                child.setEnabled(isEditorActivated);
137
            }
138
            separator = new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
139
            sepGrid = createTextGridData();
140
            separator.setLayoutData(sepGrid);
141

  
142
            activateRankCombo = createBooleanCombo(child, SHOW_RANK, NO_RANK,
143
                    PreferencePredicate.ShowRankInDistributionEditor, Messages.ChecklistEditorGeneralPreference_show_rank, isAdminPreference);
144

  
145
            if (isShowRank) {
146
                activateRankCombo.select(0);
147
            } else {
148
                activateRankCombo.select(1);
149
            }
150
            activateRankCombo.addSelectionListener(this);
151
            if (isAdminPreference) {
152
                allowOverrideRankButton = createAllowOverrideButton(child);
153
                allowOverrideRankButton.setSelection(prefRank.isAllowOverride());
154
                allowOverrideRankButton.addSelectionListener(new SelectionAdapter() {
192 155
                    @Override
193 156
                    public void widgetSelected(SelectionEvent e) {
194 157
                        setApply(true);
195
                        overrideRank = !overrideRank;
158
                        prefRank.setAllowOverride(allowOverrideRankButton.getSelection());
196 159
                    }
197 160
                });
198

  
199 161
            }
200 162

  
201
            final CLabel areaOrderLabel = new CLabel(child, SWT.NULL);
202
            areaOrderLabel.setText(Messages.ChecklistEditorGeneralPreference_Configure_area_order);
203
            areaOrderLabel.setLayoutData(textGrid);
204

  
205

  
206 163
            GridData gridData = new GridData();
207 164
            gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
208
            areaOrderSelectionCombo = new Combo(child, SWT.BORDER| SWT.READ_ONLY);
209
            areaOrderSelectionCombo.setLayoutData(gridData);
210 165

  
211
            for(TermOrder display: TermOrder.values()){
212
                areaOrderSelectionCombo.add(display.getLabel());
213
            }
166
            areaOrderSelectionCombo = createCombo(child, TermOrder.values(), PreferencePredicate.AreasSortedInDistributionEditor, Messages.ChecklistEditorGeneralPreference_Configure_area_order, isAdminPreference);
167

  
214 168
            int index = 0;
215
            if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null){
216
                TermOrder areaOrder;
217
                try{
218
                    if (orderAreas != null){
219
                        areaOrder  = TermOrder.valueOf(orderAreas);
220
                    }else{
169
            TermOrder areaOrder;
170
                try {
171
                    if (orderAreas != null) {
172
                        areaOrder = TermOrder.valueOf(orderAreas);
173
                    } else {
221 174
                        areaOrder = TermOrder.IdInVoc;
222 175
                    }
223
                }catch(IllegalArgumentException e){
176
                } catch (IllegalArgumentException e) {
224 177
                    areaOrder = TermOrder.IdInVoc;
225 178
                }
226
                for (String itemLabel : areaOrderSelectionCombo.getItems()){
227
                    if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())){
179
                for (String itemLabel : areaOrderSelectionCombo.getItems()) {
180
                    if (itemLabel.startsWith(areaOrder.getLabel())) {
228 181
                        areaOrderSelectionCombo.select(index);
229 182
                        break;
230 183
                    }
231 184
                    index++;
232 185
                }
233
            }
234
            areaOrderSelectionCombo.addSelectionListener(this);
235

  
236 186

  
187
            areaOrderSelectionCombo.addSelectionListener(this);
237 188

  
238
//            final Button sortNamedAreaByVocabularyOrder = new Button(child, SWT.CHECK);
239
//            sortNamedAreaByVocabularyOrder.setText(Messages.ChecklistEditorGeneralPreference_sort_areas);
240
//            sortNamedAreaByVocabularyOrder.setSelection(isSortByVocabularyOrder);
241
//            sortNamedAreaByVocabularyOrder.addSelectionListener(new SelectionAdapter(){
242
//                @Override
243
//                public void widgetSelected(SelectionEvent e) {
244
//                    setApply(true);
245
//                    isSortByVocabularyOrder = sortNamedAreaByVocabularyOrder.getSelection();
246
//                 }
247
//            });
248
            allowOverrideOrderAreasButton = createAllowOverrideButton(child);
249
            if (isAdminPreference){
250
                allowOverrideOrderAreasButton.setSelection(allowOverrideOrderAreas);
251
                allowOverrideOrderAreasButton.addSelectionListener(new SelectionAdapter(){
252
                    @Override
253
                    public void widgetSelected(SelectionEvent e) {
254
                        setApply(true);
255
                        allowOverrideOrderAreas = allowOverrideOrderAreasButton.getSelection();
256
                    }
257
                });
258
            }else{
259
                allowOverrideOrderAreasButton.setSelection(overrideOrderAreas);
260
                allowOverrideOrderAreasButton.addSelectionListener(new SelectionAdapter(){
189
            if (isAdminPreference) {
190
                allowOverrideOrderAreasButton = createAllowOverrideButton(child);
191
                allowOverrideOrderAreasButton.setSelection(prefAreaSort.isAllowOverride());
192
                allowOverrideOrderAreasButton.addSelectionListener(new SelectionAdapter() {
261 193
                    @Override
262 194
                    public void widgetSelected(SelectionEvent e) {
263 195
                        setApply(true);
264
                        overrideOrderAreas = allowOverrideOrderAreasButton.getSelection();
196
                        prefAreaSort.setAllowOverride(allowOverrideOrderAreasButton.getSelection());
265 197
                    }
266 198
                });
267

  
268 199
            }
269 200

  
270
//            final Button ownDescription = new Button(child, SWT.CHECK);
271
//            ownDescription.setText(Messages.ChecklistEditorGeneralPreference_own_Description);
272
//            ownDescription.setToolTipText(Messages.ChecklistEditorGeneralPreference_own_DescriptionToolTip);
273
//            ownDescription.setSelection(ownDescriptionForDistributionEditor);
274
//            ownDescription.addSelectionListener(new SelectionAdapter(){
275
//                @Override
276
//                public void widgetSelected(SelectionEvent e) {
277
//                    setApply(true);
278
//                    ownDescriptionForDistributionEditor = ownDescription.getSelection();
279
//                 }
280
//            });
281
//            Button allowOverrideDescription = createAllowOverrideButton(child);
282
//            if (isAdminPreference){
283
//                allowOverrideDescription.setSelection(allowOverrideOwnDescriptionForDistributionEditor);
284
//                allowOverrideDescription.addSelectionListener(new SelectionAdapter(){
285
//                    @Override
286
//                    public void widgetSelected(SelectionEvent e) {
287
//                        setApply(true);
288
//                        allowOverrideOwnDescriptionForDistributionEditor = allowOverrideDescription.getSelection();
289
//                    }
290
//                });
291
//            }else{
292
//                allowOverrideDescription.setSelection(overrideOwnDescriptionForDistributionEditor);
293
//                allowOverrideDescription.addSelectionListener(new SelectionAdapter(){
294
//                    @Override
295
//                    public void widgetSelected(SelectionEvent e) {
296
//                        setApply(true);
297
//                        overrideOwnDescriptionForDistributionEditor = allowOverrideDescription.getSelection();
298
//                    }
299
//                });
300
//                if (!allowOverrideOwnDescriptionForDistributionEditor){
301
//                    ownDescription.setEnabled(false);
302
//                    allowOverrideDescription.setEnabled(false);
303
//                }
304
//            }
305

  
306

  
307
            separator= new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
201
            separator = new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
308 202
            separator.setLayoutData(sepGrid);
203
            areaDisplaySelectionCombo = createCombo(child, TermDisplayEnum.values(), PreferencePredicate.DisplayOfAreasInDistributionEditor, Messages.ChecklistEditorGeneralPreference_Configure_display_of_Areas, isAdminPreference);
309 204

  
310
//
311

  
312
            final CLabel description = new CLabel(child, SWT.NULL);
313
            description.setText(Messages.ChecklistEditorGeneralPreference_Configure_display_of_Areas);
314
            description.setLayoutData(textGrid);
315

  
316

  
317
            //gridData.horizontalIndent = 5;
318

  
319

  
320
            areaDisplaySelectionCombo = new Combo(child, SWT.BORDER| SWT.READ_ONLY);
321
            areaDisplaySelectionCombo.setLayoutData(gridData);
322

  
323
            for(TermDisplayEnum display: TermDisplayEnum.values()){
324
                areaDisplaySelectionCombo.add(display.getLabel());
325
            }
326 205
            index = 0;
327
            if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null){
206
            if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null) {
328 207
                TermDisplayEnum areaDisplay;
329
                try{
330
                    if (displayArea != null){
331
                        areaDisplay  = TermDisplayEnum.byKey(displayArea);
332
                    }else{
208
                try {
209
                    if (displayArea != null) {
210
                        areaDisplay = TermDisplayEnum.byKey(displayArea);
211
                    } else {
333 212
                        areaDisplay = TermDisplayEnum.Title;
334 213
                    }
335
                }catch(IllegalArgumentException e){
214
                } catch (IllegalArgumentException e) {
336 215
                    areaDisplay = TermDisplayEnum.Title;
337 216
                }
338 217

  
339
                for (String itemLabel : areaDisplaySelectionCombo.getItems()){
340
                    if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())){
218
                for (String itemLabel : areaDisplaySelectionCombo.getItems()) {
219
                    if (itemLabel.startsWith(areaDisplay.getLabel())) {
341 220
                        areaDisplaySelectionCombo.select(index);
342 221
                        break;
343 222
                    }
......
345 224
                }
346 225
            }
347 226
            areaDisplaySelectionCombo.addSelectionListener(this);
348
            allowOverrideAreaDisplayButton = createAllowOverrideButton(child);
349
            if (isAdminPreference){
350
                allowOverrideAreaDisplayButton.setSelection(allowOverrideAreaDisplay);
351
                allowOverrideAreaDisplayButton.addSelectionListener(new SelectionAdapter(){
352
                    @Override
353
                    public void widgetSelected(SelectionEvent e) {
354
                        setApply(true);
355
                        allowOverrideAreaDisplay = allowOverrideAreaDisplayButton.getSelection();
356
                    }
357
                });
358
            }else{
359
                allowOverrideAreaDisplayButton.setSelection(overrideAreaDisplay);
360
                allowOverrideAreaDisplayButton.addSelectionListener(new SelectionAdapter(){
227

  
228
            if (isAdminPreference) {
229
                allowOverrideAreaDisplayButton = createAllowOverrideButton(child);
230
                allowOverrideAreaDisplayButton.setSelection(prefAreaDisplay.isAllowOverride());
231
                allowOverrideAreaDisplayButton.addSelectionListener(new SelectionAdapter() {
361 232
                    @Override
362 233
                    public void widgetSelected(SelectionEvent e) {
363 234
                        setApply(true);
364
                        overrideAreaDisplay = allowOverrideAreaDisplayButton.getSelection();
235
                        prefAreaDisplay.setAllowOverride(allowOverrideOrderAreasButton.getSelection());
365 236
                    }
366 237
                });
367
                if (!allowOverrideAreaDisplay){
368
                    areaDisplaySelectionCombo.setEnabled(false);
369
                    allowOverrideAreaDisplayButton.setEnabled(false);
370
                }
371 238
            }
372 239

  
373
            final CLabel descriptionStatus = new CLabel(child, SWT.NULL);
374
            descriptionStatus.setText(Messages.ChecklistEditorGeneralPreference_Configure_display_of_Status);
375
            descriptionStatus.setLayoutData(textGrid);
240
            statusDisplaySelectionCombo = createCombo(child, TermDisplayEnum.values(), PreferencePredicate.DisplayOfStatus, Messages.ChecklistEditorGeneralPreference_Configure_display_of_Status, isAdminPreference);
376 241

  
377

  
378

  
379
            statusDisplaySelectionCombo = new Combo(child, SWT.BORDER| SWT.READ_ONLY);
380
            statusDisplaySelectionCombo.setLayoutData(gridData);
381

  
382
            for(TermDisplayEnum display: TermDisplayEnum.values()){
383
                statusDisplaySelectionCombo.add(display.getLabel());
384
            }
385 242
            index = 0;
386
            if (displayStatus != null){
387
                TermDisplayEnum statusDisplay = TermDisplayEnum.byKey(displayStatus);
388
                for (String itemLabel : statusDisplaySelectionCombo.getItems()){
389
                    if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())){
243
            if (displayStatus != null) {
244
                TermDisplayEnum statusDisplay;
245
                try {
246
                    statusDisplay = TermDisplayEnum.byKey(displayStatus);
247
                } catch (IllegalArgumentException e) {
248
                    statusDisplay = TermDisplayEnum.Title;
249
                }
250
                for (String itemLabel : statusDisplaySelectionCombo.getItems()) {
251
                    if (itemLabel.startsWith(statusDisplay.getLabel())) {
390 252
                        statusDisplaySelectionCombo.select(index);
391 253
                        break;
392 254
                    }
......
395 257
            }
396 258

  
397 259
            statusDisplaySelectionCombo.addSelectionListener(this);
398
            allowOverrideStatusDisplayButton = createAllowOverrideButton(child);
399
            if (isAdminPreference){
400
                allowOverrideStatusDisplayButton.setSelection(allowOverrideStatusDisplay);
401
                allowOverrideStatusDisplayButton.addSelectionListener(new SelectionAdapter(){
402
                    @Override
403
                    public void widgetSelected(SelectionEvent e) {
404
                        setApply(true);
405
                        allowOverrideStatusDisplay = allowOverrideStatusDisplayButton.getSelection();
406
                    }
407
                });
408
            }else{
409
                allowOverrideStatusDisplayButton.setSelection(overrideStatusDisplay);
410
                allowOverrideStatusDisplayButton.addSelectionListener(new SelectionAdapter(){
260

  
261
            if (isAdminPreference) {
262
                allowOverrideStatusDisplayButton = createAllowOverrideButton(child);
263
                allowOverrideStatusDisplayButton.setSelection(prefStatusDisplay.isAllowOverride());
264
                allowOverrideStatusDisplayButton.addSelectionListener(new SelectionAdapter() {
411 265
                    @Override
412 266
                    public void widgetSelected(SelectionEvent e) {
413 267
                        setApply(true);
414
                        overrideStatusDisplay = allowOverrideStatusDisplayButton.getSelection();
268
                        prefStatusDisplay.setAllowOverride(allowOverrideStatusDisplayButton.getSelection());
415 269
                    }
416 270
                });
417
                if (!allowOverrideStatusDisplay){
418
                    statusDisplaySelectionCombo.setEnabled(false);
419
                    allowOverrideStatusDisplayButton.setEnabled(false);
420
                }
421 271
            }
422 272

  
423

  
424 273
            final CLabel labelStatus = new CLabel(child, SWT.NULL);
425 274
            labelStatus.setText(Messages.DistributionAdminPreferences_SELECT_STATUS);
426 275
            labelStatus.setLayoutData(textGrid);
427 276

  
428
            button_openStatusWizard = new CommandHandlerButton(child, SWT.PUSH,
429
                    commandHandlerStringStatus);
277
            button_openStatusWizard = new CommandHandlerButton(child, SWT.PUSH, commandHandlerStringStatus);
430 278

  
431 279
            button_openStatusWizard.setText(Messages.Distribution_status_selection);
432 280
            button_openStatusWizard.addListener(SWT.Selection, new Listener() {
433 281
                @Override
434 282
                public void handleEvent(Event e) {
435
                  switch (e.type) {
436
                  case SWT.Selection:
437
                    setApply(true);
438
                    break;
439
                  }
283
                    switch (e.type) {
284
                    case SWT.Selection:
285
                        setApply(true);
286
                        break;
287
                    }
440 288
                }
441
              });
442

  
289
            });
443 290

  
444 291
            final CLabel label = new CLabel(child, SWT.NULL);
445 292
            label.setText(Messages.ChecklistEditorGeneralPreference_open_wizard);
446 293
            label.setLayoutData(textGrid);
447 294

  
448
            button_openSelectAreas = new CommandHandlerButton(child, SWT.PUSH,
449
                      commandHandlerString);
450
            button_openSelectAreas.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
451

  
452

  
295
            button_openSelectAreaVocabularies = new CommandHandlerButton(child, SWT.PUSH, commandHandlerString);
296
            button_openSelectAreaVocabularies
297
                    .setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
453 298

  
454

  
455
//            if(isEditorActivated){
456
//                child.setEnabled(true);
457
//            }else{
458
//                child.setEnabled(false);
459
//            }
460
            if (!isAdminPreference){
299
            if (!isAdminPreference) {
461 300
                PreferencesUtil.recursiveSetEnabled(child, isEditorActivated);
301
                if (distributionEditorPref != null && !distributionEditorPref.isAllowOverride()){
302
                    activateComp.setEnabled(false);
303
                }
462 304

  
463
                if (!allowOverrideAreaVoc){
464
                    button_openSelectAreas.setButtonEnabled(false);
465
                 }
466
                if (!allowOverrideStatus){
305
                if (prefAreaVoc != null && !prefAreaVoc.isAllowOverride()) {
306
                    button_openSelectAreaVocabularies.setButtonEnabled(false);
307
                }
308
                if (prefStatus != null && !prefStatus.isAllowOverride()) {
467 309
                    button_openStatusWizard.setButtonEnabled(false);
468 310
                }
469
                if (!allowOverrideRank){
470
                    activateRankButton.setEnabled(false);
471
                    allowOverrideRankButton.setEnabled(false);
311
                if (prefRank != null && !prefRank.isAllowOverride()) {
312
                    activateRankCombo.setEnabled(false);
472 313
                }
473
                if (!allowOverrideOrderAreas){
314
                if (prefAreaSort != null && !prefAreaSort.isAllowOverride()) {
474 315
                    areaOrderSelectionCombo.setEnabled(false);
475
                    allowOverrideOrderAreasButton.setEnabled(false);
316
                    //allowOverrideOrderAreasButton.setEnabled(false);
476 317
                }
477
                if (!allowOverrideAreaDisplay){
478

  
479
                    allowOverrideAreaDisplayButton.setEnabled(false);
318
                if (prefAreaDisplay != null && !prefAreaDisplay.isAllowOverride()) {
319
                    areaDisplaySelectionCombo.setEnabled(false);
480 320
                }
481
                if (!allowOverrideStatusDisplay){
482

  
483
                    allowOverrideStatusDisplayButton.setEnabled(false);
321
                if (prefStatusDisplay != null && !prefStatusDisplay.isAllowOverride()) {
322
                    statusDisplaySelectionCombo.setEnabled(false);
484 323
                }
485
             }
486
        }
487

  
324
            }
488 325

  
326
        }
489 327
        setValid(true);
490 328
        return composite;
491 329
    }
492 330

  
493

  
494

  
495

  
496

  
497

  
498

  
499

  
500

  
501 331
    @Override
502 332
    public boolean performOk() {
503
        if (isAllowOverride){
333
       // if (distributionEditorPref == null || this.distributionEditorPref.isAllowOverride()) {
504 334

  
505
            PreferencesUtil.setBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey(), isEditorActivated);
506
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()), overrideActivated);
335
            PreferencesUtil.setBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey(),
336
                    isEditorActivated);
337

  
338
            if (distributionEditorPref == null
339
                    || isEditorActivated != Boolean.parseBoolean(distributionEditorPref.getValue())) {
340
                PreferencesUtil.setBooleanValue(
341
                        PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()),
342
                        true);
343
            }
507 344
            PreferencesUtil.setSortNamedAreasInDistributionEditor(orderAreas);
508
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AreasSortedInDistributionEditor.getKey()), overrideOrderAreas);
345
            if (prefAreaSort == null || orderAreas != prefAreaSort.getValue()) {
346
                PreferencesUtil.setBooleanValue(
347
                        PreferencesUtil.prefOverrideKey(PreferencePredicate.AreasSortedInDistributionEditor.getKey()),
348
                        true);
349
            }
509 350
            PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
510
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()), overrideRank);
351
            if (prefRank == null || isShowRank != Boolean.parseBoolean(prefRank.getValue())) {
352
                PreferencesUtil.setBooleanValue(
353
                        PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()),
354
                        true);
355
            }
511 356
            PreferencesUtil.setDisplayStatusInChecklistEditor(displayStatus);
512
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatus.getKey()), overrideStatusDisplay);
513
            PreferencesUtil.setAreaDisplayInChecklistEditor(displayArea);
514
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()), overrideAreaDisplay);
515
            PreferencesUtil.setOwnDescriptionForChecklistEditor(ownDescriptionForDistributionEditor);
516
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()), overrideOwnDescriptionForDistributionEditor);
517

  
518
            if (statusPref != null){
519
                PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), "");
520
                //PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(), statusPref.getValue());
521
                PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()),true);
522

  
357
            if (prefStatusDisplay == null || displayStatus != prefStatusDisplay.getValue()) {
358
                PreferencesUtil.setBooleanValue(
359
                        PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatus.getKey()),
360
                        true);
523 361
            }
524
            if (areaVocPref != null){
525
                PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(), "");
526
                PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey()), true);
362
            PreferencesUtil.setAreaDisplayInChecklistEditor(displayArea);
363
            if (prefAreaDisplay == null || displayArea != prefAreaDisplay.getValue()) {
364
                PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(
365
                        PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()), overrideAreaDisplay);
527 366
            }
367
            PreferencesUtil.setOwnDescriptionForChecklistEditor(ownDescriptionForDistributionEditor);
368
            PreferencesUtil.setBooleanValue(
369
                    PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()),
370
                    true);
371

  
372
            // if (statusPref != null){
373
            // PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(),
374
            // "");
375
            // //PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionStatus.getKey(),
376
            // statusPref.getValue());
377
            // PreferencesUtil.setBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.AvailableDistributionStatus.getKey()),true);
378
            //
379
            // }
380
            // if (areaVocPref != null){
381
            // PreferencesUtil.setStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey(),
382
            // "");
383
            // PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey()),
384
            // true);
385
            // }
528 386
            PreferencesUtil.firePreferencesChanged(this.getClass());
529 387

  
530
        }
388
        //}
531 389
        return true;
532 390
    }
533 391

  
......
537 395
    @Override
538 396
    public void widgetSelected(SelectionEvent e) {
539 397
        setApply(true);
540
        if (e.getSource().equals(statusDisplaySelectionCombo)){
398
        if (e.getSource().equals(statusDisplaySelectionCombo)) {
541 399
            String text = statusDisplaySelectionCombo.getText();
542
            for (TermDisplayEnum display: TermDisplayEnum.values()){
543
                if (display.getLabel().equals(text)){
400
            for (TermDisplayEnum display : TermDisplayEnum.values()) {
401
                if (text.startsWith(display.getLabel())) {
544 402
                    displayStatus = display.getKey();
545 403
                    break;
546 404
                }
547 405
            }
548 406
        }
549
        if (e.getSource().equals(areaDisplaySelectionCombo)){
407
        if (e.getSource().equals(areaDisplaySelectionCombo)) {
550 408
            String text = areaDisplaySelectionCombo.getText();
551
            for (TermDisplayEnum display: TermDisplayEnum.values()){
552
                if (display.getLabel().equals(text)){
409
            for (TermDisplayEnum display : TermDisplayEnum.values()) {
410
                if (text.startsWith(display.getLabel())) {
553 411
                    displayArea = display.getKey();
554 412
                    break;
555 413
                }
556 414
            }
557 415
        }
558
        if (e.getSource().equals(areaOrderSelectionCombo)){
416
        if (e.getSource().equals(areaOrderSelectionCombo)) {
559 417
            String text = areaOrderSelectionCombo.getText();
560
            for (TermOrder display: TermOrder.values()){
561
                if (display.getLabel().equals(text)){
418
            for (TermOrder display : TermOrder.values()) {
419
                if (text.startsWith(display.getLabel())) {
562 420
                    orderAreas = display.getKey();
563 421
                    break;
564 422
                }
565 423
            }
566 424
        }
425
        if (e.getSource().equals(this.activateRankCombo)) {
426
            String text = activateRankCombo.getText();
427
            text = text.replace(" (Default)", "");
428
            if (text.equals(SHOW_RANK)){
429
                isShowRank = true;
430
            }else{
431
                isShowRank = false;
432
            }
433
        }
567 434

  
435
        if (e.getSource().equals(this.activateCombo)) {
436
            String text = activateCombo.getText();
437
            text = text.replace(" (Default)", "");
438
            if (text.equals(ENABLE)){
439
                isEditorActivated = true;
440
            }else{
441
                isEditorActivated = false;
442
            }
443
        }
444
        PreferencesUtil.recursiveSetEnabled(child, isEditorActivated);
568 445
    }
569 446

  
570 447
    /**
......
576 453

  
577 454
    }
578 455

  
579

  
580 456
    /**
581 457
     * {@inheritDoc}
582 458
     */
......
586 462
        setPreferenceStore(PreferencesUtil.getPreferenceStore());
587 463
        distributionEditorPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DistributionEditorActivated);
588 464

  
465
        if (distributionEditorPref != null) {
466
            // isAllowOverride = distributionEditorPref.isAllowOverride();
589 467

  
590
        if (distributionEditorPref != null){
591
            isAllowOverride = distributionEditorPref.isAllowOverride();
468
            if (distributionEditorPref.isAllowOverride() ) {
469
                isEditorActivated = PreferencesUtil
470
                        .getBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey(), true);
592 471

  
593
            if (isAllowOverride && PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()))){
594
                isEditorActivated = PreferencesUtil.getBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey());
595
                overrideActivated = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()));
596
            }else{
472
            } else {
597 473
                isEditorActivated = Boolean.valueOf(distributionEditorPref.getValue());
474

  
598 475
            }
599
        }else{
600
            isEditorActivated = PreferencesUtil.getBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey());
601
            isAllowOverride = true;
602
            overrideActivated = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()));
476
            overrideActivated = PreferencesUtil.getBooleanValue(
477
                    PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()), true);
478
        } else {
479
            isEditorActivated = PreferencesUtil
480
                    .getBooleanValue(PreferencePredicate.DistributionEditorActivated.getKey(), true);
481
            // isAllowOverride = true;
482
            overrideActivated = PreferencesUtil.getBooleanValue(
483
                    PreferencesUtil.prefOverrideKey(PreferencePredicate.DistributionEditorActivated.getKey()), true);
484
            distributionEditorPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DistributionEditorActivated, PreferencePredicate.DistributionEditorActivated.getDefaultValue() != null ?  PreferencePredicate.DistributionEditorActivated.getDefaultValue().toString(): null);
485
        }
486

  
487
        prefAreaVoc = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
488
        if (prefAreaVoc == null){
489
            prefAreaVoc = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue() != null ?  PreferencePredicate.AvailableDistributionAreaVocabularies.getDefaultValue().toString(): null);
603 490
        }
604 491

  
605
        CdmPreference prefStatus = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionAreaVocabularies);
606
        allowOverrideAreaVoc = prefStatus != null?prefStatus.isAllowOverride():true;
607 492

  
608 493
        prefStatus = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AvailableDistributionStatus);
609
        allowOverrideStatus = prefStatus != null?prefStatus.isAllowOverride():true;
494
        if (prefStatus == null){
495
            prefStatus = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, PreferencePredicate.AvailableDistributionStatus.getDefaultValue() != null ?  PreferencePredicate.AvailableDistributionStatus.getDefaultValue().toString(): null);
496
        }
610 497

  
611
        CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfAreasInDistributionEditor);
612
        if (pref != null){
613
            this.allowOverrideAreaDisplay = pref.isAllowOverride();
614
            if (allowOverrideAreaDisplay){
498

  
499
        prefAreaDisplay = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfAreasInDistributionEditor);
500
        if (prefAreaDisplay != null) {
501

  
502
            if (prefAreaDisplay.isAllowOverride()) {
615 503
                displayArea = PreferencesUtil.displayAreaInChecklistEditor();
616
                overrideAreaDisplay = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()));
617
            }else{
618
                displayArea = pref.getValue();
504
                overrideAreaDisplay = PreferencesUtil.getBooleanValue(PreferencesUtil
505
                        .prefOverrideKey(PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()), true);
506
            } else {
507
                displayArea = prefAreaDisplay.getValue();
619 508
            }
620
        }else{
621
            displayArea = PreferencesUtil.displayAreaInChecklistEditor();;
622
            this.allowOverrideAreaDisplay = true;
623
            overrideAreaDisplay = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()));
509
        } else {
510
            displayArea = PreferencesUtil.displayAreaInChecklistEditor();
511

  
512
            overrideAreaDisplay = PreferencesUtil.getBooleanValue(
513
                    PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()), true);
514
            prefAreaDisplay = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DisplayOfAreasInDistributionEditor, PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue() != null ?  PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue().toString(): null);
624 515
        }
625 516

  
626
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfStatus);
627
        if (pref != null){
628
            this.allowOverrideStatusDisplay = pref.isAllowOverride();
629
            if (allowOverrideStatusDisplay){
517
        prefStatusDisplay = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DisplayOfStatus);
518
        if (prefStatusDisplay != null) {
519

  
520
            if (prefStatusDisplay.isAllowOverride()) {
630 521
                displayStatus = PreferencesUtil.displayStatusInChecklistEditor();
631
                overrideStatusDisplay = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatus.getKey()));
632
            }else{
633
                this.displayStatus = pref.getValue();
522
                overrideStatusDisplay = PreferencesUtil
523
                        .getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatus.getKey()), true);
524
            } else {
525
                this.displayStatus = prefStatusDisplay.getValue();
634 526
            }
635
        }else{
527
        } else {
636 528
            displayStatus = PreferencesUtil.displayStatusInChecklistEditor();
637
            this.allowOverrideStatusDisplay = true;
638
            overrideStatusDisplay = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatus.getKey()));
529

  
530
            overrideStatusDisplay = PreferencesUtil
531
                    .getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.DisplayOfStatus.getKey()), true);
532
            prefStatusDisplay = CdmPreference.NewTaxEditorInstance(PreferencePredicate.DisplayOfStatus, PreferencePredicate.DisplayOfStatus.getDefaultValue() != null ?  PreferencePredicate.DisplayOfStatus.getDefaultValue().toString(): null);
639 533
        }
640 534

  
641
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AreasSortedInDistributionEditor);
642
        if (pref != null){
535
        prefAreaSort = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AreasSortedInDistributionEditor);
536
        if (prefAreaSort != null) {
643 537

  
644
            this.allowOverrideOrderAreas = pref.isAllowOverride();
645
            if (allowOverrideOrderAreas){
538
            if (prefAreaSort.isAllowOverride()) {
646 539
                orderAreas = PreferencesUtil.getSortNamedAreasInDistributionEditor();
647
                overrideOrderAreas = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AreasSortedInDistributionEditor.getKey()));
648
            }else{
649
                if (pref.getValue() != null){
650
                    orderAreas = pref.getValue().toString();
651
                }else{
652
                    orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
540
                overrideOrderAreas = PreferencesUtil.getBooleanValue(
541
                        PreferencesUtil.prefOverrideKey(PreferencePredicate.AreasSortedInDistributionEditor.getKey()), true);
542
            } else {
543
                if (prefAreaSort.getValue() != null) {
544
                    orderAreas = prefAreaSort.getValue().toString();
545
                } else {
546
                    orderAreas = ((TermOrder) PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue())
547
                            .getKey();
653 548
                }
654 549
            }
655
        }else{
550
        } else {
656 551
            orderAreas = PreferencesUtil.getSortNamedAreasInDistributionEditor();
657
            this.allowOverrideOrderAreas = true;
658
            overrideOrderAreas = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AreasSortedInDistributionEditor.getKey()));
552
            overrideOrderAreas = PreferencesUtil.getBooleanValue(
553
                    PreferencesUtil.prefOverrideKey(PreferencePredicate.AreasSortedInDistributionEditor.getKey()), true);
554
            prefAreaSort = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AreasSortedInDistributionEditor, PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue() != null ?  PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue().toString(): null);
659 555
        }
660 556

  
661
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowRankInDistributionEditor);
662
        if (pref != null){
663

  
664
            allowOverrideRank = pref.isAllowOverride();
665
            if (allowOverrideRank){
557
        prefRank = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowRankInDistributionEditor);
558
        if (prefRank != null) {
559
            if (prefRank.isAllowOverride()) {
666 560
                isShowRank = PreferencesUtil.isShowRankInChecklistEditor();
667
                overrideRank = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()));
668
            }else{
669
                this.isShowRank = Boolean.valueOf(pref.getValue().toString());
561
                overrideRank = PreferencesUtil.getBooleanValue(
562
                        PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()), true);
563
            } else {
564
                this.isShowRank = Boolean.valueOf(prefRank.getValue().toString());
670 565
            }
671
        }else{
566
        } else {
672 567
            isShowRank = PreferencesUtil.isShowRankInChecklistEditor();
673
            this.allowOverrideRank = true;
674
            overrideRank = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()));
568
            overrideRank = PreferencesUtil.getBooleanValue(
569
                    PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowRankInDistributionEditor.getKey()), true);
570
            prefRank = CdmPreference.NewTaxEditorInstance(PreferencePredicate.ShowRankInDistributionEditor, PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue() != null ?  PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString(): null);
675 571
        }
676 572

  
677
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.OwnDescriptionForDistributionEditor);
678
        if (pref != null){
679

  
680
            allowOverrideOwnDescriptionForDistributionEditor = pref.isAllowOverride();
681
            if (allowOverrideOwnDescriptionForDistributionEditor){
573
        prefOwnDescription = PreferencesUtil
574
                .getPreferenceFromDB(PreferencePredicate.OwnDescriptionForDistributionEditor);
575
        if (prefOwnDescription != null) {
576
            if (prefOwnDescription.isAllowOverride()) {
682 577
                ownDescriptionForDistributionEditor = PreferencesUtil.isOwnDescriptionForChecklistEditor();
683
            }else{
684
                ownDescriptionForDistributionEditor = Boolean.valueOf(pref.getValue().toString());
578
            } else {
579
                ownDescriptionForDistributionEditor = Boolean.valueOf(prefOwnDescription.getValue().toString());
685 580
            }
686
        }else{
581
        } else {
687 582
            ownDescriptionForDistributionEditor = PreferencesUtil.isShowRankInChecklistEditor();
688
            allowOverrideOwnDescriptionForDistributionEditor = true;
689
            overrideOwnDescriptionForDistributionEditor = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()));
583
            // allowOverrideOwnDescriptionForDistributionEditor = true;
584
            overrideOwnDescriptionForDistributionEditor = PreferencesUtil.getBooleanValue(
585
                    PreferencesUtil.prefOverrideKey(PreferencePredicate.OwnDescriptionForDistributionEditor.getKey()), true);
586
            prefOwnDescription = CdmPreference.NewTaxEditorInstance(PreferencePredicate.OwnDescriptionForDistributionEditor, PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue() != null ?  PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString(): null);
690 587
        }
691 588

  
692

  
693 589
        commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler";
694 590
        commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardHandler";
695

  
696

  
697 591
    }
698 592

  
699 593
    @Override
700 594
    protected void performDefaults() {
701
        isEditorActivated = (Boolean)PreferencePredicate.DistributionEditorActivated.getDefaultValue();
702
        if (isEditorActivated){
703
            activateCombo.select(0);
595
        if (isAdminPreference){
596
            isEditorActivated = (Boolean) PreferencePredicate.DistributionEditorActivated.getDefaultValue();
704 597
        }else{
598
            isEditorActivated = Boolean.parseBoolean(distributionEditorPref.getValue().toString());
599
        }
600
        if (isEditorActivated) {
601
            activateCombo.select(0);
602
        } else {
705 603
            activateCombo.select(1);
706 604
        }
707 605

  
708
        displayArea = ((TermDisplayEnum)PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue()).getKey();
606
        if (isAdminPreference){
607
            displayArea = ((TermDisplayEnum) PreferencePredicate.DisplayOfAreasInDistributionEditor.getDefaultValue())
608
                    .getKey();
609
        }else{
610
            displayArea = prefAreaDisplay.getValue().toString();
611
        }
612

  
709 613
        TermDisplayEnum areaDisplay;
710
        try{
711
            if (displayArea != null){
712
                areaDisplay  = TermDisplayEnum.byKey(displayArea);
713
            }else{
614
        try {
615
            if (displayArea != null) {
616
                areaDisplay = TermDisplayEnum.byKey(displayArea);
617
            } else {
714 618
                areaDisplay = TermDisplayEnum.Title;
715 619
            }
716
        }catch(IllegalArgumentException e){
620
        } catch (IllegalArgumentException e) {
717 621
            areaDisplay = TermDisplayEnum.Title;
718 622
        }
719 623
        int index = 0;
720
        for (String itemLabel : areaDisplaySelectionCombo.getItems()){
721
            if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())){
624
        for (String itemLabel : areaDisplaySelectionCombo.getItems()) {
625
            if (itemLabel.equalsIgnoreCase(areaDisplay.getLabel())) {
722 626
                areaDisplaySelectionCombo.select(index);
723 627
                break;
724 628
            }
725 629
            index++;
726 630
        }
727 631

  
728
        displayStatus = ((TermDisplayEnum)PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey();
632
        if (isAdminPreference){
633
            displayStatus = ((TermDisplayEnum) PreferencePredicate.DisplayOfStatus.getDefaultValue()).getKey();
634
        }else{
635
            displayStatus = prefStatusDisplay.getValue().toString();
636
        }
637

  
729 638
        TermDisplayEnum statusDisplay;
730
        try{
731
            if (displayStatus != null){
732
                statusDisplay  = TermDisplayEnum.byKey(displayStatus);
733
            }else{
639
        try {
640
            if (displayStatus != null) {
641
                statusDisplay = TermDisplayEnum.byKey(displayStatus);
642
            } else {
734 643
                statusDisplay = TermDisplayEnum.Title;
735 644
            }
736
        }catch(IllegalArgumentException e){
645
        } catch (IllegalArgumentException e) {
737 646
            statusDisplay = TermDisplayEnum.Title;
738 647
        }
739 648
        index = 0;
740
        for (String itemLabel : statusDisplaySelectionCombo.getItems()){
741
            if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())){
649
        for (String itemLabel : statusDisplaySelectionCombo.getItems()) {
650
            if (itemLabel.equalsIgnoreCase(statusDisplay.getLabel())) {
742 651
                statusDisplaySelectionCombo.select(index);
743 652
                break;
744 653
            }
745 654
            index++;
746 655
        }
656
        if (isAdminPreference){
657
            orderAreas = ((TermOrder) PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
658
        }else{
659
            orderAreas = prefAreaSort.getValue().toString();
660
        }
747 661

  
748

  
749

  
750
        orderAreas = ((TermOrder)PreferencePredicate.AreasSortedInDistributionEditor.getDefaultValue()).getKey();
751 662
        index = 0;
752
        if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null){
663
        if (PreferencesUtil.getStringValue(PreferencePredicate.DistributionEditorActivated.getKey()) != null) {
753 664
            TermOrder areaOrder;
754
            try{
755
                if (orderAreas != null){
756
                    areaOrder  = TermOrder.valueOf(orderAreas);
757
                }else{
665
            try {
666
                if (orderAreas != null) {
667
                    areaOrder = TermOrder.valueOf(orderAreas);
668
                } else {
758 669
                    areaOrder = TermOrder.IdInVoc;
759 670
                }
760
            }catch(IllegalArgumentException e){
671
            } catch (IllegalArgumentException e) {
761 672
                areaOrder = TermOrder.IdInVoc;
762 673
            }
763
            for (String itemLabel : areaOrderSelectionCombo.getItems()){
764
                if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())){
674
            for (String itemLabel : areaOrderSelectionCombo.getItems()) {
675
                if (itemLabel.equalsIgnoreCase(areaOrder.getLabel())) {
765 676
                    areaOrderSelectionCombo.select(index);
766 677
                    break;
767 678
                }
......
769 680
            }
770 681
        }
771 682

  
683
        if (isAdminPreference){
684
            isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString());
685
        }else{
686
            isShowRank = Boolean.parseBoolean(prefRank.getValue().toString());
687
        }
772 688

  
773
        isShowRank = Boolean.valueOf(PreferencePredicate.ShowRankInDistributionEditor.getDefaultValue().toString());
774
        activateRankButton.setSelection(isShowRank);
689
        if (isShowRank) {
690
            activateRankCombo.select(0);
691
        } else {
692
            activateRankCombo.select(1);
693
        }
775 694

  
776
        ownDescriptionForDistributionEditor = Boolean.valueOf(PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString());
695
        ownDescriptionForDistributionEditor = Boolean
696
                .valueOf(PreferencePredicate.OwnDescriptionForDistributionEditor.getDefaultValue().toString());
777 697

  
778
        allowOverrideActivated = true;
779
      //  allowOverrideActivatedButton.setSelection(allowOverrideActivated);
698
        allowOverrideActivatedButton.setSelection(true);
780 699
        overrideActivated = true;
781
        allowOverrideAreaDisplay = true;
700

  
782 701
        overrideAreaDisplay = true;
783
        allowOverrideAreaDisplayButton.setSelection(allowOverrideAreaDisplay);
784
        allowOverrideStatusDisplay = true;
702
        allowOverrideAreaDisplayButton.setSelection(true);
703

  
785 704
        overrideStatusDisplay = true;
786
        allowOverrideStatusDisplayButton.setSelection(allowOverrideStatusDisplay);
787
        allowOverrideOrderAreas = true;
705
        allowOverrideStatusDisplayButton.setSelection(true);
706

  
788 707
        overrideOrderAreas = true;
789
        allowOverrideOrderAreasButton.setSelection(allowOverrideOrderAreas);
790
        allowOverrideRank = true;
708
        allowOverrideOrderAreasButton.setSelection(true);
709

  
791 710
        overrideRank = true;
792
        allowOverrideRankButton.setSelection(allowOverrideRank);
793
        allowOverrideOwnDescriptionForDistributionEditor = true;
711
        allowOverrideRankButton.setSelection(true);
712

  
794 713
        overrideOwnDescriptionForDistributionEditor = true;
795 714

  
796 715
        this.statusPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionStatus, null);
797
        this.areaVocPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
798
        if (!isAdminPreference){
716
        this.areaVocPref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies,
717
                null);
718
        if (!isAdminPreference) {
799 719
            PreferencesUtil.recursiveSetEnabled(child, isEditorActivated);
800 720

  
801
            if (!allowOverrideAreaVoc){
802
                button_openSelectAreas.setButtonEnabled(false);
803
             }
804
            if (!allowOverrideStatus){
805
                button_openStatusWizard.setButtonEnabled(false);
806
            }
807
            if (!allowOverrideRank){
808
                activateRankButton.setEnabled(false);
809
                allowOverrideRankButton.setEnabled(false);
721
            if (!prefAreaVoc.isAllowOverride()) {
722
                button_openSelectAreaVocabularies.setButtonEnabled(false);
810 723
            }
811
            if (!allowOverrideOrderAreas){
812
                areaOrderSelectionCombo.setEnabled(false);
813
                allowOverrideOrderAreasButton.setEnabled(false);
814
            }
815
            if (!allowOverrideAreaDisplay){
816

  
817
                allowOverrideAreaDisplayButton.setEnabled(false);
724
            if (!prefStatus.isAllowOverride()) {
725
                button_openStatusWizard.setButtonEnabled(false);
818 726
            }
819
            if (!allowOverrideStatusDisplay){
727
            if (!prefRank.isAllowOverride()) {
728
                activateRankCombo.setEnabled(false);
820 729

  
821
                allowOverrideStatusDisplayButton.setEnabled(false);
730
                if (!prefAreaSort.isAllowOverride()) {
731
                    areaOrderSelectionCombo.setEnabled(false);
732
                    allowOverrideOrderAreasButton.setEnabled(false);
733
                }
734
                if (!prefAreaDisplay.isAllowOverride()) {
735
                    allowOverrideAreaDisplayButton.setEnabled(false);
736
                }
737
                if (!prefStatusDisplay.isAllowOverride()) {
738
                    allowOverrideStatusDisplayButton.setEnabled(false);
739
                }
822 740
            }
823
         }
824
        super.performDefaults();
741
            super.performDefaults();
742
        }
825 743
    }
826 744

  
827

  
828 745
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/GeneralPreferencePage.java
11 11
import org.eclipse.swt.SWT;
12 12
import org.eclipse.swt.events.SelectionAdapter;
13 13
import org.eclipse.swt.events.SelectionEvent;
14
import org.eclipse.swt.events.SelectionListener;
14 15
import org.eclipse.swt.layout.GridData;
15 16
import org.eclipse.swt.widgets.Button;
17
import org.eclipse.swt.widgets.Combo;
16 18
import org.eclipse.swt.widgets.Composite;
17 19
import org.eclipse.swt.widgets.Control;
18 20
import org.eclipse.swt.widgets.Label;
19 21

  
20 22
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
23
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
21 24
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
25
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
22 26
import eu.etaxonomy.taxeditor.l10n.Messages;
23 27
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
24 28

  
......
27 31
 * @since 29.05.2018
28 32
 *
29 33
 */
30
public class GeneralPreferencePage extends CdmPreferencePage {
34
public class GeneralPreferencePage extends CdmPreferencePage implements SelectionListener{
31 35

  
32 36

  
33 37
    protected boolean isShowIOMenu;
......
43 47
    protected boolean isOverrideShowCheckListPerspective;
44 48
    protected boolean isOverrideShowTaxonNodeWizard;
45 49

  
46
    protected Button showIOMenuButton;
50
    protected Combo showIOMenuButton;
47 51
    protected Button allowOverrideShowIOMenuButton;
48
    protected Button showChecklistPerspectiveButton;
52
    protected Combo showChecklistPerspectiveButton;
49 53
    protected Button allowOverrideShowChecklistButton;
50
    protected Button showTaxonNodeWizardButton;
54
    protected Combo showTaxonNodeWizardButton;
51 55
    protected Button allowOverrideShowTaxonNodeWizardButton;
56
    final String SHOW = Messages.GeneralPreference_yes;
57
    final String DO_NOT_SHOW = Messages.GeneralPreference_no;
52 58
    /**
53 59
     * {@inheritDoc}
54 60
     */
......
62 68
        Label separator= new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
63 69
        separator.setLayoutData(gridData);
64 70
        separator.setVisible(false);
65
        showIOMenuButton = new Button(composite, SWT.CHECK);
66
        showIOMenuButton.setText(Messages.DatabasePreferncesPage_Show_IOMenu);
67
        showIOMenuButton.setSelection(isShowIOMenu);
68
        showIOMenuButton.addSelectionListener(new SelectionAdapter(){
69
             @Override
70
             public void widgetSelected(SelectionEvent e) {
71
                 isShowIOMenu = showIOMenuButton.getSelection();
72
                 setApply(true);
73
              }
74
         });
75
        allowOverrideShowIOMenuButton = createAllowOverrideButton(composite);
71

  
72
        showIOMenuButton = createBooleanCombo(composite, SHOW, DO_NOT_SHOW, PreferencePredicate.ShowImportExportMenu, "Show Export/Import Menu",
73
                isAdminPreference);
74

  
75
        showIOMenuButton.addSelectionListener(this);
76
        if (isShowIOMenu){
77
            showIOMenuButton.select(0);
78
        }else{
79
            showIOMenuButton.select(1);
80
        }
76 81
        if (isAdminPreference){
82
        allowOverrideShowIOMenuButton = createAllowOverrideButton(composite);
83

  
77 84
            allowOverrideShowIOMenuButton.setSelection(isAllowOverrideShowIOMenu);
78 85
            allowOverrideShowIOMenuButton.addSelectionListener(new SelectionAdapter(){
79 86
                @Override
......
82 89
                    setApply(true);
83 90
                }
84 91
            });
92
        }
93

  
94

  
95
        showChecklistPerspectiveButton = createBooleanCombo(composite, SHOW, DO_NOT_SHOW, PreferencePredicate.ShowChecklistPerspective, "Set Checklist Perspective as Default Perspective",
96
                isAdminPreference);
97

  
98
        showChecklistPerspectiveButton.addSelectionListener(this);
99
        if (isShowCheckListPerspective){
100
            showChecklistPerspectiveButton.select(0);
85 101
        }else{
86
            allowOverrideShowIOMenuButton.setSelection(isOverrideShowIOMenu);
87
            allowOverrideShowIOMenuButton.addSelectionListener(new SelectionAdapter(){
88
                @Override
89
                public void widgetSelected(SelectionEvent e) {
90
                    isOverrideShowIOMenu = allowOverrideShowIOMenuButton.getSelection();
91
                    setApply(true);
92
                }
93
            });
94
            if (!isAllowOverrideShowIOMenu){
95
                showIOMenuButton.setEnabled(false);
96
                allowOverrideShowIOMenuButton.setEnabled(false);
97
            }
102
            showChecklistPerspectiveButton.select(1);
98 103
        }
99 104

  
100
//        final Button showMediaViewButton = new Button(composite, SWT.CHECK);
101
//        showMediaViewButton.setText(Messages.DatabasePreferncesPage_Show_MediaView);
102
//        showMediaViewButton.setSelection(isShowMediaView);
103
//        showMediaViewButton.addSelectionListener(new SelectionAdapter(){
104
//             @Override
105
//             public void widgetSelected(SelectionEvent e) {
106
//                 isShowMediaView = showIOMenuButton.getSelection();
107
//              }
108
//         });
109
//
110
//        Button allowOverrideShowMediaViewButton = createAllowOverrideButton(composite);
111
//        if (isAdminPreference){
112
//            allowOverrideShowMediaViewButton.setSelection(isAllowOverrideShowMediaView);
113
//            allowOverrideShowMediaViewButton.addSelectionListener(new SelectionAdapter(){
114
//                @Override
115
//                public void widgetSelected(SelectionEvent e) {
116
//                    isAllowOverrideShowMediaView = allowOverrideShowMediaViewButton.getSelection();
117
//                }
118
//            });
119
//        }else{
120
//            allowOverrideShowMediaViewButton.setSelection(isOverrideShowMediaView);
121
//            allowOverrideShowMediaViewButton.addSelectionListener(new SelectionAdapter(){
122
//                @Override
123
//                public void widgetSelected(SelectionEvent e) {
124
//                    isOverrideShowMediaView = allowOverrideShowMediaViewButton.getSelection();
125
//                }
126
//            });
127
//            if (!isAllowOverrideShowMediaView){
128
//                showMediaViewButton.setEnabled(false);
129
//                allowOverrideShowMediaViewButton.setEnabled(false);
130
//            }
131
//        }
132

  
133
        showChecklistPerspectiveButton = new Button(composite, SWT.CHECK);
134
        showChecklistPerspectiveButton.setText(Messages.DatabasePreferncesPage_Show_ChecklistPerspective);
135
        showChecklistPerspectiveButton.setSelection(isShowCheckListPerspective);
136
        showChecklistPerspectiveButton.addSelectionListener(new SelectionAdapter(){
137
             @Override
138
             public void widgetSelected(SelectionEvent e) {
139
                 isShowCheckListPerspective = showChecklistPerspectiveButton.getSelection();
140
                 setApply(true);
141
              }
142
         });
143

  
144
        allowOverrideShowChecklistButton = createAllowOverrideButton(composite);
145 105
        if (isAdminPreference){
106
            allowOverrideShowChecklistButton = createAllowOverrideButton(composite);
146 107
            allowOverrideShowChecklistButton.setSelection(isAllowOverrideShowCheckListPerspective);
147 108
            allowOverrideShowChecklistButton.addSelectionListener(new SelectionAdapter(){
148 109
                @Override
......
151 112
                    setApply(true);
152 113
                }
153 114
            });
154
        }else{
155
            allowOverrideShowChecklistButton.setSelection(isOverrideShowCheckListPerspective);
156
            allowOverrideShowChecklistButton.addSelectionListener(new SelectionAdapter(){
157
                @Override
158
                public void widgetSelected(SelectionEvent e) {
159
                    isOverrideShowCheckListPerspective = allowOverrideShowChecklistButton.getSelection();
160
                    setApply(true);
161
                }
162
            });
163
            if (!isAllowOverrideShowCheckListPerspective){
164
                showChecklistPerspectiveButton.setEnabled(false);
165
                allowOverrideShowChecklistButton.setEnabled(false);
166
            }
167 115
        }
168 116

  
169
        showTaxonNodeWizardButton = new Button(composite, SWT.CHECK);
117
        showTaxonNodeWizardButton = createBooleanCombo(composite, SHOW, DO_NOT_SHOW, PreferencePredicate.ShowTaxonNodeWizard, "Show Taxonnode Wizard",
118
                isAdminPreference);
119

  
120

  
170 121
        showTaxonNodeWizardButton.setText(Messages.DatabasePreferncesPage_Show_TaxonNodeWizard);
171
        showTaxonNodeWizardButton.setSelection(isShowTaxonNodeWizard);
172
        showTaxonNodeWizardButton.addSelectionListener(new SelectionAdapter(){
173
             @Override
174
             public void widgetSelected(SelectionEvent e) {
175
                 isShowTaxonNodeWizard = showTaxonNodeWizardButton.getSelection();
176
                 setApply(true);
177
              }
178
         });
179

  
180
        allowOverrideShowTaxonNodeWizardButton = createAllowOverrideButton(composite);
122
        if (isShowTaxonNodeWizard){
123
            showTaxonNodeWizardButton.select(0);
124
        }else{
125
            showTaxonNodeWizardButton.select(1);
126
        }
127

  
128
        showTaxonNodeWizardButton.addSelectionListener(this);
129

  
130

  
181 131
        if (isAdminPreference){
132
            allowOverrideShowTaxonNodeWizardButton = createAllowOverrideButton(composite);
182 133
            allowOverrideShowTaxonNodeWizardButton.setSelection(isAllowOverrideShowTaxonNodeWizard);
183 134
            allowOverrideShowTaxonNodeWizardButton.addSelectionListener(new SelectionAdapter(){
184 135
                @Override
......
187 138
                    setApply(true);
188 139
                }
189 140
            });
190
        }else{
191
            allowOverrideShowTaxonNodeWizardButton.setSelection(isOverrideShowTaxonNodeWizard);
192
            allowOverrideShowTaxonNodeWizardButton.addSelectionListener(new SelectionAdapter(){
193
                @Override
194
                public void widgetSelected(SelectionEvent e) {
195
                    isOverrideShowTaxonNodeWizard = allowOverrideShowTaxonNodeWizardButton.getSelection();
196
                    setApply(true);
197
                }
198
            });
141
        }
142
        if(!isAdminPreference){
143
            if (!isAllowOverrideShowIOMenu){
144
                showIOMenuButton.setEnabled(false);
145

  
146
            }
147
            if (!isAllowOverrideShowCheckListPerspective){
148
                showChecklistPerspectiveButton.setEnabled(false);
149

  
150
            }
199 151
            if (!isAllowOverrideShowTaxonNodeWizard){
200 152
                showTaxonNodeWizardButton.setEnabled(false);
201
                allowOverrideShowTaxonNodeWizardButton.setEnabled(false);
153

  
202 154
            }
203 155
        }
204 156

  
......
218 170
            PreferencesUtil.setBooleanValue(PreferencePredicate.ShowImportExportMenu.getKey(), isShowIOMenu);
219 171
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowImportExportMenu.getKey()), isOverrideShowIOMenu);
220 172
        }
221
//        if (isAllowOverrideShowMediaView){
222
//            PreferencesUtil.setBooleanValue(PreferencePredicate.ShowMediaView.getKey(), isShowMediaView);
223
//        }
173

  
224 174
        if (isAllowOverrideShowTaxonNodeWizard){
225 175
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowTaxonNodeWizard.getKey()), isOverrideShowTaxonNodeWizard);
226 176
            PreferencesUtil.setBooleanValue(PreferencePredicate.ShowTaxonNodeWizard.getKey(), isShowTaxonNodeWizard);
......
233 183
        isAdminPreference = false;
234 184

  
235 185
        CdmPreferenceCache cache = CdmPreferenceCache.instance();
236
        isShowIOMenu = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowImportExportMenu.getKey());
237
        isOverrideShowIOMenu = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowImportExportMenu.getKey()));
238
        CdmPreference pref = cache.get(PreferencePredicate.ShowImportExportMenu.getKey());
186
        isShowIOMenu = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowImportExportMenu.getKey(), true);
187
        isOverrideShowIOMenu = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowImportExportMenu.getKey()), true);
188
        PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowImportExportMenu);
189
        CdmPreference pref = cache.findBestMatching(key);
239 190
        if (pref != null){
240 191
            isAllowOverrideShowIOMenu = pref.isAllowOverride();
241 192
        }else{
242 193
            isAllowOverrideShowIOMenu = true;
243 194
        }
244
//        isShowMediaView = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowMediaView.getKey());
245
//        pref = cache.get(PreferencePredicate.ShowMediaView.getKey());
246
//        if (pref != null){
247
//            isAllowOverrideShowMediaView = pref.isAllowOverride();
248
//        }else{
249
//            isAllowOverrideShowMediaView = true;
250
//        }
251
        isShowCheckListPerspective = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowChecklistPerspective.getKey());
252
        isOverrideShowCheckListPerspective = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowChecklistPerspective.getKey()));
253
        pref = cache.get(PreferencePredicate.ShowChecklistPerspective.getKey());
195

  
196
        isShowCheckListPerspective = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowChecklistPerspective.getKey(), true);
197
        isOverrideShowCheckListPerspective = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowChecklistPerspective.getKey()), true);
198
        key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.ShowChecklistPerspective);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)