]> gitweb.fperrin.net Git - GpsPrune.git/blob - tim/prune/save/PhotoTableEntry.java
34fd2b98206a3592a48a24c691cc6e926b5c9dd6
[GpsPrune.git] / tim / prune / save / PhotoTableEntry.java
1 package tim.prune.save;
2
3 import tim.prune.I18nManager;
4 import tim.prune.data.Photo;
5
6 /**
7  * Class to represent a row of the photo table for saving exif
8  */
9 public class PhotoTableEntry
10 {
11         private Photo _photo = null;
12         private String _photoName = null;
13         private boolean _save = true;
14         private String _status = null;
15
16         /**
17          * Constructor
18          * @param inPhoto photo object
19          */
20         public PhotoTableEntry(Photo inPhoto)
21         {
22                 _photo = inPhoto;
23                 if (inPhoto != null)
24                 {
25                         _photoName = inPhoto.getFile().getName();
26                         _status = getStatusString(inPhoto.getOriginalStatus(), inPhoto.getCurrentStatus());
27                 }
28         }
29
30
31         /**
32          * Make a status string from the given status bytes
33          * @param inOriginalStatus original status of photo
34          * @param inCurrentStatus current status of photo
35          * @return status string for display
36          */
37         private static String getStatusString (Photo.Status inOriginalStatus, Photo.Status inCurrentStatus)
38         {
39                 if (inOriginalStatus != inCurrentStatus)
40                 {
41                         if (inOriginalStatus == Photo.Status.NOT_CONNECTED)
42                         {
43                                 // originally didn't have a point, now it has
44                                 return I18nManager.getText("dialog.saveexif.photostatus.connected");
45                         }
46                         if (inCurrentStatus == Photo.Status.NOT_CONNECTED)
47                         {
48                                 // originally had a point, now it doesn't
49                                 return I18nManager.getText("dialog.saveexif.photostatus.disconnected");
50                         }
51                         // originally had a point, now it has a different one
52                         return I18nManager.getText("dialog.saveexif.photostatus.modified");
53                 }
54                 // unrecognised status
55                 return null;
56         }
57
58         /**
59          * @return Photo object
60          */
61         public Photo getPhoto()
62         {
63                 return _photo;
64         }
65
66         /**
67          * @return photo filename
68          */
69         public String getName()
70         {
71                 return _photoName;
72         }
73
74         /**
75          * @return photo status as string
76          */
77         public String getStatus()
78         {
79                 return _status;
80         }
81
82         /**
83          * @param inFlag true to save exif, false otherwise
84          */
85         public void setSaveFlag(boolean inFlag)
86         {
87                 _save = inFlag;
88         }
89
90         /**
91          * @return true to save exif, false otherwise
92          */
93         public boolean getSaveFlag()
94         {
95                 return _save;
96         }
97 }