Revision 040d6554
Added by Patrick Plitzner over 9 years ago
- added possibility to also add a person as nomenclatural author (fixes #4301)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
12 | 12 |
|
13 | 13 |
import java.util.Arrays; |
14 | 14 |
|
15 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
|
15 | 16 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
16 |
import eu.etaxonomy.taxeditor.model.AuthorHelper; |
|
17 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
18 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
17 | 19 |
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory; |
18 | 20 |
import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent; |
19 | 21 |
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement; |
20 |
import eu.etaxonomy.taxeditor.ui.element.IEnableableFormElement; |
|
21 | 22 |
import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement; |
22 | 23 |
import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement; |
23 |
import eu.etaxonomy.taxeditor.ui.selection.NomenclaturalAuthorTeamSelectionElement; |
|
24 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
|
25 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
26 | 24 |
|
27 | 25 |
/** |
28 | 26 |
* <p> |
29 | 27 |
* AuthorshipDetailElement class. |
30 | 28 |
* </p> |
31 |
*
|
|
29 |
* |
|
32 | 30 |
* @author n.hoffmann |
33 | 31 |
* @created Mar 4, 2010 |
34 | 32 |
* @version 1.0 |
35 | 33 |
*/ |
36 | 34 |
public class AuthorshipDetailElement extends |
37 |
AbstractIdentifiableEntityDetailElement<NonViralName> implements |
|
38 |
IEnableableFormElement { |
|
39 |
|
|
40 |
private NomenclaturalAuthorTeamSelectionElement selection_exBasionymAuthorTeam; |
|
41 |
private NomenclaturalAuthorTeamSelectionElement selection_basionymAuthorTeam; |
|
42 |
private NomenclaturalAuthorTeamSelectionElement selection_exCombinationAuthorTeam; |
|
43 |
private NomenclaturalAuthorTeamSelectionElement selection_combinationAuthorTeam; |
|
35 |
AbstractIdentifiableEntityDetailElement<NonViralName> { |
|
44 | 36 |
|
37 |
private EntitySelectionElement<TeamOrPersonBase> selectionExBasionymAuthor; |
|
38 |
private EntitySelectionElement<TeamOrPersonBase> selectionBasionymAuthor; |
|
39 |
private EntitySelectionElement<TeamOrPersonBase> selectionExCombinationAuthor; |
|
40 |
private EntitySelectionElement<TeamOrPersonBase> selectionCombinationAuthor; |
|
45 | 41 |
/** |
46 | 42 |
* <p> |
47 | 43 |
* Constructor for AuthorshipDetailElement. |
48 | 44 |
* </p> |
49 |
*
|
|
45 |
* |
|
50 | 46 |
* @param cdmFormFactory |
51 | 47 |
* a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} |
52 | 48 |
* object. |
... | ... | |
68 | 64 |
toggleable_cache = formFactory.createToggleableTextField(this, |
69 | 65 |
"Authorship Cache", entity.getAuthorshipCache(), |
70 | 66 |
entity.isProtectedAuthorshipCache(), style); |
71 |
|
|
67 |
|
|
72 | 68 |
//TODO RL |
73 | 69 |
if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){ |
74 | 70 |
toggleable_cache.setVisible(false); |
75 | 71 |
} |
76 |
selection_combinationAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
|
|
72 |
selectionCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
|
|
77 | 73 |
getConversationHolder(), |
78 | 74 |
formElement, "Author", |
79 |
AuthorHelper.getAuthor(entity.getCombinationAuthorTeam()),
|
|
75 |
entity.getCombinationAuthorTeam(),
|
|
80 | 76 |
EntitySelectionElement.ALL, style); |
81 |
addElement(selection_combinationAuthorTeam);
|
|
82 |
selection_exCombinationAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement(
|
|
77 |
addElement(selectionCombinationAuthor);
|
|
78 |
selectionExCombinationAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class,
|
|
83 | 79 |
getConversationHolder(), |
84 | 80 |
formElement, "Ex Author", |
85 |
AuthorHelper.getAuthor(entity.getExCombinationAuthorTeam()),
|
|
81 |
entity.getExCombinationAuthorTeam(),
|
|
86 | 82 |
EntitySelectionElement.ALL, style); |
87 |
addElement(selection_exCombinationAuthorTeam); |
|
88 |
selection_basionymAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement( |
|
89 |
getConversationHolder(), |
|
90 |
formElement, "Basionym Author", |
|
91 |
AuthorHelper.getAuthor(entity.getBasionymAuthorTeam()), |
|
92 |
EntitySelectionElement.ALL, style); |
|
93 |
addElement(selection_basionymAuthorTeam); |
|
94 |
selection_exBasionymAuthorTeam = formFactory.createNomenclaturalAuthorTeamSelectionElement( |
|
95 |
getConversationHolder(), |
|
96 |
formElement, "Ex Basionym Author", |
|
97 |
AuthorHelper.getAuthor(entity.getExBasionymAuthorTeam()), |
|
98 |
EntitySelectionElement.ALL, style); |
|
99 |
addElement(selection_exBasionymAuthorTeam); |
|
83 |
addElement(selectionExCombinationAuthor); |
|
84 |
selectionBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(), |
|
85 |
formElement, "Basionym Author", entity.getBasionymAuthorTeam(), |
|
86 |
EntitySelectionElement.ALL, style); |
|
87 |
addElement(selectionBasionymAuthor); |
|
88 |
selectionExBasionymAuthor = formFactory.createSelectionElement(TeamOrPersonBase.class, getConversationHolder(), |
|
89 |
formElement, "Ex Basionym Author", entity.getExBasionymAuthorTeam(), |
|
90 |
EntitySelectionElement.ALL, style); |
|
91 |
|
|
92 |
addElement(selectionExBasionymAuthor); |
|
100 | 93 |
} |
101 | 94 |
|
102 | 95 |
/** {@inheritDoc} */ |
... | ... | |
105 | 98 |
if (getEntity() == null) { |
106 | 99 |
setEntity(NonViralName.NewInstance(null)); |
107 | 100 |
} |
108 |
|
|
101 |
|
|
109 | 102 |
super.updateContent(); |
110 | 103 |
toggleable_cache.setEnabled(getEntity().isProtectedAuthorshipCache()); |
111 | 104 |
|
... | ... | |
127 | 120 |
setIrrelevant(toggleable_cache.getState(), |
128 | 121 |
Arrays.asList(new Object[] { toggleable_cache })); |
129 | 122 |
} |
130 |
} else if (eventSource == selection_combinationAuthorTeam) { |
|
123 |
} else if (eventSource == selectionExBasionymAuthor) { |
|
124 |
getEntity().setCombinationAuthorTeam( |
|
125 |
selectionExBasionymAuthor.getSelection()); |
|
126 |
} else if (eventSource == selectionCombinationAuthor) { |
|
131 | 127 |
getEntity().setCombinationAuthorTeam( |
132 |
selection_combinationAuthorTeam.getSelection());
|
|
133 |
} else if (eventSource == selection_exCombinationAuthorTeam) {
|
|
128 |
selectionCombinationAuthor.getSelection());
|
|
129 |
} else if (eventSource == selectionExCombinationAuthor) {
|
|
134 | 130 |
getEntity().setExCombinationAuthorTeam( |
135 |
selection_exCombinationAuthorTeam.getSelection());
|
|
136 |
} else if (eventSource == selection_basionymAuthorTeam) {
|
|
131 |
selectionExCombinationAuthor.getSelection());
|
|
132 |
} else if (eventSource == selectionBasionymAuthor) {
|
|
137 | 133 |
getEntity().setBasionymAuthorTeam( |
138 |
selection_basionymAuthorTeam.getSelection());
|
|
139 |
} else if (eventSource == selection_exBasionymAuthorTeam) {
|
|
134 |
selectionBasionymAuthor.getSelection());
|
|
135 |
} else if (eventSource == selectionExBasionymAuthor) {
|
|
140 | 136 |
getEntity().setExBasionymAuthorTeam( |
141 |
selection_exBasionymAuthorTeam.getSelection());
|
|
137 |
selectionExBasionymAuthor.getSelection());
|
|
142 | 138 |
} |
143 | 139 |
|
144 | 140 |
// if (eventSource != toggleable_cache) { |
... | ... | |
152 | 148 |
firePropertyChangeEvent(new CdmPropertyChangeEvent( |
153 | 149 |
getParentElement(), null)); |
154 | 150 |
} |
155 |
|
|
151 |
|
|
156 | 152 |
@Override |
157 | 153 |
public void updateToggleableCacheField() { |
158 | 154 |
if(! getEntity().isProtectedAuthorshipCache()){ |
Also available in: Unified diff