+ private Photo getPhoto() {
+ PhotoEntry current = authorized.getEntry(path);
+ if (current instanceof Album) {
+ throw new RuntimeException("PhotoPanel can only show a photo: " + current.getClass().getName());
+ }
+ return (Photo) current;
+ }
+
+ private Photo getPrevPhoto() {
+ return getAlbum().findPhotoBefore(getPhoto().getId());
+ }
+
+ private Photo getNextPhoto() {
+ return getAlbum().findPhotoAfter(getPhoto().getId());
+ }
+
+ private Album getAlbum() {
+ return (Album) getAuthorizedPhotos().getEntry(getParentPath());
+ }
+
+ private String getParentPath() {
+ String parentPath = path.substring(0, path.lastIndexOf("/"));
+ if (parentPath.length() == 0) {
+ parentPath = "/";
+ }
+ return parentPath;
+ }
+