ref #10302 adapted sizes of fields in NomenclaturalStatusRow
[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 NomenclaturalStatusDTO
40 */
41 NativeSelect type = new NativeSelect();
42 ToOneRelatedEntityCombobox<Reference> citation = new ToOneRelatedEntityCombobox<>(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(250, Unit.PIXELS);
50 citation.setNestedButtonStateUpdater(new ToOneRelatedEntityButtonUpdater<Reference>(citation));
51 citationMicroReference.setWidth(100, Unit.PIXELS);
52 ruleConsidered.setWidth(100, Unit.PIXELS);
53 codeEdition.setWidth(110, Unit.PIXELS);
54 }
55
56 /**
57 * @return the components of this NomenclaturalStatusRow
58 * in the order to display
59 */
60 public Component[] components() {
61 Component[] components = new Component[]{
62 type,
63 ruleConsidered,
64 codeEdition,
65 citation,
66 citationMicroReference,
67 };
68 addAll(Arrays.asList(components));
69 return components;
70 }
71
72 public static List<String> visibleFields() {
73 List<String> visibleFields = Arrays.asList(new String[]{
74 "type",
75 "ruleConsidered",
76 "codeEdition",
77 "citation",
78 "citationMicroReference",
79 });
80 return visibleFields;
81 }
82
83 @Override
84 public void updateRowItemsEnablement() {
85 // nothing to do
86 }
87 }