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