Revision da5756d8
Added by Katja Luther over 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewAdminConfiguration.java | ||
---|---|---|
8 | 8 |
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate; |
9 | 9 |
import eu.etaxonomy.cdm.model.metadata.PreferenceSubject; |
10 | 10 |
import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache; |
11 |
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator; |
|
12 | 11 |
import eu.etaxonomy.taxeditor.preference.NameDetailsViewConfiguration; |
13 | 12 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
14 | 13 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
... | ... | |
16 | 15 |
|
17 | 16 |
public class NameDetailsViewAdminConfiguration extends NameDetailsViewConfiguration implements IE4AdminPreferencePage{ |
18 | 17 |
|
19 |
protected NameDetailsConfigurator createNameDetailsViewConfig() { |
|
20 | 18 |
|
21 |
NameDetailsConfigurator config = new NameDetailsConfigurator(isSimpleDetailsViewActivated!= null? isSimpleDetailsViewActivated:false); |
|
22 | 19 |
|
23 |
config.setAppendedPhraseActivated(isShowAppendedPhrase); |
|
24 |
config.setAtomisedEpithetsActivated(isShowEpithets); |
|
25 |
config.setAuthorshipSectionActivated(isShowAuthorship); |
|
26 |
config.setAuthorCacheActivated(isShowAuthorCache); |
|
27 |
config.setLSIDActivated(isShowLSID); |
|
28 |
config.setNameApprobiationActivated(isShowNameApprobiation); |
|
29 |
config.setNameCacheActivated(isShowNameCache); |
|
30 |
config.setNameRelationsSectionActivated(isShowNameRelationship); |
|
31 |
config.setNomenclaturalCodeActived(isShowNomenclaturalCode); |
|
32 |
config.setNomenclaturalStatusSectionActivated(isShowNomenclaturalStatus); |
|
33 |
config.setNomenclaturalReferenceSectionActivated(isShowNomenclaturalRef); |
|
34 |
config.setProtologueActivated(isShowProtologue); |
|
35 |
config.setRankActivated(isShowRank); |
|
36 |
config.setTaxonSectionActivated(isShowTaxon); |
|
37 |
config.setSecDetailsActivated(isSecDetailsActivated); |
|
38 |
config.setSecEnabled(isSecEnabled); |
|
39 |
config.setTypeDesignationSectionActivated(isShowTypeDesignation); |
|
40 |
config.setHybridActivated(isShowHybrid); |
|
41 | 20 |
|
42 |
|
|
43 |
return config; |
|
44 |
} |
|
21 |
//protected NameDetailsConfigurator createNameDetailsViewConfig() { |
|
22 |
// |
|
23 |
// NameDetailsConfigurator config = new NameDetailsConfigurator(isSimpleDetailsViewActivated!= null? isSimpleDetailsViewActivated:false); |
|
24 |
// |
|
25 |
// config.setAppendedPhraseActivated(isShowAppendedPhrase); |
|
26 |
// config.setAtomisedEpithetsActivated(isShowEpithets); |
|
27 |
// config.setAuthorshipSectionActivated(isShowAuthorship); |
|
28 |
// config.setAuthorCacheActivated(isShowAuthorCache); |
|
29 |
// config.setLSIDActivated(isShowLSID); |
|
30 |
// config.setNameApprobiationActivated(isShowNameApprobiation); |
|
31 |
// config.setNameCacheActivated(isShowNameCache); |
|
32 |
// config.setNameRelationsSectionActivated(isShowNameRelationship); |
|
33 |
// config.setNameRelationsRuleConsideredActivated(isNameRelationRuleConsideredActivated); |
|
34 |
// config.setNameRelationsRuleConsideredCodeEditionActivated(isNameRelationRuleConsideredCodeEditionActivated); |
|
35 |
// config.setNomenclaturalCodeActived(isShowNomenclaturalCode); |
|
36 |
// config.setNomenclaturalStatusSectionActivated(isShowNomenclaturalStatus); |
|
37 |
// config.setNomenclaturalStatusRuleConsideredActivated(isNomenclaturalStatusRuleConsideredActivated); |
|
38 |
// config.setNomenclaturalStatusRuleConsideredCodeEditionActivated(isNomenclaturalStatusRuleConsideredCodeEditionActivated); |
|
39 |
// config.setNomenclaturalReferenceSectionActivated(isShowNomenclaturalRef); |
|
40 |
// config.setProtologueActivated(isShowProtologue); |
|
41 |
// config.setRankActivated(isShowRank); |
|
42 |
// config.setTaxonSectionActivated(isShowTaxon); |
|
43 |
// config.setSecDetailsActivated(isSecDetailsActivated); |
|
44 |
// config.setSecEnabled(isSecEnabled); |
|
45 |
// config.setTypeDesignationSectionActivated(isShowTypeDesignation); |
|
46 |
// config.setHybridActivated(isShowHybrid); |
|
47 |
// |
|
48 |
// |
|
49 |
// return config; |
|
50 |
// } |
|
45 | 51 |
|
46 | 52 |
|
47 | 53 |
@Override |
... | ... | |
57 | 63 |
return false; |
58 | 64 |
} |
59 | 65 |
IPreferenceService service = controller.getPreferenceService(); |
60 |
NameDetailsConfigurator config = createNameDetailsViewConfig(); |
|
61 |
String value = config.toString();
|
|
66 |
//NameDetailsConfigurator config = createNameDetailsViewConfig();
|
|
67 |
String value = nameDetailsConfig.toString();
|
|
62 | 68 |
|
63 | 69 |
if (isSimpleDetailsViewActivated == null && isAllowOverride){ |
64 | 70 |
service.remove(CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), PreferencePredicate.NameDetailsView)); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java | ||
---|---|---|
392 | 392 |
public static String NameDetailsViewConfiguration_description; |
393 | 393 |
public static String NameDetailsViewConfiguration_useLocalSettings; |
394 | 394 |
public static String NameDetailsViewConfiguration_description_not_available; |
395 |
public static String NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsidered; |
|
396 |
public static String NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsideredCodeEdition; |
|
397 |
public static String NameDetailsViewComposite_Show_Namerelationships_RuleConsidered; |
|
398 |
public static String NameDetailsViewComposite_Show_Namerelationships_RuleConsideredCodeEdition; |
|
395 | 399 |
|
396 | 400 |
|
397 | 401 |
public static String NameRelationshipWizardPage_description; |
... | ... | |
700 | 704 |
|
701 | 705 |
|
702 | 706 |
|
707 |
|
|
708 |
|
|
709 |
|
|
703 | 710 |
static { |
704 | 711 |
// initialize resource bundle |
705 | 712 |
NLS.initializeMessages(BUNDLE_NAME, Messages.class); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties | ||
---|---|---|
310 | 310 |
NameDetailsViewConfiguration_activateSimpleDetailsView=Show simplified name details view with the following elements: |
311 | 311 |
NameDetailsViewConfiguration_useLocalSettings=Use local settings for display of name details |
312 | 312 |
|
313 |
NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsidered=Rule Considered of nomenclatural status |
|
314 |
NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsideredCodeEdition=Code edition of rule considered |
|
315 |
NameDetailsViewComposite_Show_Namerelationships_RuleConsidered=Rule considered of name relationship |
|
316 |
NameDetailsViewComposite_Show_Namerelationships_RuleConsideredCodeEdition=Code edition of rule considered |
|
317 |
|
|
313 | 318 |
SetPublishConfiguration_Publish=Set Publish Flag |
314 | 319 |
SetPublishConfiguration_Publish_tooltip=With set publish flag, the taxa are published in data portal and print publications |
315 | 320 |
SetPublishConfiguration_Description_Configurator=Configure where the publish flag should be set |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties | ||
---|---|---|
310 | 310 |
NameDetailsViewConfiguration_activateSimpleDetailsView=Vereinfachten Details View mit folgenden Elementen anzeigen: |
311 | 311 |
NameDetailsViewConfiguration_useLocalSettings=Verwende die lokalen Eigenschaften f?r die Darstellung der Details |
312 | 312 |
|
313 |
NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsidered=Rule Considered des Nomenklatorischen Status |
|
314 |
NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsideredCodeEdition=Code Edition der Rule Considered |
|
315 |
NameDetailsViewComposite_Show_Namerelationships_RuleConsidered=Rule Considered der Namensrelation |
|
316 |
NameDetailsViewComposite_Show_Namerelationships_RuleConsideredCodeEdition=Code Edition der Rule Considered |
|
317 |
|
|
313 | 318 |
SetPublishConfiguration_Publish=Setze das Publish Flag |
314 | 319 |
SetPublishConfiguration_Publish_tooltip=Wenn das Publish Flag gesetzt ist, werden die Taxa ver?ffentlicht, sowohl im Datenportal als auch bei Print Publikationen |
315 | 320 |
SetPublishConfiguration_Description_Configurator=Konfigurieren Sie, wie das Setzen des Publish Flags durchgef?hrt werden soll |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsConfigurator.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.preference; |
10 | 10 |
|
11 |
import java.lang.reflect.Field; |
|
12 |
|
|
11 | 13 |
/** |
12 | 14 |
* @author k.luther |
13 | 15 |
* @date 16.12.2016 |
... | ... | |
15 | 17 |
*/ |
16 | 18 |
public class NameDetailsConfigurator { |
17 | 19 |
|
18 |
private boolean isAllowOverride = true; |
|
19 |
private boolean isSimpleDetailsViewActivated = true; |
|
20 |
|
|
21 |
private boolean isTaxonSectionActivated = true; |
|
22 |
private boolean isLSIDActivated = true; |
|
23 |
private boolean isNomenclaturalCodeActived = true; |
|
24 |
private boolean isNameCacheActivated = true; |
|
25 |
private boolean isAppendedPhraseActivated = true; |
|
26 |
private boolean isRankActivated = true; |
|
27 |
private boolean isAtomisedEpithetsActivated = true; |
|
28 |
private boolean isAuthorshipSectionActivated = true; |
|
29 |
private boolean isAuthorCacheActivated = true; |
|
30 |
private boolean isNomenclaturalReferenceSectionActivated = true; |
|
31 |
private boolean isNomenclaturalStatusSectionActivated = true; |
|
32 |
private boolean isTypeDesignationSectionActivated = true; |
|
33 |
private boolean isNameRelationsSectionActivated = true; |
|
34 |
private boolean isProtologueActivated = true; |
|
35 |
private boolean isHybridActivated = true; |
|
36 |
|
|
37 |
private boolean isNameApprobiationActivated = true; |
|
38 |
private boolean isSecEnabled = true; |
|
39 |
private boolean isSecDetailsActivated = true; |
|
20 |
boolean isAllowOverride = true; |
|
21 |
boolean isSimpleDetailsViewActivated = true; |
|
22 |
|
|
23 |
boolean isTaxonSectionActivated = true; |
|
24 |
boolean isLSIDActivated = true; |
|
25 |
boolean isNomenclaturalCodeActived = true; |
|
26 |
boolean isNameCacheActivated = true; |
|
27 |
boolean isAppendedPhraseActivated = true; |
|
28 |
boolean isRankActivated = true; |
|
29 |
boolean isAtomisedEpithetsActivated = true; |
|
30 |
boolean isAuthorshipSectionActivated = true; |
|
31 |
boolean isAuthorCacheActivated = true; |
|
32 |
boolean isNomenclaturalReferenceSectionActivated = true; |
|
33 |
boolean isNomenclaturalStatusSectionActivated = true; |
|
34 |
boolean isNomenclaturalStatusRuleConsideredActivated = true; |
|
35 |
boolean isNomenclaturalStatusRuleConsideredCodeEditionActivated = true; |
|
36 |
boolean isTypeDesignationSectionActivated = true; |
|
37 |
boolean isNameRelationsSectionActivated = true; |
|
38 |
boolean isNameRelationsRuleConsideredActivated = true; |
|
39 |
boolean isNameRelationsRuleConsideredCodeEditionActivated = true; |
|
40 |
boolean isProtologueActivated = true; |
|
41 |
boolean isHybridActivated = true; |
|
42 |
|
|
43 |
boolean isNameApprobiationActivated = true; |
|
44 |
boolean isSecEnabled = true; |
|
45 |
boolean isSecDetailsActivated = true; |
|
40 | 46 |
|
41 | 47 |
public NameDetailsConfigurator(boolean isSimpleDetailsViewActivated){ |
42 | 48 |
this.isSimpleDetailsViewActivated = isSimpleDetailsViewActivated; |
... | ... | |
165 | 171 |
StringBuffer result = new StringBuffer(); |
166 | 172 |
//the preference value is build like this: |
167 | 173 |
//<section1>:true;<section2>:false.... |
168 |
result.append("simpleViewActivated"); |
|
169 |
result.append(":"); |
|
170 |
result.append(this.isSimpleDetailsViewActivated); |
|
171 |
result.append(";"); |
|
172 |
|
|
173 |
result.append("taxon"); |
|
174 |
result.append(":"); |
|
175 |
result.append(this.isTaxonSectionActivated); |
|
176 |
result.append(";"); |
|
177 |
result.append("taxon.SecEnabled"); |
|
178 |
result.append(":"); |
|
179 |
result.append(this.isSecEnabled); |
|
180 |
result.append(";"); |
|
181 |
result.append("taxon.SecDetails"); |
|
182 |
result.append(":"); |
|
183 |
result.append(this.isSecDetailsActivated); |
|
184 |
result.append(";"); |
|
185 |
result.append("nameCache"); |
|
186 |
result.append(":"); |
|
187 |
result.append(this.isNameCacheActivated); |
|
188 |
result.append(";"); |
|
189 |
result.append("lsid"); |
|
190 |
result.append(":"); |
|
191 |
result.append(this.isLSIDActivated()); |
|
192 |
result.append(";"); |
|
193 |
result.append("nameApproviation"); |
|
194 |
result.append(":"); |
|
195 |
result.append(this.isNameApprobiationActivated()); |
|
196 |
result.append(";"); |
|
197 |
result.append("nc"); |
|
198 |
result.append(":"); |
|
199 |
result.append(this.isNomenclaturalCodeActived()); |
|
200 |
result.append(";"); |
|
201 |
result.append("ap"); |
|
202 |
result.append(":"); |
|
203 |
result.append(this.isAppendedPhraseActivated()); |
|
204 |
result.append(";"); |
|
205 |
result.append("rank"); |
|
206 |
result.append(":"); |
|
207 |
result.append(this.isRankActivated()); |
|
208 |
result.append(";"); |
|
209 |
result.append("author"); |
|
210 |
result.append(":"); |
|
211 |
result.append(this.isAuthorshipSectionActivated()); |
|
212 |
result.append(";"); |
|
213 |
result.append("authorCache"); |
|
214 |
result.append(":"); |
|
215 |
result.append(this.isAuthorCacheActivated()); |
|
216 |
result.append(";"); |
|
217 |
result.append("atomisedEpithets"); |
|
218 |
result.append(":"); |
|
219 |
result.append(this.isAtomisedEpithetsActivated()); |
|
220 |
result.append(";"); |
|
221 |
result.append("nomRef"); |
|
222 |
result.append(":"); |
|
223 |
result.append(this.isNomenclaturalReferenceSectionActivated()); |
|
224 |
result.append(";"); |
|
225 |
result.append("nomStat"); |
|
226 |
result.append(":"); |
|
227 |
result.append(this.isNomenclaturalStatusSectionActivated()); |
|
228 |
result.append(";"); |
|
229 |
result.append("protologue"); |
|
230 |
result.append(":"); |
|
231 |
result.append(this.isProtologueActivated()); |
|
232 |
result.append(";"); |
|
233 |
result.append("typeDes"); |
|
234 |
result.append(":"); |
|
235 |
result.append(this.isTypeDesignationSectionActivated()); |
|
236 |
result.append(";"); |
|
237 |
result.append("nameRelation"); |
|
238 |
result.append(":"); |
|
239 |
result.append(this.isNameRelationsSectionActivated()); |
|
240 |
result.append(";"); |
|
241 |
result.append("hybrid"); |
|
242 |
result.append(":"); |
|
243 |
result.append(this.isHybridActivated()); |
|
244 |
|
|
174 |
for (Field field: this.getClass().getDeclaredFields()){ |
|
175 |
result.append(field.getName()); |
|
176 |
result.append(":"); |
|
177 |
try { |
|
178 |
result.append(field.get(this)); |
|
179 |
} catch (IllegalArgumentException | IllegalAccessException e) { |
|
180 |
// TODO Auto-generated catch block |
|
181 |
e.printStackTrace(); |
|
182 |
} |
|
183 |
result.append(";"); |
|
184 |
} |
|
185 |
// result.append("simpleViewActivated"); |
|
186 |
// result.append(":"); |
|
187 |
// result.append(this.isSimpleDetailsViewActivated); |
|
188 |
// result.append(";"); |
|
189 |
// |
|
190 |
// result.append("taxon"); |
|
191 |
// result.append(":"); |
|
192 |
// result.append(this.isTaxonSectionActivated); |
|
193 |
// result.append(";"); |
|
194 |
// result.append("taxon.SecEnabled"); |
|
195 |
// result.append(":"); |
|
196 |
// result.append(this.isSecEnabled); |
|
197 |
// result.append(";"); |
|
198 |
// result.append("taxon.SecDetails"); |
|
199 |
// result.append(":"); |
|
200 |
// result.append(this.isSecDetailsActivated); |
|
201 |
// result.append(";"); |
|
202 |
// result.append("nameCache"); |
|
203 |
// result.append(":"); |
|
204 |
// result.append(this.isNameCacheActivated); |
|
205 |
// result.append(";"); |
|
206 |
// result.append("lsid"); |
|
207 |
// result.append(":"); |
|
208 |
// result.append(this.isLSIDActivated()); |
|
209 |
// result.append(";"); |
|
210 |
// result.append("nameApproviation"); |
|
211 |
// result.append(":"); |
|
212 |
// result.append(this.isNameApprobiationActivated()); |
|
213 |
// result.append(";"); |
|
214 |
// result.append("nc"); |
|
215 |
// result.append(":"); |
|
216 |
// result.append(this.isNomenclaturalCodeActived()); |
|
217 |
// result.append(";"); |
|
218 |
// result.append("ap"); |
|
219 |
// result.append(":"); |
|
220 |
// result.append(this.isAppendedPhraseActivated()); |
|
221 |
// result.append(";"); |
|
222 |
// result.append("rank"); |
|
223 |
// result.append(":"); |
|
224 |
// result.append(this.isRankActivated()); |
|
225 |
// result.append(";"); |
|
226 |
// result.append("author"); |
|
227 |
// result.append(":"); |
|
228 |
// result.append(this.isAuthorshipSectionActivated()); |
|
229 |
// result.append(";"); |
|
230 |
// result.append("authorCache"); |
|
231 |
// result.append(":"); |
|
232 |
// result.append(this.isAuthorCacheActivated()); |
|
233 |
// result.append(";"); |
|
234 |
// result.append("atomisedEpithets"); |
|
235 |
// result.append(":"); |
|
236 |
// result.append(this.isAtomisedEpithetsActivated()); |
|
237 |
// result.append(";"); |
|
238 |
// result.append("nomRef"); |
|
239 |
// result.append(":"); |
|
240 |
// result.append(this.isNomenclaturalReferenceSectionActivated()); |
|
241 |
// result.append(";"); |
|
242 |
// result.append("nomStat"); |
|
243 |
// result.append(":"); |
|
244 |
// result.append(this.isNomenclaturalStatusSectionActivated()); |
|
245 |
// result.append(";"); |
|
246 |
// result.append("nomStatRuleConsidered"); |
|
247 |
// result.append(":"); |
|
248 |
// result.append(this.isNomenclaturalStatusRuleConsideredActivated); |
|
249 |
// result.append(";"); |
|
250 |
// result.append("nomStatRuleConsideredCodeEdition"); |
|
251 |
// result.append(":"); |
|
252 |
// result.append(this.isNomenclaturalStatusRuleConsideredCodeEditionActivated); |
|
253 |
// result.append(";"); |
|
254 |
// result.append("protologue"); |
|
255 |
// result.append(":"); |
|
256 |
// result.append(this.isProtologueActivated()); |
|
257 |
// result.append(";"); |
|
258 |
// result.append("typeDes"); |
|
259 |
// result.append(":"); |
|
260 |
// result.append(this.isTypeDesignationSectionActivated()); |
|
261 |
// result.append(";"); |
|
262 |
// result.append("nameRelation"); |
|
263 |
// result.append(":"); |
|
264 |
// result.append(this.isNameRelationsSectionActivated()); |
|
265 |
// result.append(";"); |
|
266 |
// result.append("nameRelationRuleConsidered"); |
|
267 |
// result.append(":"); |
|
268 |
// result.append(this.isNameRelationsRuleConsideredActivated); |
|
269 |
// result.append(";"); |
|
270 |
// result.append("nameRelationRuleConsideredCodeEdition"); |
|
271 |
// result.append(":"); |
|
272 |
// result.append(this.isNameRelationsRuleConsideredCodeEditionActivated); |
|
273 |
// result.append(";"); |
|
274 |
// result.append("hybrid"); |
|
275 |
// result.append(":"); |
|
276 |
// result.append(this.isHybridActivated()); |
|
277 |
result.replace(result.length()-1, result.length(), ""); |
|
245 | 278 |
return result.toString(); |
246 | 279 |
} |
247 | 280 |
|
... | ... | |
302 | 335 |
this.isSecDetailsActivated = isSecDetailsActivated; |
303 | 336 |
} |
304 | 337 |
|
338 |
public boolean isNameRelationsRuleConsideredActivated() { |
|
339 |
return isNameRelationsRuleConsideredActivated; |
|
340 |
} |
|
341 |
|
|
342 |
public void setNameRelationsRuleConsideredActivated(boolean isRuleConsideredActivated) { |
|
343 |
this.isNameRelationsRuleConsideredActivated = isRuleConsideredActivated; |
|
344 |
} |
|
345 |
|
|
346 |
public boolean isNameRelationsRuleConsideredCodeEditionActivated() { |
|
347 |
return isNameRelationsRuleConsideredCodeEditionActivated; |
|
348 |
} |
|
349 |
|
|
350 |
public void setNameRelationsRuleConsideredCodeEditionActivated(boolean isRuleConsideredCodeEditionActivated) { |
|
351 |
this.isNameRelationsRuleConsideredCodeEditionActivated = isRuleConsideredCodeEditionActivated; |
|
352 |
} |
|
353 |
|
|
354 |
public boolean isNomenclaturalStatusRuleConsideredActivated() { |
|
355 |
return isNomenclaturalStatusRuleConsideredActivated; |
|
356 |
} |
|
357 |
|
|
358 |
public void setNomenclaturalStatusRuleConsideredActivated(boolean isRuleConsideredActivated) { |
|
359 |
this.isNomenclaturalStatusRuleConsideredActivated = isRuleConsideredActivated; |
|
360 |
} |
|
361 |
|
|
362 |
public boolean isNomenclaturalStatusRuleConsideredCodeEditionActivated() { |
|
363 |
return isNomenclaturalStatusRuleConsideredCodeEditionActivated; |
|
364 |
} |
|
365 |
|
|
366 |
public void setNomenclaturalStatusRuleConsideredCodeEditionActivated(boolean isRuleConsideredCodeEditionActivated) { |
|
367 |
this.isNomenclaturalStatusRuleConsideredCodeEditionActivated = isRuleConsideredCodeEditionActivated; |
|
368 |
} |
|
369 |
|
|
305 | 370 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java | ||
---|---|---|
42 | 42 |
protected boolean isShowNameApprobiation ; |
43 | 43 |
protected boolean isShowHybrid; |
44 | 44 |
protected boolean isShowNameRelationship; |
45 |
protected boolean isShowNameRelationshipRuleConsidered; |
|
46 |
protected boolean isShowNameRelationshipRuleConsideredCodeEdition; |
|
45 | 47 |
protected boolean isShowTypeDesignation; |
46 | 48 |
protected boolean isShowProtologue; |
47 | 49 |
protected boolean isShowNomenclaturalStatus; |
50 |
protected boolean isShowNomenclaturalStatusRuleConsidered; |
|
51 |
protected boolean isShowNomenclaturalStatusRuleConsideredCodeEdition; |
|
48 | 52 |
protected boolean isShowNomenclaturalRef; |
49 | 53 |
protected boolean isShowAuthorship; |
50 | 54 |
protected boolean isShowAuthorCache; |
... | ... | |
75 | 79 |
protected Button showAuthorship; |
76 | 80 |
protected Button showNomenclaturalRef; |
77 | 81 |
protected Button showNomenclaturalStatus; |
82 |
protected Button showNomenclaturalStatusRuleConsidered; |
|
83 |
protected Button showNomenclaturalStatusRuleConsideredCodeEdition; |
|
78 | 84 |
protected Button showProtologue; |
79 | 85 |
protected Button showTypeDesignation; |
80 | 86 |
protected Button showNameRelationship; |
87 |
protected Button showNameRelationshipRuleConsidered; |
|
88 |
protected Button showNameRelationshipRuleConsideredCodeEdition; |
|
81 | 89 |
protected Button showHybrid; |
82 | 90 |
protected Button showNameApprobiation; |
83 | 91 |
|
... | ... | |
325 | 333 |
setApply(true); |
326 | 334 |
isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection(); |
327 | 335 |
nameDetailsConfig.setNomenclaturalStatusSectionActivated(isShowNomenclaturalStatus); |
336 |
if (isSimpleDetailsViewActivated!= null? isSimpleDetailsViewActivated:false){ |
|
337 |
showNomenclaturalStatusRuleConsidered.setEnabled(isShowNomenclaturalStatus); |
|
338 |
showNomenclaturalStatusRuleConsideredCodeEdition.setEnabled(isShowNomenclaturalStatus); |
|
339 |
} |
|
340 |
} |
|
341 |
}); |
|
342 |
Composite nomenlaturalStatusComp = new Composite(dbSettings, SWT.NULL); |
|
343 |
|
|
344 |
GridLayoutFactory.fillDefaults().applyTo(nomenlaturalStatusComp); |
|
345 |
|
|
346 |
nomenlaturalStatusComp.setLayoutData(data); |
|
347 |
|
|
348 |
showNomenclaturalStatusRuleConsidered = new Button(nomenlaturalStatusComp, SWT.CHECK); |
|
349 |
isShowNomenclaturalStatusRuleConsidered = nameDetailsConfig.isNomenclaturalStatusRuleConsideredActivated(); |
|
350 |
showNomenclaturalStatusRuleConsidered.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsidered); |
|
351 |
|
|
352 |
showNomenclaturalStatusRuleConsidered.addSelectionListener(new SelectionAdapter(){ |
|
353 |
@Override |
|
354 |
public void widgetSelected(SelectionEvent e) { |
|
355 |
setApply(true); |
|
356 |
isShowNomenclaturalStatusRuleConsidered = showNomenclaturalStatusRuleConsidered.getSelection(); |
|
357 |
nameDetailsConfig.setNomenclaturalStatusRuleConsideredActivated(isShowNomenclaturalStatusRuleConsidered); |
|
358 |
} |
|
359 |
}); |
|
360 |
|
|
361 |
showNomenclaturalStatusRuleConsideredCodeEdition = new Button(nomenlaturalStatusComp, SWT.CHECK); |
|
362 |
isShowNomenclaturalStatusRuleConsideredCodeEdition = nameDetailsConfig.isNomenclaturalStatusRuleConsideredCodeEditionActivated(); |
|
363 |
showNomenclaturalStatusRuleConsideredCodeEdition.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus_RuleConsideredCodeEdition); |
|
364 |
|
|
365 |
showNomenclaturalStatusRuleConsideredCodeEdition.addSelectionListener(new SelectionAdapter(){ |
|
366 |
@Override |
|
367 |
public void widgetSelected(SelectionEvent e) { |
|
368 |
setApply(true); |
|
369 |
isShowNomenclaturalStatusRuleConsideredCodeEdition = showNomenclaturalStatusRuleConsideredCodeEdition.getSelection(); |
|
370 |
nameDetailsConfig.setNomenclaturalStatusRuleConsideredCodeEditionActivated(isShowNomenclaturalStatusRuleConsideredCodeEdition); |
|
328 | 371 |
} |
329 | 372 |
}); |
330 | 373 |
|
... | ... | |
365 | 408 |
setApply(true); |
366 | 409 |
isShowNameRelationship = showNameRelationship.getSelection(); |
367 | 410 |
nameDetailsConfig.setNameRelationsSectionActivated(isShowNameRelationship); |
411 |
if (isSimpleDetailsViewActivated!= null? isSimpleDetailsViewActivated:false){ |
|
412 |
showNameRelationshipRuleConsidered.setEnabled(isShowNameRelationship); |
|
413 |
showNameRelationshipRuleConsideredCodeEdition.setEnabled(isShowNameRelationship); |
|
414 |
} |
|
415 |
} |
|
416 |
}); |
|
417 |
|
|
418 |
Composite nameRelationComp = new Composite(dbSettings, SWT.NULL); |
|
419 |
GridLayoutFactory.fillDefaults().applyTo(nameRelationComp); |
|
420 |
nameRelationComp.setLayoutData(data); |
|
421 |
|
|
422 |
showNameRelationshipRuleConsidered = new Button(nameRelationComp, SWT.CHECK); |
|
423 |
isShowNameRelationshipRuleConsidered = nameDetailsConfig.isNameRelationsRuleConsideredActivated(); |
|
424 |
showNameRelationshipRuleConsidered.setText(Messages.NameDetailsViewComposite_Show_Namerelationships_RuleConsidered); |
|
425 |
|
|
426 |
showNameRelationshipRuleConsidered.addSelectionListener(new SelectionAdapter(){ |
|
427 |
@Override |
|
428 |
public void widgetSelected(SelectionEvent e) { |
|
429 |
setApply(true); |
|
430 |
isShowNameRelationshipRuleConsidered = showNameRelationshipRuleConsidered.getSelection(); |
|
431 |
nameDetailsConfig.setNameRelationsRuleConsideredActivated(isShowNameRelationshipRuleConsidered); |
|
432 |
} |
|
433 |
}); |
|
434 |
|
|
435 |
showNameRelationshipRuleConsideredCodeEdition = new Button(nameRelationComp, SWT.CHECK); |
|
436 |
isShowNameRelationshipRuleConsideredCodeEdition = nameDetailsConfig.isNameRelationsRuleConsideredCodeEditionActivated(); |
|
437 |
showNameRelationshipRuleConsideredCodeEdition.setText(Messages.NameDetailsViewComposite_Show_Namerelationships_RuleConsideredCodeEdition); |
|
438 |
|
|
439 |
showNameRelationshipRuleConsideredCodeEdition.addSelectionListener(new SelectionAdapter(){ |
|
440 |
@Override |
|
441 |
public void widgetSelected(SelectionEvent e) { |
|
442 |
setApply(true); |
|
443 |
isShowNameRelationshipRuleConsideredCodeEdition = showNameRelationshipRuleConsideredCodeEdition.getSelection(); |
|
444 |
nameDetailsConfig.setNameRelationsRuleConsideredCodeEditionActivated(isShowNameRelationshipRuleConsideredCodeEdition); |
|
368 | 445 |
} |
369 | 446 |
}); |
370 | 447 |
|
... | ... | |
426 | 503 |
} |
427 | 504 |
|
428 | 505 |
} |
506 |
PreferencesUtil.firePreferencesChanged(this.getClass()); |
|
429 | 507 |
return true; |
430 | 508 |
|
431 | 509 |
} |
... | ... | |
471 | 549 |
showAuthorship.setSelection(isShowAuthorship); |
472 | 550 |
showNomenclaturalRef.setSelection(isShowNomenclaturalRef); |
473 | 551 |
showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus); |
552 |
showNomenclaturalStatusRuleConsidered.setSelection(isShowNomenclaturalStatusRuleConsidered); |
|
553 |
showNomenclaturalStatusRuleConsideredCodeEdition.setSelection(isShowNomenclaturalStatusRuleConsideredCodeEdition); |
|
474 | 554 |
showProtologue.setSelection(isShowProtologue); |
475 | 555 |
showTypeDesignation.setSelection(isShowTypeDesignation); |
476 | 556 |
showNameRelationship.setSelection(isShowNameRelationship); |
557 |
showNameRelationshipRuleConsidered.setSelection(isShowNameRelationshipRuleConsidered); |
|
558 |
showNameRelationshipRuleConsideredCodeEdition.setSelection(isShowNameRelationshipRuleConsideredCodeEdition); |
|
477 | 559 |
showHybrid.setSelection(isShowHybrid); |
478 | 560 |
showNameApprobiation.setSelection(isShowNameApprobiation); |
479 | 561 |
secEnabled.setSelection(isSecEnabled); |
... | ... | |
494 | 576 |
isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated(); |
495 | 577 |
isShowNameCache = nameDetailsConfig.isNameCacheActivated(); |
496 | 578 |
isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated(); |
579 |
isShowNameRelationshipRuleConsidered = nameDetailsConfig.isNameRelationsRuleConsideredActivated(); |
|
580 |
isShowNameRelationshipRuleConsideredCodeEdition = nameDetailsConfig.isNameRelationsRuleConsideredCodeEditionActivated(); |
|
497 | 581 |
isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived(); |
498 | 582 |
isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated(); |
583 |
isShowNomenclaturalStatusRuleConsidered = nameDetailsConfig.isNomenclaturalStatusRuleConsideredActivated(); |
|
584 |
isShowNomenclaturalStatusRuleConsideredCodeEdition = nameDetailsConfig.isNomenclaturalStatusRuleConsideredCodeEditionActivated(); |
|
499 | 585 |
isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated(); |
500 | 586 |
isShowProtologue = nameDetailsConfig.isProtologueActivated(); |
501 | 587 |
isShowRank = nameDetailsConfig.isRankActivated(); |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java | ||
---|---|---|
13 | 13 |
import java.io.FileInputStream; |
14 | 14 |
import java.io.FileOutputStream; |
15 | 15 |
import java.io.IOException; |
16 |
import java.lang.reflect.Field; |
|
16 | 17 |
import java.net.URI; |
17 | 18 |
import java.net.URISyntaxException; |
18 | 19 |
import java.util.ArrayList; |
... | ... | |
921 | 922 |
|
922 | 923 |
|
923 | 924 |
//Name Details |
924 |
getPreferenceStore().setDefault(createPreferenceString(PreferencePredicate.NameDetailsView.getKey()), new NameDetailsConfigurator(false).toString()); |
|
925 |
// getPreferenceStore().setDefault(createPreferenceString(PreferencePredicate.NameDetailsView.getKey()), new NameDetailsConfigurator(false).toString());
|
|
925 | 926 |
|
926 | 927 |
//Navigator preferences |
927 | 928 |
getPreferenceStore().setDefault(createPreferenceString(PreferencePredicate.TaxonNodeOrder.getKey()), NavigatorOrderEnum.RankAndNameOrder.getKey()); |
... | ... | |
1381 | 1382 |
value = getStringValue(PreferencePredicate.NameDetailsView.getKey(), local); |
1382 | 1383 |
} |
1383 | 1384 |
if (value!= null){ |
1384 |
String [] sections = value.split(";"); |
|
1385 |
Map<String, Boolean> sectionMap = new HashMap<String, Boolean>(); |
|
1386 |
String[] sectionValues; |
|
1387 |
for (String sectionValue: sections){ |
|
1388 |
sectionValues = sectionValue.split(":"); |
|
1389 |
sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1])); |
|
1390 |
} |
|
1391 |
config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated")); |
|
1392 |
config.setTaxonSectionActivated(getValue(sectionMap, "taxon")); |
|
1393 |
config.setSecDetailsActivated(getValue(sectionMap, "taxon.SecDetails")); |
|
1394 |
config.setSecEnabled(getValue(sectionMap, "taxon.SecEnabled")); |
|
1395 |
config.setLSIDActivated(getValue(sectionMap, "lsid")); |
|
1396 |
config.setNomenclaturalCodeActived(getValue(sectionMap, "nc")); |
|
1397 |
config.setAppendedPhraseActivated(getValue(sectionMap, "ap")); |
|
1398 |
config.setRankActivated(getValue(sectionMap, "rank")); |
|
1399 |
config.setNameCacheActivated(getValue(sectionMap, "nameCache")); |
|
1400 |
config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets")); |
|
1401 |
config.setAuthorshipSectionActivated(getValue(sectionMap,"author")); |
|
1402 |
config.setAuthorCacheActivated(getValue(sectionMap, "authorCache")); |
|
1403 |
config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef")); |
|
1404 |
config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat")); |
|
1405 |
config.setProtologueActivated(getValue(sectionMap,"protologue")); |
|
1406 |
config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes")); |
|
1407 |
config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation")); |
|
1408 |
config.setHybridActivated(getValue(sectionMap,"hybrid")); |
|
1409 |
config.setNameApprobiationActivated(getValue(sectionMap, "nameApproviation")); |
|
1385 |
fillNameDetailsConfigurator(config, value); |
|
1386 |
|
|
1387 |
|
|
1410 | 1388 |
}else { |
1411 | 1389 |
return null; |
1412 | 1390 |
} |
1413 | 1391 |
return config; |
1414 | 1392 |
} |
1415 | 1393 |
|
1394 |
public static void fillNameDetailsConfigurator(NameDetailsConfigurator config, String value) { |
|
1395 |
String [] sections = value.split(";"); |
|
1396 |
Map<String, Boolean> sectionMap = new HashMap<String, Boolean>(); |
|
1397 |
String[] sectionValues; |
|
1398 |
for (String sectionValue: sections){ |
|
1399 |
sectionValues = sectionValue.split(":"); |
|
1400 |
sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1])); |
|
1401 |
} |
|
1402 |
for (Field field: config.getClass().getDeclaredFields()){ |
|
1403 |
try { |
|
1404 |
config.getClass().getDeclaredField(field.getName()).set(config, getValue(sectionMap, field.getName())); |
|
1405 |
} catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException |
|
1406 |
| SecurityException e) { |
|
1407 |
// TODO Auto-generated catch block |
|
1408 |
e.printStackTrace(); |
|
1409 |
} |
|
1410 |
} |
|
1411 |
} |
|
1412 |
|
|
1416 | 1413 |
public static NameDetailsConfigurator getPreferredNameDetailsConfiguration() { |
1417 | 1414 |
NameDetailsConfigurator config = new NameDetailsConfigurator(true); |
1418 | 1415 |
|
... | ... | |
1420 | 1417 |
|
1421 | 1418 |
value = getStringValue(PreferencePredicate.NameDetailsView.getKey(), false); |
1422 | 1419 |
if (value != null){ |
1423 |
String [] sections = value.split(";"); |
|
1424 |
Map<String, Boolean> sectionMap = new HashMap<String, Boolean>(); |
|
1425 |
String[] sectionValues; |
|
1426 |
for (String sectionValue: sections){ |
|
1427 |
sectionValues = sectionValue.split(":"); |
|
1428 |
sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1])); |
|
1429 |
} |
|
1430 |
|
|
1431 |
config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated")); |
|
1432 |
|
|
1433 |
config.setTaxonSectionActivated(getValue(sectionMap, "taxon")); |
|
1434 |
|
|
1435 |
config.setSecDetailsActivated(getValue(sectionMap, "taxon.SecDetails")); |
|
1436 |
config.setSecEnabled(getValue(sectionMap, "taxon.SecEnabled")); |
|
1437 |
|
|
1438 |
config.setLSIDActivated(getValue(sectionMap, "lsid")); |
|
1439 |
|
|
1440 |
config.setNomenclaturalCodeActived(getValue(sectionMap, "nc")); |
|
1441 |
|
|
1442 |
config.setAppendedPhraseActivated(getValue(sectionMap, "ap")); |
|
1443 |
|
|
1444 |
config.setRankActivated(getValue(sectionMap, "rank")); |
|
1445 |
|
|
1446 |
config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets")); |
|
1447 |
|
|
1448 |
config.setAuthorshipSectionActivated(getValue(sectionMap,"author")); |
|
1449 |
|
|
1450 |
config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef")); |
|
1451 |
|
|
1452 |
config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat")); |
|
1453 |
|
|
1454 |
config.setProtologueActivated(getValue(sectionMap,"protologue")); |
|
1455 |
|
|
1456 |
config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes")); |
|
1457 |
|
|
1458 |
config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation")); |
|
1459 |
|
|
1460 |
config.setHybridActivated(getValue(sectionMap,"hybrid")); |
|
1420 |
fillNameDetailsConfigurator(config, value); |
|
1461 | 1421 |
} |
1462 | 1422 |
return config; |
1463 | 1423 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java | ||
---|---|---|
3233 | 3233 |
return section; |
3234 | 3234 |
} |
3235 | 3235 |
|
3236 |
/** |
|
3237 |
* <p> |
|
3238 |
* createTextWithLabelElement |
|
3239 |
* </p> |
|
3240 |
* |
|
3241 |
* @param parentElement |
|
3242 |
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} |
|
3243 |
* object. |
|
3244 |
* @param labelString |
|
3245 |
* a {@link java.lang.String} object. |
|
3246 |
* @param initialText |
|
3247 |
* a {@link java.lang.String} object. |
|
3248 |
* @param textLimit maximal number of characters allowed |
|
3249 |
* @param style |
|
3250 |
* a int. |
|
3251 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement} |
|
3252 |
* object. |
|
3253 |
*/ |
|
3254 |
public RuleConsideredElement createRuleConsideredElement(ICdmFormElement parentElement, String labelString, |
|
3255 |
NameRelationship relation, int style) { |
|
3256 |
|
|
3257 |
|
|
3258 |
RuleConsideredElement element = new RuleConsideredElement(this, parentElement, labelString, relation, style); |
|
3259 |
adapt(element); |
|
3260 |
parentElement.addElement(element); |
|
3261 |
return element; |
|
3262 |
} |
|
3263 |
|
|
3264 |
/** |
|
3265 |
* <p> |
|
3266 |
* createTextWithLabelElement |
|
3267 |
* </p> |
|
3268 |
* |
|
3269 |
* @param parentElement |
|
3270 |
* a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} |
|
3271 |
* object. |
|
3272 |
* @param labelString |
|
3273 |
* a {@link java.lang.String} object. |
|
3274 |
* @param initialText |
|
3275 |
* a {@link java.lang.String} object. |
|
3276 |
* @param textLimit maximal number of characters allowed |
|
3277 |
* @param style |
|
3278 |
* a int. |
|
3279 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement} |
|
3280 |
* object. |
|
3281 |
*/ |
|
3282 |
public RuleConsideredElement createRuleConsideredElement(ICdmFormElement parentElement, String labelString, |
|
3283 |
NomenclaturalStatus status, int style) { |
|
3284 |
|
|
3285 | 3236 |
|
3286 |
RuleConsideredElement element = new RuleConsideredElement(this, parentElement, labelString, status, style); |
|
3287 |
adapt(element); |
|
3288 |
parentElement.addElement(element); |
|
3289 |
return element; |
|
3290 |
} |
|
3291 | 3237 |
/** |
3292 | 3238 |
* <p> |
3293 | 3239 |
* createTextWithLabelElement |
... | ... | |
3306 | 3252 |
* @return a {@link eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement} |
3307 | 3253 |
* object. |
3308 | 3254 |
*/ |
3309 |
public RuleConsideredElement createRuleConsideredElement(ICdmFormElement parentElement, String labelString, |
|
3310 |
int style) { |
|
3311 |
|
|
3312 |
|
|
3313 |
RuleConsideredElement element = new RuleConsideredElement(this, parentElement, labelString, style); |
|
3255 |
public RuleConsideredElement createRuleConsideredElement(ICdmFormElement parentElement, String labelString, boolean isShowCodeEdition, int style) { |
|
3256 |
RuleConsideredElement element = new RuleConsideredElement(this, parentElement, labelString, isShowCodeEdition, style); |
|
3314 | 3257 |
adapt(element); |
3315 | 3258 |
parentElement.addElement(element); |
3316 | 3259 |
return element; |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameRelationshipDetailElement.java | ||
---|---|---|
15 | 15 |
import eu.etaxonomy.cdm.model.name.NameRelationship; |
16 | 16 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
17 | 17 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
18 |
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator; |
|
19 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
18 | 20 |
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement; |
19 | 21 |
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; |
20 | 22 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
... | ... | |
58 | 60 |
/** {@inheritDoc} */ |
59 | 61 |
@Override |
60 | 62 |
public void createControls(ICdmFormElement element, int style) { |
63 |
NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration(); |
|
61 | 64 |
label = formFactory.createLabel(element, null); |
62 | 65 |
|
63 |
ruleConsidered = formFactory.createRuleConsideredElement(element, "Rule Considered", style); |
|
66 |
if (config.isNameRelationsRuleConsideredActivated()){ |
|
67 |
ruleConsidered = formFactory.createRuleConsideredElement(element, "Rule Considered", config.isNameRelationsRuleConsideredCodeEditionActivated(), style); |
|
68 |
} |
|
64 | 69 |
|
65 | 70 |
super.createControls(element, style); |
66 | 71 |
} |
... | ... | |
71 | 76 |
String text = entity.getFromName().getTitleCache() + " is " + entity.getType().getLabel() + " " + entity.getToName().getTitleCache(); |
72 | 77 |
|
73 | 78 |
label.setText(text); |
74 |
ruleConsidered.setElement(entity); |
|
79 |
if (ruleConsidered != null){ |
|
80 |
ruleConsidered.setElement(entity); |
|
81 |
} |
|
75 | 82 |
|
76 | 83 |
super.setEntity(entity); |
77 | 84 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java | ||
---|---|---|
16 | 16 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
17 | 17 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
18 | 18 |
import eu.etaxonomy.cdm.model.term.TermType; |
19 |
import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator; |
|
20 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
19 | 21 |
import eu.etaxonomy.taxeditor.ui.combo.term.TermComboElement; |
20 | 22 |
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection; |
21 | 23 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
... | ... | |
49 | 51 |
@Override |
50 | 52 |
public void createControls(ICdmFormElement element, int style) { |
51 | 53 |
//TermVocabulary vocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.NomenclaturalStatusType.getUuid()); |
52 |
|
|
54 |
NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration(); |
|
53 | 55 |
Comparator<NomenclaturalStatusType> termComparator= new Comparator<NomenclaturalStatusType>() { |
54 | 56 |
|
55 | 57 |
@Override |
... | ... | |
79 | 81 |
|
80 | 82 |
nomenclaturalStatusTypeCombo = formFactory.createDefinedTermComboElement(TermType.NomenclaturalStatusType, this, "Status", null,true, style, true); |
81 | 83 |
nomenclaturalStatusTypeCombo.setTermComparator(termComparator); |
82 |
ruleConsidered = formFactory.createRuleConsideredElement(this, "Rule Considered", style); |
|
84 |
if (config.isNomenclaturalStatusRuleConsideredActivated()){ |
|
85 |
ruleConsidered = formFactory.createRuleConsideredElement(this, "Rule Considered", config.isNomenclaturalStatusRuleConsideredCodeEditionActivated(), style); |
|
86 |
} |
|
83 | 87 |
|
84 | 88 |
super.createControls(element, style); |
85 | 89 |
|
... | ... | |
93 | 97 |
nomenclaturalStatusTypeCombo.setSelection(entity.getType()); |
94 | 98 |
nomenclaturalStatusTypeCombo.removeEmptyElement(); |
95 | 99 |
} |
96 |
ruleConsidered.setElement(entity); |
|
100 |
if (ruleConsidered != null){ |
|
101 |
ruleConsidered.setElement(entity); |
|
102 |
} |
|
97 | 103 |
} |
98 | 104 |
|
99 | 105 |
/** |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/RuleConsideredElement.java | ||
---|---|---|
17 | 17 |
import org.eclipse.swt.events.SelectionListener; |
18 | 18 |
|
19 | 19 |
import eu.etaxonomy.cdm.model.name.IRuleConsidered; |
20 |
import eu.etaxonomy.cdm.model.name.NameRelationship; |
|
21 | 20 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCodeEdition; |
22 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
|
23 | 21 |
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement; |
24 | 22 |
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement; |
25 | 23 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
... | ... | |
35 | 33 |
|
36 | 34 |
protected TextWithLabelElement textRuleConsidered; |
37 | 35 |
|
38 |
protected EnumComboElement<NomenclaturalCodeEdition> nomenclaturalCodeEdition; |
|
36 |
protected EnumComboElement<NomenclaturalCodeEdition> nomenclaturalCodeEdition = null;
|
|
39 | 37 |
|
40 | 38 |
Map<String, Integer> nomenclaturalCodeEditionStringMap; |
41 | 39 |
|
42 | 40 |
private IRuleConsidered element = null; |
43 | 41 |
|
44 | 42 |
|
45 |
//private NameRelationship nameRelation = null; |
|
46 |
|
|
47 | 43 |
/** |
48 | 44 |
* @param cdmFormFactory |
49 | 45 |
* @param parentElement |
... | ... | |
51 | 47 |
* @param initialRule |
52 | 48 |
* @param style |
53 | 49 |
*/ |
54 |
public RuleConsideredElement( CdmFormFactory formFactory, ICdmFormElement formElement, String labelString, int style) { |
|
50 |
public RuleConsideredElement( CdmFormFactory formFactory, ICdmFormElement formElement, String labelString, boolean isShowCodeEdition, int style) {
|
|
55 | 51 |
super(formFactory, formElement); |
56 | 52 |
this.textRuleConsidered = formFactory.createTextWithLabelElement(formElement, "Rule considered", null, style); |
57 |
this.nomenclaturalCodeEdition = formFactory.createEnumComboElement(NomenclaturalCodeEdition.class, formElement, null, style); |
|
58 |
nomenclaturalCodeEditionStringMap = new HashMap<>(); |
|
59 |
nomenclaturalCodeEdition.addSelectionListener(this); |
|
60 |
formFactory.addPropertyChangeListener(this); |
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
|
|
65 |
/** |
|
66 |
* @param cdmFormFactory |
|
67 |
* @param parentElement |
|
68 |
* @param labelString |
|
69 |
* @param initialRule |
|
70 |
* @param style |
|
71 |
*/ |
|
72 |
public RuleConsideredElement( CdmFormFactory formFactory, ICdmFormElement formElement, String labelString, NomenclaturalStatus status, int style) { |
|
73 |
super(formFactory, formElement); |
|
74 |
this.textRuleConsidered = formFactory.createTextWithLabelElement(formElement, "Rule considered", null, style); |
|
75 |
this.nomenclaturalCodeEdition = formFactory.createEnumComboElement(NomenclaturalCodeEdition.class, formElement, null, style); |
|
76 |
|
|
53 |
if(isShowCodeEdition){ |
|
54 |
this.nomenclaturalCodeEdition = formFactory.createEnumComboElement(NomenclaturalCodeEdition.class, formElement, null, style); |
|
55 |
nomenclaturalCodeEdition.addSelectionListener(this); |
|
56 |
} |
|
77 | 57 |
nomenclaturalCodeEditionStringMap = new HashMap<>(); |
78 | 58 |
|
79 |
|
|
80 |
this.element = status; |
|
81 |
textRuleConsidered.setText(status.getRuleConsidered()); |
|
82 |
|
|
83 |
nomenclaturalCodeEdition.addSelectionListener(this); |
|
84 | 59 |
formFactory.addPropertyChangeListener(this); |
85 |
} |
|
86 |
|
|
87 |
/** |
|
88 |
* @param cdmFormFactory |
|
89 |
* @param parentElement |
|
90 |
* @param labelString |
|
91 |
* @param initialRule |
|
92 |
* @param style |
|
93 |
*/ |
|
94 |
public RuleConsideredElement( CdmFormFactory formFactory, ICdmFormElement formElement, String labelString, NameRelationship relation, int style) { |
|
95 |
super(formFactory, formElement); |
|
96 |
this.textRuleConsidered = formFactory.createTextWithLabelElement(formElement, "Rule considered", null, style); |
|
97 |
|
|
98 |
this.nomenclaturalCodeEdition = formFactory.createEnumComboElement(NomenclaturalCodeEdition.class, formElement, null, style); |
|
99 |
|
|
100 |
nomenclaturalCodeEditionStringMap = new HashMap<>(); |
|
101 | 60 |
|
102 |
this.element = relation; |
|
103 |
textRuleConsidered.setText(element.getRuleConsidered()); |
|
104 |
|
|
105 |
nomenclaturalCodeEdition.addSelectionListener(this); |
|
106 |
formFactory.addPropertyChangeListener(this); |
|
107 | 61 |
} |
108 | 62 |
|
109 | 63 |
|
64 |
|
|
110 | 65 |
public IRuleConsidered getElement() { |
111 | 66 |
return element; |
112 | 67 |
} |
... | ... | |
116 | 71 |
this.element = status; |
117 | 72 |
if (status.getRuleConsidered() != null){ |
118 | 73 |
this.textRuleConsidered.setText(getText()); |
119 |
this.nomenclaturalCodeEdition.setSelection(getCodeEdition()); |
|
74 |
if (nomenclaturalCodeEdition != null){ |
|
75 |
this.nomenclaturalCodeEdition.setSelection(getCodeEdition()); |
|
76 |
} |
|
120 | 77 |
}else{ |
121 |
this.nomenclaturalCodeEdition.setEnabled(false); |
|
78 |
if (nomenclaturalCodeEdition != null){ |
|
79 |
this.nomenclaturalCodeEdition.setEnabled(false); |
|
80 |
} |
|
81 |
|
|
122 | 82 |
} |
123 | 83 |
} |
124 | 84 |
|
... | ... | |
138 | 98 |
} |
139 | 99 |
@Override |
140 | 100 |
public void widgetSelected(SelectionEvent e) { |
141 |
NomenclaturalCodeEdition edition = nomenclaturalCodeEdition.getSelection(); |
|
142 |
if (element != null){ |
|
143 |
this.element.setCodeEdition(edition); |
|
101 |
if (nomenclaturalCodeEdition != null){ |
|
102 |
NomenclaturalCodeEdition edition = nomenclaturalCodeEdition.getSelection(); |
|
103 |
if (element != null){ |
|
104 |
this.element.setCodeEdition(edition); |
|
105 |
} |
|
144 | 106 |
} |
145 | 107 |
} |
146 | 108 |
|
... | ... | |
161 | 123 |
element.setRuleConsidered(textRuleConsidered.getText()); |
162 | 124 |
} |
163 | 125 |
if (StringUtils.isBlank(textRuleConsidered.getText())){ |
164 |
this.nomenclaturalCodeEdition.setEnabled(false); |
|
126 |
if (nomenclaturalCodeEdition != null){ |
|
127 |
this.nomenclaturalCodeEdition.setEnabled(false); |
|
128 |
} |
|
165 | 129 |
this.element.setCodeEdition(null); |
166 | 130 |
}else{ |
167 |
this.nomenclaturalCodeEdition.setEnabled(true); |
|
131 |
if (nomenclaturalCodeEdition != null){ |
|
132 |
this.nomenclaturalCodeEdition.setEnabled(true); |
|
133 |
} |
|
168 | 134 |
} |
169 | 135 |
} |
170 | 136 |
|
Also available in: Unified diff
ref #8572: code cleaning and rule considered configurable