| 1 | package tmcsim.client.cadclientgui.data; |
|---|
| 2 | |
|---|
| 3 | import java.io.Serializable; |
|---|
| 4 | |
|---|
| 5 | import tmcsim.client.cadclientgui.enums.CADDataEnums.EditCommand; |
|---|
| 6 | |
|---|
| 7 | /** |
|---|
| 8 | * Each changelog holds enough data to remember which object was changed and |
|---|
| 9 | * what was changed, so that upon close, the user can choose to keep or forget |
|---|
| 10 | * the changes. |
|---|
| 11 | * |
|---|
| 12 | * @author Vincent |
|---|
| 13 | * |
|---|
| 14 | */ |
|---|
| 15 | public class ChangeLog implements Serializable { |
|---|
| 16 | |
|---|
| 17 | public EditCommand command; |
|---|
| 18 | public String listTitle; |
|---|
| 19 | public int id; |
|---|
| 20 | public String newValue; |
|---|
| 21 | public CardfileDataObject newCardfileObject; |
|---|
| 22 | public String[] tableFields = new String[4]; |
|---|
| 23 | public String timeStamp; |
|---|
| 24 | |
|---|
| 25 | // creates an edit log to modify any one field of a CardfileDataObject |
|---|
| 26 | public ChangeLog(EditCommand command, String listTitle, int id, |
|---|
| 27 | String newValue) { |
|---|
| 28 | this.command = command; |
|---|
| 29 | this.listTitle = listTitle; |
|---|
| 30 | this.id = id; |
|---|
| 31 | this.newValue = newValue; |
|---|
| 32 | } |
|---|
| 33 | |
|---|
| 34 | // creates an add log for a CardfileDataObject |
|---|
| 35 | public ChangeLog(EditCommand command, String listTitle, |
|---|
| 36 | CardfileDataObject newObj) { |
|---|
| 37 | this.command = command; |
|---|
| 38 | this.listTitle = listTitle; |
|---|
| 39 | this.newCardfileObject = newObj; |
|---|
| 40 | } |
|---|
| 41 | |
|---|
| 42 | // create a delete log for a CardfileDataObject |
|---|
| 43 | public ChangeLog(EditCommand command, String listTitle, int id) { |
|---|
| 44 | this.command = command; |
|---|
| 45 | this.listTitle = listTitle; |
|---|
| 46 | this.id = id; |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | // create an add log for a CardfileDataObject's table |
|---|
| 50 | public ChangeLog(EditCommand command, String listTitle, int id, |
|---|
| 51 | String[] tableFields) { |
|---|
| 52 | this.command = command; |
|---|
| 53 | this.listTitle = listTitle; |
|---|
| 54 | this.id = id; |
|---|
| 55 | this.tableFields = tableFields; |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | // create a delete log for a CardfileDataObject's table |
|---|
| 59 | public ChangeLog(EditCommand command, String listTitle, String timeStamp, |
|---|
| 60 | int id) { |
|---|
| 61 | this.command = command; |
|---|
| 62 | this.listTitle = listTitle; |
|---|
| 63 | this.timeStamp = timeStamp; |
|---|
| 64 | this.id = id; |
|---|
| 65 | } |
|---|
| 66 | } |
|---|