001: /* ========================================================================
002: * JCommon : a free general purpose class library for the Java(tm) platform
003: * ========================================================================
004: *
005: * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
006: *
007: * Project Info: http://www.jfree.org/jcommon/index.html
008: *
009: * This library is free software; you can redistribute it and/or modify it
010: * under the terms of the GNU Lesser General Public License as published by
011: * the Free Software Foundation; either version 2.1 of the License, or
012: * (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but
015: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017: * License for more details.
018: *
019: * You should have received a copy of the GNU Lesser General Public
020: * License along with this library; if not, write to the Free Software
021: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
022: * USA.
023: *
024: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
025: * in the United States and other countries.]
026: *
027: * ----------------
028: * ProjectInfo.java
029: * ----------------
030: * (C) Copyright 2001-2004, by Object Refinery Limited.
031: *
032: * Original Author: David Gilbert (for Object Refinery Limited);
033: * Contributor(s): -;
034: *
035: * $Id: ProjectInfo.java,v 1.5 2005/11/16 15:58:41 taqua Exp $
036: *
037: * Changes (since 27-Jun-2002)
038: * ---------------------------
039: * 27-Jun-2002 : Added logo, updated source header and Javadocs (DG);
040: * 08-Oct-2002 : Added set methods for most attributes. Fixed errors reported by Checkstyle (DG);
041: *
042: */
043:
044: package org.jfree.ui.about;
045:
046: import java.awt.Image;
047: import java.util.Iterator;
048: import java.util.List;
049:
050: import org.jfree.base.BootableProjectInfo;
051: import org.jfree.base.Library;
052:
053: /**
054: * A class for recording the basic information about a free or open source software project.
055: *
056: * @author David Gilbert
057: */
058: public class ProjectInfo extends BootableProjectInfo {
059:
060: /** An optional project logo. */
061: private Image logo;
062:
063: /** The licence text. */
064: private String licenceText;
065:
066: /** A list of contributors. */
067: private List contributors;
068:
069: /**
070: * Constructs an empty project info object.
071: */
072: public ProjectInfo() {
073: // nothing required
074: }
075:
076: /**
077: * Constructs a project info object.
078: *
079: * @param name the name of the project.
080: * @param version the version.
081: * @param info other info (usually a URL).
082: * @param logo the project logo.
083: * @param copyright a copyright statement.
084: * @param licenceName the name of the licence that applies to the project.
085: * @param licenceText the text of the licence that applies to the project.
086: */
087: public ProjectInfo(final String name, final String version,
088: final String info, final Image logo,
089: final String copyright, final String licenceName,
090: final String licenceText) {
091:
092: super (name, version, info, copyright, licenceName);
093: this .logo = logo;
094: this .licenceText = licenceText;
095:
096: }
097:
098: /**
099: * Returns the logo.
100: *
101: * @return the project logo.
102: */
103: public Image getLogo() {
104: return this .logo;
105: }
106:
107: /**
108: * Sets the project logo.
109: *
110: * @param logo the project logo.
111: */
112: public void setLogo(final Image logo) {
113: this .logo = logo;
114: }
115:
116: /**
117: * Returns the licence text.
118: *
119: * @return the licence text.
120: */
121: public String getLicenceText() {
122: return this .licenceText;
123: }
124:
125: /**
126: * Sets the project licence text.
127: *
128: * @param licenceText the licence text.
129: */
130: public void setLicenceText(final String licenceText) {
131: this .licenceText = licenceText;
132: }
133:
134: /**
135: * Returns the list of contributors for the project.
136: *
137: * @return the list of contributors.
138: */
139: public List getContributors() {
140: return this .contributors;
141: }
142:
143: /**
144: * Sets the list of contributors.
145: *
146: * @param contributors the list of contributors.
147: */
148: public void setContributors(final List contributors) {
149: this .contributors = contributors;
150: }
151:
152: /**
153: * Returns a string describing the project.
154: *
155: * @return a string describing the project.
156: */
157: public String toString() {
158:
159: final StringBuffer result = new StringBuffer();
160: result.append(getName());
161: result.append(" version ");
162: result.append(getVersion());
163: result.append(".\n");
164: result.append(getCopyright());
165: result.append(".\n");
166: result.append("\n");
167: result.append("For terms of use, see the licence below.\n");
168: result.append("\n");
169: result.append("FURTHER INFORMATION:");
170: result.append(getInfo());
171: result.append("\n");
172: result.append("CONTRIBUTORS:");
173: if (this .contributors != null) {
174: final Iterator iterator = this .contributors.iterator();
175: while (iterator.hasNext()) {
176: final Contributor contributor = (Contributor) iterator
177: .next();
178: result.append(contributor.getName());
179: result.append(" (");
180: result.append(contributor.getEmail());
181: result.append(").");
182: }
183: } else {
184: result.append("None");
185: }
186:
187: result.append("\n");
188: result.append("OTHER LIBRARIES USED BY ");
189: result.append(getName());
190: result.append(":");
191: final Library[] libraries = getLibraries();
192: if (libraries.length != 0) {
193: for (int i = 0; i < libraries.length; i++) {
194: final Library lib = libraries[i];
195: result.append(lib.getName());
196: result.append(" ");
197: result.append(lib.getVersion());
198: result.append(" (");
199: result.append(lib.getInfo());
200: result.append(").");
201: }
202: } else {
203: result.append("None");
204: }
205: result.append("\n");
206: result.append(getName());
207: result.append(" LICENCE TERMS:");
208: result.append("\n");
209: result.append(getLicenceText());
210:
211: return result.toString();
212:
213: }
214:
215: }
|