Project

General

Profile

« Previous | Next » 

Revision 12d75812

Added by Katja Luther over 3 years ago

ref #7849: remove OVERRIDE constants from IPreferenceKeys and handle it by method

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java
1
/**
2
* Copyright (C) 2016 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.wizard;
10

  
11
import java.util.List;
12

  
13
import org.eclipse.jface.preference.IPreferenceStore;
14
import org.eclipse.jface.wizard.IWizard;
15
import org.eclipse.jface.wizard.IWizardPage;
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.events.SelectionAdapter;
18
import org.eclipse.swt.events.SelectionEvent;
19
import org.eclipse.swt.layout.GridData;
20
import org.eclipse.swt.layout.GridLayout;
21
import org.eclipse.swt.widgets.Button;
22
import org.eclipse.swt.widgets.Combo;
23
import org.eclipse.swt.widgets.Composite;
24
import org.eclipse.swt.widgets.Label;
25

  
26
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
27
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
28
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
29
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
30
import eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.ListComponent;
31
import eu.etaxonomy.taxeditor.l10n.Messages;
32
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
33
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
34
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
35
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
36

  
37
/**
38
 * @author k.luther
39
 * @date 01.11.2016
40
 *
41
 */
42
public class DatabasePreferencesPage extends AbstractPreferenceWizard implements IWizardPage{
43

  
44
    CdmPreference preferedNomenclaturalCode;
45
    NameDetailsConfigurator config ;
46
    CdmPreference isRedListPreference;
47
    CdmPreference determinationOnlyForFieldUnitsPreference;
48
    CdmPreference showCollectingAreaInGeneralSectionPreference;
49
    CdmPreference showTaxonAssociationsPreference;
50
    CdmPreference setPublishFlagAsDefault;
51

  
52
    boolean isSimpleDetailsViewActivated;
53

  
54
    Composite child ;
55
    NameDetailsViewComposite nameDetailsConfig;
56
    protected NameDetailsViewComposite getNameDetailsConfig() {
57
        return nameDetailsConfig;
58
    }
59

  
60
    String selectedPreferenceKey = null;
61

  
62
    ListComponent biocaseProviderList;
63
    Abcd206ImportConfigurator abcdImportConfigurator;
64

  
65
    String[][] labelAndValues;
66

  
67
    /*
68
     *
69
     */
70
    public DatabasePreferencesPage(String pageName) {
71
        super(pageName);
72
        this.preferedNomenclaturalCode = PreferencesUtil.setPreferredNomenclaturalCode(null, false);
73
        this.config = PreferencesUtil.getPreferredNameDetailsConfiguration( false);
74
        if (config == null){
75
            config = new NameDetailsConfigurator(false);
76
        }
77

  
78

  
79
    }
80

  
81

  
82
    protected IPreferenceStore doGetPreferenceStore() {
83
        return PreferencesUtil.getPreferenceStore();
84
    }
85

  
86
    /**
87
     * @return
88
     */
89
    private String[][] getLabelAndValues() {
90
        List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
91
                .getSupportedCodes();
92
        labelAndValues = new String[supportedCodes.size()][2];
93
        for (int i = 0; i < supportedCodes.size(); i++) {
94
            labelAndValues[i][0] = NomenclaturalCodeHelper
95
                    .getDescription(supportedCodes.get(i));
96
            labelAndValues[i][1] = PreferencesUtil
97
                    .getPreferenceKey(supportedCodes.get(i));
98
        }
99
        return labelAndValues;
100
    }
101

  
102

  
103

  
104

  
105
    public void createNomenclaturalCodeTab(Composite parent){
106

  
107
        Combo nomenclaturalCodeCombo;
108
        Label nomenclaturalCodeLabel;
109

  
110
        composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
111
        nomenclaturalCodeCombo = new Combo(composite, SWT.DROP_DOWN);
112

  
113
        List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
114
              .getSupportedCodes();
115
        for (NomenclaturalCode code: supportedCodes) {
116
           nomenclaturalCodeCombo.add(NomenclaturalCodeHelper
117
                   .getDescription(code));
118

  
119
       }
120
       nomenclaturalCodeCombo.select(0);
121
       getLabelAndValues();
122
       //get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
123
       nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() {
124
           @Override
125
        public void widgetSelected(SelectionEvent evt) {
126

  
127
               String name = nomenclaturalCodeCombo.getText();
128

  
129
               for (String[] labelAndValue: labelAndValues){
130
                   if (labelAndValue[0].equals(name)){
131
                       selectedPreferenceKey = labelAndValue[1];
132
                   }
133
               }
134

  
135

  
136
               PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY, selectedPreferenceKey);
137

  
138
           }
139
       });
140
       nomenclaturalCodeLabel = new Label(composite, SWT.READ_ONLY);
141

  
142

  
143
        final Button useLocalPreference = new Button(composite, SWT.CHECK);
144
        boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
145
        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
146
        useLocalPreference.setSelection(isUseLocalPreference);
147
        useLocalPreference.addSelectionListener(new SelectionAdapter(){
148
             @Override
149
             public void widgetSelected(SelectionEvent e) {
150
                 boolean isUseLocalPreference = useLocalPreference.getSelection();
151
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, isUseLocalPreference);
152
              }
153
         });
154

  
155

  
156

  
157

  
158
    }
159
    public void createSetPublishFlagTab(Composite parent){
160
        composite = addTab(Messages.DatabasePreferencesPage_SetPublishFlag);
161
        GridLayout gridLayout = new GridLayout();
162
        gridLayout.numColumns = 2;
163
        composite.setLayout(gridLayout);
164
        //radio buttons for set publish as default, set not publish as default and inherit from parent
165

  
166
    }
167

  
168

  
169
    public void createBiocaseProviderTab(Composite parent){
170
        composite = addTab(Messages.DatabasePreferencesPage_Biocase_Provider);
171
        GridLayout gridLayout = new GridLayout();
172
        gridLayout.numColumns = 2;
173
        composite.setLayout(gridLayout);
174
        biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE);
175

  
176
    }
177

  
178
    public ListComponent getBiocaseProviderList() {
179
        return biocaseProviderList;
180
    }
181

  
182
    public void createNameDetailsViewConfigurationTab(Composite parent, NameDetailsConfigurator config){
183
    	composite = parent;
184
        composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration);
185
        GridLayout gridLayout = new GridLayout();
186
        gridLayout.numColumns = 1;
187

  
188
        composite.setLayout(gridLayout);
189
        nameDetailsConfig = new NameDetailsViewComposite(composite, SWT.SCROLL_LINE, config);
190

  
191

  
192
    }
193

  
194

  
195
    public void createSpecimenOrObservationTab(Composite parent){
196
       composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation);
197

  
198
        final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
199
        CdmPreference isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
200
        if (isShowCollectingAreaInGeneralSection == null){
201
            isShowCollectingAreaInGeneralSection = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(false));
202
        }
203
        showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
204

  
205
        showCollectingAreaInGeneralSectionButton.setSelection(Boolean.valueOf(isShowCollectingAreaInGeneralSection.getValue()));
206
        showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){
207
             @Override
208
             public void widgetSelected(SelectionEvent e) {
209
                 boolean isShowCollectingAreaInGeneralSection = showCollectingAreaInGeneralSectionButton.getSelection();
210
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION, isShowCollectingAreaInGeneralSection);
211
              }
212
         });
213

  
214
        final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
215
//        boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
216
        CdmPreference isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
217
        if (isDeterminationOnlyForFieldUnits == null){
218
            isDeterminationOnlyForFieldUnits = CdmPreference.NewDatabaseInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(false));
219
        }
220
        determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits);
221

  
222
        determinationOnlyForFieldUnitsButton.setSelection(Boolean.valueOf(isDeterminationOnlyForFieldUnits.getValue()));
223
        determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){
224
             @Override
225
             public void widgetSelected(SelectionEvent e) {
226
                 boolean isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection();
227
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS, isDeterminationOnlyForFieldUnits);
228
              }
229
         });
230

  
231
        final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
232
        CdmPreference isShowTaxonAssociation = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
233
        if (isShowTaxonAssociation == null){
234
            isShowTaxonAssociation = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(false));
235
        }
236
        showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations);
237

  
238
        showTaxonAssociationButton.setSelection(Boolean.valueOf(isShowTaxonAssociation.getValue()));
239
        showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){
240
             @Override
241
             public void widgetSelected(SelectionEvent e) {
242
                 boolean isShowTaxonAssociation = showTaxonAssociationButton.getSelection();
243
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, isShowTaxonAssociation);
244
              }
245
         });
246

  
247
        final Button showLifeFormButton = new Button(composite, SWT.CHECK);
248
        CdmPreference  isShowLifeForm = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
249
        if (isShowLifeForm == null){
250
            isShowLifeForm = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(false));
251
        }
252

  
253
        showLifeFormButton.setText(Messages.DatabasePreferncesPage_Life_Form);
254
        showLifeFormButton.setSelection(Boolean.valueOf(isShowLifeForm.getValue()));
255
        showLifeFormButton.addSelectionListener(new SelectionAdapter(){
256
             @Override
257
             public void widgetSelected(SelectionEvent e) {
258
                 boolean isShowLifeForm = showLifeFormButton.getSelection();
259
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_LIFE_FORM, isShowLifeForm);
260
              }
261
         });
262

  
263
//        Composite useLocalComp = new Composite(composite, SWT.NONE);
264

  
265

  
266
        final Button useLocalPreference = new Button(composite, SWT.CHECK);
267
        boolean isUseLocalPreference = isShowTaxonAssociation.isAllowOverride();
268
        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
269
        GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, false, false);
270
        gridData.verticalIndent = 10;
271
        useLocalPreference.setLayoutData(gridData);
272

  
273
        useLocalPreference.setSelection(isUseLocalPreference);
274
        useLocalPreference.addSelectionListener(new SelectionAdapter(){
275
             @Override
276
             public void widgetSelected(SelectionEvent e) {
277
                 boolean isUseLocalPreference = useLocalPreference.getSelection();
278
               //  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF, isUseLocalPreference);
279
              }
280
         });
281

  
282

  
283

  
284
 }
285

  
286
/**
287
 * {@inheritDoc}
288
 */
289
@Override
290
public boolean canFlipToNextPage() {
291
    // TODO Auto-generated method stub
292
    return false;
293
}
294

  
295

  
296

  
297
/**
298
 * {@inheritDoc}
299
 */
300
@Override
301
public String getName() {
302
    // TODO Auto-generated method stub
303
    return null;
304
}
305

  
306

  
307

  
308
/**
309
 * {@inheritDoc}
310
 */
311
@Override
312
public IWizardPage getNextPage() {
313
    // TODO Auto-generated method stub
314
    return null;
315
}
316

  
317

  
318

  
319
/**
320
 * {@inheritDoc}
321
 */
322
@Override
323
public IWizardPage getPreviousPage() {
324
    // TODO Auto-generated method stub
325
    return null;
326
}
327

  
328

  
329

  
330
/**
331
 * {@inheritDoc}
332
 */
333
@Override
334
public IWizard getWizard() {
335
    // TODO Auto-generated method stub
336
    return null;
337
}
338

  
339

  
340

  
341
/**
342
 * {@inheritDoc}
343
 */
344
@Override
345
public boolean isPageComplete() {
346

  
347
    return true;
348
}
349

  
350

  
351

  
352
/**
353
 * {@inheritDoc}
354
 */
355
@Override
356
public void setPreviousPage(IWizardPage page) {
357
    // TODO Auto-generated method stub
358

  
359
}
360

  
361

  
362

  
363
/**
364
 * {@inheritDoc}
365
 */
366
@Override
367
public void setWizard(IWizard newWizard) {
368
    // TODO Auto-generated method stub
369

  
370
}
371

  
372
/**
373
 * {@inheritDoc}
374
 */
375
@Override
376
public void createControl(Composite parent) {
377
    createNameDetailsViewConfigurationTab(parent, config);
378
    createNomenclaturalCodeTab(parent);
379

  
380
    createSpecimenOrObservationTab(parent);
381
    createBiocaseProviderTab(parent);
382
    setControl(parent);
383
}
384

  
385
/**
386
 * @return
387
 */
388
public NameDetailsConfigurator getConfig() {
389
    return config;
390
}
391

  
392
/**
393
 *
394
 */
395
public Abcd206ImportConfigurator getAbcdImportConfig() {
396
    return abcdImportConfigurator;
397

  
398
}
399

  
400
/**
401
 * @return
402
 */
403
public void createAbcdImportConfig() {
404
    this.abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
405
    this.abcdImportConfigurator.setAddMediaAsMediaSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
406
    this.abcdImportConfigurator.setAllowReuseOtherClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
407
    //this.abcdImportConfigurator.setClassificationUuid(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID));
408
    this.abcdImportConfigurator.setDeduplicateClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
409
    this.abcdImportConfigurator.setDeduplicateReferences(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
410
   // this.abcdImportConfigurator.setDefaultAuthor(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR));
411
    this.abcdImportConfigurator.setGetSiblings(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
412
    this.abcdImportConfigurator.setIgnoreAuthorship(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
413
    this.abcdImportConfigurator.setIgnoreImportOfExistingSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
414
    this.abcdImportConfigurator.setMapUnitIdToAccessionNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
415
    this.abcdImportConfigurator.setMapUnitIdToBarcode(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
416
    this.abcdImportConfigurator.setMapUnitIdToCatalogNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
417
    this.abcdImportConfigurator.setMoveNewTaxaToDefaultClassification(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
418
    this.abcdImportConfigurator.setReuseExistingDescriptiveGroups(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
419
    this.abcdImportConfigurator.setReuseExistingTaxaWhenPossible(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
420

  
421
}
422

  
423

  
424

  
425

  
426

  
427

  
428

  
429
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage__.java
1
/**
2
* Copyright (C) 2016 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.wizard;
10

  
11
import java.util.List;
12

  
13
import org.eclipse.jface.preference.IPreferenceStore;
14
import org.eclipse.jface.wizard.IWizard;
15
import org.eclipse.jface.wizard.IWizardPage;
16
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.events.SelectionAdapter;
18
import org.eclipse.swt.events.SelectionEvent;
19
import org.eclipse.swt.layout.GridData;
20
import org.eclipse.swt.layout.GridLayout;
21
import org.eclipse.swt.widgets.Button;
22
import org.eclipse.swt.widgets.Combo;
23
import org.eclipse.swt.widgets.Composite;
24
import org.eclipse.swt.widgets.Label;
25

  
26
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator;
27
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
28
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
29
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
30
import eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.ListComponent;
31
import eu.etaxonomy.taxeditor.l10n.Messages;
32
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper;
33
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
34
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
35
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
36

  
37
/**
38
 * @author k.luther
39
 * @date 01.11.2016
40
 *
41
 */
42
public class DatabasePreferencesPage__ extends AbstractPreferenceWizard implements IWizardPage{
43

  
44
    CdmPreference preferedNomenclaturalCode;
45
    NameDetailsConfigurator config ;
46
    CdmPreference isRedListPreference;
47
    CdmPreference determinationOnlyForFieldUnitsPreference;
48
    CdmPreference showCollectingAreaInGeneralSectionPreference;
49
    CdmPreference showTaxonAssociationsPreference;
50
    CdmPreference setPublishFlagAsDefault;
51

  
52
    boolean isSimpleDetailsViewActivated;
53

  
54
    Composite child ;
55
    NameDetailsViewComposite nameDetailsConfig;
56
    protected NameDetailsViewComposite getNameDetailsConfig() {
57
        return nameDetailsConfig;
58
    }
59

  
60
    String selectedPreferenceKey = null;
61

  
62
    ListComponent biocaseProviderList;
63
    Abcd206ImportConfigurator abcdImportConfigurator;
64

  
65
    String[][] labelAndValues;
66

  
67
    /*
68
     *
69
     */
70
    public DatabasePreferencesPage__(String pageName) {
71
        super(pageName);
72
        this.preferedNomenclaturalCode = PreferencesUtil.setPreferredNomenclaturalCode(null, false);
73
        this.config = PreferencesUtil.getPreferredNameDetailsConfiguration( false);
74
        if (config == null){
75
            config = new NameDetailsConfigurator(false);
76
        }
77

  
78

  
79
    }
80

  
81

  
82
    protected IPreferenceStore doGetPreferenceStore() {
83
        return PreferencesUtil.getPreferenceStore();
84
    }
85

  
86
    /**
87
     * @return
88
     */
89
    private String[][] getLabelAndValues() {
90
        List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
91
                .getSupportedCodes();
92
        labelAndValues = new String[supportedCodes.size()][2];
93
        for (int i = 0; i < supportedCodes.size(); i++) {
94
            labelAndValues[i][0] = NomenclaturalCodeHelper
95
                    .getDescription(supportedCodes.get(i));
96
            labelAndValues[i][1] = PreferencesUtil
97
                    .getPreferenceKey(supportedCodes.get(i));
98
        }
99
        return labelAndValues;
100
    }
101

  
102

  
103

  
104

  
105
    public void createNomenclaturalCodeTab(Composite parent){
106

  
107
        Combo nomenclaturalCodeCombo;
108
        Label nomenclaturalCodeLabel;
109

  
110
        composite = addTab(Messages.DatabasePreferencesPage_Define_Default_NomenclaturalCode);
111
        nomenclaturalCodeCombo = new Combo(composite, SWT.DROP_DOWN);
112

  
113
        List<NomenclaturalCode> supportedCodes = NomenclaturalCodeHelper
114
              .getSupportedCodes();
115
        for (NomenclaturalCode code: supportedCodes) {
116
           nomenclaturalCodeCombo.add(NomenclaturalCodeHelper
117
                   .getDescription(code));
118

  
119
       }
120
       nomenclaturalCodeCombo.select(0);
121
       getLabelAndValues();
122
       //get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY);
123
       nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() {
124
           @Override
125
        public void widgetSelected(SelectionEvent evt) {
126

  
127
               String name = nomenclaturalCodeCombo.getText();
128

  
129
               for (String[] labelAndValue: labelAndValues){
130
                   if (labelAndValue[0].equals(name)){
131
                       selectedPreferenceKey = labelAndValue[1];
132
                   }
133
               }
134

  
135

  
136
               PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY, selectedPreferenceKey);
137

  
138
           }
139
       });
140
       nomenclaturalCodeLabel = new Label(composite, SWT.READ_ONLY);
141

  
142

  
143
//        final Button useLocalPreference = new Button(composite, SWT.CHECK);
144
//        boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
145
//        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
146
//        useLocalPreference.setSelection(isUseLocalPreference);
147
//        useLocalPreference.addSelectionListener(new SelectionAdapter(){
148
//             @Override
149
//             public void widgetSelected(SelectionEvent e) {
150
//                 boolean isUseLocalPreference = useLocalPreference.getSelection();
151
//                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY, isUseLocalPreference);
152
//              }
153
//         });
154

  
155

  
156

  
157

  
158
    }
159
    public void createSetPublishFlagTab(Composite parent){
160
        composite = addTab(Messages.DatabasePreferencesPage_SetPublishFlag);
161
        GridLayout gridLayout = new GridLayout();
162
        gridLayout.numColumns = 2;
163
        composite.setLayout(gridLayout);
164
        //radio buttons for set publish as default, set not publish as default and inherit from parent
165

  
166
    }
167

  
168

  
169
    public void createBiocaseProviderTab(Composite parent){
170
        composite = addTab(Messages.DatabasePreferencesPage_Biocase_Provider);
171
        GridLayout gridLayout = new GridLayout();
172
        gridLayout.numColumns = 2;
173
        composite.setLayout(gridLayout);
174
        biocaseProviderList = new ListComponent(composite, SWT.SCROLL_LINE);
175

  
176
    }
177

  
178
    public ListComponent getBiocaseProviderList() {
179
        return biocaseProviderList;
180
    }
181

  
182
    public void createNameDetailsViewConfigurationTab(Composite parent, NameDetailsConfigurator config){
183
    	composite = parent;
184
        composite = addTab(Messages.DatabasePreferencesPage_details_view_configuration);
185
        GridLayout gridLayout = new GridLayout();
186
        gridLayout.numColumns = 1;
187

  
188
        composite.setLayout(gridLayout);
189
        nameDetailsConfig = new NameDetailsViewComposite(composite, SWT.SCROLL_LINE, config);
190

  
191

  
192
    }
193

  
194

  
195
    public void createSpecimenOrObservationTab(Composite parent){
196
       composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation);
197

  
198
        final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK);
199
        CdmPreference isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection);
200
        if (isShowCollectingAreaInGeneralSection == null){
201
            isShowCollectingAreaInGeneralSection = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowCollectingAreasInGeneralSection, Boolean.toString(false));
202
        }
203
        showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section);
204

  
205
        showCollectingAreaInGeneralSectionButton.setSelection(Boolean.valueOf(isShowCollectingAreaInGeneralSection.getValue()));
206
        showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){
207
             @Override
208
             public void widgetSelected(SelectionEvent e) {
209
                 boolean isShowCollectingAreaInGeneralSection = showCollectingAreaInGeneralSectionButton.getSelection();
210
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION, isShowCollectingAreaInGeneralSection);
211
              }
212
         });
213

  
214
        final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK);
215
//        boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS);
216
        CdmPreference isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
217
        if (isDeterminationOnlyForFieldUnits == null){
218
            isDeterminationOnlyForFieldUnits = CdmPreference.NewDatabaseInstance(PreferencePredicate.DeterminationOnlyForFieldUnits, Boolean.toString(false));
219
        }
220
        determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits);
221

  
222
        determinationOnlyForFieldUnitsButton.setSelection(Boolean.valueOf(isDeterminationOnlyForFieldUnits.getValue()));
223
        determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){
224
             @Override
225
             public void widgetSelected(SelectionEvent e) {
226
                 boolean isDeterminationOnlyForFieldUnits = determinationOnlyForFieldUnitsButton.getSelection();
227
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS, isDeterminationOnlyForFieldUnits);
228
              }
229
         });
230

  
231
        final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK);
232
        CdmPreference isShowTaxonAssociation = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
233
        if (isShowTaxonAssociation == null){
234
            isShowTaxonAssociation = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowTaxonAssociations, Boolean.toString(false));
235
        }
236
        showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations);
237

  
238
        showTaxonAssociationButton.setSelection(Boolean.valueOf(isShowTaxonAssociation.getValue()));
239
        showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){
240
             @Override
241
             public void widgetSelected(SelectionEvent e) {
242
                 boolean isShowTaxonAssociation = showTaxonAssociationButton.getSelection();
243
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, isShowTaxonAssociation);
244
              }
245
         });
246

  
247
        final Button showLifeFormButton = new Button(composite, SWT.CHECK);
248
        CdmPreference  isShowLifeForm = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
249
        if (isShowLifeForm == null){
250
            isShowLifeForm = CdmPreference.NewDatabaseInstance(PreferencePredicate.ShowLifeForm, Boolean.toString(false));
251
        }
252

  
253
        showLifeFormButton.setText(Messages.DatabasePreferncesPage_Life_Form);
254
        showLifeFormButton.setSelection(Boolean.valueOf(isShowLifeForm.getValue()));
255
        showLifeFormButton.addSelectionListener(new SelectionAdapter(){
256
             @Override
257
             public void widgetSelected(SelectionEvent e) {
258
                 boolean isShowLifeForm = showLifeFormButton.getSelection();
259
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_LIFE_FORM, isShowLifeForm);
260
              }
261
         });
262

  
263
//        Composite useLocalComp = new Composite(composite, SWT.NONE);
264

  
265

  
266
        final Button useLocalPreference = new Button(composite, SWT.CHECK);
267
        boolean isUseLocalPreference = isShowTaxonAssociation.isAllowOverride();
268
        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
269
        GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, false, false);
270
        gridData.verticalIndent = 10;
271
        useLocalPreference.setLayoutData(gridData);
272

  
273
        useLocalPreference.setSelection(isUseLocalPreference);
274
        useLocalPreference.addSelectionListener(new SelectionAdapter(){
275
             @Override
276
             public void widgetSelected(SelectionEvent e) {
277
                 boolean isUseLocalPreference = useLocalPreference.getSelection();
278
               //  PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF, isUseLocalPreference);
279
              }
280
         });
281

  
282

  
283

  
284
 }
285

  
286
/**
287
 * {@inheritDoc}
288
 */
289
@Override
290
public boolean canFlipToNextPage() {
291
    // TODO Auto-generated method stub
292
    return false;
293
}
294

  
295

  
296

  
297
/**
298
 * {@inheritDoc}
299
 */
300
@Override
301
public String getName() {
302
    // TODO Auto-generated method stub
303
    return null;
304
}
305

  
306

  
307

  
308
/**
309
 * {@inheritDoc}
310
 */
311
@Override
312
public IWizardPage getNextPage() {
313
    // TODO Auto-generated method stub
314
    return null;
315
}
316

  
317

  
318

  
319
/**
320
 * {@inheritDoc}
321
 */
322
@Override
323
public IWizardPage getPreviousPage() {
324
    // TODO Auto-generated method stub
325
    return null;
326
}
327

  
328

  
329

  
330
/**
331
 * {@inheritDoc}
332
 */
333
@Override
334
public IWizard getWizard() {
335
    // TODO Auto-generated method stub
336
    return null;
337
}
338

  
339

  
340

  
341
/**
342
 * {@inheritDoc}
343
 */
344
@Override
345
public boolean isPageComplete() {
346

  
347
    return true;
348
}
349

  
350

  
351

  
352
/**
353
 * {@inheritDoc}
354
 */
355
@Override
356
public void setPreviousPage(IWizardPage page) {
357
    // TODO Auto-generated method stub
358

  
359
}
360

  
361

  
362

  
363
/**
364
 * {@inheritDoc}
365
 */
366
@Override
367
public void setWizard(IWizard newWizard) {
368
    // TODO Auto-generated method stub
369

  
370
}
371

  
372
/**
373
 * {@inheritDoc}
374
 */
375
@Override
376
public void createControl(Composite parent) {
377
    createNameDetailsViewConfigurationTab(parent, config);
378
    createNomenclaturalCodeTab(parent);
379

  
380
    createSpecimenOrObservationTab(parent);
381
    createBiocaseProviderTab(parent);
382
    setControl(parent);
383
}
384

  
385
/**
386
 * @return
387
 */
388
public NameDetailsConfigurator getConfig() {
389
    return config;
390
}
391

  
392
/**
393
 *
394
 */
395
public Abcd206ImportConfigurator getAbcdImportConfig() {
396
    return abcdImportConfigurator;
397

  
398
}
399

  
400
/**
401
 * @return
402
 */
403
public void createAbcdImportConfig() {
404
    this.abcdImportConfigurator.setAddIndividualsAssociationsSuchAsSpecimenAndObservations(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_INDIVIDUALS_ASSOCIATIONS_SUCH_AS_SPECIMEN_AND_OBSERVATIONS));
405
    this.abcdImportConfigurator.setAddMediaAsMediaSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ADD_MEDIA_AS_MEDIASPECIMEN));
406
    this.abcdImportConfigurator.setAllowReuseOtherClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_ALLOW_REUSE_OTHER_CLASSIFICATIONS));
407
    //this.abcdImportConfigurator.setClassificationUuid(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID));
408
    this.abcdImportConfigurator.setDeduplicateClassifications(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_CLASSIFICATIONS));
409
    this.abcdImportConfigurator.setDeduplicateReferences(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEDUPLICATE_REFERENCES));
410
   // this.abcdImportConfigurator.setDefaultAuthor(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR));
411
    this.abcdImportConfigurator.setGetSiblings(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_DO_SIBLINGS));
412
    this.abcdImportConfigurator.setIgnoreAuthorship(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_AUTHORSHIP));
413
    this.abcdImportConfigurator.setIgnoreImportOfExistingSpecimen(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_IGNORE_IMPORT_OF_EXISTING_SPECIMEN));
414
    this.abcdImportConfigurator.setMapUnitIdToAccessionNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_ACCESSION_NUMBER));
415
    this.abcdImportConfigurator.setMapUnitIdToBarcode(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TO_BARCODE));
416
    this.abcdImportConfigurator.setMapUnitIdToCatalogNumber(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MAP_UNIT_ID_TOCATALOG_NUMBER));
417
    this.abcdImportConfigurator.setMoveNewTaxaToDefaultClassification(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_MOVE_NEW_TAXA_TO_DEFAULT_CLASSIFICATION));
418
    this.abcdImportConfigurator.setReuseExistingDescriptiveGroups(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_DESCRIPTIVE_GROUPS));
419
    this.abcdImportConfigurator.setReuseExistingTaxaWhenPossible(doGetPreferenceStore().getBoolean(IPreferenceKeys.ABCD_IMPORT_CONFIGURATOR_REUSE_EXISTING_TAXA_WHEN_POSSIBLE));
420

  
421
}
422

  
423

  
424

  
425

  
426

  
427

  
428

  
429
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard.java
1
/**
2
* Copyright (C) 2016 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.wizard;
10

  
11
import org.eclipse.jface.wizard.IWizardPage;
12
import org.eclipse.jface.wizard.Wizard;
13

  
14
import eu.etaxonomy.cdm.api.application.ICdmRepository;
15
import eu.etaxonomy.cdm.api.service.IPreferenceService;
16
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
17
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
18
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
19
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
20
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
21
import eu.etaxonomy.taxeditor.store.CdmStore;
22

  
23
/**
24
 * @author k.luther
25
 * @date 18.11.2016
26
 *
27
 */
28
public class DatabasePreferencesWizard extends Wizard {
29

  
30

  
31
    public DatabasePreferencesPage preferencePage;
32

  
33

  
34

  
35
    public DatabasePreferencesWizard() {
36
        setWindowTitle("Database Preferences Wizard");
37

  
38
        preferencePage = new DatabasePreferencesPage("Database Preferences");
39

  
40

  
41
    }
42

  
43

  
44

  
45
    /**
46
     * @return the preferencePage
47
     */
48
    public DatabasePreferencesPage getPreferencePage() {
49
        return preferencePage;
50
    }
51
    /**
52
     * {@inheritDoc}
53
     */
54
    @Override
55
    public boolean performFinish() {
56

  
57
//       getPreferencePage().performOk();
58

  
59
        String value =PreferencesUtil.getStringValue(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY);
60

  
61
        boolean allowOverride =  PreferencesUtil.getBooleanValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
62
        CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
63
        pref.setAllowOverride(allowOverride);
64

  
65
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
66
        if (controller == null){
67
            return false;
68
        }
69
        IPreferenceService service = controller.getPreferenceService();
70
        service.set(pref);
71
        NameDetailsConfigurator config = getPreferencePage().getNameDetailsConfig().createNameDetailsViewConfig();
72
        value = config.toString();
73
        allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
74

  
75
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value);
76
        pref.setAllowOverride(allowOverride);
77
        service.set(pref);
78
        if (!allowOverride || (allowOverride && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.OVERRIDE_NAME_DETAILS))){
79
            PreferencesUtil.saveConfigToPrefernceStore(config);
80
        }
81

  
82

  
83
        boolean isDeterminationOnlyForFieldUnit= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS );
84
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.DeterminationOnlyForFieldUnits, String.valueOf(isDeterminationOnlyForFieldUnit));
85
       // allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF);
86
        pref.setAllowOverride(allowOverride);
87
        service.set(pref);
88

  
89
        boolean isShowCollectingAreasInGeneralsecion= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION );
90
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowCollectingAreasInGeneralSection, String.valueOf(isShowCollectingAreasInGeneralsecion));
91
        pref.setAllowOverride(allowOverride);
92
        service.set(pref);
93

  
94
        boolean isShowTaxonAssociations= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS);
95
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowTaxonAssociations, String.valueOf(isShowTaxonAssociations));
96
        pref.setAllowOverride(allowOverride);
97
        service.set(pref);
98

  
99
        boolean isShowLifeForm= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM);
100
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowLifeForm, String.valueOf(isShowLifeForm));
101
        pref.setAllowOverride(allowOverride);
102
        service.set(pref);
103

  
104
        String biocaseProviderList = this.getPreferencePage().getBiocaseProviderList().createAllProviderString();
105
        if (biocaseProviderList == null){
106
            getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST,"");
107
        }else{
108
            getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST, biocaseProviderList);
109

  
110
        }
111
        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.BioCaseProvider, String.valueOf(biocaseProviderList));
112
        pref.setAllowOverride(false);
113
        service.set(pref);
114
//        getPreferencePage().createAbcdImportConfig();
115
//        value = getPreferencePage().getAbcdImportConfig().toString();
116
//        allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_ABCD_IMPORT_CONFIG);
117
//        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.AbcdImportConfig, value);
118
//        pref.setAllowOverride(allowOverride);
119
//        service.set(pref);
120

  
121
        return true;
122
    }
123

  
124

  
125

  
126
    @Override
127
    public void addPages() {
128
        addPage(preferencePage);
129

  
130
    }
131

  
132
    @Override
133
    public IWizardPage getNextPage(IWizardPage currentPage) {
134

  
135
       return null;
136
    }
137

  
138

  
139
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard__.java
1
/**
2
* Copyright (C) 2016 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.databaseAdmin.wizard;
10

  
11
import org.eclipse.jface.wizard.IWizardPage;
12
import org.eclipse.jface.wizard.Wizard;
13

  
14
/**
15
 * @author k.luther
16
 * @date 18.11.2016
17
 *
18
 */
19
public class DatabasePreferencesWizard__ extends Wizard {
20

  
21

  
22
    public DatabasePreferencesPage__ preferencePage;
23

  
24

  
25

  
26
    public DatabasePreferencesWizard__() {
27
        setWindowTitle("Database Preferences Wizard");
28

  
29
        preferencePage = new DatabasePreferencesPage__("Database Preferences");
30

  
31

  
32
    }
33

  
34

  
35

  
36
    /**
37
     * @return the preferencePage
38
     */
39
    public DatabasePreferencesPage__ getPreferencePage() {
40
        return preferencePage;
41
    }
42
    /**
43
     * {@inheritDoc}
44
     */
45
    @Override
46
    public boolean performFinish() {
47
//
48
////       getPreferencePage().performOk();
49
//
50
//        String value =PreferencesUtil.getStringValue(IPreferenceKeys.PREFERRED_NOMENCLATURAL_CODE_KEY);
51
//
52
//       // boolean allowOverride =  PreferencesUtil.getBooleanValue(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY);
53
//        CdmPreference pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NomenclaturalCode, value);
54
////        pref.setAllowOverride(allowOverride);
55
////
56
////        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
57
////        if (controller == null){
58
////            return false;
59
////        }
60
////        IPreferenceService service = controller.getPreferenceService();
61
////        service.set(pref);
62
////        NameDetailsConfigurator config = getPreferencePage().getNameDetailsConfig().createNameDetailsViewConfig();
63
////        value = config.toString();
64
////        allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
65
////
66
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value);
67
////        pref.setAllowOverride(allowOverride);
68
////        service.set(pref);
69
////        if (!allowOverride || (allowOverride && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.OVERRIDE_NAME_DETAILS))){
70
////            PreferencesUtil.saveConfigToPrefernceStore(config);
71
////        }
72
////
73
////
74
////        boolean isDeterminationOnlyForFieldUnit= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS );
75
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.DeterminationOnlyForFieldUnits, String.valueOf(isDeterminationOnlyForFieldUnit));
76
////       // allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF);
77
////        pref.setAllowOverride(allowOverride);
78
////        service.set(pref);
79
////
80
////        boolean isShowCollectingAreasInGeneralsecion= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION );
81
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowCollectingAreasInGeneralSection, String.valueOf(isShowCollectingAreasInGeneralsecion));
82
////        pref.setAllowOverride(allowOverride);
83
////        service.set(pref);
84
////
85
////        boolean isShowTaxonAssociations= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS);
86
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowTaxonAssociations, String.valueOf(isShowTaxonAssociations));
87
////        pref.setAllowOverride(allowOverride);
88
////        service.set(pref);
89
////
90
////        boolean isShowLifeForm= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM);
91
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowLifeForm, String.valueOf(isShowLifeForm));
92
////        pref.setAllowOverride(allowOverride);
93
////        service.set(pref);
94
////
95
////        String biocaseProviderList = this.getPreferencePage().getBiocaseProviderList().createAllProviderString();
96
////        if (biocaseProviderList == null){
97
////            getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST,"");
98
////        }else{
99
////            getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST, biocaseProviderList);
100
//
101
//        }
102
//        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.BioCaseProvider, String.valueOf(biocaseProviderList));
103
//        pref.setAllowOverride(false);
104
//        service.set(pref);
105
////        getPreferencePage().createAbcdImportConfig();
106
////        value = getPreferencePage().getAbcdImportConfig().toString();
107
////        allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_ABCD_IMPORT_CONFIG);
108
////        pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.AbcdImportConfig, value);
109
////        pref.setAllowOverride(allowOverride);
110
////        service.set(pref);
111

  
112
        return true;
113
    }
114

  
115

  
116

  
117
    @Override
118
    public void addPages() {
119
        addPage(preferencePage);
120

  
121
    }
122

  
123
    @Override
124
    public IWizardPage getNextPage(IWizardPage currentPage) {
125

  
126
       return null;
127
    }
128

  
129

  
130
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenDatabasePreferencesWizardHandler.java
1
/**
2
* Copyright (C) 2016 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.handler;
10

  
11
import org.eclipse.e4.core.di.annotations.Execute;
12
import org.eclipse.jface.wizard.WizardDialog;
13

  
14
import eu.etaxonomy.taxeditor.databaseAdmin.wizard.DatabasePreferencesWizard;
15
import eu.etaxonomy.taxeditor.model.AbstractUtility;
16

  
17
/**
18
 * @author k.luther
19
 * @date 18.11.2016
20
 *
21
 */
22
public class OpenDatabasePreferencesWizardHandler {
23

  
24
    @Execute
25
    public Object execute(){
26
        DatabasePreferencesWizard databasePreferencesWizard = new DatabasePreferencesWizard();
27
        WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(),
28
                databasePreferencesWizard);
29

  
30
        dialog.open();
31

  
32
        return null;
33
    }
34

  
35
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmPreferenceCache.java
103 103
        loadAndPutPreference(controller, key);
104 104

  
105 105
        if (preferenceCache.get(key) != null){
106
            if (!PreferencesUtil.getBooleanValue(IPreferenceKeys.DISTRIBUTION_STATUS_OVERRIDE) || !preferenceCache.get(key).isAllowOverride()){
106
            if (!PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionStatus.getKey())) || !preferenceCache.get(key).isAllowOverride()){
107 107
                //get terms for the uuids... and add them to the termManager as preferred terms
108 108
                ITermService termService = CdmStore.getService(ITermService.class);
109 109
                String[] uuidArray = preferenceCache.get(key).getValue().split(";");
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java
394 394
        if (isAllowOverride){
395 395

  
396 396
            PreferencesUtil.setBooleanValue(EditorPreferencePredicate.DistributionEditorActivated.getKey(), isEditorActivated);
397
            PreferencesUtil.setBooleanValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE, overrideActivated);
397
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.DistributionEditorActivated.getKey()), overrideActivated);
398 398
            PreferencesUtil.setSortNamedAreasByOrderInVocabulary(isSortByVocabularyOrder);
399
            PreferencesUtil.setBooleanValue(IPreferenceKeys.DISTRIBUTION_AREAS_SORTED_BY_IDINVOC_OVERRIDE, overrideOrderAreas);
399
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.AreasSortedByIdInVocabulary.getKey()), overrideOrderAreas);
400 400
            PreferencesUtil.setShowRankInChecklistEditor(isShowRank);
401
            PreferencesUtil.setBooleanValue(IPreferenceKeys.DISTRIBUTION_SHOW_RANK_OVERRIDE, overrideRank);
401
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.ShowRankInDistributionEditor.getKey()), overrideRank);
402 402
            PreferencesUtil.setDisplayStatusInChecklistEditor(displayStatus);
403
            PreferencesUtil.setBooleanValue(IPreferenceKeys.DISTRIBUTION_DISPLAY_STATUS_OVERRIDE, overrideStatusDisplay);
403
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.DisplayOfStatus.getKey()), overrideStatusDisplay);
404 404
            PreferencesUtil.setAreaDisplayInChecklistEditor(displayArea);
405
            PreferencesUtil.setBooleanValue(IPreferenceKeys.DISTRIBUTION_DISPLAY_AREA_OVERRIDE, overrideAreaDisplay);
405
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.DisplayOfAreasInDistributionEditor.getKey()), overrideAreaDisplay);
406 406
            PreferencesUtil.setOwnDescriptionForChecklistEditor(ownDescriptionForDistributionEditor);
407
            PreferencesUtil.setBooleanValue(IPreferenceKeys.OWN_DESCRIPTION_OVERRIDE, overrideOwnDescriptionForDistributionEditor);
407
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.OwnDescriptionForDistributionEditor.getKey()), overrideOwnDescriptionForDistributionEditor);
408 408

  
409 409

  
410 410

  
......
462 462

  
463 463
        if (distributionEditorPref != null){
464 464
            isAllowOverride = distributionEditorPref.isAllowOverride();
465
            boolean test = PreferencesUtil.getBooleanValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE);
466
            if (isAllowOverride && PreferencesUtil.getBooleanValue(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE)){
465
            boolean test = PreferencesUtil.getBooleanValue(EditorPreferencePredicate.DistributionEditorActivated.getKey());
466
            if (isAllowOverride && PreferencesUtil.getBooleanValue(EditorPreferencePredicate.DistributionEditorActivated.getKey())){
467 467
                isEditorActivated = PreferencesUtil.getBooleanValue(EditorPreferencePredicate.DistributionEditorActivated.getKey());
468 468
            }else{
469 469
                isEditorActivated = Boolean.valueOf(distributionEditorPref.getValue());
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/GeneralPreferencePage.java
192 192
    @Override
193 193
    public boolean performOk() {
194 194
        if (isAllowOverrideShowCheckListPerspective){
195
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.ShowChecklistPerspective.getKey()), isOverrideShowCheckListPerspective);
195 196
            PreferencesUtil.setBooleanValue(EditorPreferencePredicate.ShowChecklistPerspective.getKey(), isShowCheckListPerspective);
196 197
        }
197 198
        if (isAllowOverrideShowIOMenu){
198 199
            PreferencesUtil.setBooleanValue(EditorPreferencePredicate.ShowImportExportMenu.getKey(), isShowIOMenu);
200
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.ShowImportExportMenu.getKey()), isOverrideShowIOMenu);
199 201
        }
200 202
//        if (isAllowOverrideShowMediaView){
201 203
//            PreferencesUtil.setBooleanValue(EditorPreferencePredicate.ShowMediaView.getKey(), isShowMediaView);
202 204
//        }
203 205
        if (isAllowOverrideShowTaxonNodeWizard){
206
            PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.ShowTaxonNodeWizard.getKey()), isOverrideShowTaxonNodeWizard);
204 207
            PreferencesUtil.setBooleanValue(EditorPreferencePredicate.ShowTaxonNodeWizard.getKey(), isShowTaxonNodeWizard);
205 208
        }
206 209

  
......
212 215

  
213 216
        CdmPreferenceCache cache = CdmPreferenceCache.instance();
214 217
        isShowIOMenu = PreferencesUtil.getBooleanValue(EditorPreferencePredicate.ShowImportExportMenu.getKey());
218
        isOverrideShowIOMenu = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.ShowImportExportMenu.getKey()));
215 219
        CdmPreference pref = cache.get(EditorPreferencePredicate.ShowImportExportMenu.getKey());
216 220
        if (pref != null){
217 221
            isAllowOverrideShowIOMenu = pref.isAllowOverride();
......
226 230
//            isAllowOverrideShowMediaView = true;
227 231
//        }
228 232
        isShowCheckListPerspective = PreferencesUtil.getBooleanValue(EditorPreferencePredicate.ShowChecklistPerspective.getKey());
233
        isOverrideShowCheckListPerspective = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.ShowChecklistPerspective.getKey()));
229 234
        pref = cache.get(EditorPreferencePredicate.ShowChecklistPerspective.getKey());
230 235
        if (pref != null){
231 236
            isAllowOverrideShowCheckListPerspective = pref.isAllowOverride();
......
233 238
            isAllowOverrideShowCheckListPerspective = true;
234 239
        }
235 240
        isShowTaxonNodeWizard = PreferencesUtil.getBooleanValue(EditorPreferencePredicate.ShowTaxonNodeWizard.getKey());
241
        isOverrideShowTaxonNodeWizard = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(EditorPreferencePredicate.ShowTaxonNodeWizard.getKey()));
236 242
        pref = cache.get(EditorPreferencePredicate.ShowTaxonNodeWizard.getKey());
237 243
        if (pref != null){
238 244
            isAllowOverrideShowTaxonNodeWizard = pref.isAllowOverride();
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
24 24
	 *
25 25
	 */
26 26
	public static final String PREFERRED_NOMENCLATURAL_CODE_KEY = "eu.etaxonomy.taxeditor.nomenclaturalCode";
27
    public static final String OVERRIDE_NOMENCLATURAL_CODE_KEY = "eu.etaxonomy.taxeditor.nomenclaturalCode.override";
28
    public static final String ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY = "eu.etaxonomy.taxeditor.nomenclaturalCode.allow_override";
29
   // public static final String CDM_NOMENCLATURAL_CODE_KEY = "eu.etaxonomy.taxeditor.cdm.nomenclaturalCode";
27

  
30 28
	/**
31 29
	 * TaxonSearch Configurator
32 30
	 */
......
96 94
	public static final String SORT_RANKS_HIERARCHICHALLY = "eu.etaxonomy.taxeditor.menus.sortRanksHierarchichally";
97 95
	/** Constant <code>SORT_NODES_NATURALL="eu.etaxonomy.taxeditor.menus.sortNodesN"{trunked}</code> */
98 96
	public static final String SORT_NODES = "eu.etaxonomy.taxeditor.menus.sortNodes";
99
//	/** Constant <code>SORT_NODES_NATURALL="eu.etaxonomy.taxeditor.menus.sortNodesN"{trunked}</code> */
100
//	public static final String SORT_NODES_ALPHABETICALLY = "eu.etaxonomy.taxeditor.menus.sortNodesAlphabetically";
97

  
101 98
	/** Constant <code>RESTORE_NAVIGATOR_STATE="eu.etaxonomy.taxeditor.taxonnavigator.restoreState"{trunked}</code> */
102 99
	public static final String RESTORE_NAVIGATOR_STATE = "eu.etaxonomy.taxeditor.taxonnavigator.restoreState";
103 100
	/**
......
126 123
	public static final String DISABLE_SERVICES_API_TIMESTAMP_CHECK = "eu.etaxonomy.taxeditor.cdmlib.remoting.disableServicesApiTimestampCheck";
127 124
	public static final String ADD_TYPES_TO_ALL_NAMES = "eu.etaxonomy.taxeditor.store.addTypeToAllNames";
128 125
    public static final String DETERMINATION_ONLY_FOR_FIELD_UNITS = "eu.etaxonomy.taxeditor.specimen.determinationOnlyOnFieldUnitLevel";
129
    public static final String DETERMINATION_ONLY_FOR_FIELD_UNITS_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.determinationOnlyOnFieldUnitLevel.override";
130
    public static final String DETERMINATIONS_ONLY_FOR_FIELDUNITS_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.determinationOnlyOnFieldUnitLevel.allowOverride";
131 126
    public static final String SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION = "eu.etaxonomy.taxeditor.specimen.showCollectingAreasInGeneralSection";
132
    public static final String SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showCollectingAreasInGeneralSection.override";
133
    public static final String SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showCollectingAreasInGeneralSection.allowOverride";
134 127
    public static final String SHOW_TAXON_ASSOCIATIONS = "eu.etaxonomy.taxeditor.specimen.showTaxonAssociations";
135
    public static final String SHOW_TAXON_ASSOCIATIONS_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showTaxonAssociations.override";
136
    public static final String SHOW_TAXON_ASSOCIATIONS_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showTaxonAssociations.allowOverride";
137 128
    public static final String SHOW_LIFE_FORM = "eu.etaxonomy.taxeditor.specimen.showLifeForm";
138
    public static final String SHOW_LIFE_FORM_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showLifeForm.override";
139
    public static final String SHOW_LIFE_FORM_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showLifeForm.allowOverride";
140 129
    public static final String SHOW_SPECIMEN = "eu.etaxonomy.taxeditor.specimen.showSpecimen";
141
    public static final String SHOW_SPECIMEN_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showSpecimen.allowOverride";
142
    public static final String SHOW_SPECIMEN_OVERRIDE = "eu.etaxonomy.taxeditor.specimen.showSpecimen.override";
143

  
144
    //Distribution Editor preferences
145
   // public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
146
  //  public static final String DISTRIBUTION_AREA_OCCURENCE_STATUS = "eu.etaxonomy.taxeditor.checklist.distributionAreaStatus";
147
  //  public static final String DISTRIBUTION_VOCABULARIES = "eu.etaxonomy.taxeditor.checklist.distributionVocabularies";
148
    public static final String DISTRIBUTION_VOCABULARIES_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.checklist.distributionVocabulariesAllowOverride";
149
    public static final String DISTRIBUTION_VOCABULARIES_OVERRIDE = "eu.etaxonomy.taxeditor.checklist.distributionVocabulariesOverride";
150
  //  public static final String CHECKLIST_AREA_DISPLAY = "eu.etaxonomy.taxeditor.checklist.checklistAreaDisplay";
151
//    public static final String CHECKLIST_AREA_DISPLAY_ID_IN_VOCABULARY = "IdInVocabulary";
152
//    public static final String CHECKLIST_AREA_DISPLAY_TITLE = "Title";
153
//    public static final String CHECKLIST_AREA_DISPLAY_SYMBOL1 = "Symbol1";
154
//    public static final String CHECKLIST_AREA_DISPLAY_SYMBOL2 = "Symbol2";
155
  //  public static final String CHECKLIST_STATUS_DISPLAY = "eu.etaxonomy.taxeditor.checklist.checklistDisplayStatus";
156
//    public static final String CHECKLIST_SHOW_RANK = "eu.etaxonomy.taxeditor.checklist.checklistShowRank";
157

  
158
    public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE_OVERRIDE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActiveOverride";
159
    public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActiveAllowOverride";
160

  
161
    public static final String DISTRIBUTION_STATUS_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.status";
162
    public static final String DISTRIBUTION_DESCRIPTION_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.ownDescriptionOverride";
163
    public static final String DISTRIBUTION_DISPLAY_AREA_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.checklistAreaDisplayOverride";
164
    public static final String DISTRIBUTION_DISPLAY_STATUS_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.checklistDisplayStatusOverride";
165
    public static final String DISTRIBUTION_SHOW_RANK_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.checklistShowRankOverride";
166
    public static final String DISTRIBUTION_AREAS_SORTED_BY_IDINVOC_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.sortByVocabularyOrderOverride";
167
 //   public static final String SORT_NAMED_AREA_BY_VOCABULARY_ORDER = "eu.etaxonomy.taxeditor.distribution.namedArea.sortByVocabularyOrder";
168
    public static final String OWN_DESCRIPTION_OVERRIDE = "eu.etaxonomy.taxeditor.distribution.namedArea.ownDescriptionOverride";
169

  
170 130
    public static final String COMMON_NAME_AREA_VOCABULARIES = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies";
171
    public static final String COMMON_NAME_AREA_VOCABULARIES_ALLOW_OVERRIDE = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies.allowOverride";
172
    public static final String COMMON_NAME_AREA_VOCABULARIES_OVERRIDE = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies.override";
131

  
173 132
//Taxon Details View
174 133
    public static final String SHOW_SEC_DETAILS = "eu.etaxonomy.taxeditor.taxon.showSecDetails";
175 134
    public static final String DISABLE_SEC = "eu.etaxonomy.taxeditor.taxon.disableSec";
......
233 192
    public static final String ABCD_IMPORT_CONFIGURATOR_DEFAULT_AUTHOR = "eu.etaxonomy.taxeditor.abcd_import_configurator.defaultAuthor";
234 193
    public static final String ABCD_IMPORT_CONFIGURATOR_CLASSIFICATION_UUID =  "eu.etaxonomy.taxeditor.abcd_import_configurator.classificationUuid";
235 194
    public static final String ABCD_IMPORT_CONFIGURATOR_NOMENCLATURAL_CODE = "eu.etaxonomy.taxeditor.abcd_import_configurator.nomenclaturalCode";
236
    public static final String ABCD_IMPORT_OVERRIDE = "eu.etaxonomy.taxeditor.abcd_import_configurator.override";
237
    public static final String ALLOW_OVERRIDE_ABCD_IMPORT_CONFIG = "eu.etaxonomy.taxeditor.abcd_import_configurator.allowOverride";
238 195

  
239 196

  
240 197

  
......
256 213
    public static final String PUBLISH = "PUBLISH";
257 214

  
258 215
    public static final String FILTER_COMMON_NAME_REFERENCES = "eu.etaxonomy.taxeditor.references.selection.filterCommonNameReferences";
259
    public static final String SHOW_IO_MENU = "eu.etaxonomy.taxeditor.menu.showIO";
260 216

  
261
   // public static final String SHOW_MEDIA = "eu.etaxonomy.taxeditor.view.showMedia";
262
  //  public static final String SHOW_CHECKLIST_PERSPECTIVE = "eu.etaxonomy.taxeditor.perspective.showChecklist";
263
  //  public static final String SHOW_TAXONNODE_WIZARD = "eu.etaxonomy.taxeditor.menu.showTaxonNodeWizard";
264 217
    public static final String IS_SEARCH_FOR_IDENTIFIER_AS_DEFAULT = "eu.etaxonomy.taxeditor.search.reference.defaultIdentifier"+ CdmStore.getActiveCdmSource().getName();
265 218
    public static final String SEARCH_FOR_IDENTIFIER_AND_TITLECACHE = "eu.etaxonomy.taxeditor.search.reference.identifierAndTitleCache" + CdmStore.getActiveCdmSource().getName();
266
//    public static final String DISABLE_MULTI_CLASSIFICATION = "eu.etaxonomy.taxeditor.classification.multi";
267

  
268
  //  public static final String SHOW_ID_IN_SOURCE = "eu.etaxonomy.taxeditor.source.detail.IdInSource";
269
   // public static final String SHOW_NAMESPACE_IN_SOURCE = "eu.etaxonomy.taxeditor.source.detail.nameInSource";
270 219

  
271 220

  
272 221

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencePropertyTester.java
37 37
	        return isChecklistEditorEnabled();
38 38
	    }
39 39
	    if(SHOW_IO_MENU.equals(property)){
40
	        boolean test = isShowIOMenuEnabled();
40 41
            return isShowIOMenuEnabled();
41 42
        }
42 43
	    if(SHOW_SPECIMEN_MENU.equals(property)){
......
56 57
        return PreferencesUtil.getBooleanValue(EditorPreferencePredicate.DistributionEditorActivated.getKey());
57 58
    }
58 59
	private boolean isShowIOMenuEnabled() {
59
        return PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_IO_MENU);
60
        return PreferencesUtil.getBooleanValue(EditorPreferencePredicate.ShowImportExportMenu.getKey());
60 61
    }
61 62

  
62 63
	private boolean isShowSpecimenMenuEnabled() {
63
        return PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SPECIMEN);
64
        return PreferencesUtil.getBooleanValue(EditorPreferencePredicate.ShowSpecimen.getKey());
64 65
    }
65 66

  
66 67
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
110 110
	    return name + "_"+  ((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
111 111
	}
112 112

  
113
	private static String prefOverrideKey(String name) {
113
	static String prefOverrideKey(String name) {
114 114
        return name + "_OVERRIDE_"+ ((CdmRemoteSource)CdmStore.getActiveCdmSource()).toString();
115 115
    }
116 116

  
......
390 390
    			} else{
391 391
    			    setStringValue(PREFERRED_NOMENCLATURAL_CODE_KEY,
392 392
    				        preference.getValue());
393
    			    setBooleanValue(ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY,preference.isAllowOverride());
393

  
394 394
    				return preference;
395 395
    			}
396 396
    		} else{
......
435 435

  
436 436

  
437 437
	public static NomenclaturalCode getPreferredNomenclaturalCode(){
438
	    if (getBooleanValue(OVERRIDE_NOMENCLATURAL_CODE_KEY)) {
438
	    if (getBooleanValue(prefOverrideKey(PreferencePredicate.NomenclaturalCode.getKey()))) {
439 439
            return getPreferredNomenclaturalCode(true);
440 440
        } else{
441 441
            return getPreferredNomenclaturalCode(false);
......
487 487
    }
488 488

  
489 489
	public static boolean isShowTaxonAssociations(){
490
        if (getBooleanValue(SHOW_TAXON_ASSOCIATIONS_OVERRIDE) && getBooleanValue(SHOW_TAXON_ASSOCIATIONS_ALLOW_OVERRIDE)) {
491
            return getBooleanValue(SHOW_TAXON_ASSOCIATIONS);
492
        } else{
493
            CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
494

  
495
            return pref!=null?Boolean.valueOf(pref.getValue()):false;
496
        }
490
        boolean result = getBooleanValue(EditorPreferencePredicate.ShowTaxonAssociations.getKey());
491
        return result;
497 492
    }
498 493

  
499 494
	public static boolean isShowLifeForm(){
500
        if (getBooleanValue(SHOW_LIFE_FORM_OVERRIDE) && getBooleanValue(SHOW_LIFE_FORM_ALLOW_OVERRIDE)) {
501
            return getBooleanValue(SHOW_LIFE_FORM);
502
        } else{
503
            CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowLifeForm);
504

  
505
            return pref!=null?Boolean.valueOf(pref.getValue()):false;
506
        }
495
	    boolean result =  getBooleanValue(EditorPreferencePredicate.ShowLifeForm.getKey());
496
	    return result;
507 497
    }
508 498

  
509 499
	public static boolean isDeterminationOnlyForFieldUnits(){
510
        if (getBooleanValue(DETERMINATION_ONLY_FOR_FIELD_UNITS_OVERRIDE) && getBooleanValue(DETERMINATIONS_ONLY_FOR_FIELDUNITS_ALLOW_OVERRIDE)) {
511
            return getBooleanValue(DETERMINATION_ONLY_FOR_FIELD_UNITS);
512
        } else{
513
            CdmPreference pref = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits);
514

  
515
            return pref!=null?Boolean.valueOf(pref.getValue()):false;
516
        }
500
	    boolean result =  getBooleanValue(EditorPreferencePredicate.DeterminationOnlyForFieldUnits.getKey());
501
        return result;
517 502
    }
518 503

  
519 504
	public static boolean isCollectingAreaInGeneralSection(){
520
        if (getBooleanValue(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION_OVERRIDE) && getBooleanValue(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION_ALLOW_OVERRIDE)) {
521
            return getBooleanValue(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION);
522
        } else{
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff