Revision 256fbc69
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import eu.etaxonomy.cdm.io.specimen.abcd206.in.Abcd206ImportConfigurator; |
27 | 27 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference; |
28 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
|
28 | 29 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
29 | 30 |
import eu.etaxonomy.taxeditor.l10n.Messages; |
30 | 31 |
import eu.etaxonomy.taxeditor.model.NomenclaturalCodeHelper; |
... | ... | |
115 | 116 |
.getDescription(code)); |
116 | 117 |
|
117 | 118 |
} |
118 |
nomenclaturalCodeCombo.select(0);
|
|
119 |
nomenclaturalCodeCombo.select(0); |
|
119 | 120 |
getLabelAndValues(); |
120 | 121 |
//get the actual nomenclatural code and set it as selection: doGetPreferenceStore().getString(IPreferenceKeys.CDM_NOMENCLATURAL_CODE_KEY); |
121 | 122 |
nomenclaturalCodeCombo.addSelectionListener(new SelectionAdapter() { |
... | ... | |
201 | 202 |
|
202 | 203 |
|
203 | 204 |
public void createSpecimenOrObservationTab(Composite parent){ |
204 |
composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation);
|
|
205 |
composite = addTab(Messages.DatabasePreferencesPage_Specimen_Or_Observation); |
|
205 | 206 |
|
206 | 207 |
final Button showCollectingAreaInGeneralSectionButton = new Button(composite, SWT.CHECK); |
207 |
boolean isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION); |
|
208 |
CdmPreference isShowCollectingAreaInGeneralSection = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection); |
|
209 |
|
|
208 | 210 |
showCollectingAreaInGeneralSectionButton.setText(Messages.DatabasePreferncesPage_Show_Collecting_Areas_in_general_section); |
209 |
showCollectingAreaInGeneralSectionButton.setSelection(isShowCollectingAreaInGeneralSection); |
|
211 |
|
|
212 |
showCollectingAreaInGeneralSectionButton.setSelection(Boolean.valueOf(isShowCollectingAreaInGeneralSection.getValue())); |
|
210 | 213 |
showCollectingAreaInGeneralSectionButton.addSelectionListener(new SelectionAdapter(){ |
211 | 214 |
@Override |
212 | 215 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
216 | 219 |
}); |
217 | 220 |
|
218 | 221 |
final Button determinationOnlyForFieldUnitsButton = new Button(composite, SWT.CHECK); |
219 |
boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS); |
|
222 |
// boolean isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS); |
|
223 |
CdmPreference isDeterminationOnlyForFieldUnits = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits); |
|
224 |
|
|
220 | 225 |
determinationOnlyForFieldUnitsButton.setText(Messages.DatabasePreferncesPage_Determination_only_for_field_unnits); |
221 |
determinationOnlyForFieldUnitsButton.setSelection(isDeterminationOnlyForFieldUnits); |
|
226 |
|
|
227 |
determinationOnlyForFieldUnitsButton.setSelection(Boolean.valueOf(isDeterminationOnlyForFieldUnits.getValue())); |
|
222 | 228 |
determinationOnlyForFieldUnitsButton.addSelectionListener(new SelectionAdapter(){ |
223 | 229 |
@Override |
224 | 230 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
228 | 234 |
}); |
229 | 235 |
|
230 | 236 |
final Button showTaxonAssociationButton = new Button(composite, SWT.CHECK); |
231 |
boolean isShowTaxonAssociation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS);
|
|
237 |
CdmPreference isShowTaxonAssociation = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations);
|
|
232 | 238 |
showTaxonAssociationButton.setText(Messages.DatabasePreferncesPage_Taxon_Associations); |
233 |
showTaxonAssociationButton.setSelection(isShowTaxonAssociation); |
|
239 |
|
|
240 |
showTaxonAssociationButton.setSelection(Boolean.valueOf(isShowTaxonAssociation.getValue())); |
|
234 | 241 |
showTaxonAssociationButton.addSelectionListener(new SelectionAdapter(){ |
235 | 242 |
@Override |
236 | 243 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
255 | 262 |
|
256 | 263 |
|
257 | 264 |
final Button useLocalPreference = new Button(composite, SWT.CHECK); |
258 |
boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF);
|
|
265 |
boolean isUseLocalPreference = isShowTaxonAssociation.isAllowOverride();
|
|
259 | 266 |
useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences); |
260 | 267 |
GridData gridData = new GridData(SWT.FILL, SWT.BOTTOM, false, false); |
261 | 268 |
gridData.verticalIndent = 10; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesWizard.java | ||
---|---|---|
67 | 67 |
service.set(pref); |
68 | 68 |
|
69 | 69 |
value = getPreferencePage().getNameDetailsConfig().createNameDetailsViewConfig().toString(); |
70 |
allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAMEDETAILS); |
|
70 |
allowOverride = getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
|
|
71 | 71 |
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.NameDetailsView, value); |
72 | 72 |
pref.setAllowOverride(allowOverride); |
73 | 73 |
service.set(pref); |
... | ... | |
89 | 89 |
pref.setAllowOverride(allowOverride); |
90 | 90 |
service.set(pref); |
91 | 91 |
|
92 |
boolean isShowLifeForm= getPreferencePage().doGetPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM); |
|
93 |
pref = CdmPreference.NewDatabaseInstance( PreferencePredicate.ShowLifeForm, String.valueOf(isShowLifeForm)); |
|
94 |
pref.setAllowOverride(allowOverride); |
|
95 |
service.set(pref); |
|
96 |
|
|
92 | 97 |
String biocaseProviderList = this.getPreferencePage().getBiocaseProviderList().createAllProviderString(); |
93 | 98 |
if (biocaseProviderList == null){ |
94 | 99 |
getPreferencePage().doGetPreferenceStore().setValue(IPreferenceKeys.BIOCASE_PROVIDER_LIST,""); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java | ||
---|---|---|
177 | 177 |
* Key for the saved P2 repositories |
178 | 178 |
*/ |
179 | 179 |
public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories"; |
180 |
public static final String ALLOW_OVERRIDE_NAMEDETAILS = "eu.etaxonomy.taxeditor.details.allow_override"; |
|
180 |
// public static final String ALLOW_OVERRIDE_NAMEDETAILS = "eu.etaxonomy.taxeditor.details.allow_override";
|
|
181 | 181 |
public static final String ALLOW_OVERRIDE_RL = "eu.etaxonomy.taxeditor.isRL.allow_override"; |
182 | 182 |
public static final String ALLOW_OVERRIDE_SPECIMEN_PREF = "eu.etaxonomy.taxeditor.specimen.allowOverride"; |
183 | 183 |
public static final String ALLOW_OVERRIDE_NAME_DETAILS = "eu.etaxonomy.taxeditor.name.allowOverride"; |
184 |
|
|
184 |
public static final String OVERRIDE_SPECIMEN_PREF = "eu.etaxonomy.taxeditor.name.override"; |
|
185 | 185 |
/* |
186 | 186 |
* Keys for the Abcd Import Configurator |
187 | 187 |
* |
... | ... | |
221 | 221 |
|
222 | 222 |
|
223 | 223 |
|
224 |
|
|
224 | 225 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java | ||
---|---|---|
188 | 188 |
return null; |
189 | 189 |
} |
190 | 190 |
|
191 |
public static boolean isShowTaxonAssociations(){ |
|
192 |
if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) { |
|
193 |
return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS); |
|
194 |
} else{ |
|
195 |
CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations); |
|
196 |
|
|
197 |
return Boolean.valueOf(pref.getValue()); |
|
198 |
} |
|
199 |
} |
|
200 |
|
|
201 |
public static boolean isShowLifeForm(){ |
|
202 |
if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) { |
|
203 |
return getPreferenceStore().getBoolean(SHOW_LIFE_FORM); |
|
204 |
} else{ |
|
205 |
CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowLifeForm); |
|
206 |
|
|
207 |
return Boolean.valueOf(pref.getValue()); |
|
208 |
} |
|
209 |
} |
|
210 |
|
|
211 |
public static boolean isDeterminationOnlyForFieldUnits(){ |
|
212 |
if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) { |
|
213 |
return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS); |
|
214 |
} else{ |
|
215 |
CdmPreference pref = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits); |
|
216 |
|
|
217 |
return Boolean.valueOf(pref.getValue()); |
|
218 |
} |
|
219 |
} |
|
220 |
|
|
221 |
public static boolean isCollectingAreaInGeneralSection(){ |
|
222 |
if (getPreferenceStore().getBoolean(OVERRIDE_SPECIMEN_PREF) && getPreferenceStore().getBoolean(ALLOW_OVERRIDE_SPECIMEN_PREF)) { |
|
223 |
return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION); |
|
224 |
} else{ |
|
225 |
CdmPreference pref = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection); |
|
226 |
|
|
227 |
return Boolean.valueOf(pref.getValue()); |
|
228 |
} |
|
229 |
} |
|
230 |
|
|
191 | 231 |
|
192 |
private static CdmPreference getPreferenceFromDB(PreferencePredicate predicate){ |
|
232 |
|
|
233 |
public static CdmPreference getPreferenceFromDB(PreferencePredicate predicate){ |
|
193 | 234 |
ICdmRepository controller; |
194 | 235 |
CdmPreference pref = null; |
195 | 236 |
|
... | ... | |
952 | 993 |
public static void setShowIdInVocabularyInChecklistEditor(boolean selection) { |
953 | 994 |
getPreferenceStore().setValue(CHECKLIST_ID_IN_VOCABULARY, selection); |
954 | 995 |
} |
955 |
|
|
996 |
|
|
956 | 997 |
/** |
957 | 998 |
* @return |
958 | 999 |
*/ |
... | ... | |
990 | 1031 |
return null; |
991 | 1032 |
} |
992 | 1033 |
|
993 |
getPreferenceStore().setValue(ALLOW_OVERRIDE_NAMEDETAILS, preference.isAllowOverride()); |
|
1034 |
getPreferenceStore().setValue(ALLOW_OVERRIDE_NAME_DETAILS, preference.isAllowOverride());
|
|
994 | 1035 |
|
995 | 1036 |
//the preference value is build like this: |
996 | 1037 |
//<section1>:true;<section2>:false.... |
... | ... | |
1055 | 1096 |
getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, |
1056 | 1097 |
(getValue(sectionMap,"nameRelation"))); |
1057 | 1098 |
config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation")); |
1058 |
|
|
1099 |
|
|
1059 | 1100 |
getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_HYBRID, |
1060 | 1101 |
(getValue(sectionMap, "hybrid"))); |
1061 | 1102 |
config.setHybridActivated(getValue(sectionMap,"hybrid")); |
... | ... | |
1069 | 1110 |
}else{ |
1070 | 1111 |
return true; |
1071 | 1112 |
} |
1072 |
|
|
1073 |
} |
|
1074 |
|
|
1075 |
public static boolean getIsDeterminiationOnlyForFieldUnit(boolean local){ |
|
1076 |
CdmPreference preference = null; |
|
1077 |
|
|
1078 |
if (!local) { |
|
1079 |
preference = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits); |
|
1080 |
} |
|
1081 |
if (preference == null){ |
|
1082 |
return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS); |
|
1083 |
} |
|
1084 |
return Boolean.valueOf(preference.getValue()); |
|
1085 |
} |
|
1086 |
|
|
1087 |
public static boolean getIsShowCollectingAreasInGeneralSection(boolean local){ |
|
1088 |
CdmPreference preference = null; |
|
1089 |
|
|
1090 |
if (!local) { |
|
1091 |
preference = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection); |
|
1092 |
} |
|
1093 |
if (preference == null){ |
|
1094 |
return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION); |
|
1095 |
} |
|
1096 |
return Boolean.valueOf(preference.getValue()); |
|
1097 |
} |
|
1098 | 1113 |
|
1099 |
public static boolean getIsShowTaxonAssociations(boolean local){ |
|
1100 |
CdmPreference preference = null; |
|
1114 |
} |
|
1101 | 1115 |
|
1102 |
if (!local) { |
|
1103 |
preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations); |
|
1104 |
} |
|
1105 |
if (preference == null){ |
|
1106 |
return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS); |
|
1107 |
} |
|
1108 |
return Boolean.valueOf(preference.getValue()); |
|
1109 |
} |
|
1116 |
// public static boolean isDeterminiationOnlyForFieldUnit(boolean local){ |
|
1117 |
// CdmPreference preference = null; |
|
1118 |
// |
|
1119 |
// if (!local) { |
|
1120 |
// preference = getPreferenceFromDB(PreferencePredicate.DeterminationOnlyForFieldUnits); |
|
1121 |
// } |
|
1122 |
// if (preference == null){ |
|
1123 |
// return getPreferenceStore().getBoolean(DETERMINATION_ONLY_FOR_FIELD_UNITS); |
|
1124 |
// } |
|
1125 |
// return Boolean.valueOf(preference.getValue()); |
|
1126 |
// } |
|
1127 |
// |
|
1128 |
// public static boolean isShowCollectingAreasInGeneralSection(boolean local){ |
|
1129 |
// CdmPreference preference = null; |
|
1130 |
// |
|
1131 |
// if (!local) { |
|
1132 |
// preference = getPreferenceFromDB(PreferencePredicate.ShowCollectingAreasInGeneralSection); |
|
1133 |
// } |
|
1134 |
// if (preference == null){ |
|
1135 |
// return getPreferenceStore().getBoolean(SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION); |
|
1136 |
// } |
|
1137 |
// return Boolean.valueOf(preference.getValue()); |
|
1138 |
// } |
|
1139 |
// |
|
1140 |
// public static boolean isShowTaxonAssociations(boolean local){ |
|
1141 |
// CdmPreference preference = null; |
|
1142 |
// |
|
1143 |
// if (!local) { |
|
1144 |
// preference = getPreferenceFromDB(PreferencePredicate.ShowTaxonAssociations); |
|
1145 |
// } |
|
1146 |
// if (preference == null){ |
|
1147 |
// return getPreferenceStore().getBoolean(SHOW_TAXON_ASSOCIATIONS); |
|
1148 |
// } |
|
1149 |
// return Boolean.valueOf(preference.getValue()); |
|
1150 |
// } |
|
1110 | 1151 |
|
1111 | 1152 |
// public static boolean getBioCaseProvider(boolean local){ |
1112 | 1153 |
// CdmPreference preference = null; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import org.eclipse.jface.preference.BooleanFieldEditor; |
12 | 12 |
import org.eclipse.jface.preference.FieldEditorPreferencePage; |
13 |
import org.eclipse.swt.SWT; |
|
14 |
import org.eclipse.swt.layout.GridData; |
|
15 |
import org.eclipse.swt.widgets.Label; |
|
13 | 16 |
import org.eclipse.ui.IWorkbench; |
14 | 17 |
import org.eclipse.ui.IWorkbenchPreferencePage; |
15 | 18 |
|
19 |
import eu.etaxonomy.cdm.api.application.ICdmRepository; |
|
20 |
import eu.etaxonomy.cdm.api.service.IPreferenceService; |
|
21 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference; |
|
22 |
import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey; |
|
23 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
|
24 |
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject; |
|
25 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
26 |
|
|
16 | 27 |
/** |
17 | 28 |
* @author pplitzner |
18 | 29 |
* @date 13.02.2014 |
... | ... | |
23 | 34 |
@Override |
24 | 35 |
public void init(IWorkbench workbench) { |
25 | 36 |
setPreferenceStore(PreferencesUtil.getPreferenceStore()); |
37 |
ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration(); |
|
38 |
if (controller != null){ |
|
39 |
IPreferenceService service = controller.getPreferenceService(); |
|
40 |
PrefKey keyTaxonAssociation = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowTaxonAssociations); |
|
41 |
CdmPreference prefTaxonAssociation = service.find(keyTaxonAssociation); |
|
42 |
PrefKey keyDeterminationFieldUnit = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.DeterminationOnlyForFieldUnits); |
|
43 |
CdmPreference prefDeterminationFieldUnit = service.find(keyDeterminationFieldUnit); |
|
44 |
PrefKey keyCollectingAreas = CdmPreference.NewKey(PreferenceSubject.NewDatabaseInstance(), PreferencePredicate.ShowCollectingAreasInGeneralSection); |
|
45 |
CdmPreference prefCollectingAreas = service.find(keyCollectingAreas); |
|
46 |
|
|
47 |
getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_SPECIMEN_PREF, prefTaxonAssociation == null? true : prefTaxonAssociation.isAllowOverride()); |
|
48 |
} |
|
49 |
if (getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY)) { |
|
50 |
setDescription("Set the preferences for the display of specimen and obeservations."); |
|
51 |
}else{ |
|
52 |
setDescription("The CDM settings don't allow to set the preferences for the display of specimen and obeservations locally. If you need to make local settings, please ask an administrator."); |
|
53 |
|
|
54 |
} |
|
26 | 55 |
} |
27 | 56 |
|
28 | 57 |
@Override |
... | ... | |
37 | 66 |
addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS, |
38 | 67 |
"Show taxon associations of a specimen in the details view", |
39 | 68 |
getFieldEditorParent())); |
40 |
} else { |
|
41 |
setDescription("The CDM settings don't allow to set the preferences for editing specimen locally. If you need to make local settings, please ask an administrator."); |
|
69 |
addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_LIFE_FORM, |
|
70 |
"Show taxon associations of a specimen in the details view", |
|
71 |
getFieldEditorParent())); |
|
72 |
Label label = new Label(getFieldEditorParent(), SWT.NONE); |
|
73 |
|
|
74 |
label.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1)); |
|
75 |
|
|
76 |
addField(new BooleanFieldEditor( |
|
77 |
IPreferenceKeys.OVERRIDE_SPECIMEN_PREF, |
|
78 |
"Use local specimen preferences", |
|
79 |
getFieldEditorParent())); |
|
80 |
|
|
81 |
|
|
42 | 82 |
} |
43 | 83 |
|
44 | 84 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/AbstractDeterminationEventDetailSection.java | ||
---|---|---|
12 | 12 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
13 | 13 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
14 | 14 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
15 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
16 | 15 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
17 | 16 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
18 | 17 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
... | ... | |
48 | 47 |
@Override |
49 | 48 |
public DeterminationEvent createNewElement() { |
50 | 49 |
DeterminationEvent instance = DeterminationEvent.NewInstance(); |
51 |
if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
|
|
50 |
if(PreferencesUtil.isDeterminationOnlyForFieldUnits()){
|
|
52 | 51 |
instance.setIdentifiedUnit(getEntity().innerFieldUnit()); |
53 | 52 |
} |
54 | 53 |
else{ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java | ||
---|---|---|
25 | 25 |
import eu.etaxonomy.taxeditor.ui.element.LayoutConstants; |
26 | 26 |
import eu.etaxonomy.taxeditor.ui.element.OriginalLabelDataElement; |
27 | 27 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; |
28 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
|
29 | 28 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; |
30 | 29 |
|
31 | 30 |
/** |
... | ... | |
57 | 56 |
private SourceCollectionDetailSection section_source; |
58 | 57 |
|
59 | 58 |
private OriginalLabelDataElement textOriginalLabel; |
60 |
|
|
59 |
|
|
61 | 60 |
|
62 | 61 |
|
63 | 62 |
/** |
... | ... | |
116 | 115 |
|
117 | 116 |
textOriginalLabel = formFactory.createOriginalLabelDataElement(formElement); |
118 | 117 |
textOriginalLabel.setEntity(getEntity()); |
119 |
|
|
118 |
|
|
120 | 119 |
super.createControls(formElement, entity, style); |
121 | 120 |
|
122 | 121 |
section_source = formFactory.createSourceCollectionDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE); |
123 | 122 |
section_source.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
124 | 123 |
section_source.setEntity(entity); |
125 | 124 |
|
125 |
|
|
126 | 126 |
} |
127 | 127 |
|
128 | 128 |
/** {@inheritDoc} */ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java | ||
---|---|---|
17 | 17 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
18 | 18 |
import eu.etaxonomy.cdm.model.occurrence.Collection; |
19 | 19 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
20 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
21 | 20 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
22 | 21 |
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement; |
23 | 22 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
... | ... | |
88 | 87 |
formElement, "Country", |
89 | 88 |
entity.getCountry(), EntitySelectionElement.NOTHING, style); |
90 | 89 |
|
91 |
if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
|
|
90 |
if(PreferencesUtil.isCollectingAreaInGeneralSection()){
|
|
92 | 91 |
section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE); |
93 | 92 |
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
94 | 93 |
section_collectingAreas.setEntity(entity); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitDetailElement.java | ||
---|---|---|
10 | 10 |
package eu.etaxonomy.taxeditor.ui.section.occurrence; |
11 | 11 |
|
12 | 12 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
13 |
import eu.etaxonomy.cdm.model.common.DefinedTerm; |
|
14 |
import eu.etaxonomy.cdm.model.common.TermType; |
|
15 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
16 | 13 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
17 | 14 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
18 |
import eu.etaxonomy.taxeditor.ui.combo.TermComboElement; |
|
19 | 15 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
20 | 16 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
21 | 17 |
import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement; |
22 | 18 |
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement; |
23 |
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement; |
|
24 | 19 |
|
25 | 20 |
/** |
26 | 21 |
* <p>FieldUnitDetailElement class.</p> |
... | ... | |
38 | 33 |
private TextWithLabelElement text_fieldObjectDefinition; |
39 | 34 |
|
40 | 35 |
private TextWithLabelElement text_fieldNotes; |
41 |
|
|
36 |
|
|
42 | 37 |
private TextWithLabelElement text_lifeForm; |
43 | 38 |
|
44 | 39 |
private NumberWithLabelElement number_individualCount; |
... | ... | |
69 | 64 |
// Disable for now |
70 | 65 |
// text_fieldObjectDefinition = formFactory.createTextWithLabelElement(formElement, "Field Object Definition", entity.getFieldObjectDefinition(CdmStore.getDefaultLanguage()), style); |
71 | 66 |
text_fieldNotes = formFactory.createTextWithLabelElement(formElement, "Field Notes", entity.getFieldNotes(), style); |
72 |
if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_LIFE_FORM)){
|
|
67 |
if (PreferencesUtil.isShowLifeForm()){
|
|
73 | 68 |
text_lifeForm = formFactory.createTextWithLabelElement(formElement, "Life Form", entity.getLifeform(PreferencesUtil.getGlobalLanguage()), style); |
74 | 69 |
} |
75 |
|
|
70 |
|
|
76 | 71 |
number_individualCount = formFactory.createNumberTextWithLabelElement(formElement, "Individual Count", entity.getIndividualCount(), style); |
77 | 72 |
super.createControls(formElement, entity, style); |
78 | 73 |
} |
... | ... | |
99 | 94 |
else if(eventSource == number_individualCount){ |
100 | 95 |
getEntity().setIndividualCount(number_individualCount.getInteger()); |
101 | 96 |
} |
102 |
|
|
97 |
|
|
103 | 98 |
} |
104 | 99 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java | ||
---|---|---|
15 | 15 |
import eu.etaxonomy.cdm.model.common.LanguageString; |
16 | 16 |
import eu.etaxonomy.cdm.model.location.NamedArea; |
17 | 17 |
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType; |
18 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
19 | 18 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
20 | 19 |
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement; |
21 | 20 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
... | ... | |
77 | 76 |
combo_specorobstype.setSelection(entity.getType()); |
78 | 77 |
selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement, |
79 | 78 |
"Country", entity.getCountry(), EntitySelectionElement.NOTHING, style); |
80 |
if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
|
|
79 |
if(PreferencesUtil.isCollectingAreaInGeneralSection()){
|
|
81 | 80 |
section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE); |
82 | 81 |
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
83 | 82 |
section_collectingAreas.setEntity(entity); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java | ||
---|---|---|
12 | 12 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
13 | 13 |
|
14 | 14 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
15 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
16 | 15 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
17 | 16 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
18 | 17 |
import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement; |
... | ... | |
79 | 78 |
formElement, "Dist. To Watersurface : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER, style); |
80 | 79 |
|
81 | 80 |
|
82 |
if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
|
|
81 |
if(!PreferencesUtil.isCollectingAreaInGeneralSection()){
|
|
83 | 82 |
section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE); |
84 | 83 |
section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1)); |
85 | 84 |
section_collectingAreas.setEntity(entity); |
Also available in: Unified diff
refactor db preferences for specimen and observations