Revision 4bff1cd7
Added by Katja Luther about 4 years ago
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle.properties | ||
---|---|---|
280 | 280 |
|
281 | 281 |
page.name.104 = Distribution Data |
282 | 282 |
page.name.105 = Status |
283 |
page.name.106 = Named area vocabularies |
|
283 |
page.name.106 = Named area vocabularies |
|
284 |
page.name.107 = Details View |
|
284 | 285 |
|
285 | 286 |
page.name.sources = Sources |
286 | 287 |
partdescriptor.label.4 = Character Tree Editor |
eu.etaxonomy.taxeditor.store/OSGI-INF/l10n/bundle_de.properties | ||
---|---|---|
281 | 281 |
page.name.104 = Verbreitungsdaten |
282 | 282 |
page.name.105 = Status |
283 | 283 |
page.name.106 = Gebietsvokabulare |
284 |
page.name.107 = Details View |
|
284 | 285 |
|
285 | 286 |
page.name.sources = Quellen |
286 | 287 |
partdescriptor.label.4 = Character-Baumeditor |
eu.etaxonomy.taxeditor.store/plugin.xml | ||
---|---|---|
648 | 648 |
id="eu.etaxonomy.taxeditor.preference.DistributionStatusPreferencePage" |
649 | 649 |
name="%page.name.105"> |
650 | 650 |
</page> |
651 |
<page |
|
652 |
category="eu.etaxonomy.taxeditor.preference.DistributionGeneralPreference" |
|
653 |
class="eu.etaxonomy.taxeditor.preference.DistributionDetailsViewPreference" |
|
654 |
id="eu.etaxonomy.taxeditor.preference.DistributionDetailsViewPreference" |
|
655 |
name="%page.name.107"> |
|
656 |
</page> |
|
651 | 657 |
<page |
652 | 658 |
category="eu.etaxonomy.taxeditor.preference.DistributionGeneralPreference" |
653 | 659 |
class="eu.etaxonomy.taxeditor.preference.NamedAreaVocabularyPreferencePage" |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties | ||
---|---|---|
536 | 536 |
FactualData_showModifier=Show modifier |
537 | 537 |
FactualData_showModifier_FreeText=Show modifier freetext |
538 | 538 |
FactualData_description=If a preference is not selectable, there is a serverside preference not allowed to override. |
539 |
FactualData_showIdInVocabulary=Show id in vocabulary in text field |
|
540 |
FactualData_showIdInVocabulary_tooltip=Show id in vocabulary in text field of details view |
|
539 |
FactualData_showIdInVocabulary=Show id in vocabulary in area text field
|
|
540 |
FactualData_showIdInVocabulary_tooltip=Show id in vocabulary in area text field of details view
|
|
541 | 541 |
DistributionAggregationWizardPage_AGGREGATION_MODE=Aggregation mode |
542 | 542 |
DistributionAggregationWizardPage_AREA=From sub area to super area |
543 | 543 |
DistributionAggregationWizardPage_AREA_LEVEL=Area Level |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties | ||
---|---|---|
535 | 535 |
FactualData_showModifier=Zeige Modifier |
536 | 536 |
FactualData_showModifier_FreeText=Zeige Freitext-Modifier |
537 | 537 |
FactualData_description=Wenn die Pr?ferenz nicht ausgew?hlt werden kann, dann gibt es eine serverseitige Pr?ferenz, die das ?berschreiben nicht erlaubt. |
538 |
FactualData_showIdInVocabulary=Zeige Id im Vokabular im Textfeld |
|
539 |
FactualData_showIdInVocabulary_tooltip=Zeige die Id im Vokabular im Textfeld des Details View |
|
538 |
FactualData_showIdInVocabulary=Zeige Id im Vokabular im Areal-Textfeld
|
|
539 |
FactualData_showIdInVocabulary_tooltip=Zeige die Id im Vokabular im Areal-Textfeld des Details View
|
|
540 | 540 |
DistributionAggregationWizardPage_AGGREGATION_MODE=Aggregation mode |
541 | 541 |
DistributionAggregationWizardPage_AREA=From sub area to super area |
542 | 542 |
DistributionAggregationWizardPage_AREA_LEVEL=Area Level |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DistributionDetailsViewPreference.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2019 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.preference; |
|
10 |
|
|
11 |
import org.eclipse.swt.events.SelectionAdapter; |
|
12 |
import org.eclipse.swt.events.SelectionEvent; |
|
13 |
import org.eclipse.swt.events.SelectionListener; |
|
14 |
import org.eclipse.swt.widgets.Button; |
|
15 |
import org.eclipse.swt.widgets.Combo; |
|
16 |
import org.eclipse.swt.widgets.Composite; |
|
17 |
import org.eclipse.swt.widgets.Control; |
|
18 |
|
|
19 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference; |
|
20 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
|
21 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
|
22 |
import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage; |
|
23 |
|
|
24 |
/** |
|
25 |
* @author k.luther |
|
26 |
* @since 02.07.2019 |
|
27 |
* |
|
28 |
*/ |
|
29 |
public class DistributionDetailsViewPreference extends CdmPreferencePage implements SelectionListener{ |
|
30 |
|
|
31 |
protected Combo comboShowIdInVocabularyInText; |
|
32 |
private boolean isOverrideShowIdInVoc = true; |
|
33 |
protected Boolean isShowIdInVoc; |
|
34 |
protected boolean allowOverrideShowIdInVoc; |
|
35 |
protected CdmPreference prefShowIdInVoc = null; |
|
36 |
Button allowOverrideButtonShowIdInVoc; |
|
37 |
/** |
|
38 |
* {@inheritDoc} |
|
39 |
*/ |
|
40 |
@Override |
|
41 |
protected Control createContents(Composite parent) { |
|
42 |
getValues(); |
|
43 |
Composite composite = createComposite(parent); |
|
44 |
//show Id in Vocabulary in textfield |
|
45 |
comboShowIdInVocabularyInText = createBooleanCombo(composite, SHOW, DO_NOT_SHOW, PreferencePredicate.NamedAreaWithIdInVoc, Messages.FactualData_showIdInVocabulary, isAdminPreference); |
|
46 |
comboShowIdInVocabularyInText.setToolTipText(Messages.FactualData_showIdInVocabulary_tooltip); |
|
47 |
comboShowIdInVocabularyInText.addSelectionListener(this); |
|
48 |
if (this.isAdminPreference){ |
|
49 |
allowOverrideButtonShowIdInVoc = createAllowOverrideButton(composite); |
|
50 |
allowOverrideButtonShowIdInVoc.setSelection(allowOverrideShowIdInVoc); |
|
51 |
allowOverrideButtonShowIdInVoc.addSelectionListener(new SelectionAdapter(){ |
|
52 |
@Override |
|
53 |
public void widgetSelected(SelectionEvent e) { |
|
54 |
allowOverrideShowIdInVoc = !allowOverrideShowIdInVoc; |
|
55 |
setApply(true); |
|
56 |
} |
|
57 |
}); |
|
58 |
} |
|
59 |
int index = 0; |
|
60 |
if(isShowIdInVoc==null){ |
|
61 |
comboShowIdInVocabularyInText.select(0); |
|
62 |
} else{ |
|
63 |
for (String itemLabel : comboShowIdInVocabularyInText.getItems()){ |
|
64 |
if (itemLabel.startsWith(this.SHOW) && isShowIdInVoc){ |
|
65 |
comboShowIdInVocabularyInText.select(index); |
|
66 |
break; |
|
67 |
} |
|
68 |
if (itemLabel.startsWith(DO_NOT_SHOW) && !isShowIdInVoc){ |
|
69 |
comboShowIdInVocabularyInText.select(index); |
|
70 |
break; |
|
71 |
} |
|
72 |
index++; |
|
73 |
} |
|
74 |
} |
|
75 |
if (!isAdminPreference){ |
|
76 |
comboShowIdInVocabularyInText.setEnabled(allowOverrideShowIdInVoc); |
|
77 |
} |
|
78 |
|
|
79 |
|
|
80 |
return composite; |
|
81 |
} |
|
82 |
@Override |
|
83 |
public void getValues(){ |
|
84 |
//get show IdInVocabulary values |
|
85 |
prefShowIdInVoc = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NamedAreaWithIdInVoc); |
|
86 |
if (prefShowIdInVoc == null){ |
|
87 |
prefShowIdInVoc = CdmPreference.NewTaxEditorInstance(PreferencePredicate.NamedAreaWithIdInVoc, PreferencePredicate.NamedAreaWithIdInVoc.getDefaultValue().toString()); |
|
88 |
} |
|
89 |
allowOverrideShowIdInVoc = prefShowIdInVoc.isAllowOverride(); |
|
90 |
isShowIdInVoc = null; |
|
91 |
String showIdInVoc = PreferencesUtil.getStringValue(PreferencePredicate.NamedAreaWithIdInVoc.getKey(), true); |
|
92 |
if (showIdInVoc != null){ |
|
93 |
isShowIdInVoc = Boolean.valueOf(showIdInVoc); |
|
94 |
} |
|
95 |
|
|
96 |
isOverrideShowIdInVoc = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NamedAreaWithIdInVoc.getKey())); |
|
97 |
if (!isOverrideShowIdInVoc){ |
|
98 |
isShowIdInVoc = null; |
|
99 |
} |
|
100 |
|
|
101 |
} |
|
102 |
|
|
103 |
@Override |
|
104 |
protected void performDefaults() { |
|
105 |
isShowIdInVoc = null; |
|
106 |
allowOverrideShowIdInVoc = true; |
|
107 |
|
|
108 |
comboShowIdInVocabularyInText.select(0); |
|
109 |
if (isAdminPreference){ |
|
110 |
allowOverrideButtonShowIdInVoc.setSelection(allowOverrideShowIdInVoc); |
|
111 |
} |
|
112 |
|
|
113 |
setApply(true); |
|
114 |
super.performDefaults(); |
|
115 |
} |
|
116 |
@Override |
|
117 |
public void widgetSelected(SelectionEvent e) { |
|
118 |
if (e.getSource().equals(this.comboShowIdInVocabularyInText)) { |
|
119 |
String text = comboShowIdInVocabularyInText.getText(); |
|
120 |
if (text.startsWith(Messages.Preference_Use_Default)){ |
|
121 |
isOverrideShowIdInVoc = false; |
|
122 |
isShowIdInVoc = null; |
|
123 |
|
|
124 |
}else if (text.equals(SHOW)){ |
|
125 |
isShowIdInVoc = true; |
|
126 |
isOverrideShowIdInVoc = true; |
|
127 |
}else{ |
|
128 |
isShowIdInVoc = false; |
|
129 |
isOverrideShowIdInVoc = true; |
|
130 |
} |
|
131 |
|
|
132 |
} |
|
133 |
setApply(true); |
|
134 |
|
|
135 |
} |
|
136 |
|
|
137 |
@Override |
|
138 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
139 |
} |
|
140 |
|
|
141 |
@Override |
|
142 |
public boolean performOk() { |
|
143 |
if (isApply()){ |
|
144 |
if (isShowIdInVoc != null){ |
|
145 |
PreferencesUtil.setStringValue(PreferencePredicate.NamedAreaWithIdInVoc.getKey(), Boolean.toString(isShowIdInVoc)); |
|
146 |
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NamedAreaWithIdInVoc.getKey()), true); |
|
147 |
|
|
148 |
}else{ |
|
149 |
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NamedAreaWithIdInVoc.getKey()), false); |
|
150 |
} |
|
151 |
|
|
152 |
} |
|
153 |
return true; |
|
154 |
} |
|
155 |
|
|
156 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/DistributionGeneralPreference.java | ||
---|---|---|
20 | 20 |
*/ |
21 | 21 |
public class DistributionGeneralPreference extends CdmPreferencePage { |
22 | 22 |
|
23 |
/** |
|
24 |
* {@inheritDoc} |
|
25 |
*/ |
|
26 | 23 |
@Override |
27 | 24 |
protected Control createContents(Composite parent) { |
28 | 25 |
noDefaultAndApplyButton(); |
29 | 26 |
return null; |
30 | 27 |
} |
31 | 28 |
|
29 |
|
|
30 |
|
|
32 | 31 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/FactualDataPreference.java | ||
---|---|---|
49 | 49 |
protected boolean allowOverrideFreeText; |
50 | 50 |
private boolean isOverrideFreeText = true; |
51 | 51 |
|
52 |
protected Combo comboShowIdInVocabularyInText; |
|
53 |
private boolean isOverrideShowIdInVoc = true; |
|
54 |
protected Boolean isShowIdInVoc; |
|
55 |
protected boolean allowOverrideShowIdInVoc; |
|
56 |
protected CdmPreference prefShowIdInVoc = null; |
|
57 |
Button allowOverrideButtonShowIdInVoc; |
|
52 |
|
|
58 | 53 |
|
59 | 54 |
@Override |
60 | 55 |
public void init() { |
... | ... | |
139 | 134 |
comboShowModifierFreeText.setEnabled(allowOverrideFreeText); |
140 | 135 |
} |
141 | 136 |
|
142 |
//show Id in Vocabulary in textfield |
|
143 |
comboShowIdInVocabularyInText = createBooleanCombo(composite, SHOW, DO_NOT_SHOW, PreferencePredicate.NamedAreaWithIdInVoc, Messages.FactualData_showIdInVocabulary, isAdminPreference); |
|
144 |
comboShowIdInVocabularyInText.setToolTipText(Messages.FactualData_showIdInVocabulary_tooltip); |
|
145 |
comboShowIdInVocabularyInText.addSelectionListener(this); |
|
146 |
if (this.isAdminPreference){ |
|
147 |
allowOverrideButtonShowIdInVoc = createAllowOverrideButton(composite); |
|
148 |
allowOverrideButtonShowIdInVoc.setSelection(allowOverrideShowIdInVoc); |
|
149 |
allowOverrideButtonShowIdInVoc.addSelectionListener(new SelectionAdapter(){ |
|
150 |
@Override |
|
151 |
public void widgetSelected(SelectionEvent e) { |
|
152 |
allowOverrideShowIdInVoc = !allowOverrideShowIdInVoc; |
|
153 |
setApply(true); |
|
154 |
} |
|
155 |
}); |
|
156 |
} |
|
157 |
index = 0; |
|
158 |
if(isShowIdInVoc==null){ |
|
159 |
comboShowIdInVocabularyInText.select(0); |
|
160 |
} else{ |
|
161 |
for (String itemLabel : comboShowIdInVocabularyInText.getItems()){ |
|
162 |
if (itemLabel.startsWith(this.SHOW) && isShowIdInVoc){ |
|
163 |
comboShowIdInVocabularyInText.select(index); |
|
164 |
break; |
|
165 |
} |
|
166 |
if (itemLabel.startsWith(DO_NOT_SHOW) && !isShowIdInVoc){ |
|
167 |
comboShowIdInVocabularyInText.select(index); |
|
168 |
break; |
|
169 |
} |
|
170 |
index++; |
|
171 |
} |
|
172 |
} |
|
173 |
if (!isAdminPreference){ |
|
174 |
comboShowIdInVocabularyInText.setEnabled(allowOverrideShowIdInVoc); |
|
175 |
} |
|
176 |
|
|
177 | 137 |
|
178 | 138 |
return composite; |
179 | 139 |
|
... | ... | |
198 | 158 |
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.ShowModifierFreeText.getKey()), false); |
199 | 159 |
} |
200 | 160 |
|
201 |
if (isShowIdInVoc != null){ |
|
202 |
PreferencesUtil.setStringValue(PreferencePredicate.NamedAreaWithIdInVoc.getKey(), Boolean.toString(isShowIdInVoc)); |
|
203 |
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NamedAreaWithIdInVoc.getKey()), true); |
|
204 |
|
|
205 |
}else{ |
|
206 |
PreferencesUtil.setBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NamedAreaWithIdInVoc.getKey()), false); |
|
207 |
} |
|
208 |
|
|
209 | 161 |
} |
210 | 162 |
return true; |
211 | 163 |
} |
... | ... | |
246 | 198 |
isShowModifierFreeText = null; |
247 | 199 |
} |
248 | 200 |
|
249 |
//get show IdInVocabulary values |
|
250 |
prefShowIdInVoc = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NamedAreaWithIdInVoc); |
|
251 |
if (prefShowIdInVoc == null){ |
|
252 |
prefShowIdInVoc = CdmPreference.NewTaxEditorInstance(PreferencePredicate.NamedAreaWithIdInVoc, PreferencePredicate.NamedAreaWithIdInVoc.getDefaultValue().toString()); |
|
253 |
} |
|
254 |
allowOverrideShowIdInVoc = prefShowIdInVoc.isAllowOverride(); |
|
255 |
isShowIdInVoc = null; |
|
256 |
String showIdInVoc = PreferencesUtil.getStringValue(PreferencePredicate.NamedAreaWithIdInVoc.getKey(), true); |
|
257 |
if (showIdInVoc != null){ |
|
258 |
isShowIdInVoc = Boolean.valueOf(showIdInVoc); |
|
259 |
} |
|
260 |
|
|
261 |
isOverrideShowIdInVoc = PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.NamedAreaWithIdInVoc.getKey())); |
|
262 |
if (!isOverrideShowIdInVoc){ |
|
263 |
isShowIdInVoc = null; |
|
264 |
} |
|
265 | 201 |
|
266 | 202 |
} |
267 | 203 |
|
... | ... | |
282 | 218 |
if (isAdminPreference){ |
283 | 219 |
allowOverrideFreeTextButton.setSelection(allowOverrideFreeText); |
284 | 220 |
} |
285 |
|
|
286 |
isShowIdInVoc = null; |
|
287 |
allowOverrideShowIdInVoc = true; |
|
288 |
|
|
289 |
comboShowIdInVocabularyInText.select(0); |
|
290 |
if (isAdminPreference){ |
|
291 |
allowOverrideButtonShowIdInVoc.setSelection(allowOverrideShowIdInVoc); |
|
292 |
} |
|
293 |
|
|
294 | 221 |
setApply(true); |
295 | 222 |
super.performDefaults(); |
296 | 223 |
} |
... | ... | |
326 | 253 |
isOverrideFreeText = true; |
327 | 254 |
} |
328 | 255 |
|
329 |
} |
|
330 |
|
|
331 |
if (e.getSource().equals(this.comboShowIdInVocabularyInText)) { |
|
332 |
String text = comboShowIdInVocabularyInText.getText(); |
|
333 |
if (text.startsWith(Messages.Preference_Use_Default)){ |
|
334 |
isOverrideShowIdInVoc = false; |
|
335 |
isShowIdInVoc = null; |
|
336 |
|
|
337 |
}else if (text.equals(SHOW)){ |
|
338 |
isShowIdInVoc = true; |
|
339 |
isOverrideShowIdInVoc = true; |
|
340 |
}else{ |
|
341 |
isShowIdInVoc = false; |
|
342 |
isOverrideShowIdInVoc = true; |
|
343 |
} |
|
344 |
|
|
345 | 256 |
} |
346 | 257 |
setApply(true); |
347 | 258 |
|
Also available in: Unified diff
fix #8725: move preference