01: package org.osbl.demo.urlaub.gui;
02:
03: import org.conform.*;
04: import org.conform.DefaultBeanData;
05:
06: /**
07: * @author hengels
08: * @version $Revision: 840 $
09: */
10: public class NowOrNeverPropertyData extends DefaultPropertyData {
11: public NowOrNeverPropertyData(DefaultBeanData beanData,
12: PropertyMeta property) {
13: super (beanData, property);
14: }
15:
16: public Object getValue() {
17: return super .getValue() != null;
18: }
19:
20: public void setValue(Object value) {
21: if (Boolean.TRUE.equals(value)) {
22: Class type = getPropertyMeta().getType();
23: if (java.util.Date.class.equals(type))
24: super .setValue(new java.util.Date());
25: else if (java.sql.Timestamp.class.equals(type))
26: super .setValue(new java.sql.Timestamp(System
27: .currentTimeMillis()));
28: else if (java.sql.Date.class.equals(type))
29: super .setValue(new java.sql.Date(System
30: .currentTimeMillis()));
31: else if (java.sql.Time.class.equals(type))
32: super .setValue(new java.sql.Time(System
33: .currentTimeMillis()));
34: else if (java.util.Calendar.class.equals(type))
35: super.setValue(java.util.Calendar.getInstance());
36: } else
37: super.setValue(null);
38: }
39: }
|