Project

General

Profile

« Previous | Next » 

Revision 6702c7e1

Added by Andreas Kohlbecker almost 7 years ago

ref #6169 basic TaxonName popup editor

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/component/registration/RegistrationItemEditButtonGroup.java
31 31

  
32 32
    public static final String STYLE_NAMES = "edit-button-group " + ValoTheme.LAYOUT_COMPONENT_GROUP;
33 33

  
34
    /**
35
     * Either the id of the name in the Registration or the id of the typifying name
36
     * of the first type designation.
37
     */
38
    private Integer nameId = null;
34
    private IdButton nameButton = null;
39 35

  
40
    private Button nameButton = null;
41

  
42
    private List<Button> typeDesignationButtons = new ArrayList<>();
36
    private List<IdButton> typeDesignationButtons = new ArrayList<>();
43 37

  
44 38
    private List<Label> labels = new ArrayList<>();
45 39

  
46 40

  
47

  
48 41
    public RegistrationItemEditButtonGroup(RegistrationDTO regDto){
49 42

  
50 43
        setWidth(100, Unit.PERCENTAGE);
51 44

  
52 45
        if(regDto.getName() != null){
53
            nameButton = new Button(regDto.getName().getLabel());
54
            addComponent(nameButton);
46
            nameButton = new IdButton(regDto.getName().getId(), new Button(regDto.getName().getLabel()));
47
            addComponent(nameButton.getButton());
55 48
        } else {
56 49
            // no name in the registration! we only show the typified name as label
57 50
            addComponent(new Label(regDto.getTypifiedName().getLabel()));
......
65 58
            regDto.getTypeDesignations().get(key).forEach(value -> {
66 59
            Button tdButton = new Button(value.getLabel());
67 60
            addComponent(tdButton);
68
            typeDesignationButtons.add(tdButton);
61
            typeDesignationButtons.add(new IdButton(value.getId(), tdButton));
69 62
            }) ;
70 63
        });
71 64
        Button addTypeDesignationButton = new Button(FontAwesome.PLUS);
......
76 69

  
77 70
    }
78 71

  
79
    public Button getNameButton() {
72
    public IdButton getNameButton() {
80 73
        return nameButton;
81 74
    }
82 75

  
......
88 81
        addStyleName(STYLE_NAMES);
89 82
    }
90 83

  
84
    public class IdButton {
85
        private Integer id;
86
        private Button button;
87

  
88
        public IdButton(Integer id, Button button){
89
            this.id = id;
90
            this.button = button;
91
        }
92

  
93
        /**
94
         * @return the id
95
         */
96
        public Integer getId() {
97
            return id;
98
        }
99

  
100
        /**
101
         * @return the button
102
         */
103
        public Button getButton() {
104
            return button;
105
        }
106

  
107

  
108
    }
109

  
91 110
}

Also available in: Unified diff