+ /**
+ * @param inTimestamp Timestamp of photo
+ */
+ public void setTimestamp(Timestamp inTimestamp)
+ {
+ _timestamp = inTimestamp;
+ }
+
+ /**
+ * @return timestamp of photo
+ */
+ public Timestamp getTimestamp()
+ {
+ return _timestamp;
+ }
+
+ /**
+ * Calculate the size of the image (slow)
+ */
+ private void calculateSize()
+ {
+ ImageIcon icon = new ImageIcon(_file.getAbsolutePath());
+ int width = icon.getIconWidth();
+ int height = icon.getIconHeight();
+ if (width > 0 && height > 0)
+ {
+ _size = new Dimension(width, height);
+ }
+ }
+
+ /**
+ * @return size of image as Dimension object
+ */
+ public Dimension getSize()
+ {
+ if (_size == null)
+ {
+ calculateSize();
+ }
+ return _size;
+ }
+
+ /**
+ * @return width of the image, if known
+ */
+ public int getWidth()
+ {
+ if (_size == null)
+ {
+ calculateSize();
+ if (_size == null) {return -1;}
+ }
+ return _size.width;
+ }
+
+ /**
+ * @return height of the image, if known
+ */
+ public int getHeight()
+ {
+ if (_size == null)
+ {
+ calculateSize();
+ if (_size == null) {return -1;}
+ }
+ return _size.height;
+ }
+
+ /**
+ * @param inStatus status of photo when loaded
+ */
+ public void setOriginalStatus(Status inStatus)
+ {
+ _originalStatus = inStatus;
+ _currentStatus = inStatus;
+ }
+
+ /**
+ * @return status of photo when it was loaded
+ */
+ public Status getOriginalStatus()
+ {
+ return _originalStatus;
+ }
+
+ /**
+ * @return current status of photo
+ */
+ public Status getCurrentStatus()
+ {
+ return _currentStatus;
+ }
+ /**
+ * @param inStatus current status of photo
+ */
+ public void setCurrentStatus(Status inStatus)
+ {
+ _currentStatus = inStatus;
+ }
+
+ /**
+ * @return true if photo is connected to a point
+ */
+ public boolean isConnected()
+ {
+ return _currentStatus != Status.NOT_CONNECTED;
+ }
+
+ /**
+ * @return byte array of thumbnail data
+ */
+ public byte[] getExifThumbnail()
+ {
+ return _exifThumbnail;
+ }
+
+ /**
+ * @param inBytes byte array from exif
+ */
+ public void setExifThumbnail(byte[] inBytes)
+ {
+ _exifThumbnail = inBytes;
+ }
+
+ /**
+ * Delete the cached data when the Photo is no longer needed
+ */
+ public void resetCachedData()
+ {
+ _size = null;
+ // remove thumbnail too
+ }
+