1 17 package org.alfresco.web.ui.common.converter; 18 19 import java.util.Date ; 20 import java.util.TimeZone ; 21 22 import javax.faces.component.UIComponent; 23 import javax.faces.context.FacesContext; 24 import javax.faces.convert.DateTimeConverter; 25 26 import org.alfresco.util.ISO8601DateFormat; 27 28 33 public class XMLDateConverter extends DateTimeConverter 34 { 35 38 public static final String CONVERTER_ID = "org.alfresco.faces.XMLDataConverter"; 39 40 43 public Object getAsObject(FacesContext context, UIComponent component, String value) 44 { 45 return ISO8601DateFormat.parse(value); 46 } 47 48 51 public String getAsString(FacesContext context, UIComponent component, Object value) 52 { 53 String str = null; 54 55 if (value instanceof String ) 56 { 57 Date date = ISO8601DateFormat.parse((String )value); 58 str = super.getAsString(context, component, date); 59 } 60 else 61 { 62 str = super.getAsString(context, component, value); 63 } 64 65 return str; 66 } 67 68 72 public TimeZone getTimeZone() 73 { 74 return TimeZone.getDefault(); 77 } 78 79 } 80 | Popular Tags |