KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > ui > about > ProjectInfo


1 /* ========================================================================
2  * JCommon : a free general purpose class library for the Java(tm) platform
3  * ========================================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jcommon/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22  * USA.
23  *
24  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
25  * in the United States and other countries.]
26  *
27  * ----------------
28  * ProjectInfo.java
29  * ----------------
30  * (C) Copyright 2001-2004, by Object Refinery Limited.
31  *
32  * Original Author: David Gilbert (for Object Refinery Limited);
33  * Contributor(s): -;
34  *
35  * $Id: ProjectInfo.java,v 1.5 2005/11/16 15:58:41 taqua Exp $
36  *
37  * Changes (since 27-Jun-2002)
38  * ---------------------------
39  * 27-Jun-2002 : Added logo, updated source header and Javadocs (DG);
40  * 08-Oct-2002 : Added set methods for most attributes. Fixed errors reported by Checkstyle (DG);
41  *
42  */

43
44 package org.jfree.ui.about;
45
46 import java.awt.Image JavaDoc;
47 import java.util.Iterator JavaDoc;
48 import java.util.List JavaDoc;
49
50 import org.jfree.base.BootableProjectInfo;
51 import org.jfree.base.Library;
52
53 /**
54  * A class for recording the basic information about a free or open source software project.
55  *
56  * @author David Gilbert
57  */

58 public class ProjectInfo extends BootableProjectInfo {
59
60     /** An optional project logo. */
61     private Image JavaDoc logo;
62
63     /** The licence text. */
64     private String JavaDoc licenceText;
65
66     /** A list of contributors. */
67     private List JavaDoc contributors;
68
69     /**
70      * Constructs an empty project info object.
71      */

72     public ProjectInfo() {
73         // nothing required
74
}
75
76     /**
77      * Constructs a project info object.
78      *
79      * @param name the name of the project.
80      * @param version the version.
81      * @param info other info (usually a URL).
82      * @param logo the project logo.
83      * @param copyright a copyright statement.
84      * @param licenceName the name of the licence that applies to the project.
85      * @param licenceText the text of the licence that applies to the project.
86      */

87     public ProjectInfo(final String JavaDoc name,
88                        final String JavaDoc version,
89                        final String JavaDoc info,
90                        final Image JavaDoc logo,
91                        final String JavaDoc copyright,
92                        final String JavaDoc licenceName,
93                        final String JavaDoc licenceText) {
94
95         super(name, version, info, copyright, licenceName);
96         this.logo = logo;
97         this.licenceText = licenceText;
98
99     }
100
101     /**
102      * Returns the logo.
103      *
104      * @return the project logo.
105      */

106     public Image JavaDoc getLogo() {
107         return this.logo;
108     }
109
110     /**
111      * Sets the project logo.
112      *
113      * @param logo the project logo.
114      */

115     public void setLogo(final Image JavaDoc logo) {
116         this.logo = logo;
117     }
118
119     /**
120      * Returns the licence text.
121      *
122      * @return the licence text.
123      */

124     public String JavaDoc getLicenceText() {
125         return this.licenceText;
126     }
127
128     /**
129      * Sets the project licence text.
130      *
131      * @param licenceText the licence text.
132      */

133     public void setLicenceText(final String JavaDoc licenceText) {
134         this.licenceText = licenceText;
135     }
136
137     /**
138      * Returns the list of contributors for the project.
139      *
140      * @return the list of contributors.
141      */

142     public List JavaDoc getContributors() {
143         return this.contributors;
144     }
145
146     /**
147      * Sets the list of contributors.
148      *
149      * @param contributors the list of contributors.
150      */

151     public void setContributors(final List JavaDoc contributors) {
152         this.contributors = contributors;
153     }
154
155     /**
156      * Returns a string describing the project.
157      *
158      * @return a string describing the project.
159      */

160     public String JavaDoc toString() {
161
162         final StringBuffer JavaDoc result = new StringBuffer JavaDoc();
163         result.append(getName());
164         result.append(" version ");
165         result.append(getVersion());
166         result.append(".\n");
167         result.append(getCopyright());
168         result.append(".\n");
169         result.append("\n");
170         result.append("For terms of use, see the licence below.\n");
171         result.append("\n");
172         result.append("FURTHER INFORMATION:");
173         result.append(getInfo());
174         result.append("\n");
175         result.append("CONTRIBUTORS:");
176         if (this.contributors != null) {
177             final Iterator JavaDoc iterator = this.contributors.iterator();
178             while (iterator.hasNext()) {
179                 final Contributor contributor = (Contributor) iterator.next();
180                 result.append(contributor.getName());
181                 result.append(" (");
182                 result.append(contributor.getEmail());
183                 result.append(").");
184             }
185         }
186         else {
187             result.append("None");
188         }
189
190         result.append("\n");
191         result.append("OTHER LIBRARIES USED BY ");
192         result.append(getName());
193         result.append(":");
194         final Library[] libraries = getLibraries();
195         if (libraries.length != 0) {
196             for (int i = 0; i < libraries.length; i++) {
197                 final Library lib = libraries[i];
198                 result.append(lib.getName());
199                 result.append(" ");
200                 result.append(lib.getVersion());
201                 result.append(" (");
202                 result.append(lib.getInfo());
203                 result.append(").");
204             }
205         }
206         else {
207             result.append("None");
208         }
209         result.append("\n");
210         result.append(getName());
211         result.append(" LICENCE TERMS:");
212         result.append("\n");
213         result.append(getLicenceText());
214
215         return result.toString();
216
217     }
218
219 }
220
Popular Tags