Project

General

Profile

Revision 852ab2c5

ID852ab2c5eef3ee3a7757670528bd37fc1dbcaac6
Parent 44bc51cb
Child d9ff01e1

Added by Katja Luther over 1 year ago

ref #7849: add message to term selection wizard that no selection -> all terms available, smaller adapation in areaselection dialogs

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/VocabularyAdminPreferences.java
14 14
import org.eclipse.swt.widgets.Composite;
15 15
import org.eclipse.swt.widgets.Control;
16 16

  
17
import eu.etaxonomy.cdm.api.application.ICdmRepository;
18
import eu.etaxonomy.cdm.api.service.IPreferenceService;
19 17
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
20 18
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
21 19
import eu.etaxonomy.taxeditor.l10n.Messages;
22 20
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
23 21
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
24
import eu.etaxonomy.taxeditor.store.CdmStore;
25 22
import eu.etaxonomy.taxeditor.ui.element.CommandHandlerButton;
26 23

  
27 24
/**
......
79 76
        if (pref == null){
80 77
            return true;
81 78
        }
82
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
83 79

  
84
        if(controller!=null){
85
            IPreferenceService service = controller.getPreferenceService();
80
        PreferencesUtil.updateDBPreferences();
86 81

  
87
            CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.CommonNameAreaVocabularies);
88
            if(pref==null){
89
                pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.CommonNameAreaVocabularies, "");
90
            }
91
            pref.setAllowOverride(allowOverride);
92
            service.set(pref);
93

  
94
            PreferencesUtil.updateDBPreferences();
95
        }
96 82
        return true;
97 83

  
98 84
    }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/NameDetailsViewComposite.java
18 18
import org.eclipse.swt.widgets.Composite;
19 19

  
20 20
import eu.etaxonomy.taxeditor.l10n.Messages;
21
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
22 21
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
23 22
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
24 23

  
......
68 67
//       NameDetailsConfigurator config = PreferencesUtil.setPreferredNameDetailsConfiguration(local)
69 68

  
70 69
       final Button allowLocalPreference = new Button(this, SWT.CHECK);
71
       boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
72
       allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
73
       allowLocalPreference.setSelection(isUseLocalPreference);
74
       allowLocalPreference.addSelectionListener(new SelectionAdapter(){
75
            @Override
76
            public void widgetSelected(SelectionEvent e) {
77
                boolean isUseLocalPreference = allowLocalPreference.getSelection();
78
                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS, isUseLocalPreference);
79
             }
80
        });
70
//       boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
71
//       allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
72
//       allowLocalPreference.setSelection(isUseLocalPreference);
73
//       allowLocalPreference.addSelectionListener(new SelectionAdapter(){
74
//            @Override
75
//            public void widgetSelected(SelectionEvent e) {
76
//                boolean isUseLocalPreference = allowLocalPreference.getSelection();
77
//                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS, isUseLocalPreference);
78
//             }
79
//        });
81 80

  
82 81

  
83 82
       isSimpleDetailsViewActivated= config.isSimpleDetailsViewActivated();
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
363 363
AbcdImportPreference_allow_override_tooltip=It is allowed to change this preference locally.
364 364

  
365 365
AbcdImportProvider_description=Configure the default list of biocase provider for the specimen search
366
AvailableAreaVocabulariesPage_PAGE_DESCRIPTION=In order to see or modify the %s of taxa,\nyou have to select the vocabularies to select the available areas from.
366
AvailableAreaVocabulariesPage_PAGE_DESCRIPTION=Select vocabularies to select the available areas from.
367 367
AvailableAreaVocabulariesPage_PAGE_TITLE=Select Vocabularies for %s
368 368
AvailableDistributionPage_CHECK_MESSAGE=Please check at least one item
369 369
AvailableDistributionPage_PAGE_DESCRIPTION=In order to see and modify distribution status of taxa\nyou have to select the areas which you like to see/modify.
370 370
AvailableDistributionPage_PAGE_TITLE=Select areas for Distribution Editor
371
AvailableDistributionStatusPage_PAGE_DESCRIPTION=To modify the distribution status for taxa in a given area\nyou may preselect the available status list.
371
AvailableDistributionStatusPage_PAGE_DESCRIPTION=Choose available status in distribution editor.\nIf no status is selected all status are available.
372 372
AvailableDistributionStatusPage_PAGE_TITLE=Select Distribution Status
373 373
AvailableDistributionStatusWizard_PAGE_TITLE=Available Distribution Status
374 374
AvailableDistributionStatusWizard_WINDOW_TITLE=Distribution Status Selection
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
364 364
AbcdImportPreference_allow_override_tooltip=Es d?rfen lokale ?nderungen an den Pr?ferenzen vorgenommen werden.
365 365

  
366 366
AbcdImportProvider_description=Konfiguration einer Liste von Biocase Providern f?r die Specimen Suche
367
AvailableAreaVocabulariesPage_PAGE_DESCRIPTION=Um %s von Taxa anzuzeigen oder zu bearbeiten,\nmuss das Vokabular ausgew?hlt werden, von dem die Gebiete ausgew?hlt werden sollen.
367
AvailableAreaVocabulariesPage_PAGE_DESCRIPTION=Auswahl der Vokabulare, aus denen die Gebiete f?r %s ausgew?hlt werden sollen.
368 368
AvailableAreaVocabulariesPage_PAGE_TITLE=Vokabular f?r %s ausw?hlen
369 369
AvailableDistributionPage_CHECK_MESSAGE=Bitte w?hlen Sie mindestens einen Eintrag aus
370 370
AvailableDistributionPage_PAGE_DESCRIPTION=Um den Verbreitungsstatus von Taxa anzuzeigen und zu bearbeiten,\n muss das Gebiet ausgew?hlt werden, dass angezeigt/bearbeitet werden soll.
371 371
AvailableDistributionPage_PAGE_TITLE=Auswahl der zur Verf\u00FCgung stehenden Gebiete f?r den Verbreitungs-Editor
372
AvailableDistributionStatusPage_PAGE_DESCRIPTION=Um den Verbreitungsstatus f?r Taxa in einem bestimmten Gebiet zu bearbeiten,\nk?nnen Sie die Liste der verf?gbare Status ausw?hlen.
372
AvailableDistributionStatusPage_PAGE_DESCRIPTION=Auswahl der im Verbreitungseditor zu Verf\u00FCgung stehenden Status.\nWenn kein Status ausgew?hlt ist, werden alle Status angezeigt.
373 373
AvailableDistributionStatusPage_PAGE_TITLE=Verbreitungsstatus ausw?hlen
374 374
AvailableDistributionStatusWizard_PAGE_TITLE=Verf?gbare Verbreitungsstatus
375 375
AvailableDistributionStatusWizard_WINDOW_TITLE=Verbreitungsstatus ausw?hlen
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
1400 1400
                return null;
1401 1401
            }
1402 1402

  
1403
            setBooleanValue(ALLOW_OVERRIDE_NAME_DETAILS, preference.isAllowOverride());
1403
        //    setBooleanValue(ALLOW_OVERRIDE_NAME_DETAILS, preference.isAllowOverride());
1404 1404
            value = preference.getValue();
1405 1405
            config.setAllowOverride(preference.isAllowOverride());
1406 1406
            //the preference value is build like this:
......
1855 1855

  
1856 1856
    //Name Details
1857 1857
    NameDetailsConfigurator config = getPreferredNameDetailsConfiguration(false);
1858
    if (config != null ){
1859
        if (!getBooleanValue(OVERRIDE_NAME_DETAILS) ||  !getBooleanValue(ALLOW_OVERRIDE_NAME_DETAILS)){
1860
            setPreferredNameDetailsConfiguration(config, false);
1861
        }
1862
    }
1858
//    if (config != null ){
1859
//        if (!getBooleanValue(OVERRIDE_NAME_DETAILS) ||  !getBooleanValue(ALLOW_OVERRIDE_NAME_DETAILS)){
1860
//            setPreferredNameDetailsConfiguration(config, false);
1861
//        }
1862
//    }
1863 1863

  
1864 1864

  
1865 1865

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/CommonNameNamedAreaSelectionDialog.java
22 22
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
23 23
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
24 24
import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache;
25
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
26 25
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
27 26
import eu.etaxonomy.taxeditor.store.CdmStore;
28 27

  
......
49 48
    }
50 49

  
51 50
    private static UUID[] createVocabularyUuidList() {
52
        String preselectedVocString = PreferencesUtil.getStringValue(IPreferenceKeys.COMMON_NAME_AREA_VOCABULARIES);
51
        String preselectedVocString = PreferencesUtil.getStringValue(PreferencePredicate.CommonNameAreaVocabularies.getKey());
53 52
        if (StringUtils.isBlank(preselectedVocString)){
54 53
            return null;
55 54
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NamedAreaSelectionDialog.java
13 13
import java.util.List;
14 14
import java.util.UUID;
15 15

  
16
import org.apache.commons.lang.StringUtils;
17 16
import org.eclipse.jface.action.Action;
18 17
import org.eclipse.jface.action.IAction;
19 18
import org.eclipse.jface.dialogs.Dialog;
......
30 29
import eu.etaxonomy.cdm.model.common.TermType;
31 30
import eu.etaxonomy.cdm.model.common.TermVocabulary;
32 31
import eu.etaxonomy.cdm.model.location.NamedArea;
33
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
34
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
35 32
import eu.etaxonomy.taxeditor.model.ImageResources;
36 33
import eu.etaxonomy.taxeditor.model.MessagingUtils;
37 34
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
......
102 99

  
103 100
		selectedVocabularies = new ArrayList<TermVocabulary>();
104 101
		this.preferenceID = preferenceId;
105
		if (preselectedVocabularyUuids == null || preselectedVocabularyUuids.length == 0){
106
		    preselectedVocabularyUuids = createVocabularyUuidList();
107
		}
108
		if (preselectedVocabularyUuids != null){
102

  
103
		if (preselectedVocabularyUuids != null && preselectedVocabularyUuids.length > 0){
109 104
    		for(int i=0;i<preselectedVocabularyUuids.length;i++){
110 105
    			TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
111 106
    			selectedVocabularies.add(preselectedVocabulary);
112 107
    		}
108
		}else{
109
		    selectedVocabularies = createSelectedVocabularies();
113 110
		}
114 111

  
115

  
116
		selectedVocabularies = createSelectedVocabularies();
117

  
118 112
	}
119 113

  
120 114
    protected List<TermVocabulary> createSelectedVocabularies() {
......
128 122
        return tempSelectedVocabularies;
129 123
    }
130 124

  
131
    private static UUID[] createVocabularyUuidList() {
132
        String preselectedVocString = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
133
        if (StringUtils.isBlank(preselectedVocString)){
134
            return null;
135
        }
136
        String[] preselectedVocArray = preselectedVocString.split(";");
137
        UUID[] uuidList = new UUID[preselectedVocArray.length];
138
        int i = 0;
139
        for (String uuidString: preselectedVocArray){
140
            uuidList[i]= UUID.fromString(uuidString);
141
            i++;
142
        }
143
        return uuidList;
144
    }
125
//    private static UUID[] createVocabularyUuidList() {
126
//        String preselectedVocString = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
127
//        if (StringUtils.isBlank(preselectedVocString)){
128
//            return null;
129
//        }
130
//        String[] preselectedVocArray = preselectedVocString.split(";");
131
//        UUID[] uuidList = new UUID[preselectedVocArray.length];
132
//        int i = 0;
133
//        for (String uuidString: preselectedVocArray){
134
//            uuidList[i]= UUID.fromString(uuidString);
135
//            i++;
136
//        }
137
//        return uuidList;
138
//    }
145 139

  
146 140

  
147 141
	private String getPrefKey(TermVocabulary vocabulary){
......
169 163
	private List<TermVocabulary> getAvailableVocabularies(){
170 164
	    vocabularies = new ArrayList();
171 165
	    CdmPreferenceCache cache = CdmPreferenceCache.instance();
172
        CdmPreference pref = cache.get(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
173
	    if (pref != null && !pref.isAllowOverride()){
174
            UUID[] preselectedVocabularyUuids = createVocabularyUuidList();
175

  
176
            for(int i=0;i<preselectedVocabularyUuids.length;i++){
177
                TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
178
                vocabularies.add(preselectedVocabulary);
179
            }
180
        }else{
166
//        CdmPreference pref = cache.get(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey());
167
//	    if (pref != null && !pref.isAllowOverride()){
168
//            UUID[] preselectedVocabularyUuids = createVocabularyUuidList();
169
//
170
//            for(int i=0;i<preselectedVocabularyUuids.length;i++){
171
//                TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
172
//                vocabularies.add(preselectedVocabulary);
173
//            }
174
//        }else{
181 175
            vocabularies = CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null);
182
        }
176
//        }
183 177
		//List<TermVocabulary> vocabularies = CdmStore.getService(IVocabularyService.class).listByTermType(TermType.NamedArea, true, null, null, null, null);
184 178
		return vocabularies;
185 179
	}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
423 423
    }
424 424

  
425 425
    private void createTaxonSections(RootElement parent) {
426
        NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration(true);
426
        NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration();
427 427
        ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
428 428
                getSectionStyle(ParsingMessagesSection.class, true));
429 429
        if (!config.isSimpleDetailsViewActivated()){

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)