Project

General

Profile

Download (1.99 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 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.registration;
10

    
11
import eu.etaxonomy.cdm.api.service.IRegistrationService;
12
import eu.etaxonomy.cdm.model.agent.Institution;
13
import eu.etaxonomy.cdm.model.common.User;
14
import eu.etaxonomy.cdm.model.name.Registration;
15
import eu.etaxonomy.cdm.vaadin.component.CdmBeanItemContainerFactory;
16
import eu.etaxonomy.vaadin.mvp.AbstractCdmEditorPresenter;
17

    
18
/**
19
 * @author a.kohlbecker
20
 * @since May 15, 2017
21
 *
22
 */
23
public class RegistrationEditorPresenter extends AbstractCdmEditorPresenter<Registration, RegistrationPopEditorView> {
24

    
25
    private static final long serialVersionUID = 6930557602995331944L;
26

    
27
    /**
28
     * {@inheritDoc}
29
     */
30
    @Override
31
    protected IRegistrationService getService() {
32
        return getRepo().getRegistrationService();
33
    }
34

    
35
    /**
36
     * {@inheritDoc}
37
     */
38
    @Override
39
    protected Registration loadBeanById(Object identifier) {
40

    
41
        Registration reg;
42
        if(identifier != null){
43
            reg = getRepo().getRegistrationService().find((Integer)identifier);
44
        } else {
45
            reg = Registration.NewInstance();
46
        }
47
        return reg;
48
    }
49

    
50
    /**
51
     * {@inheritDoc}
52
     */
53
    @Override
54
    public void handleViewEntered() {
55
        super.handleViewEntered();
56

    
57
        CdmBeanItemContainerFactory selectFieldFactory = new CdmBeanItemContainerFactory(getRepo());
58

    
59
        getView().getInstitutionField().setContainerDataSource(selectFieldFactory.buildBeanItemContainer(Institution.class));
60
        getView().getInstitutionField().setItemCaptionPropertyId("titleCache");
61

    
62
        getView().getSubmitterField().setContainerDataSource(selectFieldFactory.buildBeanItemContainer(User.class));
63
        getView().getSubmitterField().setItemCaptionPropertyId("username");
64
    }
65

    
66

    
67

    
68
}
(6-6/17)