Revision 0aa1233b
Added by Andreas Kohlbecker almost 5 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/model/name/TaxonNameDTO.java | ||
---|---|---|
16 | 16 |
|
17 | 17 |
import org.joda.time.DateTime; |
18 | 18 |
|
19 |
import eu.etaxonomy.cdm.model.EntityCollectionSetterAdapter.SetterAdapterException; |
|
19 | 20 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
20 | 21 |
import eu.etaxonomy.cdm.model.common.Annotation; |
21 | 22 |
import eu.etaxonomy.cdm.model.common.Credit; |
... | ... | |
327 | 328 |
return name.getStatus(); |
328 | 329 |
} |
329 | 330 |
|
331 |
public void setStatus(Set<NomenclaturalStatus> status) throws SetterAdapterException { |
|
332 |
name.setStatus(status); |
|
333 |
} |
|
334 |
|
|
330 | 335 |
public boolean isProtectedAuthorshipCache() { |
331 | 336 |
return name.isProtectedAuthorshipCache(); |
332 | 337 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/NomenclaturalStatusRow.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2019 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.vaadin.view.name; |
|
10 |
|
|
11 |
import java.util.Arrays; |
|
12 |
import java.util.List; |
|
13 |
|
|
14 |
import com.vaadin.server.Sizeable.Unit; |
|
15 |
import com.vaadin.ui.Component; |
|
16 |
import com.vaadin.ui.NativeSelect; |
|
17 |
import com.vaadin.ui.TextField; |
|
18 |
|
|
19 |
import eu.etaxonomy.cdm.model.reference.Reference; |
|
20 |
import eu.etaxonomy.cdm.vaadin.component.CollectionRow; |
|
21 |
import eu.etaxonomy.cdm.vaadin.component.CollectionRowItemCollection; |
|
22 |
import eu.etaxonomy.cdm.vaadin.component.TextFieldNFix; |
|
23 |
import eu.etaxonomy.cdm.vaadin.event.ToOneRelatedEntityButtonUpdater; |
|
24 |
import eu.etaxonomy.vaadin.component.ToOneRelatedEntityCombobox; |
|
25 |
|
|
26 |
/** |
|
27 |
* @author a.kohlbecker |
|
28 |
* @since Apr 29, 2019 |
|
29 |
* |
|
30 |
*/ |
|
31 |
public class NomenclaturalStatusRow extends CollectionRowItemCollection implements CollectionRow { |
|
32 |
|
|
33 |
|
|
34 |
private static final long serialVersionUID = -4088064849794846181L; |
|
35 |
|
|
36 |
/* |
|
37 |
* CONVENTION! |
|
38 |
* |
|
39 |
* The fieldname must match the properties of the SpecimenTypeDesignationDTO |
|
40 |
*/ |
|
41 |
NativeSelect type = new NativeSelect(); |
|
42 |
ToOneRelatedEntityCombobox<Reference> citation = new ToOneRelatedEntityCombobox<Reference>(null, Reference.class); |
|
43 |
TextField citationMicroReference = new TextFieldNFix(); |
|
44 |
TextField ruleConsidered = new TextFieldNFix(); |
|
45 |
|
|
46 |
public NomenclaturalStatusRow() { |
|
47 |
|
|
48 |
citation.setWidth(200, Unit.PIXELS); |
|
49 |
citation.setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(citation)); |
|
50 |
citationMicroReference.setWidth(200, Unit.PIXELS); |
|
51 |
ruleConsidered.setWidth(200, Unit.PIXELS); |
|
52 |
} |
|
53 |
|
|
54 |
/** |
|
55 |
* @return |
|
56 |
*/ |
|
57 |
public Component[] components() { |
|
58 |
Component[] components = new Component[]{ |
|
59 |
type, |
|
60 |
citation, |
|
61 |
citationMicroReference, |
|
62 |
ruleConsidered |
|
63 |
}; |
|
64 |
addAll(Arrays.asList(components)); |
|
65 |
return components; |
|
66 |
} |
|
67 |
|
|
68 |
public static List<String> visibleFields() { |
|
69 |
List<String> visibleFields = Arrays.asList(new String[]{ |
|
70 |
"type", |
|
71 |
"citation", |
|
72 |
"citationMicroReference", |
|
73 |
"ruleConsidered" |
|
74 |
}); |
|
75 |
return visibleFields; |
|
76 |
} |
|
77 |
|
|
78 |
/** |
|
79 |
* {@inheritDoc} |
|
80 |
*/ |
|
81 |
@Override |
|
82 |
public void updateRowItemsEnablement() { |
|
83 |
// nothing to do |
|
84 |
} |
|
85 |
|
|
86 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationDTORow.java | ||
---|---|---|
56 | 56 |
ToOneRelatedEntityCombobox<Reference> mediaSpecimenReference = |
57 | 57 |
new ToOneRelatedEntityCombobox<Reference>(null, Reference.class); |
58 | 58 |
TextField mediaSpecimenReferenceDetail = new TextFieldNFix(); //"Image reference detail"); |
59 |
private ToOneRelatedEntityButtonUpdater<Reference> mediaSpecimenReferenceUpdater; |
|
60 |
private ToOneRelatedEntityButtonUpdater<Collection> collectionFieldUpdater; |
|
61 | 59 |
|
62 | 60 |
public SpecimenTypeDesignationDTORow(){ |
63 | 61 |
|
64 | 62 |
kindOfUnit.setRequired(true); |
65 | 63 |
kindOfUnit.setRow(this); |
64 |
|
|
66 | 65 |
typeStatus.setRequired(true); |
67 | 66 |
|
68 | 67 |
accessionNumber.setWidth(100, Unit.PIXELS); |
68 |
|
|
69 | 69 |
preferredStableUri.setWidth(150, Unit.PIXELS); |
70 | 70 |
preferredStableUri.setConverter(new UriConverter()); |
71 |
|
|
71 | 72 |
collection.setWidth(200, Unit.PIXELS); |
72 | 73 |
collection.setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Collection>(collection)); |
74 |
|
|
73 | 75 |
mediaUri.setWidth(150, Unit.PIXELS); |
74 | 76 |
mediaUri.setConverter(new UriConverter()); |
77 |
|
|
75 | 78 |
mediaSpecimenReference.setWidth(200, Unit.PIXELS); |
76 | 79 |
mediaSpecimenReference.setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(mediaSpecimenReference)); |
80 |
|
|
77 | 81 |
mediaSpecimenReferenceDetail.setWidth(200, Unit.PIXELS); |
78 | 82 |
|
79 | 83 |
kindOfUnit.addValueChangeListener(e -> |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetEditorPresenter.java | ||
---|---|---|
284 | 284 |
* @return |
285 | 285 |
*/ |
286 | 286 |
private void addTypeDesignation(SpecimenTypeDesignationDTO element) { |
287 |
getView().updateAllowDelete(); |
|
287 |
getView().updateAllowDeleteTypeDesignation();
|
|
288 | 288 |
} |
289 | 289 |
|
290 | 290 |
|
... | ... | |
304 | 304 |
|
305 | 305 |
reg.getTypeDesignations().remove(std); |
306 | 306 |
|
307 |
getView().updateAllowDelete(); |
|
307 |
getView().updateAllowDeleteTypeDesignation();
|
|
308 | 308 |
} |
309 | 309 |
|
310 | 310 |
/** |
... | ... | |
369 | 369 |
SpecimenTypeDesignationDTORow row = collectionPopupEditorsRowMap.get(event.getSourceView()); |
370 | 370 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 3); |
371 | 371 |
combobox.setValue((Collection) event.getEntity()); |
372 |
} |
|
373 |
for( CollectionRowItemCollection row : popuEditorTypeDesignationSourceRows) { |
|
374 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 3); |
|
375 |
combobox.reload(); |
|
372 |
} else { |
|
373 |
for( CollectionRowItemCollection row : popuEditorTypeDesignationSourceRows) { |
|
374 |
ToOneRelatedEntityCombobox<Collection> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 3); |
|
375 |
combobox.reload(); |
|
376 |
} |
|
376 | 377 |
} |
377 | 378 |
} |
378 | 379 |
} |
... | ... | |
413 | 414 |
SpecimenTypeDesignationDTORow row = referencePopupEditorsRowMap.get(event.getSourceView()); |
414 | 415 |
ToOneRelatedEntityCombobox<Reference> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 7); |
415 | 416 |
combobox.setValue((Reference) event.getEntity()); |
416 |
|
|
417 | 417 |
} else { |
418 | 418 |
for( CollectionRowItemCollection row : popuEditorTypeDesignationSourceRows) { |
419 | 419 |
ToOneRelatedEntityCombobox<Reference> combobox = row.getComponent(ToOneRelatedEntityCombobox.class, 7); |
420 | 420 |
combobox.reload(); |
421 | 421 |
} |
422 | 422 |
} |
423 |
|
|
423 | 424 |
} |
424 | 425 |
|
425 | 426 |
/** |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetPopupEditor.java | ||
---|---|---|
18 | 18 |
import com.vaadin.data.Validator.InvalidValueException; |
19 | 19 |
import com.vaadin.data.validator.DoubleRangeValidator; |
20 | 20 |
import com.vaadin.server.ErrorMessage; |
21 |
import com.vaadin.shared.ui.MarginInfo; |
|
21 | 22 |
import com.vaadin.spring.annotation.SpringComponent; |
22 | 23 |
import com.vaadin.ui.AbstractSelect.ItemCaptionMode; |
23 | 24 |
import com.vaadin.ui.Component; |
... | ... | |
225 | 226 |
typeDesignationsCollectionField.setPropertyHeader("mediaSpecimenReference", "Image reference"); |
226 | 227 |
typeDesignationsCollectionField.setPropertyHeader("mediaSpecimenReferenceDetail", "Reference detail"); |
227 | 228 |
typeDesignationsCollectionField.addElementAddedListener( e -> typeDesignationsCollectionField.setComponentError(null)); |
229 |
typeDesignationsCollectionField.getLayout().setMargin(new MarginInfo(false, true)); |
|
228 | 230 |
|
229 | 231 |
// typeDesignationsCollectionField.getLayout().setMargin(false); |
230 | 232 |
// typeDesignationsCollectionField.addStyleName("composite-field-wrapper"); |
... | ... | |
332 | 334 |
Component item = gridLayout.getComponent(SpecimenTypeDesignationDTORow.rowListSelectColumn(), rowIndex); |
333 | 335 |
((CollectionRowRepresentative)item).updateRowItemsEnabledStates(); |
334 | 336 |
} |
335 |
updateAllowDelete(); |
|
337 |
updateAllowDeleteTypeDesignation();
|
|
336 | 338 |
} |
337 | 339 |
|
338 | 340 |
/** |
339 | 341 |
* {@inheritDoc} |
340 | 342 |
*/ |
341 | 343 |
@Override |
342 |
public void updateAllowDelete(){ |
|
344 |
public void updateAllowDeleteTypeDesignation(){
|
|
343 | 345 |
// disable the delete button if there is only one typeDesignation |
344 | 346 |
// if this typeDesignation is deleted the fieldUnit would become orphan in the |
345 | 347 |
// TypeDesignationWorkingSet |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/SpecimenTypeDesignationWorkingsetPopupEditorView.java | ||
---|---|---|
38 | 38 |
* if this typeDesignation is deleted the fieldUnit would become orphan in the |
39 | 39 |
* TypeDesignationWorkingSet |
40 | 40 |
*/ |
41 |
public void updateAllowDelete(); |
|
41 |
public void updateAllowDeleteTypeDesignation();
|
|
42 | 42 |
|
43 | 43 |
TeamOrPersonField getCollectorField(); |
44 | 44 |
|
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNameEditorPresenter.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import java.util.Arrays; |
12 | 12 |
import java.util.EnumSet; |
13 |
import java.util.HashMap; |
|
13 | 14 |
import java.util.List; |
15 |
import java.util.Map; |
|
14 | 16 |
import java.util.UUID; |
15 | 17 |
|
16 | 18 |
import org.apache.commons.lang.StringUtils; |
... | ... | |
18 | 20 |
import org.hibernate.criterion.Restrictions; |
19 | 21 |
import org.springframework.context.annotation.Scope; |
20 | 22 |
import org.vaadin.spring.events.annotation.EventBusListenerMethod; |
23 |
import org.vaadin.viritin.fields.AbstractElementCollection; |
|
21 | 24 |
|
22 | 25 |
import com.vaadin.data.Property; |
23 | 26 |
import com.vaadin.spring.annotation.SpringComponent; |
... | ... | |
31 | 34 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
32 | 35 |
import eu.etaxonomy.cdm.model.common.AnnotationType; |
33 | 36 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
37 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
|
38 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
|
34 | 39 |
import eu.etaxonomy.cdm.model.name.Rank; |
35 | 40 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
36 | 41 |
import eu.etaxonomy.cdm.model.name.TaxonNameFactory; |
... | ... | |
80 | 85 |
@Scope("prototype") |
81 | 86 |
public class TaxonNameEditorPresenter extends AbstractCdmDTOEditorPresenter<TaxonNameDTO, TaxonName, TaxonNamePopupEditorView> { |
82 | 87 |
|
88 |
private static final long serialVersionUID = -3538980627079389221L; |
|
89 |
|
|
90 |
private static final EnumSet<CRUD> SUB_EDITOR_CRUD = EnumSet.of(CRUD.UPDATE, CRUD.DELETE); |
|
83 | 91 |
|
84 | 92 |
private static final List<String> RELATED_NAME_INIT_STRATEGY = Arrays.asList( |
85 | 93 |
"$", |
... | ... | |
90 | 98 |
|
91 | 99 |
public static final List<String> REFERENCE_INIT_STRATEGY = Arrays.asList("authorship", "inReference.authorship", "inReference.inReference.authorship", "inReference.inReference.inReference.authorship"); |
92 | 100 |
|
93 |
private static final long serialVersionUID = -3538980627079389221L; |
|
94 | 101 |
|
95 | 102 |
private static final Logger logger = Logger.getLogger(TaxonNameEditorPresenter.class); |
96 | 103 |
|
... | ... | |
100 | 107 |
|
101 | 108 |
private BeanInstantiator<Reference> newReferenceInstantiator; |
102 | 109 |
|
110 |
private Map<ReferencePopupEditor, NomenclaturalStatusRow> statusTypeReferencePopupEditorsRowMap = new HashMap<>(); |
|
111 |
|
|
103 | 112 |
private TaxonNameStringFilterablePagingProvider genusOrUninomialPartPagingProvider; |
104 | 113 |
|
105 | 114 |
private TaxonNameStringFilterablePagingProvider specificEpithetPartPagingProvider; |
... | ... | |
117 | 126 |
/** |
118 | 127 |
* {@inheritDoc} |
119 | 128 |
*/ |
129 |
@SuppressWarnings("serial") |
|
120 | 130 |
@Override |
121 | 131 |
public void handleViewEntered() { |
122 | 132 |
|
... | ... | |
153 | 163 |
getView().getNomReferenceCombobox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getNomReferenceCombobox(), this)); |
154 | 164 |
getView().getNomReferenceCombobox().getSelect().addValueChangeListener( e -> updateOrthographicCorrectionRestriction()); |
155 | 165 |
|
156 |
|
|
157 |
relatedNamePagingProvider = pagingProviderFactory.taxonNamesWithoutOrthophicIncorrect(); |
|
158 |
relatedNamePagingProvider.setInitStrategy(RELATED_NAME_INIT_STRATEGY); |
|
159 |
getView().getBasionymComboboxSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>()); |
|
160 |
getView().getBasionymComboboxSelect().setPagingProviders(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize(), this); |
|
161 |
|
|
162 |
getView().getReplacedSynonymsComboboxSelect().setCaptionGenerator( new CdmTitleCacheCaptionGenerator<TaxonName>()); |
|
163 |
getView().getReplacedSynonymsComboboxSelect().setPagingProviders(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize(), this); |
|
164 |
|
|
165 | 166 |
CdmFilterablePagingProvider<Reference, Reference> icbnCodesPagingProvider = pagingProviderFactory.referencePagingProvider(); |
166 | 167 |
// @formatter:off |
167 | 168 |
// TODO use markers on references instead of isbn. The marker type MarkerType.NOMENCLATURAL_RELEVANT() has already prepared (#7466) |
... | ... | |
175 | 176 |
})); |
176 | 177 |
// @formatter:on |
177 | 178 |
|
179 |
statusTypeReferencePopupEditorsRowMap.clear(); |
|
180 |
getView().getNomStatusCollectionField().addElementAddedListener(e -> addNomenclaturalStatus(e.getElement())); |
|
181 |
getView().getNomStatusCollectionField().setEditorInstantiator(new AbstractElementCollection.Instantiator<NomenclaturalStatusRow>() { |
|
182 |
|
|
183 |
@Override |
|
184 |
public NomenclaturalStatusRow create() { |
|
185 |
NomenclaturalStatusRow row = new NomenclaturalStatusRow(); |
|
186 |
|
|
187 |
row.type.setContainerDataSource(cdmBeanItemContainerFactory.buildBeanItemContainer(NomenclaturalStatusType.ALTERNATIVE().getVocabulary().getUuid())); |
|
188 |
row.type.setNullSelectionAllowed(false); |
|
189 |
|
|
190 |
row.citation.loadFrom(icbnCodesPagingProvider, icbnCodesPagingProvider, icbnCodesPagingProvider.getPageSize()); |
|
191 |
row.citation.getSelect().setCaptionGenerator(new ReferenceEllypsisCaptionGenerator(LabelType.NOMENCLATURAL, row.citation.getSelect())); |
|
192 |
row.citation.getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<Reference>(row.citation.getSelect(), |
|
193 |
TaxonNameEditorPresenter.this)); |
|
194 |
row.citation.addClickListenerAddEntity(e -> doReferenceEditorAdd(row)); |
|
195 |
row.citation.addClickListenerEditEntity(e -> { |
|
196 |
if(row.citation.getValue() != null){ |
|
197 |
doReferenceEditorEdit(row); |
|
198 |
} |
|
199 |
}); |
|
200 |
|
|
201 |
getView().applyDefaultComponentStyle(row.components()); |
|
202 |
|
|
203 |
return row; |
|
204 |
} |
|
205 |
}); |
|
206 |
|
|
207 |
relatedNamePagingProvider = pagingProviderFactory.taxonNamesWithoutOrthophicIncorrect(); |
|
208 |
relatedNamePagingProvider.setInitStrategy(RELATED_NAME_INIT_STRATEGY); |
|
209 |
getView().getBasionymComboboxSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>()); |
|
210 |
getView().getBasionymComboboxSelect().setPagingProviders(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize(), this); |
|
211 |
|
|
212 |
getView().getReplacedSynonymsComboboxSelect().setCaptionGenerator( new CdmTitleCacheCaptionGenerator<TaxonName>()); |
|
213 |
getView().getReplacedSynonymsComboboxSelect().setPagingProviders(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize(), this); |
|
214 |
|
|
178 | 215 |
getView().getValidationField().getRelatedNameComboBox().getSelect().setCaptionGenerator(new CdmTitleCacheCaptionGenerator<TaxonName>()); |
179 | 216 |
getView().getValidationField().getRelatedNameComboBox().loadFrom(relatedNamePagingProvider, relatedNamePagingProvider, relatedNamePagingProvider.getPageSize()); |
180 | 217 |
getView().getValidationField().getRelatedNameComboBox().getSelect().addValueChangeListener(new ToOneRelatedEntityReloader<>(getView().getValidationField().getRelatedNameComboBox(), this)); |
... | ... | |
195 | 232 |
AnnotationType.EDITORIAL().getUuid(), AnnotationType.TECHNICAL().getUuid())); |
196 | 233 |
} |
197 | 234 |
|
235 |
/** |
|
236 |
* @param element |
|
237 |
* @return |
|
238 |
*/ |
|
239 |
private void addNomenclaturalStatus(NomenclaturalStatus element) { |
|
240 |
// Nothing to do |
|
241 |
} |
|
242 |
|
|
198 | 243 |
@Override |
199 | 244 |
protected void adaptDataProviders() { |
200 | 245 |
updateOrthographicCorrectionRestriction(); |
... | ... | |
239 | 284 |
"nomenclaturalReference.inReference.inReference.inReference.authorship", |
240 | 285 |
|
241 | 286 |
"status.type", |
287 |
"status.citation.authorship.$", |
|
288 |
"status.citation.inReference.authorship.$", |
|
242 | 289 |
|
243 | 290 |
"combinationAuthorship", |
244 | 291 |
"exCombinationAuthorship", |
... | ... | |
336 | 383 |
return getRepo().getNameService(); |
337 | 384 |
} |
338 | 385 |
|
386 |
|
|
387 |
public void doReferenceEditorAdd(NomenclaturalStatusRow row) { |
|
388 |
|
|
389 |
ReferencePopupEditor referencePopupEditor = openPopupEditor(ReferencePopupEditor.class, null); |
|
390 |
|
|
391 |
referencePopupEditor.withReferenceTypes(RegistrationUIDefaults.MEDIA_REFERENCE_TYPES); |
|
392 |
referencePopupEditor.grantToCurrentUser(SUB_EDITOR_CRUD); |
|
393 |
referencePopupEditor.withDeleteButton(true); |
|
394 |
referencePopupEditor.loadInEditor(null); |
|
395 |
|
|
396 |
statusTypeReferencePopupEditorsRowMap.put(referencePopupEditor, row); |
|
397 |
} |
|
398 |
|
|
399 |
public void doReferenceEditorEdit(NomenclaturalStatusRow row) { |
|
400 |
|
|
401 |
ReferencePopupEditor referencePopupEditor = openPopupEditor(ReferencePopupEditor.class, null); |
|
402 |
referencePopupEditor.withReferenceTypes(RegistrationUIDefaults.MEDIA_REFERENCE_TYPES); |
|
403 |
referencePopupEditor.grantToCurrentUser(SUB_EDITOR_CRUD); |
|
404 |
referencePopupEditor.withDeleteButton(true); |
|
405 |
referencePopupEditor.loadInEditor(row.citation.getValue().getUuid()); |
|
406 |
|
|
407 |
statusTypeReferencePopupEditorsRowMap.put(referencePopupEditor, row); |
|
408 |
} |
|
339 | 409 |
/** |
340 | 410 |
* @param referenceEditorPopup |
341 | 411 |
*/ |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditor.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.view.name; |
10 | 10 |
|
11 |
import java.util.Collection; |
|
11 | 12 |
import java.util.EnumSet; |
12 | 13 |
import java.util.HashMap; |
13 | 14 |
import java.util.List; |
... | ... | |
16 | 17 |
|
17 | 18 |
import org.apache.commons.lang3.BooleanUtils; |
18 | 19 |
import org.springframework.context.annotation.Scope; |
20 |
import org.vaadin.viritin.fields.AbstractElementCollection.Instantiator; |
|
21 |
import org.vaadin.viritin.fields.ElementCollectionField; |
|
19 | 22 |
|
20 | 23 |
import com.vaadin.data.Property; |
21 | 24 |
import com.vaadin.data.Property.ValueChangeListener; |
25 |
import com.vaadin.data.Validator.InvalidValueException; |
|
26 |
import com.vaadin.server.ErrorMessage; |
|
27 |
import com.vaadin.shared.ui.MarginInfo; |
|
22 | 28 |
import com.vaadin.spring.annotation.SpringComponent; |
23 | 29 |
import com.vaadin.ui.AbstractField; |
24 | 30 |
import com.vaadin.ui.Alignment; |
25 | 31 |
import com.vaadin.ui.CheckBox; |
32 |
import com.vaadin.ui.Component; |
|
26 | 33 |
import com.vaadin.ui.GridLayout; |
27 | 34 |
import com.vaadin.ui.NativeSelect; |
35 |
import com.vaadin.ui.Panel; |
|
28 | 36 |
import com.vaadin.ui.TextField; |
29 | 37 |
|
30 | 38 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
... | ... | |
32 | 40 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
33 | 41 |
import eu.etaxonomy.cdm.model.common.RelationshipBase.Direction; |
34 | 42 |
import eu.etaxonomy.cdm.model.name.NameRelationshipType; |
43 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
|
35 | 44 |
import eu.etaxonomy.cdm.model.name.Rank; |
36 | 45 |
import eu.etaxonomy.cdm.model.name.RankClass; |
37 | 46 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
... | ... | |
73 | 82 |
|
74 | 83 |
private final static int GRID_COLS = 4; |
75 | 84 |
|
76 |
private final static int GRID_ROWS = 19;
|
|
85 |
private final static int GRID_ROWS = 20;
|
|
77 | 86 |
|
78 | 87 |
private static final boolean HAS_BASIONYM_DEFAULT = false; |
79 | 88 |
|
... | ... | |
105 | 114 |
|
106 | 115 |
private NameRelationField orthographicVariantField; |
107 | 116 |
|
117 |
private ElementCollectionField<NomenclaturalStatus> nomStatusCollectionField; |
|
118 |
|
|
108 | 119 |
private CheckBox basionymToggle; |
109 | 120 |
|
110 | 121 |
private CheckBox replacedSynonymsToggle; |
... | ... | |
194 | 205 |
*/ |
195 | 206 |
@Override |
196 | 207 |
public void focusFirst() { |
197 |
// titleField.focus(); |
|
208 |
// none |
|
209 |
} |
|
198 | 210 |
|
211 |
@Override |
|
212 |
public void applyDefaultComponentStyle(Component ... components){ |
|
213 |
for(int i = 0; i <components.length; i++){ |
|
214 |
components[i].setStyleName(getDefaultComponentStyles()); |
|
215 |
} |
|
199 | 216 |
} |
200 | 217 |
|
201 | 218 |
/** |
... | ... | |
353 | 370 |
nomenclaturalReferenceDetail = addTextField("Reference detail", "nomenclaturalMicroReference", 0, row, 2, row); |
354 | 371 |
nomenclaturalReferenceDetail.setWidth(100, Unit.PERCENTAGE); |
355 | 372 |
|
373 |
// --------------- nom status |
|
374 |
row++; |
|
375 |
nomStatusCollectionField = new ElementCollectionField<NomenclaturalStatus>( |
|
376 |
NomenclaturalStatus.class, |
|
377 |
new Instantiator<NomenclaturalStatus>() { |
|
378 |
|
|
379 |
@Override |
|
380 |
public NomenclaturalStatus create() { |
|
381 |
return NomenclaturalStatus.NewInstance(null); |
|
382 |
} |
|
383 |
}, |
|
384 |
NomenclaturalStatusRow.class |
|
385 |
){ |
|
386 |
|
|
387 |
@Override |
|
388 |
public void commit() throws SourceException, InvalidValueException { |
|
389 |
validate(); // validate always so that empty rows are recognized |
|
390 |
super.commit(); |
|
391 |
} |
|
392 |
|
|
393 |
@Override |
|
394 |
public boolean isEmpty() { |
|
395 |
Collection value = getValue(); |
|
396 |
return value == null || value.isEmpty() ; |
|
397 |
} |
|
398 |
|
|
399 |
@Override |
|
400 |
public void setComponentError(ErrorMessage componentError) { |
|
401 |
nomStatusCollectionField.setComponentError(componentError); |
|
402 |
} |
|
403 |
|
|
404 |
}; |
|
405 |
|
|
406 |
nomStatusCollectionField.getLayout().setSpacing(false); |
|
407 |
nomStatusCollectionField.setVisibleProperties(NomenclaturalStatusRow.visibleFields()); |
|
408 |
nomStatusCollectionField.setPropertyHeader("type", "Status type"); |
|
409 |
nomStatusCollectionField.setPropertyHeader("citation", "Reference"); |
|
410 |
nomStatusCollectionField.setPropertyHeader("citationMicroReference", "Reference detail"); |
|
411 |
nomStatusCollectionField.setPropertyHeader("ruleConsidered", "Rule considered"); |
|
412 |
nomStatusCollectionField.addElementAddedListener( e -> nomStatusCollectionField.setComponentError(null)); |
|
413 |
nomStatusCollectionField.getLayout().setMargin(new MarginInfo(false, true)); |
|
414 |
|
|
415 |
Panel nomStatusCollectionPanel = new Panel(nomStatusCollectionField.getLayout()); |
|
416 |
nomStatusCollectionPanel.setCaption("Status"); |
|
417 |
nomStatusCollectionPanel.setWidth(800, Unit.PIXELS); |
|
418 |
|
|
419 |
bindField(nomStatusCollectionField, "status"); |
|
420 |
addComponent(nomStatusCollectionPanel, 0, row, 2, row); |
|
421 |
|
|
356 | 422 |
// --------------- Basionyms |
357 | 423 |
row++; |
358 | 424 |
basionymsComboboxSelect = new ToManyRelatedEntitiesComboboxSelect<TaxonName>(TaxonName.class, "Basionym"); |
... | ... | |
1021 | 1087 |
if(validationToggleReadonly){ |
1022 | 1088 |
validationToggle.setReadOnly(true); |
1023 | 1089 |
} |
1090 |
nomStatusCollectionField.getLayout().iterator().forEachRemaining(c -> c.setReadOnly(readOnly)); |
|
1024 | 1091 |
} |
1025 | 1092 |
|
1026 | 1093 |
/** |
... | ... | |
1038 | 1105 |
exCombinationAuthorshipField.setEnabled(!readOnly); |
1039 | 1106 |
basionymAuthorshipField.setEnabled(!readOnly); |
1040 | 1107 |
exBasionymAuthorshipField.setEnabled(!readOnly); |
1108 |
nomStatusCollectionField.getLayout().iterator().forEachRemaining(c -> c.setReadOnly(readOnly)); |
|
1041 | 1109 |
} |
1042 | 1110 |
|
1043 | 1111 |
|
1044 |
|
|
1045 | 1112 |
/** |
1046 | 1113 |
* @return the infraGenericEpithetField |
1047 | 1114 |
*/ |
... | ... | |
1071 | 1138 |
return orthographicVariantToggle; |
1072 | 1139 |
} |
1073 | 1140 |
|
1141 |
@Override |
|
1142 |
public ElementCollectionField<NomenclaturalStatus> getNomStatusCollectionField(){ |
|
1143 |
return nomStatusCollectionField; |
|
1144 |
} |
|
1074 | 1145 |
|
1075 | 1146 |
} |
src/main/java/eu/etaxonomy/cdm/vaadin/view/name/TaxonNamePopupEditorView.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
import java.util.EnumSet; |
12 | 12 |
|
13 |
import org.vaadin.viritin.fields.ElementCollectionField; |
|
14 |
|
|
13 | 15 |
import com.vaadin.ui.AbstractField; |
14 | 16 |
import com.vaadin.ui.CheckBox; |
17 |
import com.vaadin.ui.Component; |
|
15 | 18 |
import com.vaadin.ui.NativeSelect; |
16 | 19 |
import com.vaadin.ui.TextField; |
17 | 20 |
|
21 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
|
18 | 22 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
19 | 23 |
import eu.etaxonomy.cdm.model.reference.Reference; |
20 | 24 |
import eu.etaxonomy.cdm.vaadin.component.common.TeamOrPersonField; |
... | ... | |
126 | 130 |
*/ |
127 | 131 |
TextField getNomenclaturalReferenceDetail(); |
128 | 132 |
|
133 |
ElementCollectionField<NomenclaturalStatus> getNomStatusCollectionField(); |
|
134 |
|
|
135 |
/** |
|
136 |
* @param components |
|
137 |
*/ |
|
138 |
void applyDefaultComponentStyle(Component[] components); |
|
139 |
|
|
129 | 140 |
|
130 | 141 |
} |
Also available in: Unified diff
fix #8193 ElementCollectionField to edit nomenclatural status in TaxonNamePopupEditor