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