1e0e7125ff5f6f9722ee559e4860bccee0bfc9cc
[cdm-vaadin.git] / 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 NativeSelect codeEdition = new NativeSelect();
46
47 public NomenclaturalStatusRow() {
48
49 citation.setWidth(200, Unit.PIXELS);
50 citation.setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(citation));
51 citationMicroReference.setWidth(200, Unit.PIXELS);
52 ruleConsidered.setWidth(200, Unit.PIXELS);
53 codeEdition.setWidth(200, Unit.PIXELS);
54 }
55
56 /**
57 * @return
58 */
59 public Component[] components() {
60 Component[] components = new Component[]{
61 type,
62 citation,
63 citationMicroReference,
64 ruleConsidered,
65 codeEdition
66 };
67 addAll(Arrays.asList(components));
68 return components;
69 }
70
71 public static List<String> visibleFields() {
72 List<String> visibleFields = Arrays.asList(new String[]{
73 "type",
74 "citation",
75 "citationMicroReference",
76 "ruleConsidered",
77 "codeEdition"
78 });
79 return visibleFields;
80 }
81
82 /**
83 * {@inheritDoc}
84 */
85 @Override
86 public void updateRowItemsEnablement() {
87 // nothing to do
88 }
89
90 }