Project

General

Profile

« Previous | Next » 

Revision 185eb33b

Added by Katja Luther over 5 years ago

ref #7849: improve DB preference handling and use editorpreferencePredicates keys also for local preferences

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ChecklistEditorGeneralAdminPreference.java
14 14
import eu.etaxonomy.cdm.api.application.ICdmRepository;
15 15
import eu.etaxonomy.cdm.api.service.IPreferenceService;
16 16
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
17
import eu.etaxonomy.taxeditor.l10n.Messages;
17 18
import eu.etaxonomy.taxeditor.preference.ChecklistEditorGeneralPreference;
18 19
import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
19 20
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
......
27 28
public class ChecklistEditorGeneralAdminPreference extends ChecklistEditorGeneralPreference implements IE4AdminPreferencePage {
28 29

  
29 30

  
30

  
31

  
32

  
33 31
    @Override
34 32
    protected Control createContents(Composite parent) {
35

  
36
//        allowOverride = distributionPref.isAllowOverride();
37
//
38
//        final Button allowOverrideCheckButton = new Button(parent, SWT.CHECK);
39
//        allowOverrideCheckButton.setText(Messages.ChecklistEditorGeneralPreference_allowOverride);
40
//        allowOverrideCheckButton.setSelection(allowOverride);
41
//        allowOverrideCheckButton.addSelectionListener(new SelectionAdapter(){
42
//            @Override
43
//            public void widgetSelected(SelectionEvent e) {
44
//                allowOverride = allowOverrideCheckButton.getSelection();
45
//            }
46
//        });
47
//
48 33
        return super.createContents(parent);
49
//
50
//        final Button activateCheckButton = new Button(composite, SWT.CHECK);
51
//        activateCheckButton.setText(Messages.ChecklistEditorGeneralPreference_enable);
52
//        activateCheckButton.setSelection(isEditorActivated);
53
//        activateCheckButton.addSelectionListener(new SelectionAdapter(){
54
//            @Override
55
//            public void widgetSelected(SelectionEvent e) {
56
//                isEditorActivated = activateCheckButton.getSelection();
57
//
58
//                if(isEditorActivated){
59
//                    child.setVisible(true);
60
//                    child.setEnabled(true);
61
//                }else{
62
//                    child.setVisible(false);
63
//                    child.setEnabled(false);
64
//                }
65
//
66
//            }
67
//        });
68
//
69
//        child  = new Composite(composite, SWT.NULL);
70
//        child.setLayout(new GridLayout());
71
//        child.setVisible(isEditorActivated);
72
//
73
//
74
//
75
////
76
//
77
//
78
////
79
////        final CommandHandlerButton button_openWizard = new CommandHandlerButton(child, SWT.PUSH,
80
////                "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler");
81
////
82
////        button_openWizard.setText(Messages.ChecklistEditorGeneralPreference_open_distribution_selection);
83
//
84
////        Table table = new Table
85
//        final CLabel description = new CLabel(child, SWT.NULL);
86
//        description.setText(Messages.ChecklistEditorGeneralPreference_Configure_display_of_Areas);
87
//
88
//
89
//        GridData gridData = new GridData();
90
//        gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
91
//        gridData.horizontalIndent = 5;
92
////      classificationSelection.setLayoutData(gridData);
93
//
94
//
95
//        final Button showIdInVocabulary = new Button(child, SWT.RADIO);
96
//        CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowIdInVocabulary);
97
//        if (pref != null){
98
//            isShowIdInVocabulary = Boolean.valueOf(pref.getValue());
99
//        }else{
100
//            isShowIdInVocabulary = false;
101
//        }
102
//        showIdInVocabulary.setText(Messages.ChecklistEditorGeneralPreference_show_id_in_voc);
103
//        showIdInVocabulary.setSelection(isShowIdInVocabulary);
104
//        showIdInVocabulary.addSelectionListener(new SelectionAdapter(){
105
//            @Override
106
//            public void widgetSelected(SelectionEvent e) {
107
//                isShowIdInVocabulary = showIdInVocabulary.getSelection();
108
//
109
//             }
110
//        });
111
//        final Button showSymbol1 = new Button(child, SWT.RADIO);
112
//        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSymbol1);
113
//        if (pref != null){
114
//            isShowSymbol1 = Boolean.valueOf(pref.getValue());
115
//        }else{
116
//            isShowSymbol1 = false;
117
//        }
118
//        showSymbol1.setText(Messages.ChecklistEditorGeneralPreference_show_symbol1);
119
//        showSymbol1.setSelection(isShowSymbol1);
120
//        showSymbol1.addSelectionListener(new SelectionAdapter(){
121
//            @Override
122
//            public void widgetSelected(SelectionEvent e) {
123
//                isShowSymbol1 = showSymbol1.getSelection();
124
//
125
//             }
126
//        });
127
//        final Button showSymbol2 = new Button(child, SWT.RADIO);
128
//        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSymbol2);
129
//        if (pref != null){
130
//            isShowSymbol2 = Boolean.valueOf(pref.getValue());
131
//        }else{
132
//            isShowSymbol2 = false;
133
//        }
134
//        showSymbol2.setText(Messages.ChecklistEditorGeneralPreference_show_symbol2);
135
//        showSymbol2.setSelection(isShowSymbol2);
136
//        showSymbol2.addSelectionListener(new SelectionAdapter(){
137
//            @Override
138
//            public void widgetSelected(SelectionEvent e) {
139
//                isShowSymbol2 = showSymbol2.getSelection();
140
//
141
//             }
142
//        });
143
//        final Button showTitle = new Button(child, SWT.RADIO);
144
//        isShowTitle = !(isShowIdInVocabulary || isShowSymbol1 || isShowSymbol2);
145
//
146
//        showTitle.setText(Messages.ChecklistEditorGeneralPreference_show_title);
147
//        showTitle.setSelection(isShowTitle);
148
//        showTitle.addSelectionListener(new SelectionAdapter(){
149
//            @Override
150
//            public void widgetSelected(SelectionEvent e) {
151
//                isShowTitle = showTitle.getSelection();
152
//
153
//             }
154
//        });
155
//
156
//        final Label seperator1 = new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
157
//        final Button sortNamedAreaByVocabularyOrder = new Button(child, SWT.CHECK);
158
//
159
//        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.AreasSortedByIdInVocabulary);
160
//        if (pref != null){
161
//            isSortByVocabularyOrder = Boolean.valueOf(pref.getValue());
162
//        }else{
163
//            isSortByVocabularyOrder = false;
164
//        }
165
//
166
//        sortNamedAreaByVocabularyOrder.setText(Messages.ChecklistEditorGeneralPreference_sort_areas);
167
//        sortNamedAreaByVocabularyOrder.setSelection(isSortByVocabularyOrder);
168
//        sortNamedAreaByVocabularyOrder.addSelectionListener(new SelectionAdapter(){
169
//            @Override
170
//            public void widgetSelected(SelectionEvent e) {
171
//                isSortByVocabularyOrder = sortNamedAreaByVocabularyOrder.getSelection();
172
//             }
173
//        });
174
//        final Label seperator2 = new Label(child, SWT.HORIZONTAL | SWT.SEPARATOR);
175
//        final CLabel descriptionStatus = new CLabel(child, SWT.NULL);
176
//        descriptionStatus.setText(Messages.ChecklistEditorGeneralPreference_STATUS_DISPLAY_TEXT);
177
//        final Button showSymbol = new Button(child, SWT.CHECK);
178
//        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowSymbolForStatus);
179
//        if (pref != null){
180
//            isShowSymbol = Boolean.valueOf(pref.getValue());
181
//        }else{
182
//            isShowSymbol = false;
183
//        }
184
//
185
//        showSymbol.setText(Messages.ChecklistEditorGeneralPreference_show_symbol);
186
//        showSymbol.setSelection(isShowSymbol);
187
//        showSymbol.addSelectionListener(new SelectionAdapter(){
188
//            @Override
189
//            public void widgetSelected(SelectionEvent e) {
190
//                isShowSymbol = showSymbol.getSelection();
191
//             }
192
//        });
193
////        PreferencesUtil.recursiveSetEnabled(button_openWizard, CdmStore.isActive());
194
//        pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowRankInDistributionEditor);
195
//        if (pref != null){
196
//            isShowRank = Boolean.valueOf(pref.getValue());
197
//        }else{
198
//            isShowRank = false;
199
//        }
200
//
201
//        final Button activateRankButton = new Button(child, SWT.CHECK);
202
//        activateRankButton.setText(Messages.ChecklistEditorGeneralPreference_show_rank);
203
//        activateRankButton.setSelection(isShowRank);
204
//        activateRankButton.addSelectionListener(new SelectionAdapter(){
205
//            @Override
206
//            public void widgetSelected(SelectionEvent e) {
207
//                isShowRank = activateRankButton.getSelection();
208
//            }
209
//        });
210
//
211
//
212
//        if(isEditorActivated){
213
//            child.setEnabled(true);
214
//        }else{
215
//            child.setEnabled(false);
216
//        }
217 34

  
218
  //      return composite;
219 35
    }
220 36

  
221 37
    @Override
......
259 75
    }
260 76

  
261 77
    @Override
262
    public void init() {
263
        setPreferenceStore(PreferencesUtil.getPreferenceStore());
78
    public void getValues() {
79

  
264 80
        distributionEditorPref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.DistributionEditorActivated);
265 81
        if (distributionEditorPref == null){
266 82
            distributionEditorPref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.DistributionEditorActivated, EditorPreferencePredicate.DistributionEditorActivated.getDefaultValue().toString());
......
316 132

  
317 133
        commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler";
318 134
        commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler";
135
        overrideString = Messages.GeneralPreference_allowOverride;
319 136
        setValid(false);
320

  
321 137
    }
322 138

  
323 139
}

Also available in: Unified diff