View Javadoc

1   /*
2    *  DISCLAIMER
3    */
4   package org.flowfuse.base.frontend.support;
5   
6   import org.apache.commons.logging.Log;
7   import org.apache.commons.logging.LogFactory;
8   
9   import java.beans.PropertyEditorSupport;
10  import java.util.Date;
11  
12  /***
13   * @author <a href="stefan@flowfuse.org">Stefan Kleineikenscheidt</a>,
14   *         Flowfuse.org
15   * @version $Id: MyDateSupport.java,v 1.2 2006/01/15 19:56:10 skleinei Exp $
16   */
17  public class MyDateSupport extends PropertyEditorSupport {
18  
19    /***
20     * RCS ID
21     */
22    public final static String rcsid = "$Id: MyDateSupport.java,v 1.2 2006/01/15 19:56:10 skleinei Exp $";
23  
24    /***
25     * Logger
26     */
27    protected final Log logger = LogFactory.getLog(this.getClass());
28  
29    public String getAsText() {
30      Object value = getValue();
31      // TODO
32      return "10/10/2010";
33    }
34  
35    public void setAsText(String string)
36            throws IllegalArgumentException {
37      try {
38        setValue(new Date());
39      } catch (NumberFormatException ex) {
40        throw new IllegalArgumentException(
41                "Invalid id for Fruit: " + string);
42      }
43    }
44  }
45  
46  /* EOF */