| 1 | package tmcsim.client.cadclientgui.data; |
|---|
| 2 | |
|---|
| 3 | import java.io.Serializable; |
|---|
| 4 | import java.util.LinkedList; |
|---|
| 5 | |
|---|
| 6 | import javax.swing.table.DefaultTableModel; |
|---|
| 7 | |
|---|
| 8 | public class CardfileDataObject implements Serializable { |
|---|
| 9 | |
|---|
| 10 | private int idTag; |
|---|
| 11 | |
|---|
| 12 | private String category; |
|---|
| 13 | private String name; |
|---|
| 14 | private String address; |
|---|
| 15 | private String city; |
|---|
| 16 | private String state; |
|---|
| 17 | private String zip; |
|---|
| 18 | private String phone1; |
|---|
| 19 | private String phone2; |
|---|
| 20 | private String fax; |
|---|
| 21 | private LinkedList<String[]> commentsTableFields; |
|---|
| 22 | |
|---|
| 23 | public CardfileDataObject(String category, String name, int idTag) { |
|---|
| 24 | this.idTag = idTag; |
|---|
| 25 | this.category = category; |
|---|
| 26 | this.name = name; |
|---|
| 27 | address = ""; |
|---|
| 28 | city = ""; |
|---|
| 29 | state = ""; |
|---|
| 30 | zip = ""; |
|---|
| 31 | phone1 = ""; |
|---|
| 32 | phone2 = ""; |
|---|
| 33 | fax = ""; |
|---|
| 34 | commentsTableFields = new LinkedList<String[]>(); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | public int getId() { |
|---|
| 38 | return idTag; |
|---|
| 39 | } |
|---|
| 40 | |
|---|
| 41 | public String getCategory() { |
|---|
| 42 | return category; |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | public void setName(String name) { |
|---|
| 46 | this.name = name; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | public String getName() { |
|---|
| 50 | return name; |
|---|
| 51 | } |
|---|
| 52 | |
|---|
| 53 | public void setAddress(String address) { |
|---|
| 54 | this.address = address; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | public String getAddress() { |
|---|
| 58 | return address; |
|---|
| 59 | } |
|---|
| 60 | |
|---|
| 61 | public void setCity(String city) { |
|---|
| 62 | this.city = city; |
|---|
| 63 | } |
|---|
| 64 | |
|---|
| 65 | public String getCity() { |
|---|
| 66 | return city; |
|---|
| 67 | } |
|---|
| 68 | |
|---|
| 69 | public void setState(String state) { |
|---|
| 70 | this.state = state; |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | public String getState() { |
|---|
| 74 | return state; |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | public void setZip(String zip) { |
|---|
| 78 | this.zip = zip; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | public String getZip() { |
|---|
| 82 | return zip; |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | public void setPhone1(String phone1) { |
|---|
| 86 | this.phone1 = phone1; |
|---|
| 87 | } |
|---|
| 88 | |
|---|
| 89 | public String getPhone1() { |
|---|
| 90 | return phone1; |
|---|
| 91 | } |
|---|
| 92 | |
|---|
| 93 | public void setPhone2(String phone2) { |
|---|
| 94 | this.phone2 = phone2; |
|---|
| 95 | } |
|---|
| 96 | |
|---|
| 97 | public String getPhone2() { |
|---|
| 98 | return phone2; |
|---|
| 99 | } |
|---|
| 100 | |
|---|
| 101 | public void setFax(String fax) { |
|---|
| 102 | this.fax = fax; |
|---|
| 103 | } |
|---|
| 104 | |
|---|
| 105 | public String getFax() { |
|---|
| 106 | return fax; |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | public LinkedList<String[]> getCommentsTableFields() { |
|---|
| 110 | return commentsTableFields; |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | public void addComment(String[] fields) { |
|---|
| 114 | commentsTableFields.add(fields); |
|---|
| 115 | } |
|---|
| 116 | |
|---|
| 117 | public void removeComment(String timeStamp) { |
|---|
| 118 | for (int i = 0; i < commentsTableFields.size(); i++) { |
|---|
| 119 | String[] temp = commentsTableFields.get(i); |
|---|
| 120 | if (temp[1].equals(timeStamp)) { |
|---|
| 121 | commentsTableFields.remove(i); |
|---|
| 122 | return; |
|---|
| 123 | } |
|---|
| 124 | } |
|---|
| 125 | } |
|---|
| 126 | |
|---|
| 127 | public boolean equals(Object obj) { |
|---|
| 128 | if (obj.getClass() != getClass()) { |
|---|
| 129 | return false; |
|---|
| 130 | } |
|---|
| 131 | if (idTag != ((CardfileDataObject) obj).idTag) { |
|---|
| 132 | return false; |
|---|
| 133 | } |
|---|
| 134 | return true; |
|---|
| 135 | } |
|---|
| 136 | |
|---|
| 137 | } |
|---|