|
1 |
| package photospace.web; |
|
2 |
| |
|
3 |
| import java.util.*; |
|
4 |
| import photospace.meta.*; |
|
5 |
| |
|
6 |
| public class Page |
|
7 |
| implements java.io.Serializable |
|
8 |
| { |
|
9 |
| private CollectionMeta collection; |
|
10 |
| private int index = -1; |
|
11 |
| |
|
12 |
0
| public Meta getCurrent()
|
|
13 |
| { |
|
14 |
0
| if (index == -1) return collection;
|
|
15 |
0
| if (index == 0) return (Meta) collection.getFiles()[0];
|
|
16 |
0
| return (Meta) collection.getFiles()[1];
|
|
17 |
| } |
|
18 |
| |
|
19 |
0
| public void setCollection(CollectionMeta collection)
|
|
20 |
| { |
|
21 |
0
| this.collection = collection;
|
|
22 |
| } |
|
23 |
| |
|
24 |
0
| public CollectionMeta getCollection()
|
|
25 |
| { |
|
26 |
0
| return collection;
|
|
27 |
| } |
|
28 |
| |
|
29 |
0
| public List getParents()
|
|
30 |
| { |
|
31 |
0
| List parents = new ArrayList();
|
|
32 |
0
| CollectionMeta parent = getCurrent().getParent();
|
|
33 |
0
| while (parent != null)
|
|
34 |
| { |
|
35 |
0
| parents.add(parent);
|
|
36 |
0
| parent = parent.getParent();
|
|
37 |
| } |
|
38 |
0
| Collections.reverse(parents);
|
|
39 |
0
| return parents;
|
|
40 |
| } |
|
41 |
| |
|
42 |
0
| public Meta getPrevious()
|
|
43 |
| { |
|
44 |
0
| if (index == 0) return null;
|
|
45 |
0
| return (Meta) collection.getFiles()[0];
|
|
46 |
| } |
|
47 |
| |
|
48 |
0
| public Meta getNext()
|
|
49 |
| { |
|
50 |
0
| if (index == collection.getTotal() - 1) return null;
|
|
51 |
0
| if (index == 0) return (Meta) collection.getFiles()[1];
|
|
52 |
0
| return (Meta) collection.getFiles()[2];
|
|
53 |
| } |
|
54 |
| |
|
55 |
0
| public int getIndex()
|
|
56 |
| { |
|
57 |
0
| return index;
|
|
58 |
| } |
|
59 |
| |
|
60 |
0
| public void setIndex(int index)
|
|
61 |
| { |
|
62 |
0
| this.index = index;
|
|
63 |
| } |
|
64 |
| } |