1 package eu
.etaxonomy
.cdm
.remote
.editor
;
3 import java
.beans
.PropertyEditorSupport
;
5 import org
.joda
.time
.DateTime
;
6 import org
.joda
.time
.format
.DateTimeFormatter
;
7 import org
.joda
.time
.format
.DateTimeFormatterBuilder
;
9 public class DateTimeEditor
extends PropertyEditorSupport
{
11 private static DateTimeFormatter parser
;
12 private static DateTimeFormatter printer
;
15 parser
= new DateTimeFormatterBuilder().appendPattern("dd/MM/YYYY").appendOptional(new DateTimeFormatterBuilder().appendPattern(" HH:mm:ss").toParser()).toFormatter();
16 printer
= new DateTimeFormatterBuilder().appendPattern("dd/MM/YYYY HH:mm:ss").toFormatter();
19 public void setAsText(String text
) {
20 setValue(parser
.parseDateTime(text
));
23 public String
getAsText() {
24 return printer
.print((DateTime
)getValue());