Revision 7ee1c79a
Added by Andreas Kohlbecker over 4 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/model/name/NameRelationshipDTO.java | ||
---|---|---|
13 | 13 |
import eu.etaxonomy.cdm.model.common.RelationshipBase.Direction; |
14 | 14 |
import eu.etaxonomy.cdm.model.name.NameRelationship; |
15 | 15 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
16 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCodeEdition; |
|
16 | 17 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
17 | 18 |
import eu.etaxonomy.cdm.model.reference.Reference; |
18 | 19 |
|
... | ... | |
33 | 34 |
Reference citation; |
34 | 35 |
String citationMicroReference; |
35 | 36 |
String ruleConsidered; |
37 |
NomenclaturalCodeEdition codeEdition; |
|
36 | 38 |
|
37 | 39 |
/** |
38 | 40 |
* @param entity |
... | ... | |
49 | 51 |
citation = nameRel.getCitation(); |
50 | 52 |
citationMicroReference = nameRel.getCitationMicroReference(); |
51 | 53 |
ruleConsidered = nameRel.getRuleConsidered(); |
54 |
codeEdition = nameRel.getCodeEdition(); |
|
52 | 55 |
} |
53 | 56 |
|
54 | 57 |
/** |
... | ... | |
146 | 149 |
this.ruleConsidered = ruleConsidered; |
147 | 150 |
} |
148 | 151 |
|
152 |
public NomenclaturalCodeEdition getCodeEdition() { |
|
153 |
return codeEdition; |
|
154 |
} |
|
155 |
|
|
156 |
public void setCodeEdition(NomenclaturalCodeEdition codeEdition) { |
|
157 |
this.codeEdition = codeEdition; |
|
158 |
} |
|
159 |
|
|
160 |
|
|
161 |
|
|
149 | 162 |
|
150 | 163 |
|
151 | 164 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/model/name/TaxonNameDTO.java | ||
---|---|---|
170 | 170 |
relationship.setCitation(nameRelDto.getCitation()); |
171 | 171 |
relationship.setCitationMicroReference(nameRelDto.getCitationMicroReference()); |
172 | 172 |
relationship.setRuleConsidered(nameRelDto.getRuleConsidered()); |
173 |
relationship.setCodeEdition(nameRelDto.getCodeEdition()); |
|
173 | 174 |
} else { |
174 | 175 |
// need to remove the old relationship and to create a new one. |
175 | 176 |
// the actual removal will take place .... |
176 | 177 |
if(direction == Direction.relatedTo){ |
177 | 178 |
name.addRelationshipFromName(nameRelDto.getOtherName(), nameRelationshipType, |
178 |
nameRelDto.getCitation(), nameRelDto.getCitationMicroReference(), nameRelDto.getRuleConsidered()); |
|
179 |
nameRelDto.getCitation(), nameRelDto.getCitationMicroReference(), nameRelDto.getRuleConsidered(), nameRelDto.getCodeEdition());
|
|
179 | 180 |
} else { |
180 | 181 |
name.addRelationshipToName(nameRelDto.getOtherName(), nameRelationshipType, |
181 |
nameRelDto.getCitation(), nameRelDto.getCitationMicroReference(), nameRelDto.getRuleConsidered()); |
|
182 |
nameRelDto.getCitation(), nameRelDto.getCitationMicroReference(), nameRelDto.getRuleConsidered(), nameRelDto.getCodeEdition());
|
|
182 | 183 |
} |
183 | 184 |
if(persistedRelatedName != null){ |
184 | 185 |
name.removeRelationWithTaxonName(persistedRelatedName, direction, nameRelationshipType); |
... | ... | |
242 | 243 |
} |
243 | 244 |
if(!currentRelatedNames.contains(tn)){ |
244 | 245 |
if(direction.equals(Direction.relatedTo)){ |
245 |
tn.addRelationshipToName(name, relType, null); |
|
246 |
tn.addRelationshipToName(name, relType, null, null);
|
|
246 | 247 |
} else { |
247 |
tn.addRelationshipFromName(name, relType, null); |
|
248 |
tn.addRelationshipFromName(name, relType, null, null);
|
|
248 | 249 |
} |
249 | 250 |
} |
250 | 251 |
namesSeen.add(tn); |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java | ||
---|---|---|
139 | 139 |
|
140 | 140 |
super.handleViewEntered(); |
141 | 141 |
|
142 |
List<NomenclaturalCodeEdition> nomCodes = NomenclaturalCodeEdition.forCode(RegistrationUIDefaults.NOMENCLATURAL_CODE); |
|
143 |
BeanItemContainer<NomenclaturalCodeEdition> codeEditionItemContainer = cdmBeanItemContainerFactory.buildEnumTermItemContainer( |
|
144 |
NomenclaturalCodeEdition.class, nomCodes.toArray(new NomenclaturalCodeEdition[nomCodes.size()]) |
|
145 |
); |
|
146 |
|
|
142 | 147 |
getView().getRankSelect().setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(TermType.Rank)); |
143 | 148 |
getView().getRankSelect().setItemCaptionPropertyId("label"); |
144 | 149 |
|
... | ... | |
205 | 210 |
doReferenceEditorEdit(row); |
206 | 211 |
} |
207 | 212 |
}); |
208 |
|
|
209 |
List<NomenclaturalCodeEdition> nomCodes = NomenclaturalCodeEdition.forCode(RegistrationUIDefaults.NOMENCLATURAL_CODE); |
|
210 |
BeanItemContainer<NomenclaturalCodeEdition> codeEditionItemContainer = cdmBeanItemContainerFactory.buildEnumTermItemContainer( |
|
211 |
NomenclaturalCodeEdition.class, nomCodes.toArray(new NomenclaturalCodeEdition[nomCodes.size()]) |
|
212 |
); |
|
213 | 213 |
row.codeEdition.setContainerDataSource(codeEditionItemContainer); |
214 | 214 |
|
215 | 215 |
getView().applyDefaultComponentStyle(row.components()); |
... | ... | |
218 | 218 |
} |
219 | 219 |
}); |
220 | 220 |
|
221 |
|
|
221 | 222 |
relatedNamePagingProvider = pagingProviderFactory.taxonNamesWithoutOrthophicIncorrect(); |
222 | 223 |
relatedNamePagingProvider.setInitStrategy(RELATED_NAME_INIT_STRATEGY); |
223 | 224 |
getView().getBasionymComboboxSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>()); |
... | ... | |
232 | 233 |
getView().getValidationField().getCitatonComboBox().getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, getView().getValidationField().getCitatonComboBox().getSelect())); |
233 | 234 |
getView().getValidationField().getCitatonComboBox().loadFrom(icbnCodesPagingProvider, icbnCodesPagingProvider, icbnCodesPagingProvider.getPageSize()); |
234 | 235 |
getView().getValidationField().getCitatonComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getValidationField().getCitatonComboBox(), this)); |
236 |
getView().getValidationField().getCodeEditionSelect().setContainerDataSource(codeEditionItemContainer); |
|
235 | 237 |
|
236 | 238 |
getView().getOrthographicVariantField().getRelatedNameComboBox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>()); |
237 | 239 |
getView().getOrthographicVariantField().getRelatedNameComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getOrthographicVariantField().getRelatedNameComboBox(), this)); |
... | ... | |
240 | 242 |
getView().getOrthographicVariantField().getCitatonComboBox().getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.BIBLIOGRAPHIC, getView().getOrthographicVariantField().getCitatonComboBox().getSelect())); |
241 | 243 |
getView().getOrthographicVariantField().getCitatonComboBox().loadFrom(icbnCodesPagingProvider, icbnCodesPagingProvider, icbnCodesPagingProvider.getPageSize()); |
242 | 244 |
getView().getOrthographicVariantField().getCitatonComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getOrthographicVariantField().getCitatonComboBox(), this)); |
245 |
getView().getOrthographicVariantField().getCodeEditionSelect().setContainerDataSource(codeEditionItemContainer); |
|
243 | 246 |
|
244 | 247 |
getView().getAnnotationsField().setAnnotationTypeItemContainer(cdmBeanItemContainerFactory.buildBeanItemContainer( |
245 | 248 |
AnnotationType.EDITORIAL().getVocabulary().getUuid())); |
src/main/java/eu/etaxonomy/vaadin/component/NameRelationField.java | ||
---|---|---|
12 | 12 |
|
13 | 13 |
import com.vaadin.data.fieldgroup.BeanFieldGroup; |
14 | 14 |
import com.vaadin.data.fieldgroup.FieldGroup; |
15 |
import com.vaadin.ui.AbstractSelect; |
|
15 | 16 |
import com.vaadin.ui.Button; |
16 | 17 |
import com.vaadin.ui.Component; |
17 | 18 |
import com.vaadin.ui.CssLayout; |
18 | 19 |
import com.vaadin.ui.GridLayout; |
20 |
import com.vaadin.ui.NativeSelect; |
|
19 | 21 |
import com.vaadin.ui.themes.ValoTheme; |
20 | 22 |
|
21 | 23 |
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter.LabelType; |
... | ... | |
63 | 65 |
|
64 | 66 |
TextFieldNFix ruleConsideredField = new TextFieldNFix(); |
65 | 67 |
|
68 |
NativeSelect codeEditionSelect = new NativeSelect(); |
|
69 |
|
|
66 | 70 |
private Direction direction; |
67 | 71 |
|
68 | 72 |
private NameRelationshipType type; |
... | ... | |
137 | 141 |
citatonComboBox.setCaption("Reference"); |
138 | 142 |
citationMicroReferenceField.setCaption("Reference detail"); |
139 | 143 |
ruleConsideredField.setCaption("Rule considered"); |
144 |
codeEditionSelect.setCaption("Nom. code"); |
|
140 | 145 |
|
141 | 146 |
grid.addComponent(citatonComboBox, 0, 1, 0, 1); |
142 | 147 |
grid.addComponent(citationMicroReferenceField, 1, 1, 1, 1); |
143 |
grid.addComponent(ruleConsideredField, 0, 2, 1, 2); |
|
148 |
grid.addComponent(ruleConsideredField, 0, 2, 0, 2); |
|
149 |
grid.addComponent(codeEditionSelect, 1, 2, 1, 2); |
|
144 | 150 |
|
145 | 151 |
relatedNameComboBox.setWidth(100, Unit.PERCENTAGE); |
146 | 152 |
ruleConsideredField.setWidth(100, Unit.PERCENTAGE); |
147 | 153 |
citatonComboBox.setWidth(100, Unit.PERCENTAGE); |
154 |
codeEditionSelect.setWidth(100, Unit.PERCENTAGE); |
|
148 | 155 |
|
149 | 156 |
|
150 | 157 |
|
... | ... | |
158 | 165 |
compositeWrapper.addComponents(toolBar); |
159 | 166 |
|
160 | 167 |
addSizedComponents(compositeWrapper); |
161 |
addStyledComponents(relatedNameComboBox, citationMicroReferenceField, citatonComboBox, ruleConsideredField, newButton, removeButton); |
|
168 |
addStyledComponents(relatedNameComboBox, citationMicroReferenceField, citatonComboBox, ruleConsideredField, codeEditionSelect, newButton, removeButton);
|
|
162 | 169 |
|
163 | 170 |
return compositeWrapper; |
164 | 171 |
} |
... | ... | |
181 | 188 |
|
182 | 189 |
super.setInternalValue(newValue); |
183 | 190 |
|
184 |
|
|
185 | 191 |
newValue = HibernateProxyHelper.deproxy(newValue); |
186 | 192 |
if(newValue != null) { |
187 | 193 |
compositeWrapper.addComponent(grid); |
... | ... | |
189 | 195 |
fieldGroup.bind(citationMicroReferenceField, "citationMicroReference"); |
190 | 196 |
fieldGroup.bind(citatonComboBox, "citation"); |
191 | 197 |
fieldGroup.bind(ruleConsideredField, "ruleConsidered"); |
198 |
fieldGroup.bind(codeEditionSelect, "codeEdition"); |
|
192 | 199 |
|
193 | 200 |
fieldGroup.setItemDataSource(newValue); |
194 | 201 |
} else { |
... | ... | |
198 | 205 |
fieldGroup.unbind(citationMicroReferenceField); |
199 | 206 |
fieldGroup.unbind(citatonComboBox); |
200 | 207 |
fieldGroup.unbind(ruleConsideredField); |
208 |
fieldGroup.unbind(codeEditionSelect); |
|
201 | 209 |
|
202 | 210 |
fieldGroup.setItemDataSource(newValue); |
203 | 211 |
} |
... | ... | |
228 | 236 |
return citatonComboBox; |
229 | 237 |
} |
230 | 238 |
|
239 |
public AbstractSelect getCodeEditionSelect(){ |
|
240 |
return codeEditionSelect; |
|
241 |
} |
|
242 |
|
|
231 | 243 |
/** |
232 | 244 |
* {@inheritDoc} |
233 | 245 |
*/ |
Also available in: Unified diff
fix #8409 adding select for code editions to NameRelationField