Project

General

Profile

Revision 6285cec5

ID6285cec58095ab63c8755d011726313320881490
Parent e4aadd07
Child c059f13b

Added by Katja Luther almost 3 years ago

smaller changes in preferences

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ChecklistEditorGeneralAdminPreference.java
74 74
    }
75 75

  
76 76
    @Override
77
    public void init() {
77
    public void getValues() {
78 78

  
79 79
        distributionEditorPref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.DistributionEditorActivated);
80 80
        if (distributionEditorPref == null){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NomenclaturalCodePreferences.java
63 63
            CdmPreference pref = service.find(key);
64 64
            if (pref != null){
65 65
                actualCode = pref.getValue();
66

  
66
                allowOverride = pref.isAllowOverride();
67 67
            }else{
68 68
                actualCode = PreferencesUtil.getPreferenceKey(PreferencesUtil.getPreferredNomenclaturalCode());
69
                allowOverride = true;
69 70
            }
70
            allowOverride = pref.isAllowOverride();
71

  
71 72
        }
72 73

  
73 74
	    Composite composite = createComposite(parent);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/PublishFlagPreference.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
10 10

  
11
import org.eclipse.swt.SWT;
12
import org.eclipse.swt.custom.CLabel;
13
import org.eclipse.swt.events.SelectionEvent;
14
import org.eclipse.swt.events.SelectionListener;
15
import org.eclipse.swt.layout.GridData;
16
import org.eclipse.swt.layout.GridLayout;
17 11
import org.eclipse.swt.widgets.Combo;
18
import org.eclipse.swt.widgets.Composite;
19
import org.eclipse.swt.widgets.Control;
20 12

  
21 13
import eu.etaxonomy.cdm.api.application.ICdmRepository;
22 14
import eu.etaxonomy.cdm.api.service.IPreferenceService;
23 15
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
24
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
25
import eu.etaxonomy.taxeditor.l10n.Messages;
26 16
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
27 17
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
28 18
import eu.etaxonomy.taxeditor.preference.PublishEnum;
29
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
19
import eu.etaxonomy.taxeditor.preference.PublishFlagLocalPreference;
30 20
import eu.etaxonomy.taxeditor.store.CdmStore;
31 21

  
32 22
/**
......
34 24
 * @since 23.03.2018
35 25
 *
36 26
 */
37
public class PublishFlagPreference extends CdmPreferencePage implements IE4AdminPreferencePage{
27
public class PublishFlagPreference extends PublishFlagLocalPreference implements IE4AdminPreferencePage{
38 28

  
39 29
    PublishEnum publishBehaviour;
40 30

  
41 31
    Combo publishFlagBehaviour;
42 32
    CdmPreference pref = null;
43 33

  
34
    protected boolean allowOverride;
35

  
44 36
   @Override
45 37
   public void init() {
46 38
       super.init();
47 39

  
48 40

  
49 41
   }
50
    /**
51
     * {@inheritDoc}
52
     */
53
    @Override
54
    protected Control createContents(Composite parent) {
55
        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DefaultBehaviourForPublishFlag);
56
        if (pref == null){
57
            pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.DefaultBehaviourForPublishFlag, EditorPreferencePredicate.DefaultBehaviourForPublishFlag.getDefaultValue().toString());
58
        }
59

  
60
        final Composite composite = new Composite(parent, SWT.NULL);
61

  
62
        GridLayout gridLayout = new GridLayout();
63
        composite.setLayout(gridLayout);
64
        final CLabel description = new CLabel(composite, SWT.NULL);
65
        description.setText(Messages.PublishFlagPreference_description);
66

  
67
        GridData gridData = new GridData();
68
        gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
69
        gridData.horizontalIndent = 5;
70

  
71
        publishFlagBehaviour = new Combo(composite, SWT.BORDER| SWT.READ_ONLY);
72
        publishFlagBehaviour.addSelectionListener(new SelectionListener() {
73

  
74
            @Override
75
            public void widgetSelected(SelectionEvent e) {
76
                setApply(true);
77
            }
78

  
79
            @Override
80
            public void widgetDefaultSelected(SelectionEvent e) {
81
                // TODO Auto-generated method stub
82 42

  
83
            }
84
        });
85
        publishFlagBehaviour.setLayoutData(gridData);
86

  
87
        for(PublishEnum display: PublishEnum.values()){
88
            publishFlagBehaviour.add(display.getLabel());
89
        }
90

  
91
        int index = 0;
92

  
93
        PublishEnum publishFlag = PublishEnum.valueOf(pref.getValue());
94
        for (String itemLabel : publishFlagBehaviour.getItems()){
95
            if (itemLabel.equalsIgnoreCase(publishFlag.getLabel())){
96
                publishFlagBehaviour.select(index);
97
                break;
98
            }
99
            index++;
100
        }
101

  
102
        return composite;
103

  
104
    }
105 43

  
106 44

  
107 45
    @Override
......
117 55
            }
118 56
        }
119 57
        CdmPreference pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.DefaultBehaviourForPublishFlag, text);
120
        pref.setAllowOverride(true);
58
        pref.setAllowOverride(allowOverride);
121 59

  
122 60
        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
123 61
        if (controller == null){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
603 603
    public static String GfBioTerminologyImportPresenter_TEXT_SEARCH_DEFAULT;
604 604

  
605 605
    public static String PublishFlagPreference_description;
606
    public static String PublishFlagPreference_description_not_allowed;
606 607
    public static String PublishFlagPreference_do_not_set;
607 608
    public static String PublishFlagPreference_inherit;
608 609
    public static String PublishFlagPreference_set;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/ChecklistEditorGeneralPreference.java
482 482
     * {@inheritDoc}
483 483
     */
484 484
    @Override
485
    public void init() {
485
    public void getValues() {
486 486
        isAdminPreference = false;
487 487
        setPreferenceStore(PreferencesUtil.getPreferenceStore());
488 488
        distributionEditorPref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.DistributionEditorActivated);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DefaultFeatureTreePreferenecs.java
136 136
			defaultFeatureTreeForStructuredDescriptionUuid = defaultFeatureTreeForStructuredDescription.getUuid().toString();
137 137
		}
138 138

  
139
		getPreferenceStore().setValue(IPreferenceKeys.FEATURE_TREE_DEFAULT_TEXT, defaultFeatureTreeForTextualDescriptionUuid);
140
		getPreferenceStore().setValue(IPreferenceKeys.FEATURE_TREE_DEFAULT_STRUCTURE, defaultFeatureTreeForStructuredDescriptionUuid);
139
		getPreferenceStore().setValue(PreferencesUtil.createPreferenceString(IPreferenceKeys.FEATURE_TREE_DEFAULT_TEXT), defaultFeatureTreeForTextualDescriptionUuid);
140
		getPreferenceStore().setValue(PreferencesUtil.createPreferenceString(IPreferenceKeys.FEATURE_TREE_DEFAULT_STRUCTURE), defaultFeatureTreeForStructuredDescriptionUuid);
141 141

  
142 142
		return super.performOk();
143 143
	}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/EditorPreferencePredicate.java
65 65
    DistributionEditorActivated(UUID.fromString("733e9bce-4394-4fae-97d3-1b7dfc48ee3c"), "Distribution Editor Is activated", "distribution.editor.activated",  Boolean.TRUE),
66 66
    AreasSortedByIdInVocabulary(UUID.fromString("513d7de9-fec4-432c-b4dd-75f9f6e74ad0"), "Distribution Editor: Areas sorted by ID in Vocabulary", "distribution.editor.areas.sortedByIDInVoc", Boolean.FALSE),  //unsure about correct default value, please decide
67 67
    //the following 4 should be replaced by termLabelPreferenceEnum , enum should contain label, abbrevLabel, idInVoc, symbol1, symbol2, ...
68
    DisplayOfStatus(UUID.fromString("1ee6b945-0a81-4f05-b867-f9d105882249"), "Distribution Editor: Show Symbol for Status", "distribution.editor.status.showSymbol", TermDisplayEnum.Title),
68
    DisplayOfStatus(UUID.fromString("1ee6b945-0a81-4f05-b867-f9d105882249"), "Distribution Editor: Display of Status", "distribution.editor.status.display", TermDisplayEnum.Title),
69 69
    DisplayOfAreasInDistributionEditor(UUID.fromString("7b671bba-1b7f-4cb9-bbac-c914518a4bf8"), "Distribution Editor: Display of Areas", "distribution.editor.areas.displayAreas",  TermDisplayEnum.Title),
70 70
    OwnDescriptionForDistributionEditor(UUID.fromString("38282571-049c-473e-bec3-bde6f65f796a"), "Distribution Editor: Create distribution editor TaxonDescription", "distribution.editor.distributionOwnDescription",  Boolean.FALSE),
71 71

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
208 208

  
209 209
    public static final String LAST_SELECTED_REFERENCES = "eu.etaxonomy.taxeditor.references.selection.lastSelected";
210 210

  
211
    public static final String DO_NOT_PUBLISH = "DO NOT PUBLISH";
212
    public static final String INHERIT_FROM_PARENT = "PARENT";
213
    public static final String PUBLISH = "PUBLISH";
211
//    public static final String DO_NOT_PUBLISH = "DO NOT PUBLISH";
212
//    public static final String INHERIT_FROM_PARENT = "PARENT";
213
//    public static final String PUBLISH = "PUBLISH";
214 214

  
215 215
    public static final String FILTER_COMMON_NAME_REFERENCES = "eu.etaxonomy.taxeditor.references.selection.filterCommonNameReferences";
216 216

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/OrderPreferences.java
91 91

  
92 92
		@Override
93 93
		public boolean performOk() {
94
		    PreferencesUtil.setSortNodes(this.orderActivated);
95
	        PreferencesUtil.setStoreNavigatorState(isRestoreTaxonNavigator);
96
	    	MessageDialog.openInformation(getShell(), null, Messages.OrderPreferencePage_PleaseReopenNavigator);
97

  
94
		    if (this.orderActivated != null){
95
    		    PreferencesUtil.setSortNodes(this.orderActivated);
96
    	        PreferencesUtil.setStoreNavigatorState(isRestoreTaxonNavigator);
97
    	    	MessageDialog.openInformation(getShell(), null, Messages.OrderPreferencePage_PleaseReopenNavigator);
98
		    }
98 99
			return super.performOk();
99 100

  
100 101
		}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/CdmPreferencePage.java
125 125

  
126 126
    public void setApply(boolean isApply) {
127 127
        this.isApply = isApply;
128
        this.getApplyButton().setEnabled(this.isApply);
128
        if (this.getApplyButton() != null){
129
            this.getApplyButton().setEnabled(this.isApply);
130
        }
129 131
    }
130 132

  
131 133

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)