2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.vaadin
.view
.name
;
11 import java
.util
.Collection
;
12 import java
.util
.EnumSet
;
13 import java
.util
.HashMap
;
14 import java
.util
.List
;
16 import java
.util
.UUID
;
18 import org
.apache
.commons
.lang3
.BooleanUtils
;
19 import org
.apache
.logging
.log4j
.LogManager
;
20 import org
.apache
.logging
.log4j
.Logger
;
21 import org
.springframework
.context
.annotation
.Scope
;
22 import org
.vaadin
.viritin
.fields
.AbstractElementCollection
.Instantiator
;
23 import org
.vaadin
.viritin
.fields
.ElementCollectionField
;
25 import com
.vaadin
.data
.Property
;
26 import com
.vaadin
.data
.Property
.ValueChangeListener
;
27 import com
.vaadin
.data
.Validator
.InvalidValueException
;
28 import com
.vaadin
.server
.FontAwesome
;
29 import com
.vaadin
.shared
.ui
.MarginInfo
;
30 import com
.vaadin
.spring
.annotation
.SpringComponent
;
31 import com
.vaadin
.ui
.AbstractField
;
32 import com
.vaadin
.ui
.Alignment
;
33 import com
.vaadin
.ui
.Button
;
34 import com
.vaadin
.ui
.CheckBox
;
35 import com
.vaadin
.ui
.Component
;
36 import com
.vaadin
.ui
.CssLayout
;
37 import com
.vaadin
.ui
.GridLayout
;
38 import com
.vaadin
.ui
.NativeSelect
;
39 import com
.vaadin
.ui
.Panel
;
40 import com
.vaadin
.ui
.TextField
;
41 import com
.vaadin
.ui
.themes
.ValoTheme
;
43 import eu
.etaxonomy
.cdm
.api
.util
.RoleProberImpl
;
44 import eu
.etaxonomy
.cdm
.model
.agent
.TeamOrPersonBase
;
45 import eu
.etaxonomy
.cdm
.model
.common
.AnnotationType
;
46 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
47 import eu
.etaxonomy
.cdm
.model
.common
.RelationshipBase
.Direction
;
48 import eu
.etaxonomy
.cdm
.model
.name
.NameRelationshipType
;
49 import eu
.etaxonomy
.cdm
.model
.name
.Rank
;
50 import eu
.etaxonomy
.cdm
.model
.name
.RankClass
;
51 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
52 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
53 import eu
.etaxonomy
.cdm
.service
.UserHelperAccess
;
54 import eu
.etaxonomy
.cdm
.vaadin
.component
.TextFieldNFix
;
55 import eu
.etaxonomy
.cdm
.vaadin
.component
.common
.FilterableAnnotationsField
;
56 import eu
.etaxonomy
.cdm
.vaadin
.component
.common
.TeamOrPersonField
;
57 import eu
.etaxonomy
.cdm
.vaadin
.data
.validator
.NomenclaturalReferenceExistsValidator
;
58 import eu
.etaxonomy
.cdm
.vaadin
.event
.ReferenceEditorAction
;
59 import eu
.etaxonomy
.cdm
.vaadin
.event
.TaxonNameEditorAction
;
60 import eu
.etaxonomy
.cdm
.vaadin
.event
.TaxonNameEditorActionStrRep
;
61 import eu
.etaxonomy
.cdm
.vaadin
.model
.name
.NameRelationshipDTO
;
62 import eu
.etaxonomy
.cdm
.vaadin
.model
.name
.NomenclaturalStatusDTO
;
63 import eu
.etaxonomy
.cdm
.vaadin
.model
.name
.TaxonNameDTO
;
64 import eu
.etaxonomy
.cdm
.vaadin
.permission
.CdmEditDeletePermissionTester
;
65 import eu
.etaxonomy
.cdm
.vaadin
.permission
.RolesAndPermissions
;
66 import eu
.etaxonomy
.cdm
.vaadin
.ui
.RegistrationUIDefaults
;
67 import eu
.etaxonomy
.cdm
.vaadin
.ui
.UIMessages
;
68 import eu
.etaxonomy
.cdm
.vaadin
.util
.TeamOrPersonBaseCaptionGenerator
;
69 import eu
.etaxonomy
.cdm
.vaadin
.util
.converter
.SetToListConverter
;
70 import eu
.etaxonomy
.vaadin
.component
.NameRelationField
;
71 import eu
.etaxonomy
.vaadin
.component
.ReloadableLazyComboBox
;
72 import eu
.etaxonomy
.vaadin
.component
.SwitchableTextField
;
73 import eu
.etaxonomy
.vaadin
.component
.ToManyRelatedEntitiesComboboxSelect
;
74 import eu
.etaxonomy
.vaadin
.component
.ToOneRelatedEntityCombobox
;
75 import eu
.etaxonomy
.vaadin
.component
.WeaklyRelatedEntityCombobox
;
76 import eu
.etaxonomy
.vaadin
.event
.EditorActionType
;
77 import eu
.etaxonomy
.vaadin
.mvp
.AbstractCdmDTOPopupEditor
;
80 * @author a.kohlbecker
85 public class TaxonNamePopupEditor
86 extends AbstractCdmDTOPopupEditor
<TaxonNameDTO
, TaxonName
, TaxonNameEditorPresenter
>
87 implements TaxonNamePopupEditorView
{
89 private static final long serialVersionUID
= -7037436241474466359L;
90 private static final Logger logger
= LogManager
.getLogger();
92 private final static int GRID_COLS
= 4;
94 private final static int GRID_ROWS
= 21;
96 private static final boolean HAS_BASIONYM_DEFAULT
= false;
98 private AbstractField
<String
> genusOrUninomialField
;
100 private AbstractField
<String
> infraGenericEpithetField
;
102 private AbstractField
<String
> specificEpithetField
;
104 private AbstractField
<String
> infraSpecificEpithetField
;
106 private SwitchableTextField fullTitleCacheFiled
;
108 private SwitchableTextField protectedNameCacheField
;
110 private ToOneRelatedEntityCombobox
<Reference
> nomReferenceCombobox
;
112 private TextField nomenclaturalReferenceDetail
;
114 private TeamOrPersonField exBasionymAuthorshipField
;
116 private TeamOrPersonField basionymAuthorshipField
;
118 private ToManyRelatedEntitiesComboboxSelect
<TaxonName
> basionymsComboboxSelect
;
120 private ToManyRelatedEntitiesComboboxSelect
<TaxonName
> replacedSynonymsComboboxSelect
;
122 private NameRelationField validationField
;
124 private NameRelationField orthographicVariantField
;
126 private CheckBox nomStatusCollectionFieldToggle
;
128 private ElementCollectionField
<NomenclaturalStatusDTO
> nomStatusCollectionField
;
130 private CheckBox basionymToggle
;
132 private CheckBox replacedSynonymsToggle
;
134 private CheckBox validationToggle
;
136 private CheckBox orthographicVariantToggle
;
138 private NativeSelect rankSelect
;
140 private Button rankSelectFullListToggle
;
142 private TeamOrPersonField combinationAuthorshipField
;
144 private TeamOrPersonField exCombinationAuthorshipField
;
146 private EnumSet
<TaxonNamePopupEditorMode
> modesActive
= EnumSet
.noneOf(TaxonNamePopupEditorMode
.class);
148 private Boolean isInferredCombinationAuthorship
= null;
150 private Boolean isInferredBasionymAuthorship
= null;
152 private Boolean isInferredExBasionymAuthorship
= null;
154 private Map
<AbstractField
, Property
.ValueChangeListener
> authorshipUpdateListeners
= new HashMap
<>();
156 private Boolean isInferredExCombinationAuthorship
;
158 private int specificEpithetFieldRow
;
160 private ValueChangeListener updateFieldVisibilityListener
= e
-> updateFieldVisibility();
162 private FilterableAnnotationsField annotationsListField
;
164 private AnnotationType
[] editableAnotationTypes
= RegistrationUIDefaults
.EDITABLE_ANOTATION_TYPES
;
166 private int genusOrUninomialRow
;
168 private OrthographicCorrectionReferenceValidator orthographicCorrectionValidator
;
170 private boolean isRanksFullList
= false;
173 * By default AnnotationType.EDITORIAL() is enabled.
175 * @return the editableAnotationTypes
178 public AnnotationType
[] getEditableAnotationTypes() {
179 return editableAnotationTypes
;
183 * By default AnnotationType.EDITORIAL() is enabled.
185 * @param editableAnotationTypes the editableAnotationTypes to set
188 public void setEditableAnotationTypes(AnnotationType
... editableAnotationTypes
) {
189 this.editableAnotationTypes
= editableAnotationTypes
;
192 public TaxonNamePopupEditor() {
193 super(new GridLayout(GRID_COLS
, GRID_ROWS
), TaxonNameDTO
.class);
197 public String
getWindowCaption() {
198 return "Name editor";
202 public int getWindowWidth() {
207 public void focusFirst() {
212 public void applyDefaultComponentStyle(Component
... components
){
213 for(int i
= 0; i
<components
.length
; i
++){
214 components
[i
].setStyleName(getDefaultComponentStyles());
219 protected String
getDefaultComponentStyles() {
224 protected void initContent() {
226 GridLayout grid
= (GridLayout
)getFieldLayout();
228 grid
.setHideEmptyRowsAndColumns(true);
229 grid
.setSpacing(true);
230 grid
.setColumnExpandRatio(0, 0.3f
);
231 grid
.setColumnExpandRatio(1, 0.3f
);
232 grid
.setColumnExpandRatio(2, 0.3f
);
233 grid
.setColumnExpandRatio(3, 0.0f
);
236 * TaxonName properties for reference here (NOTE: this editor operates on TaxonNameDTOs!):
237 - nameType: preset, needs to be set in the presenter for new names
238 - appendedPhrase: -> TODO field
239 - nomenclaturalMicroReference: -> TODO field
240 - nomenclaturalSource.citation -> field but disabled for REGISTRY
241 - rank -> SelectField which determines the visiblity of the other fields
243 - fullTitleCache + protectedFullTitleCache -> SwitchableTextField : ADVANCED_MODE
244 - nameCache + protectedNameCache -> SwitchableTextField : ADVANCED_MODE
246 - homotypicalGroup -> hidden
247 - typeDesignations -> hidden
248 - descriptions -> hidden
249 - taxonBases -> hidden
250 - registrations -> hidden
252 - relationsFromThisName-> TODO implement later
253 - relationsToThisName -> TODO implement later
255 - genusOrUninomial -> textField
256 - infraGenericEpithet -> textField
257 - specificEpithet -> textField
258 - infraSpecificEpithet -> textField
260 - authorshipCache + protectedAuthorshipCache -> SwitchableTextField : only ADVANCED_MODE and disabled for REGISTRY
261 - basionymAuthorship -> field but disabled for REGISTRY, basionym is set as nameRelationShip
262 - combinationAuthorship -> field but disabled for REGISTRY author team of the reference
263 - exCombinationAuthorship -> textField
264 - exBasionymAuthorship -> textField
266 - status -> TODO field
267 - monomHybrid -> TODO implement hybrids later
268 - binomHybrid -> TODO implement hybrids later
269 - trinomHybrid -> TODO implement hybrids later
271 - hybridParentRelations -> TODO implement hybrids later
272 - hybridChildRelations -> TODO implement hybrids later
273 - hybridFormula -> TODO implement hybrids later
275 ** ViralName attributes **
278 ** BacterialName attributes **
283 - originalPublicationYear
289 rankSelect
= new NativeSelect("Rank");
290 rankSelect
.setNullSelectionAllowed(false);
291 rankSelect
.setWidth(100, Unit
.PERCENTAGE
);
292 rankSelectFullListToggle
= new Button();
293 updateRankSelectFullListToggleButton();
294 rankSelectFullListToggle
.addClickListener(e
-> {
295 isRanksFullList
= !isRanksFullList
;
296 updateRankSelectFullListToggleButton();
298 CssLayout rankSelectGroup
= new CssLayout();
299 rankSelectGroup
.setWidth(100, Unit
.PERCENTAGE
);
300 rankSelectGroup
.addComponents(rankSelect
, rankSelectFullListToggle
);
301 bindField(rankSelect
, "rank");
302 applyDefaultComponentStyles(rankSelect
);
303 applyDefaultComponentStyles(rankSelectFullListToggle
);
304 applyDefaultComponentStyle(rankSelectGroup
);
305 addComponent(rankSelectGroup
, 0, row
, 1, row
);
306 rankSelectGroup
.setStyleName(ValoTheme
.LAYOUT_COMPONENT_GROUP
);
307 grid
.setComponentAlignment(rankSelectGroup
, Alignment
.TOP_RIGHT
);
310 basionymToggle
= new CheckBox("With basionym");
311 basionymToggle
.setValue(HAS_BASIONYM_DEFAULT
);
312 basionymToggle
.setStyleName(getDefaultComponentStyles());
313 grid
.addComponent(basionymToggle
, 0, row
);
314 grid
.setComponentAlignment(basionymToggle
, Alignment
.BOTTOM_LEFT
);
316 replacedSynonymsToggle
= new CheckBox("With replaced synonym");
317 grid
.addComponent(replacedSynonymsToggle
, 1, row
);
318 grid
.setComponentAlignment(replacedSynonymsToggle
, Alignment
.BOTTOM_LEFT
);
320 validationToggle
= new CheckBox("Validation");
321 grid
.addComponent(validationToggle
, 2, row
);
322 grid
.setComponentAlignment(validationToggle
, Alignment
.BOTTOM_LEFT
);
324 orthographicVariantToggle
= new CheckBox("Orthographical variant");
325 grid
.addComponent(orthographicVariantToggle
, 3, row
);
326 grid
.setComponentAlignment(orthographicVariantToggle
, Alignment
.BOTTOM_LEFT
);
330 fullTitleCacheFiled
= addSwitchableTextField("Full title cache", "fullTitleCache", "protectedFullTitleCache", 0, row
, GRID_COLS
-1, row
);
331 fullTitleCacheFiled
.setWidth(100, Unit
.PERCENTAGE
);
333 protectedNameCacheField
= addSwitchableTextField("Name cache", "nameCache", "protectedNameCache", 0, row
, GRID_COLS
-1, row
);
334 protectedNameCacheField
.setWidth(100, Unit
.PERCENTAGE
);
336 genusOrUninomialRow
= row
;
337 genusOrUninomialField
= addTextField("Genus or uninomial", "genusOrUninomial", 0, row
, 1, row
);
338 genusOrUninomialField
.setWidth(200, Unit
.PIXELS
);
339 infraGenericEpithetField
= addTextField("Infrageneric epithet", "infraGenericEpithet", 2, row
, 3, row
);
340 infraGenericEpithetField
.setWidth(200, Unit
.PIXELS
);
342 specificEpithetFieldRow
= row
;
343 specificEpithetField
= addTextField("Specific epithet", "specificEpithet", 0, row
, 1, row
);
344 specificEpithetField
.setWidth(200, Unit
.PIXELS
);
345 infraSpecificEpithetField
= addTextField("Infraspecific epithet", "infraSpecificEpithet", 2, row
, 3, row
);
346 infraSpecificEpithetField
.setWidth(200, Unit
.PIXELS
);
349 combinationAuthorshipField
= new TeamOrPersonField("Combination author(s)", TeamOrPersonBaseCaptionGenerator
.CacheType
.NOMENCLATURAL_TITLE
);
350 combinationAuthorshipField
.setWidth(100, Unit
.PERCENTAGE
);
351 addField(combinationAuthorshipField
, "combinationAuthorship", 0, row
, GRID_COLS
-1, row
);
354 nomReferenceCombobox
= new ToOneRelatedEntityCombobox
<Reference
>("Nomenclatural reference", Reference
.class);
355 nomReferenceCombobox
.addClickListenerAddEntity(e
-> getViewEventBus().publish(
357 new ReferenceEditorAction(EditorActionType
.ADD
, null, nomReferenceCombobox
, this)
359 nomReferenceCombobox
.addClickListenerEditEntity(e
-> {
360 if(nomReferenceCombobox
.getValue() != null){
361 getViewEventBus().publish(this,
362 new ReferenceEditorAction(
363 EditorActionType
.EDIT
,
364 nomReferenceCombobox
.getValue().getUuid(),
366 nomReferenceCombobox
,
373 // nomReferenceCombobox.getSelect().addValueChangeListener(e -> logger.debug("nomReferenceCombobox value changed #1"));
374 // nomReferenceCombobox.setWidth(300, Unit.PIXELS);
375 nomReferenceCombobox
.setWidth("100%");
376 addField(nomReferenceCombobox
, "nomenclaturalReference", 0, row
, 3, row
);
379 nomenclaturalReferenceDetail
= addTextField("Reference detail", "nomenclaturalMicroReference", 0, row
, 2, row
);
380 nomenclaturalReferenceDetail
.setWidth(100, Unit
.PERCENTAGE
);
382 // --------------- nom status
384 nomStatusCollectionFieldToggle
= new CheckBox("Invalid, illegitimate, or other status");
385 nomStatusCollectionFieldToggle
.addValueChangeListener(e
-> {
386 nomStatusCollectionField
.getLayout().getParent().setVisible(nomStatusCollectionFieldToggle
.getValue());
388 addComponent(nomStatusCollectionFieldToggle
, 0, row
, 0, row
);
390 nomStatusCollectionField
= new ElementCollectionField
<NomenclaturalStatusDTO
>(
391 NomenclaturalStatusDTO
.class,
392 new Instantiator
<NomenclaturalStatusDTO
>() {
393 private static final long serialVersionUID
= -2427045940046513092L;
396 public NomenclaturalStatusDTO
create() {
397 return NomenclaturalStatusDTO
.newInstance();
400 NomenclaturalStatusRow
.class
402 private static final long serialVersionUID
= -3130918034491809593L;
405 public void commit() throws SourceException
, InvalidValueException
{
406 validate(); // validate always so that empty rows are recognized
411 public boolean isEmpty() {
412 Collection
<?
> value
= getValue();
413 return value
== null || value
.isEmpty() ;
418 nomStatusCollectionField
.getLayout().setSpacing(false);
419 nomStatusCollectionField
.setVisibleProperties(NomenclaturalStatusRow
.visibleFields());
420 nomStatusCollectionField
.setPropertyHeader("type", "Status type");
421 nomStatusCollectionField
.setPropertyHeader("citation", "Reference");
422 nomStatusCollectionField
.setPropertyHeader("citationMicroReference", "Reference detail");
423 nomStatusCollectionField
.setPropertyHeader("ruleConsidered", "Rule considered");
424 nomStatusCollectionField
.addElementAddedListener( e
-> nomStatusCollectionField
.setComponentError(null));
425 nomStatusCollectionField
.getLayout().setMargin(new MarginInfo(false, true));
427 Panel nomStatusCollectionPanel
= new Panel(nomStatusCollectionField
.getLayout());
428 nomStatusCollectionPanel
.setCaption("Status");
429 nomStatusCollectionPanel
.setWidth(100, Unit
.PERCENTAGE
);
431 bindField(nomStatusCollectionField
, "status");
432 addComponent(nomStatusCollectionPanel
, 0, row
, 3, row
);
434 // --------------- Basionyms
436 basionymsComboboxSelect
= new ToManyRelatedEntitiesComboboxSelect
<TaxonName
>(TaxonName
.class, "Basionym");
437 basionymsComboboxSelect
.setConverter(new SetToListConverter
<TaxonName
>());
438 addField(basionymsComboboxSelect
, "basionyms", 0, row
, 3, row
);
439 basionymsComboboxSelect
.setWidth(100, Unit
.PERCENTAGE
);
440 basionymsComboboxSelect
.withEditButton(true);
441 basionymsComboboxSelect
.setEditPermissionTester(new CdmEditDeletePermissionTester());
442 basionymsComboboxSelect
.setEditActionListener(e
-> {
444 Object fieldValue
= e
.getSource().getValue();
445 UUID beanUuid
= null;
446 if(fieldValue
!= null){
447 beanUuid
= ((CdmBase
)fieldValue
).getUuid();
450 ReloadableLazyComboBox
<TaxonName
> lazyCombobox
= (ReloadableLazyComboBox
<TaxonName
>) e
.getSource();
451 getViewEventBus().publish(this, new TaxonNameEditorAction(e
.getAction(), beanUuid
, null, lazyCombobox
, this));
453 grid
.setComponentAlignment(basionymsComboboxSelect
, Alignment
.TOP_RIGHT
);
456 basionymAuthorshipField
= new TeamOrPersonField("Basionym author(s)", TeamOrPersonBaseCaptionGenerator
.CacheType
.NOMENCLATURAL_TITLE
);
457 basionymAuthorshipField
.setWidth(100, Unit
.PERCENTAGE
);
458 addField(basionymAuthorshipField
, "basionymAuthorship", 0, row
, GRID_COLS
-1, row
);
460 exBasionymAuthorshipField
= new TeamOrPersonField("Ex-basionym author(s)", TeamOrPersonBaseCaptionGenerator
.CacheType
.NOMENCLATURAL_TITLE
);
461 exBasionymAuthorshipField
.setWidth(100, Unit
.PERCENTAGE
);
462 addField(exBasionymAuthorshipField
, "exBasionymAuthorship", 0, row
, GRID_COLS
-1, row
);
464 // --------------- ReplacedSynonyms
466 replacedSynonymsComboboxSelect
= new ToManyRelatedEntitiesComboboxSelect
<>(TaxonName
.class, "Replaced synonym");
467 replacedSynonymsComboboxSelect
.setConverter(new SetToListConverter
<>());
468 addField(replacedSynonymsComboboxSelect
, "replacedSynonyms", 0, row
, 3, row
);
469 replacedSynonymsComboboxSelect
.setWidth(100, Unit
.PERCENTAGE
);
470 replacedSynonymsComboboxSelect
.withEditButton(true);
471 replacedSynonymsComboboxSelect
.setEditPermissionTester(new CdmEditDeletePermissionTester());
472 replacedSynonymsComboboxSelect
.setEditActionListener(e
-> {
474 Object fieldValue
= e
.getSource().getValue();
475 UUID beanUuid
= null;
476 if(fieldValue
!= null){
477 beanUuid
= ((CdmBase
)fieldValue
).getUuid();
480 ReloadableLazyComboBox
<TaxonName
> lazyCombobox
= (ReloadableLazyComboBox
<TaxonName
>) e
.getSource();
481 getViewEventBus().publish(this, new TaxonNameEditorAction(e
.getAction(), beanUuid
, null, lazyCombobox
, this));
483 grid
.setComponentAlignment(replacedSynonymsComboboxSelect
, Alignment
.TOP_RIGHT
);
485 // --------------- Validation
487 validationField
= new NameRelationField("Validation of", "Designation", Direction
.relatedTo
, NameRelationshipType
.VALIDATED_BY_NAME());
488 validationField
.setWidth(100, Unit
.PERCENTAGE
);
489 ToOneRelatedEntityCombobox
<TaxonName
> validatedNameComboBox
= validationField
.getRelatedNameComboBox();
490 validatedNameComboBox
.addClickListenerAddEntity(e
-> getViewEventBus().publish(
492 new TaxonNameEditorAction(EditorActionType
.ADD
, null, validatedNameComboBox
, this)
494 validatedNameComboBox
.addClickListenerEditEntity(e
-> {
495 if(validatedNameComboBox
.getValue() != null){
496 getViewEventBus().publish(this,
497 new TaxonNameEditorAction(
498 EditorActionType
.EDIT
,
499 validatedNameComboBox
.getValue().getUuid(),
501 validatedNameComboBox
,
506 ToOneRelatedEntityCombobox
<Reference
> validationCitatonComboBox
= validationField
.getCitatonComboBox();
507 validationCitatonComboBox
.addClickListenerAddEntity(e
-> getViewEventBus().publish(
508 // NOTE: adding new references is currently not allowed for name relations, see NameRelationField!!
510 new ReferenceEditorAction(EditorActionType
.ADD
, null, validationCitatonComboBox
, this)
512 validationCitatonComboBox
.addClickListenerEditEntity(e
-> {
513 if(validationCitatonComboBox
.getValue() != null){
514 getViewEventBus().publish(this,
515 new ReferenceEditorAction(
516 EditorActionType
.EDIT
,
517 validationCitatonComboBox
.getValue().getUuid(),
519 validationCitatonComboBox
,
524 addField(validationField
, "validationFor", 0, row
, 3, row
);
525 grid
.setComponentAlignment(validationField
, Alignment
.TOP_RIGHT
);
527 // ------- Orthographic Variant (Correction)
529 orthographicVariantField
= new NameRelationField("Orthographical variant", "Name variant", Direction
.relatedTo
, NameRelationshipType
.ORTHOGRAPHIC_VARIANT());
530 orthographicVariantField
.setWidth(100, Unit
.PERCENTAGE
);
531 // corrected name must have same
532 ToOneRelatedEntityCombobox
<TaxonName
> orthographicVariantCombobox
= orthographicVariantField
.getRelatedNameComboBox();
533 orthographicVariantCombobox
.addClickListenerAddEntity(e
-> getViewEventBus().publish(
535 new TaxonNameEditorAction(EditorActionType
.ADD
, null, orthographicVariantCombobox
, this)
537 orthographicVariantCombobox
.addClickListenerEditEntity(e
-> {
538 if(orthographicVariantCombobox
.getValue() != null){
539 getViewEventBus().publish(this,
540 new TaxonNameEditorAction(
541 EditorActionType
.EDIT
,
542 orthographicVariantCombobox
.getValue().getUuid(),
544 orthographicVariantCombobox
,
549 ToOneRelatedEntityCombobox
<Reference
> orthographicCorrectionCitatonComboBox
= orthographicVariantField
.getCitatonComboBox();
550 orthographicCorrectionCitatonComboBox
.addClickListenerAddEntity(e
-> getViewEventBus().publish(
551 // NOTE: adding new references is currently not allowed for name relations, see NameRelationField!!
553 new ReferenceEditorAction(EditorActionType
.ADD
, null, orthographicCorrectionCitatonComboBox
, this)
555 orthographicCorrectionCitatonComboBox
.addClickListenerEditEntity(e
-> {
556 if(orthographicCorrectionCitatonComboBox
.getValue() != null){
557 getViewEventBus().publish(this,
558 new ReferenceEditorAction(
559 EditorActionType
.EDIT
,
560 orthographicCorrectionCitatonComboBox
.getValue().getUuid(),
562 orthographicCorrectionCitatonComboBox
,
567 addField(orthographicVariantField
, "orthographicVariant", 0, row
, 3, row
);
568 grid
.setComponentAlignment(orthographicVariantField
, Alignment
.TOP_RIGHT
);
571 exCombinationAuthorshipField
= new TeamOrPersonField("Ex-combination author(s)", TeamOrPersonBaseCaptionGenerator
.CacheType
.NOMENCLATURAL_TITLE
);
572 exCombinationAuthorshipField
.setWidth(100, Unit
.PERCENTAGE
);
573 addField(exCombinationAuthorshipField
, "exCombinationAuthorship", 0, row
, GRID_COLS
-1, row
);
576 annotationsListField
= new FilterableAnnotationsField("Editorial notes");
577 annotationsListField
.setWidth(100, Unit
.PERCENTAGE
);
578 boolean isCurator
= UserHelperAccess
.userHelper().userIs(new RoleProberImpl(RolesAndPermissions
.ROLE_CURATION
));
579 boolean isAdmin
= UserHelperAccess
.userHelper().userIsAdmin();
580 if(isCurator
|| isAdmin
){
581 annotationsListField
.withNewButton(true);
583 annotationsListField
.setAnnotationTypesVisible(editableAnotationTypes
);
586 addField(annotationsListField
, "annotations", 0, row
, GRID_COLS
-1, row
);
588 // -----------------------------------------------------------------------------
590 setAdvancedModeEnabled(true);
591 registerAdvancedModeComponents(fullTitleCacheFiled
, protectedNameCacheField
);
593 registerAdvancedModeComponents(combinationAuthorshipField
);
594 registerAdvancedModeComponents(basionymAuthorshipField
);
595 registerAdvancedModeComponents(exBasionymAuthorshipField
);
596 registerAdvancedModeComponents(exCombinationAuthorshipField
);
598 registerAdvancedModeComponents(combinationAuthorshipField
.getCachFields());
599 registerAdvancedModeComponents(exCombinationAuthorshipField
.getCachFields());
600 registerAdvancedModeComponents(basionymAuthorshipField
.getCachFields());
601 registerAdvancedModeComponents(exBasionymAuthorshipField
.getCachFields());
603 setAdvancedMode(false);
605 //TODO remove below line once #7858 is fixed
606 withDeleteButton(false);
610 private void updateRankSelectFullListToggleButton() {
611 if(isRanksFullList
) {
612 rankSelectFullListToggle
.setIcon(FontAwesome
.COMPRESS
);
613 rankSelectFullListToggle
.setDescription("Show short list of ranks");
615 rankSelectFullListToggle
.setIcon(FontAwesome
.EXPAND
);
616 rankSelectFullListToggle
.setDescription("Show full list of ranks");
620 protected TeamOrPersonBase
inferBasiomynAuthors() {
621 List
<TaxonName
> basionyms
= basionymsComboboxSelect
.getValue();
622 if(!basionyms
.isEmpty() && basionyms
.get(0) != null){
623 TaxonName basionym
= basionyms
.get(0);
624 if(basionym
.getCombinationAuthorship() != null){
625 return basionym
.getCombinationAuthorship();
626 } else if(basionym
.getNomenclaturalReference() != null){
627 return basionym
.getNomenclaturalReference().getAuthorship();
633 protected TeamOrPersonBase
inferExBasiomynAuthors() {
634 List
<TaxonName
> basionyms
= basionymsComboboxSelect
.getValue();
635 if(!basionyms
.isEmpty() && basionyms
.get(0) != null){
636 TaxonName basionym
= basionyms
.get(0);
637 return basionym
.getExCombinationAuthorship();
642 protected TeamOrPersonBase
inferCombinationAuthors() {
643 Reference nomRef
= nomReferenceCombobox
.getValue();
645 return nomRef
.getAuthorship();
650 protected TeamOrPersonBase
inferExCombinationAuthors() {
651 NameRelationshipDTO nameRelationDTO
= validationField
.getValue();
653 TeamOrPersonBase inferredExAuthor
= null;
654 if(nameRelationDTO
!= null && nameRelationDTO
.getOtherName() != null){
655 TaxonName validatedName
= nameRelationDTO
.getOtherName();
656 if(validatedName
.getCombinationAuthorship() != null) {
657 inferredExAuthor
= validatedName
.getCombinationAuthorship();
658 } else if(validatedName
.getNomenclaturalReference() != null){
659 inferredExAuthor
= validatedName
.getNomenclaturalReference().getAuthorship();
662 TeamOrPersonBase
<?
> inferredCominationAuthors
= inferCombinationAuthors();
663 if(inferredExAuthor
!= null && inferredCominationAuthors
!= null
664 // comparing by nomTitle to detect duplicates:
665 && inferredExAuthor
.getNomenclaturalTitleCache().equals(inferredCominationAuthors
.getNomenclaturalTitleCache())) {
666 // If and only if ex author = author the ex author is not included
667 // into the author teams due to the ICN 46.10. (see #8317)
668 inferredExAuthor
= null;
670 return inferredExAuthor
;
674 protected void afterItemDataSourceSet() {
677 rankSelect
.addValueChangeListener(updateFieldVisibilityListener
);
678 basionymToggle
.addValueChangeListener(e
-> {
679 updateAuthorshipFields();
681 validationToggle
.addValueChangeListener(e
-> {
682 updateAuthorshipFields();
684 replacedSynonymsToggle
.addValueChangeListener(e
-> {
685 boolean enable
= e
.getProperty().getValue() != null && (Boolean
)e
.getProperty().getValue();
686 replacedSynonymsComboboxSelect
.setVisible(enable
);
688 orthographicVariantToggle
.addValueChangeListener(e
-> {
689 boolean enable
= e
.getProperty().getValue() != null && (Boolean
)e
.getProperty().getValue();
690 orthographicVariantField
.setVisible(enable
);
693 TaxonNameDTO taxonNameDTO
= getBean();
694 boolean showBasionymSection
= taxonNameDTO
.getBasionyms().size() > 0
695 || taxonNameDTO
.getBasionymAuthorship() != null
696 || taxonNameDTO
.getExBasionymAuthorship() != null;
697 basionymToggle
.setValue(showBasionymSection
);
698 basionymToggle
.setReadOnly(showBasionymSection
);
700 boolean showReplacedSynonyms
= taxonNameDTO
.getReplacedSynonyms().size() > 0;
701 replacedSynonymsToggle
.setValue(showReplacedSynonyms
);
702 replacedSynonymsToggle
.setReadOnly(showReplacedSynonyms
);
703 replacedSynonymsComboboxSelect
.setVisible(showReplacedSynonyms
);
705 boolean showValidationSection
= taxonNameDTO
.getValidationFor() != null || taxonNameDTO
.getExCombinationAuthorship() != null;
706 validationToggle
.setValue(showValidationSection
);
707 validationToggle
.setReadOnly(showValidationSection
);
709 boolean showOrthographicCorrectionSection
= taxonNameDTO
.getOrthographicVariant() != null;
710 orthographicVariantToggle
.setValue(showOrthographicCorrectionSection
);
711 orthographicVariantToggle
.setReadOnly(showOrthographicCorrectionSection
);
713 if(isModeEnabled(TaxonNamePopupEditorMode
.AUTOFILL_AUTHORSHIP_DATA
)){
714 updateAuthorshipFields();
716 if(isModeEnabled(TaxonNamePopupEditorMode
.NOMENCLATURALREFERENCE_SECTION_EDITING_ONLY
) && getBean().getNomenclaturalReference() != null) {
717 nomReferenceCombobox
.setDescription("Selection limited to nomenclatural reference and parts of it.");
719 if(isModeEnabled(TaxonNamePopupEditorMode
.REQUIRE_NOMENCLATURALREFERENCE
)) {
720 nomReferenceCombobox
.setRequired(true);
721 nomReferenceCombobox
.setImmediate(true);
723 String userHint
= "Please use the 'Edit' function to fix the problem in the related name.";
724 validationField
.getRelatedNameComboBox().getSelect().addValidator(new NomenclaturalReferenceExistsValidator(userHint
));
725 orthographicVariantField
.getRelatedNameComboBox().getSelect().addValidator(new NomenclaturalReferenceExistsValidator(userHint
));
726 basionymsComboboxSelect
.addFieldValidator(new NomenclaturalReferenceExistsValidator(userHint
));
727 replacedSynonymsComboboxSelect
.addFieldValidator(new NomenclaturalReferenceExistsValidator(userHint
));
732 * Updates all authorship fields if the an authorship field is empty this method attempts to infer the
733 * authors from the related nomenclatural reference or taxon name.
735 * Finally the {@link #updateFieldVisibility()} is invoked.
740 public void updateAuthorshipFields() {
742 TaxonNameDTO taxonName
= getBean();
744 // ------------- CombinationAuthors
745 isInferredCombinationAuthorship
= updateAuthorshipFieldData(
746 taxonName
.getCombinationAuthorship(),
747 inferCombinationAuthors(),
748 combinationAuthorshipField
,
749 nomReferenceCombobox
.getSelect(),
750 isInferredCombinationAuthorship
);
753 // ------------- Basionym and ExBasionymAuthors
754 if(BooleanUtils
.isTrue(basionymToggle
.getValue())){
756 isInferredBasionymAuthorship
= updateAuthorshipFieldData(
757 taxonName
.getBasionymAuthorship(),
758 inferBasiomynAuthors(),
759 basionymAuthorshipField
,
760 basionymsComboboxSelect
,
761 isInferredBasionymAuthorship
764 isInferredExBasionymAuthorship
= updateAuthorshipFieldData(
765 taxonName
.getExBasionymAuthorship(),
766 inferExBasiomynAuthors(),
767 exBasionymAuthorshipField
,
768 basionymsComboboxSelect
,
769 isInferredExBasionymAuthorship
774 // ------------- Validation and ExCombinationAuthors
775 isInferredExCombinationAuthorship
= updateAuthorshipFieldData(
776 taxonName
.getExCombinationAuthorship(),
777 inferExCombinationAuthors(),
778 exCombinationAuthorshipField
,
779 validationField
.getRelatedNameComboBox(),
780 isInferredExCombinationAuthorship
783 updateFieldVisibility();
790 * the value of the taxonName authorship field
791 * @param inferredAuthors
792 * the value inferred from other fields which may be set as authorship to the taxon name
793 * @param authorshipField
794 * the ui element to edit the taxonName authorship field
795 * @param updateTriggerField
796 * @param lastInferredAuthorshipState
799 protected Boolean
updateAuthorshipFieldData(TeamOrPersonBase
<?
> authorship
, TeamOrPersonBase inferredAuthors
,
800 TeamOrPersonField authorshipField
, AbstractField updateTriggerField
,
801 Boolean lastInferredAuthorshipState
) {
803 if(authorship
== null){
804 authorshipField
.setValue(inferredAuthors
);
805 lastInferredAuthorshipState
= true;
807 boolean authorshipMatch
= authorship
== inferredAuthors
;
808 if(lastInferredAuthorshipState
== null){
809 // initialization of authorshipState, this comes only into account when the editor is just being initialized
810 lastInferredAuthorshipState
= authorshipMatch
;
812 if(!authorshipMatch
&& lastInferredAuthorshipState
){
813 // update the combinationAuthorshipField to follow changes of the nomenclatural reference in case it was autofilled before
814 authorshipField
.setValue(inferredAuthors
);
815 lastInferredAuthorshipState
= true;
819 if(updateTriggerField
!= null){
821 // this ChangeListener must be added at this very late point in the editor lifecycle so that it is called after
822 // the ToOneRelatedEntityReloader which may have been added to the updateTriggerField in the presenters handleViewEntered() method.
823 // Otherwise we risk multiple representation problems in the hibernate session
824 if(!authorshipUpdateListeners
.containsKey(updateTriggerField
)){
825 ValueChangeListener listener
= e
-> {
826 logger
.debug(" value changed #2");
827 updateAuthorshipFields();
829 updateTriggerField
.addValueChangeListener(listener
);
830 authorshipUpdateListeners
.put(updateTriggerField
, listener
);
834 return lastInferredAuthorshipState
;
837 private void updateFieldVisibility() {
839 // TODO use getField() instead and remove field references
840 Rank rank
= (Rank
) rankSelect
.getValue();
842 @SuppressWarnings("deprecation")
843 boolean isSpeciesOrBelow
= rank
.isLowerOrEqualTo(RankClass
.Species
);
844 Boolean withBasionymSection
= BooleanUtils
.isTrue(basionymToggle
.getValue());
845 Boolean withValidationSection
= BooleanUtils
.isTrue(validationToggle
.getValue());
846 Boolean withOrthographicCorrectionSection
= BooleanUtils
.isTrue(orthographicVariantToggle
.getValue());
848 if(isModeEnabled(TaxonNamePopupEditorMode
.VALIDATE_AGAINST_HIGHER_NAME_PART
)){
849 if(isSpeciesOrBelow
) {
850 if(TextField
.class.isAssignableFrom(genusOrUninomialField
.getClass())){
851 WeaklyRelatedEntityCombobox
<TaxonName
> combobox
= new WeaklyRelatedEntityCombobox
<TaxonName
>("-> this caption will be replaced <-", TaxonName
.class);
852 combobox
.addClickListenerAddEntity(e
-> getViewEventBus().publish(
854 new TaxonNameEditorActionStrRep(
855 EditorActionType
.ADD
,
860 combobox
.addClickListenerEditEntity(e
-> {
861 //WeaklyRelatedEntityCombobox<TaxonName> wrcbbx = combobox;
862 if(combobox
.getValue() != null){
863 getViewEventBus().publish(this,
864 new TaxonNameEditorActionStrRep(
865 EditorActionType
.EDIT
,
866 combobox
.getIdForValue(),
873 combobox
.getSelect().setRequiredError(UIMessages
.REQUIRED_SELECT_MISSING
);
874 genusOrUninomialField
= replaceComponent("genusOrUninomial", genusOrUninomialField
, combobox
, 0, genusOrUninomialRow
, 1, genusOrUninomialRow
);
877 if(WeaklyRelatedEntityCombobox
.class.isAssignableFrom(genusOrUninomialField
.getClass())) {
878 genusOrUninomialField
= replaceComponent("genusOrUninomial", genusOrUninomialField
, new TextFieldNFix(), 0, genusOrUninomialRow
, 1, genusOrUninomialRow
);
879 genusOrUninomialField
.setRequiredError(UIMessages
.REQUIRED_TEXT_MISSING
);
884 if(isModeEnabled(TaxonNamePopupEditorMode
.VALIDATE_AGAINST_HIGHER_NAME_PART
)){
885 if(rank
.isInfraSpecific()) {
886 if(TextField
.class.isAssignableFrom(specificEpithetField
.getClass())) {
887 WeaklyRelatedEntityCombobox
<TaxonName
> combobox
= new WeaklyRelatedEntityCombobox
<TaxonName
>("-> this caption will be replaced <-", TaxonName
.class);
888 specificEpithetField
= replaceComponent("specificEpithet", specificEpithetField
, combobox
, 0, specificEpithetFieldRow
, 1, specificEpithetFieldRow
);
889 combobox
.getSelect().setRequiredError(UIMessages
.REQUIRED_SELECT_MISSING
);
890 combobox
.addClickListenerAddEntity(e
-> getViewEventBus().publish(
892 new TaxonNameEditorActionStrRep(EditorActionType
.ADD
, e
.getButton(), combobox
, this)
894 combobox
.addClickListenerEditEntity(e
-> {
895 if(combobox
.getValue() != null){
896 getViewEventBus().publish(this,
897 new TaxonNameEditorActionStrRep(
898 EditorActionType
.EDIT
,
899 combobox
.getIdForValue(),
908 if(WeaklyRelatedEntityCombobox
.class.isAssignableFrom(specificEpithetField
.getClass())) {
909 specificEpithetField
= replaceComponent("specificEpithet", specificEpithetField
, new TextFieldNFix(), 0, specificEpithetFieldRow
, 1, specificEpithetFieldRow
);
910 specificEpithetField
.setRequiredError(UIMessages
.REQUIRED_TEXT_MISSING
);
915 if(isModeEnabled(TaxonNamePopupEditorMode
.ORTHOGRAPHIC_CORRECTION
)){
916 orthographicVariantField
.setCaption("Orthographical correction");
917 orthographicVariantField
.getRelatedNameComboBox().setCaption("Incorrect name");
918 orthographicVariantToggle
.setCaption("Orthographical correction");
920 orthographicVariantField
.setCaption("Orthographical variant");
921 orthographicVariantField
.getRelatedNameComboBox().setCaption("Name variant");
922 orthographicVariantToggle
.setCaption("Orthographical variant");
925 genusOrUninomialField
.setRequired(true);
926 specificEpithetField
.setVisible(isSpeciesOrBelow
);
927 specificEpithetField
.setRequired(isSpeciesOrBelow
);
928 infraSpecificEpithetField
.setVisible(rank
.isInfraSpecific());
929 infraSpecificEpithetField
.setRequired(rank
.isInfraSpecific());
930 infraSpecificEpithetField
.setRequiredError(UIMessages
.REQUIRED_TEXT_MISSING
);
931 infraGenericEpithetField
.setVisible(rank
.isInfraGeneric());
932 infraGenericEpithetField
.setRequired(rank
.isInfraGeneric());
933 infraSpecificEpithetField
.setRequiredError(UIMessages
.REQUIRED_TEXT_MISSING
);
935 basionymsComboboxSelect
.setVisible(withBasionymSection
);
937 combinationAuthorshipField
.setVisible(isInferredCombinationAuthorship
!= null && !isInferredCombinationAuthorship
);
938 basionymAuthorshipField
.setVisible(withBasionymSection
&& isInferredBasionymAuthorship
!= null && !isInferredBasionymAuthorship
);
939 exBasionymAuthorshipField
.setVisible(withBasionymSection
&& isInferredExBasionymAuthorship
!= null && !isInferredExBasionymAuthorship
);
941 validationField
.setVisible(withValidationSection
);
942 exCombinationAuthorshipField
.setVisible(withValidationSection
&& isInferredExCombinationAuthorship
!= null && !isInferredExCombinationAuthorship
);
944 orthographicVariantField
.setVisible(withOrthographicCorrectionSection
);
945 if(withOrthographicCorrectionSection
){
946 orthographicCorrectionValidator
= new OrthographicCorrectionReferenceValidator(nomReferenceCombobox
);
947 orthographicVariantField
.addValidator(orthographicCorrectionValidator
);
949 if(orthographicCorrectionValidator
!= null){
950 orthographicVariantField
.removeValidator(orthographicCorrectionValidator
);
951 orthographicVariantField
= null;
955 infraSpecificEpithetField
.setVisible(rank
.isInfraSpecific());
956 specificEpithetField
.setVisible(isSpeciesOrBelow
);
957 infraGenericEpithetField
.setVisible(rank
.isInfraGenericButNotSpeciesGroup());
958 genusOrUninomialField
.setCaption(isSpeciesOrBelow ?
"Genus" : "Uninomial");
960 updateNomStatusCollectionFieldVisibility();
964 public void updateNomStatusCollectionFieldVisibility() {
965 boolean nameHasStatus
= false;
966 if(nomStatusCollectionField
.getLayout().getRows() > 1) {
967 // fist row holds the lables
968 NativeSelect fistStatusSelect
= (NativeSelect
)nomStatusCollectionField
.getLayout().getComponent(0, 1);
969 nameHasStatus
= fistStatusSelect
.getValue() != null;
971 nomStatusCollectionField
.getLayout().getParent().setVisible(nameHasStatus
);
972 nomStatusCollectionFieldToggle
.setValue(Boolean
.valueOf(nameHasStatus
));
976 public void cancel() {
977 authorshipUpdateListeners
.keySet().forEach(field
-> field
.removeValueChangeListener(authorshipUpdateListeners
.get(field
)));
978 rankSelect
.removeValueChangeListener(updateFieldVisibilityListener
);
983 public ToOneRelatedEntityCombobox
<Reference
> getNomReferenceCombobox() {
984 return nomReferenceCombobox
;
988 public TextField
getNomenclaturalReferenceDetail() {
989 return nomenclaturalReferenceDetail
;
993 public ToManyRelatedEntitiesComboboxSelect
<TaxonName
> getBasionymComboboxSelect() {
994 return basionymsComboboxSelect
;
998 public ToManyRelatedEntitiesComboboxSelect
<TaxonName
> getReplacedSynonymsComboboxSelect() {
999 return replacedSynonymsComboboxSelect
;
1003 public NativeSelect
getRankSelect() {
1008 public Button
getRankSelectFullListToggle() {
1009 return rankSelectFullListToggle
;
1013 public AbstractField
<String
> getGenusOrUninomialField(){
1014 return genusOrUninomialField
;
1018 public TeamOrPersonField
getExBasionymAuthorshipField() {
1019 return exBasionymAuthorshipField
;
1023 public TeamOrPersonField
getBasionymAuthorshipField() {
1024 return basionymAuthorshipField
;
1028 public TeamOrPersonField
getCombinationAuthorshipField() {
1029 return combinationAuthorshipField
;
1033 public TeamOrPersonField
getExCombinationAuthorshipField() {
1034 return exCombinationAuthorshipField
;
1038 public NameRelationField
getValidationField(){
1039 return validationField
;
1043 public NameRelationField
getOrthographicVariantField() {
1044 return orthographicVariantField
;
1048 public void enableMode(TaxonNamePopupEditorMode mode
){
1049 modesActive
.add(mode
);
1050 updateFormOnModeChange();
1054 public boolean isModeEnabled(TaxonNamePopupEditorMode mode
){
1055 return modesActive
.contains(mode
);
1059 public boolean isRanksFullList() {
1060 return isRanksFullList
;
1064 public void disableMode(TaxonNamePopupEditorMode mode
){
1065 modesActive
.remove(mode
);
1066 updateFormOnModeChange();
1070 * updates UI in turn of mode changes if needed, that is when the bean has been set
1073 private void updateFormOnModeChange() {
1074 if(getBean() != null){
1075 // need to update the ui
1076 afterItemDataSourceSet();
1077 if(!isModeEnabled(TaxonNamePopupEditorMode
.AUTOFILL_AUTHORSHIP_DATA
)){
1078 updateFieldVisibility();
1084 public EnumSet
<TaxonNamePopupEditorMode
> getModesActive(){
1089 public CheckBox
getBasionymToggle() {
1090 return basionymToggle
;
1094 public FilterableAnnotationsField
getAnnotationsField() {
1095 return annotationsListField
;
1099 public void setReadOnly(boolean readOnly
) {
1100 super.setReadOnly(readOnly
);
1101 boolean basionymToggleReadonly
= basionymToggle
.isReadOnly();
1102 boolean validationToggleReadonly
= validationToggle
.isReadOnly();
1103 combinationAuthorshipField
.setEditorReadOnly(readOnly
);
1104 exCombinationAuthorshipField
.setEditorReadOnly(readOnly
);
1105 basionymAuthorshipField
.setEditorReadOnly(readOnly
);
1106 exBasionymAuthorshipField
.setEditorReadOnly(readOnly
);
1107 // preserve old readonly states if they were true
1108 if(basionymToggleReadonly
){
1109 basionymToggle
.setReadOnly(true);
1111 if(validationToggleReadonly
){
1112 validationToggle
.setReadOnly(true);
1114 nomStatusCollectionField
.getLayout().iterator().forEachRemaining(c
-> c
.setReadOnly(readOnly
));
1118 * Sets the readonly state of all fields in this editor, but leaving the editor itself untouched.
1122 public void setAllFieldsReadOnly(boolean readOnly
) {
1123 logger
.error("Set all fields to readonly");
1125 recursiveReadonly(readOnly
, getMainLayout());
1126 // NOTE:We are using the enabled state instead of read only since
1127 // setting read only will not affect the members editor.
1128 // this seems to be a bug in TeamOrPersonField or in
1129 // ToManyRelatedEntitiesListSelect
1130 combinationAuthorshipField
.setEnabled(!readOnly
);
1131 exCombinationAuthorshipField
.setEnabled(!readOnly
);
1132 basionymAuthorshipField
.setEnabled(!readOnly
);
1133 exBasionymAuthorshipField
.setEnabled(!readOnly
);
1134 nomStatusCollectionField
.getLayout().iterator().forEachRemaining(c
-> c
.setReadOnly(readOnly
));
1138 public AbstractField
<String
> getInfraGenericEpithetField() {
1139 return infraGenericEpithetField
;
1143 public AbstractField
<String
> getSpecificEpithetField() {
1144 return specificEpithetField
;
1148 public AbstractField
<String
> getInfraSpecificEpithetField() {
1149 return infraSpecificEpithetField
;
1153 public CheckBox
getOrthographicVariantToggle() {
1154 return orthographicVariantToggle
;
1158 public ElementCollectionField
<NomenclaturalStatusDTO
> getNomStatusCollectionField(){
1159 return nomStatusCollectionField
;