KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > barracuda > examples > xmlc > data > UserData


1 package org.enhydra.barracuda.examples.xmlc.data;
2
3 import java.util.*;
4
5 public class UserData extends HashMap implements Cloneable JavaDoc {
6
7     private boolean newrec = true;
8     private boolean dirty = false;
9
10     //define basic ROW types
11
public static final String JavaDoc SELECTED = "Selected"; //Boolean
12
public static final String JavaDoc FIRST_NAME = "FirstName"; //String
13
public static final String JavaDoc LAST_NAME = "LastName"; //String
14
public static final String JavaDoc GENDER = "Gender"; //Boolean (true=male)
15
public static final String JavaDoc AGE = "Age"; //Integer
16
public static final String JavaDoc EMAIL = "Email"; //String
17
public static final String JavaDoc PHONE = "Phone"; //String
18
public static final String JavaDoc NOTES = "Notes"; //String
19

20     public UserData() {
21         put(UserData.SELECTED, new Boolean JavaDoc(false));
22         put(UserData.FIRST_NAME, "");
23         put(UserData.LAST_NAME, "");
24         put(UserData.GENDER, new Boolean JavaDoc(true));
25         put(UserData.AGE, new Integer JavaDoc(0));
26         put(UserData.EMAIL, "");
27         put(UserData.PHONE, "");
28         put(UserData.NOTES, "");
29         setNew(true);
30         setDirty(false);
31     }
32
33     /**
34      * set data in the store
35      */

36     public Object JavaDoc put(Object JavaDoc key, Object JavaDoc value) {
37         setDirty(true);
38         return super.put(key, value);
39     }
40     
41     /**
42      * mark this data record as new
43      */

44     public void setNew(boolean val) {
45         newrec = val;
46     }
47     
48     /**
49      * Is this data record new
50      */

51     public boolean isNew() {
52         return newrec;
53     }
54     
55     /**
56      * mark this data record dirty/clean
57      */

58     public void setDirty(boolean val) {
59         dirty = val;
60     }
61     
62     /**
63      * Is this data record dirty
64      */

65     public boolean isDirty() {
66         return dirty;
67     }
68     
69     /**
70      * Make a copy of the current object
71      */

72     public Object JavaDoc clone() {
73         return super.clone();
74     }
75 }
76
77
Popular Tags