View Javadoc

1   // Copyright (C) 2004, Brian Enigma <enigma at netninja.com>
2   // This file is part of iGallery.
3   //
4   // iGallery is free software; you can redistribute it and/or modify
5   // it under the terms of the GNU General Public License as published by
6   // the Free Software Foundation; either version 2 of the License, or
7   // (at your option) any later version.
8   //
9   // iGallery is distributed in the hope that it will be useful,
10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  // GNU General Public License for more details.
13  //
14  // You should have received a copy of the GNU General Public License
15  // along with Foobar; if not, write to the Free Software
16  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  package org.ninjasoft.igallery.data;
18  
19  import java.util.*;
20  
21  /***
22   * Simple bean to wrap album information
23   * @author enigma
24   */
25  public class GalleryAlbum {
26      private int refNumber = 0;
27      private String name = "";
28      private String title = "";
29      private String summary = "";
30      private String parent = "";
31      private GalleryAlbum parentAlbum = null;
32      private Vector images = null;
33      
34      public String toString() {
35          StringBuffer result = new StringBuffer();
36          if (parentAlbum != null) {
37              result.append(parentAlbum.toString());
38              result.append(" / ");
39          }
40          result.append(Integer.toString(refNumber));
41          result.append(":");
42          result.append(name);
43          return result.toString();
44      }
45      
46  	/***
47  	 * @return Returns the name.
48  	 */
49  	public String getName() {
50  		return name;
51  	}
52  	/***
53  	 * @param name The name to set.
54  	 */
55  	public void setName(String name) {
56  		this.name = name;
57  	}
58  	/***
59  	 * @return Returns the parent.
60  	 */
61  	public String getParent() {
62  		return parent;
63  	}
64  	/***
65  	 * @param parent The parent to set.
66  	 */
67  	public void setParent(String parent) {
68  		this.parent = parent;
69  	}
70  	/***
71  	 * @return Returns the refNumber.
72  	 */
73  	public int getRefNumber() {
74  		return refNumber;
75  	}
76  	/***
77  	 * @param refNumber The refNumber to set.
78  	 */
79  	public void setRefNumber(int refNumber) {
80  		this.refNumber = refNumber;
81  	}
82  	/***
83  	 * @return Returns the summary.
84  	 */
85  	public String getSummary() {
86  		return summary;
87  	}
88  	/***
89  	 * @param summary The summary to set.
90  	 */
91  	public void setSummary(String summary) {
92  		this.summary = summary;
93  	}
94  	/***
95  	 * @return Returns the title.
96  	 */
97  	public String getTitle() {
98  		return title;
99  	}
100 	/***
101 	 * @param title The title to set.
102 	 */
103 	public void setTitle(String title) {
104 		this.title = title;
105 	}
106 	/***
107 	 * @return Returns the parentAlbum.
108 	 */
109 	public GalleryAlbum getParentAlbum() {
110 		return parentAlbum;
111 	}
112 	/***
113 	 * @param parentAlbum The parentAlbum to set.
114 	 */
115 	public void setParentAlbum(GalleryAlbum parentAlbum) {
116 		this.parentAlbum = parentAlbum;
117 	}
118     
119     public void addPicture(GalleryPicture i) {
120         if (images == null)
121             images = new Vector();
122         this.images.add(i);
123     }
124     public void addPictures(Collection c) {
125         if (images == null)
126             images = new Vector();
127         this.images.addAll(c);
128     }
129     public Vector getPictures() {
130         if (images == null)
131             images = new Vector();
132         return this.images;
133     }
134     public int getPictureCount() {
135         if (images != null)
136         	return this.images.size();
137         return -1;
138     }
139     public void resetPictures() {
140         this.images = null;
141     }
142 }