2 * Copyright (C) 2017 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.vaadin
.util
.converter
;
11 import java
.util
.Date
;
12 import java
.util
.Locale
;
14 import org
.joda
.time
.DateTime
;
16 import com
.vaadin
.data
.util
.converter
.Converter
;
19 * @author a.kohlbecker
23 public final class JodaDateTimeConverter
implements Converter
<Date
, DateTime
> {
25 public DateTime
convertToModel(Date value
, Class
<?
extends DateTime
> targetType
, Locale locale
)
26 throws com
.vaadin
.data
.util
.converter
.Converter
.ConversionException
{
27 DateTime dateTime
= null;
30 dateTime
= new DateTime(value
);
31 } catch (IllegalArgumentException e
) {
32 throw new ConversionException(e
);
39 public Date
convertToPresentation(DateTime value
, Class
<?
extends Date
> targetType
, Locale locale
)
40 throws com
.vaadin
.data
.util
.converter
.Converter
.ConversionException
{
43 date
= value
.toDate();
49 public Class
<DateTime
> getModelType() {
50 return DateTime
.class;
54 public Class
<Date
> getPresentationType() {