1 |
70c753df
|
Andreas Kohlbecker
|
/**
|
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 java.util.Arrays;
|
12 |
|
|
import java.util.Collection;
|
13 |
|
|
|
14 |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
15 |
|
|
import org.springframework.context.annotation.Scope;
|
16 |
|
|
import org.springframework.security.core.GrantedAuthority;
|
17 |
|
|
|
18 |
|
|
import com.vaadin.spring.annotation.SpringComponent;
|
19 |
|
|
import com.vaadin.ui.DateField;
|
20 |
|
|
import com.vaadin.ui.FormLayout;
|
21 |
|
|
import com.vaadin.ui.ListSelect;
|
22 |
|
|
import com.vaadin.ui.TextField;
|
23 |
|
|
|
24 |
50257107
|
Andreas Kohlbecker
|
import eu.etaxonomy.cdm.model.agent.Institution;
|
25 |
|
|
import eu.etaxonomy.cdm.model.common.User;
|
26 |
70c753df
|
Andreas Kohlbecker
|
import eu.etaxonomy.cdm.model.name.Registration;
|
27 |
|
|
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
|
28 |
50257107
|
Andreas Kohlbecker
|
import eu.etaxonomy.cdm.vaadin.component.SelectFieldFactory;
|
29 |
70c753df
|
Andreas Kohlbecker
|
import eu.etaxonomy.cdm.vaadin.security.AccessRestrictedView;
|
30 |
|
|
import eu.etaxonomy.cdm.vaadin.util.converter.JodaDateTimeConverter;
|
31 |
|
|
import eu.etaxonomy.vaadin.mvp.AbstractCdmPopupEditor;
|
32 |
|
|
|
33 |
|
|
/**
|
34 |
|
|
* @author a.kohlbecker
|
35 |
|
|
* @since May 15, 2017
|
36 |
|
|
*
|
37 |
|
|
*/
|
38 |
|
|
@SpringComponent
|
39 |
|
|
@Scope("prototype")
|
40 |
|
|
public class RegistrationPopupEditor extends AbstractCdmPopupEditor<Registration, RegistrationEditorPresenter>
|
41 |
|
|
implements RegistrationPopEditorView, AccessRestrictedView {
|
42 |
|
|
|
43 |
c8a10c34
|
Andreas Kohlbecker
|
private static final long serialVersionUID = 5418275817834009509L;
|
44 |
|
|
|
45 |
|
|
@Autowired
|
46 |
|
|
private SelectFieldFactory selectFieldFactory;
|
47 |
70c753df
|
Andreas Kohlbecker
|
|
48 |
|
|
public RegistrationPopupEditor() {
|
49 |
|
|
super(new FormLayout(), Registration.class);
|
50 |
50257107
|
Andreas Kohlbecker
|
}
|
51 |
|
|
|
52 |
|
|
/**
|
53 |
|
|
* {@inheritDoc}
|
54 |
|
|
*/
|
55 |
|
|
@Override
|
56 |
|
|
protected void initContent() {
|
57 |
|
|
|
58 |
70c753df
|
Andreas Kohlbecker
|
FormLayout form = (FormLayout)getFieldLayout();
|
59 |
|
|
form.setSpacing(true);
|
60 |
|
|
form.setMargin(true);
|
61 |
|
|
|
62 |
|
|
TextField identifierField = new TextField("Identifier");
|
63 |
|
|
addField(identifierField, "identifier");
|
64 |
|
|
identifierField.setEnabled(false);
|
65 |
|
|
|
66 |
|
|
TextField specificIdentifierField = new TextField("Specific Identifier");
|
67 |
|
|
addField(specificIdentifierField, "specificIdentifier");
|
68 |
|
|
specificIdentifierField.setEnabled(false);
|
69 |
|
|
|
70 |
|
|
ListSelect statusSelect = new ListSelect("Status", Arrays.asList(RegistrationStatus.values()));
|
71 |
|
|
statusSelect.setNullSelectionAllowed(false);
|
72 |
|
|
statusSelect.setRows(1);
|
73 |
|
|
addField(statusSelect, "status");
|
74 |
|
|
|
75 |
c8a10c34
|
Andreas Kohlbecker
|
ListSelect submitterField = selectFieldFactory.createListSelect("Submitter", User.class);
|
76 |
70c753df
|
Andreas Kohlbecker
|
submitterField.setEnabled(false);
|
77 |
|
|
addField(submitterField, "submitter");
|
78 |
|
|
|
79 |
c8a10c34
|
Andreas Kohlbecker
|
ListSelect institutionField = selectFieldFactory.createListSelect("Institution", Institution.class);
|
80 |
|
|
institutionField.setEnabled(false);
|
81 |
|
|
addField(institutionField, "institution");
|
82 |
70c753df
|
Andreas Kohlbecker
|
|
83 |
|
|
DateField registrationDateField = new DateField("Registration date");
|
84 |
|
|
addField(registrationDateField, "registrationDate");
|
85 |
|
|
registrationDateField.setConverter(new JodaDateTimeConverter());
|
86 |
c8a10c34
|
Andreas Kohlbecker
|
|
87 |
70c753df
|
Andreas Kohlbecker
|
}
|
88 |
|
|
|
89 |
|
|
/**
|
90 |
|
|
* {@inheritDoc}
|
91 |
|
|
*/
|
92 |
|
|
@Override
|
93 |
|
|
public String getWindowCaption() {
|
94 |
|
|
return "Registration editor";
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
/**
|
98 |
|
|
* {@inheritDoc}
|
99 |
|
|
*/
|
100 |
|
|
@Override
|
101 |
|
|
public void focusFirst() {
|
102 |
|
|
// none
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
/**
|
106 |
|
|
* {@inheritDoc}
|
107 |
|
|
*/
|
108 |
|
|
@Override
|
109 |
|
|
protected String getDefaultComponentStyles() {
|
110 |
|
|
return "tiny";
|
111 |
|
|
}
|
112 |
|
|
|
113 |
|
|
/**
|
114 |
|
|
* {@inheritDoc}
|
115 |
|
|
*/
|
116 |
|
|
@Override
|
117 |
|
|
public boolean allowAnonymousAccess() {
|
118 |
|
|
return false;
|
119 |
|
|
}
|
120 |
|
|
|
121 |
|
|
/**
|
122 |
|
|
* {@inheritDoc}
|
123 |
|
|
*/
|
124 |
|
|
@Override
|
125 |
|
|
public Collection<Collection<GrantedAuthority>> allowedGrantedAuthorities() {
|
126 |
|
|
return null;
|
127 |
|
|
}
|
128 |
|
|
}
|