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.component;
|
10
|
|
11
|
import com.vaadin.data.Property;
|
12
|
import com.vaadin.ui.TextField;
|
13
|
|
14
|
import eu.etaxonomy.cdm.vaadin.util.converter.JodaTimePartialConverter;
|
15
|
|
16
|
/**
|
17
|
* The PartialDateField is just a simple TextField by now but will evolve to
|
18
|
* a more user friendly widget with either selectors for year, month, day
|
19
|
* or it will use calendar widget like the DateField which allows selecting only
|
20
|
* the year or year + month.
|
21
|
*
|
22
|
* @author a.kohlbecker
|
23
|
* @since Apr 7, 2017
|
24
|
*
|
25
|
*/
|
26
|
public class PartialDateField extends TextField {
|
27
|
|
28
|
private static final long serialVersionUID = -347319052346135100L;
|
29
|
|
30
|
JodaTimePartialConverter.DateFormat format = JodaTimePartialConverter.DateFormat.DAY_MONTH_YEAR_DOT;
|
31
|
|
32
|
/**
|
33
|
*
|
34
|
*/
|
35
|
public PartialDateField() {
|
36
|
super();
|
37
|
setConverter(new JodaTimePartialConverter(format));
|
38
|
}
|
39
|
|
40
|
/**
|
41
|
* @param dataSource
|
42
|
*/
|
43
|
public PartialDateField(Property dataSource) {
|
44
|
super(dataSource);
|
45
|
setConverter(new JodaTimePartialConverter(format));
|
46
|
}
|
47
|
|
48
|
/**
|
49
|
* @param caption
|
50
|
* @param dataSource
|
51
|
*/
|
52
|
public PartialDateField(String caption, Property dataSource) {
|
53
|
super(caption, dataSource);
|
54
|
setConverter(new JodaTimePartialConverter(format));
|
55
|
}
|
56
|
|
57
|
/**
|
58
|
* @param caption
|
59
|
* @param value
|
60
|
*/
|
61
|
public PartialDateField(String caption, String value) {
|
62
|
super(caption, value);
|
63
|
setConverter(new JodaTimePartialConverter(format));
|
64
|
}
|
65
|
|
66
|
/**
|
67
|
* @param caption
|
68
|
*/
|
69
|
public PartialDateField(String caption) {
|
70
|
super(caption);
|
71
|
setConverter(new JodaTimePartialConverter(format));
|
72
|
}
|
73
|
|
74
|
|
75
|
|
76
|
}
|