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.editor.reference;
|
10
|
|
11
|
import org.springframework.context.annotation.Scope;
|
12
|
|
13
|
import com.vaadin.data.fieldgroup.FieldGroup.CommitException;
|
14
|
import com.vaadin.spring.annotation.SpringComponent;
|
15
|
import com.vaadin.ui.TextField;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.reference.Reference;
|
18
|
import eu.etaxonomy.vaadin.ui.view.AbstractPopupEditor;
|
19
|
|
20
|
/**
|
21
|
* @author a.kohlbecker
|
22
|
* @since Apr 4, 2017
|
23
|
*
|
24
|
*/
|
25
|
|
26
|
@SpringComponent
|
27
|
@Scope("prototype")
|
28
|
public class ReferencePopupEditor extends AbstractPopupEditor<Reference> {
|
29
|
|
30
|
private static final long serialVersionUID = -4347633563800758815L;
|
31
|
|
32
|
private TextField titleField;
|
33
|
|
34
|
/**
|
35
|
* @param layout
|
36
|
* @param dtoType
|
37
|
*/
|
38
|
public ReferencePopupEditor() {
|
39
|
super(Reference.class);
|
40
|
/*
|
41
|
"type",
|
42
|
"uri",
|
43
|
"abbrevTitleCache",
|
44
|
"protectedAbbrevTitleCache",
|
45
|
"nomenclaturallyRelevant",
|
46
|
"authorship",
|
47
|
"referenceAbstract",
|
48
|
"title",
|
49
|
"abbrevTitle",
|
50
|
"editor",
|
51
|
"volume",
|
52
|
"pages",
|
53
|
"edition",
|
54
|
"isbn",
|
55
|
"issn",
|
56
|
"doi",
|
57
|
"seriesPart",
|
58
|
"datePublished",
|
59
|
"publisher",
|
60
|
"placePublished",
|
61
|
"institution",
|
62
|
"school",
|
63
|
"organization",
|
64
|
"inReference"
|
65
|
*/
|
66
|
addTextField("Reference cache", "titleCache");
|
67
|
addTextField("Abbrev. cache", "abbrevTitleCache");
|
68
|
titleField = addTextField("Title", "title");
|
69
|
titleField.setRequired(true);
|
70
|
addTextField("NomenclaturalTitle", "abbrevTitle");
|
71
|
// addTextField("Author(s)", "authorship").setRequired(true);
|
72
|
addTextField("Editor", "editor");
|
73
|
addTextField("Series", "seriesPart");
|
74
|
addTextField("Volume", "volume");
|
75
|
addTextField("Pages", "pages");
|
76
|
addTextField("Place published", "placePublished");
|
77
|
addTextField("Publisher", "publisher").setRequired(true);
|
78
|
// TODO implement a TimePeriod component addDateField("DatePublished", "datePublished") // .setConverter(new JodaDateTimeConverter());
|
79
|
addTextField("ISSN", "issn");
|
80
|
addTextField("ISBN", "isbn");
|
81
|
addTextField("DOI", "doi");
|
82
|
|
83
|
}
|
84
|
|
85
|
/**
|
86
|
* {@inheritDoc}
|
87
|
*/
|
88
|
@Override
|
89
|
public String getWindowCaption() {
|
90
|
return "Reference editor";
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* {@inheritDoc}
|
95
|
*/
|
96
|
@Override
|
97
|
public void focusFirst() {
|
98
|
titleField.focus();
|
99
|
}
|
100
|
|
101
|
/**
|
102
|
* {@inheritDoc}
|
103
|
*/
|
104
|
@Override
|
105
|
public void storeDto(Reference bean) throws CommitException {
|
106
|
//TODO this should happen in the AbstractPopupEditor!
|
107
|
getRepsitory().getReferenceService().saveOrUpdate(bean);
|
108
|
}
|
109
|
|
110
|
|
111
|
|
112
|
}
|