Source code: com/lanceolav/jreftree/Messages.java
1 /**
2 * JRefTree is a GUI interface to organize and output bibliographic references.
3 * Copyright (C) 2003 Lance O. Eastgate.
4 *
5 * This file is part of JRefTree, and was created on Mar 25, 2003.
6 *
7 * JRefTree is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 *
21 * The author can be reached at jreftree@lanceolav.com.
22 */
23
24 package com.lanceolav.jreftree;
25
26 import javax.swing.*;
27 import java.awt.*;
28
29 public final class Messages {
30
31 private static String version = null;
32 private static String year = null;
33
34 private Messages() {}
35
36 public static void setVersion(String v) { version = v; }
37 public static void setYear(String y) { year = y; }
38
39 public static void displayCopyright() {
40 JTextArea textArea = new JTextArea(
41 " GNU GENERAL PUBLIC LICENSE\n"+
42 "TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n"+
43 "\n"+
44 " 0. This License applies to any program or other work which contains\n"+
45 "a notice placed by the copyright holder saying it may be distributed\n"+
46 "under the terms of this General Public License. The 'Program', below,\n"+
47 "refers to any such program or work, and a 'work based on the Program'\n"+
48 "means either the Program or any derivative work under copyright law:\n"+
49 "that is to say, a work containing the Program or a portion of it,\n"+
50 "either verbatim or with modifications and/or translated into another\n"+
51 "language. (Hereinafter, translation is included without limitation in\n"+
52 "the term 'modification'.) Each licensee is addressed as 'you'.\n"+
53 "\n"+
54 "Activities other than copying, distribution and modification are not\n"+
55 "covered by this License; they are outside its scope. The act of\n"+
56 "running the Program is not restricted, and the output from the Program\n"+
57 "is covered only if its contents constitute a work based on the\n"+
58 "Program (independent of having been made by running the Program).\n"+
59 "Whether that is true depends on what the Program does.\n"+
60 "\n"+
61 " 1. You may copy and distribute verbatim copies of the Program's\n"+
62 "source code as you receive it, in any medium, provided that you\n"+
63 "conspicuously and appropriately publish on each copy an appropriate\n"+
64 "copyright notice and disclaimer of warranty; keep intact all the\n"+
65 "notices that refer to this License and to the absence of any warranty;\n"+
66 "and give any other recipients of the Program a copy of this License\n"+
67 "along with the Program.\n"+
68 "\n"+
69 "You may charge a fee for the physical act of transferring a copy, and\n"+
70 "you may at your option offer warranty protection in exchange for a fee.\n"+
71 "\n"+
72 " 2. You may modify your copy or copies of the Program or any portion\n"+
73 "of it, thus forming a work based on the Program, and copy and\n"+
74 "distribute such modifications or work under the terms of Section 1\n"+
75 "above, provided that you also meet all of these conditions:\n"+
76 "\n"+
77 " a) You must cause the modified files to carry prominent notices\n"+
78 " stating that you changed the files and the date of any change.\n"+
79 "\n"+
80 " b) You must cause any work that you distribute or publish, that in\n"+
81 " whole or in part contains or is derived from the Program or any\n"+
82 " part thereof, to be licensed as a whole at no charge to all third\n"+
83 " parties under the terms of this License.\n"+
84 "\n"+
85 " c) If the modified program normally reads commands interactively\n"+
86 " when run, you must cause it, when started running for such\n"+
87 " interactive use in the most ordinary way, to print or display an\n"+
88 " announcement including an appropriate copyright notice and a\n"+
89 " notice that there is no warranty (or else, saying that you provide\n"+
90 " a warranty) and that users may redistribute the program under\n"+
91 " these conditions, and telling the user how to view a copy of this\n"+
92 " License. (Exception: if the Program itself is interactive but\n"+
93 " does not normally print such an announcement, your work based on\n"+
94 " the Program is not required to print an announcement.)\n"+
95 "\n"+
96 "These requirements apply to the modified work as a whole. If\n"+
97 "identifiable sections of that work are not derived from the Program,\n"+
98 "and can be reasonably considered independent and separate works in\n"+
99 "themselves, then this License, and its terms, do not apply to those\n"+
100 "sections when you distribute them as separate works. But when you\n"+
101 "distribute the same sections as part of a whole which is a work based\n"+
102 "on the Program, the distribution of the whole must be on the terms of\n"+
103 "this License, whose permissions for other licensees extend to the\n"+
104 "entire whole, and thus to each and every part regardless of who wrote it.\n"+
105 "\n"+
106 "Thus, it is not the intent of this section to claim rights or contest\n"+
107 "your rights to work written entirely by you; rather, the intent is to\n"+
108 "exercise the right to control the distribution of derivative or\n"+
109 "collective works based on the Program.\n"+
110 "\n"+
111 "In addition, mere aggregation of another work not based on the Program\n"+
112 "with the Program (or with a work based on the Program) on a volume of\n"+
113 "a storage or distribution medium does not bring the other work under\n"+
114 "the scope of this License.\n"+
115 "\n"+
116 " 3. You may copy and distribute the Program (or a work based on it,\n"+
117 "under Section 2) in object code or executable form under the terms of\n"+
118 "Sections 1 and 2 above provided that you also do one of the following:\n"+
119 "\n"+
120 " a) Accompany it with the complete corresponding machine-readable\n"+
121 " source code, which must be distributed under the terms of Sections\n"+
122 " 1 and 2 above on a medium customarily used for software interchange; or,\n"+
123 "\n"+
124 " b) Accompany it with a written offer, valid for at least three\n"+
125 " years, to give any third party, for a charge no more than your\n"+
126 " cost of physically performing source distribution, a complete\n"+
127 " machine-readable copy of the corresponding source code, to be\n"+
128 " distributed under the terms of Sections 1 and 2 above on a medium\n"+
129 " customarily used for software interchange; or,\n"+
130 "\n"+
131 " c) Accompany it with the information you received as to the offer\n"+
132 " to distribute corresponding source code. (This alternative is\n"+
133 " allowed only for noncommercial distribution and only if you\n"+
134 " received the program in object code or executable form with such\n"+
135 " an offer, in accord with Subsection b above.)\n"+
136 "\n"+
137 "The source code for a work means the preferred form of the work for\n"+
138 "making modifications to it. For an executable work, complete source\n"+
139 "code means all the source code for all modules it contains, plus any\n"+
140 "associated interface definition files, plus the scripts used to\n"+
141 "control compilation and installation of the executable. However, as a\n"+
142 "special exception, the source code distributed need not include\n"+
143 "anything that is normally distributed (in either source or binary\n"+
144 "form) with the major components (compiler, kernel, and so on) of the\n"+
145 "operating system on which the executable runs, unless that component\n"+
146 "itself accompanies the executable.\n"+
147 "\n"+
148 "If distribution of executable or object code is made by offering\n"+
149 "access to copy from a designated place, then offering equivalent\n"+
150 "access to copy the source code from the same place counts as\n"+
151 "distribution of the source code, even though third parties are not\n"+
152 "compelled to copy the source along with the object code.\n"+
153 "\n"+
154 " 4. You may not copy, modify, sublicense, or distribute the Program\n"+
155 "except as expressly provided under this License. Any attempt\n"+
156 "otherwise to copy, modify, sublicense or distribute the Program is\n"+
157 "void, and will automatically terminate your rights under this License.\n"+
158 "However, parties who have received copies, or rights, from you under\n"+
159 "this License will not have their licenses terminated so long as such\n"+
160 "parties remain in full compliance.\n"+
161 "\n"+
162 " 5. You are not required to accept this License, since you have not\n"+
163 "signed it. However, nothing else grants you permission to modify or\n"+
164 "distribute the Program or its derivative works. These actions are\n"+
165 "prohibited by law if you do not accept this License. Therefore, by\n"+
166 "modifying or distributing the Program (or any work based on the\n"+
167 "Program), you indicate your acceptance of this License to do so, and\n"+
168 "all its terms and conditions for copying, distributing or modifying\n"+
169 "the Program or works based on it.\n"+
170 "\n"+
171 " 6. Each time you redistribute the Program (or any work based on the\n"+
172 "Program), the recipient automatically receives a license from the\n"+
173 "original licensor to copy, distribute or modify the Program subject to\n"+
174 "these terms and conditions. You may not impose any further\n"+
175 "restrictions on the recipients' exercise of the rights granted herein.\n"+
176 "You are not responsible for enforcing compliance by third parties to\n"+
177 "this License.\n"+
178 "\n"+
179 " 7. If, as a consequence of a court judgment or allegation of patent\n"+
180 "infringement or for any other reason (not limited to patent issues),\n"+
181 "conditions are imposed on you (whether by court order, agreement or\n"+
182 "otherwise) that contradict the conditions of this License, they do not\n"+
183 "excuse you from the conditions of this License. If you cannot\n"+
184 "distribute so as to satisfy simultaneously your obligations under this\n"+
185 "License and any other pertinent obligations, then as a consequence you\n"+
186 "may not distribute the Program at all. For example, if a patent\n"+
187 "license would not permit royalty-free redistribution of the Program by\n"+
188 "all those who receive copies directly or indirectly through you, then\n"+
189 "the only way you could satisfy both it and this License would be to\n"+
190 "refrain entirely from distribution of the Program.\n"+
191 "\n"+
192 "If any portion of this section is held invalid or unenforceable under\n"+
193 "any particular circumstance, the balance of the section is intended to\n"+
194 "apply and the section as a whole is intended to apply in other\n"+
195 "circumstances.\n"+
196 "\n"+
197 "It is not the purpose of this section to induce you to infringe any\n"+
198 "patents or other property right claims or to contest validity of any\n"+
199 "such claims; this section has the sole purpose of protecting the\n"+
200 "integrity of the free software distribution system, which is\n"+
201 "implemented by public license practices. Many people have made\n"+
202 "generous contributions to the wide range of software distributed\n"+
203 "through that system in reliance on consistent application of that\n"+
204 "system; it is up to the author/donor to decide if he or she is willing\n"+
205 "to distribute software through any other system and a licensee cannot\n"+
206 "impose that choice.\n"+
207 "\n"+
208 "This section is intended to make thoroughly clear what is believed to\n"+
209 "be a consequence of the rest of this License.\n"+
210 "\n"+
211 " 8. If the distribution and/or use of the Program is restricted in\n"+
212 "certain countries either by patents or by copyrighted interfaces, the\n"+
213 "original copyright holder who places the Program under this License\n"+
214 "may add an explicit geographical distribution limitation excluding\n"+
215 "those countries, so that distribution is permitted only in or among\n"+
216 "countries not thus excluded. In such case, this License incorporates\n"+
217 "the limitation as if written in the body of this License.\n"+
218 "\n"+
219 " 9. The Free Software Foundation may publish revised and/or new versions\n"+
220 "of the General Public License from time to time. Such new versions will\n"+
221 "be similar in spirit to the present version, but may differ in detail to\n"+
222 "address new problems or concerns.\n"+
223 "\n"+
224 "Each version is given a distinguishing version number. If the Program\n"+
225 "specifies a version number of this License which applies to it and 'any\n"+
226 "later version', you have the option of following the terms and conditions\n"+
227 "either of that version or of any later version published by the Free\n"+
228 "Software Foundation. If the Program does not specify a version number of\n"+
229 "this License, you may choose any version ever published by the Free Software\n"+
230 "Foundation.\n"+
231 "\n"+
232 " 10. If you wish to incorporate parts of the Program into other free\n"+
233 "programs whose distribution conditions are different, write to the author\n"+
234 "to ask for permission. For software which is copyrighted by the Free\n"+
235 "Software Foundation, write to the Free Software Foundation; we sometimes\n"+
236 "make exceptions for this. Our decision will be guided by the two goals\n"+
237 "of preserving the free status of all derivatives of our free software and\n"+
238 "of promoting the sharing and reuse of software generally.\n"
239 );
240 textArea.setFont(new Font("Serif", Font.ITALIC, 12));
241 textArea.setLineWrap(true);
242 textArea.setWrapStyleWord(true);
243
244 JScrollPane scrollText = new JScrollPane(textArea);
245 scrollText.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
246 scrollText.setPreferredSize(new Dimension(640,480));
247
248 JOptionPane.showMessageDialog(null,scrollText,"Copyright",
249 JOptionPane.INFORMATION_MESSAGE);
250 }
251
252 public static void displayWarranty() {
253 JTextArea textArea = new JTextArea(
254 " NO WARRANTY\n"+
255 "\n"+
256 " 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n"+
257 "FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n"+
258 "OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n"+
259 "PROVIDE THE PROGRAM 'AS IS' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n"+
260 "OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n"+
261 "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n"+
262 "TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n"+
263 "PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n"+
264 "REPAIR OR CORRECTION.\n"+
265 "\n"+
266 " 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n"+
267 "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n"+
268 "REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n"+
269 "INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n"+
270 "OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n"+
271 "TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n"+
272 "YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n"+
273 "PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n"+
274 "POSSIBILITY OF SUCH DAMAGES.\n"
275 );
276 textArea.setFont(new Font("Serif", Font.ITALIC, 12));
277 textArea.setLineWrap(true);
278 textArea.setWrapStyleWord(true);
279
280 JScrollPane scrollText = new JScrollPane(textArea);
281 scrollText.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
282 scrollText.setPreferredSize(new Dimension(640, 400));
283
284 JOptionPane.showMessageDialog(null, scrollText, "Warranty",
285 JOptionPane.INFORMATION_MESSAGE);
286 }
287
288 public static void displayTODO() {
289 String[] message = {
290 "TODO",
291 "----",
292 "Here are some possible TODOs:",
293 " - Include option to reload the URLs for the papers.",
294 " - Get more URLs for papers.",
295 " - Export selected values",
296 " - Export all references in part of the tree",
297 " - Introduce adjustable parameters (e.g. to specify",
298 " working directory), and have them saved in the project file",
299 " - Make sure the pdf files (and perhaps ps etc?) are valid",
300 " - Link references to resources on the internet",
301 " - move folders",
302 " - select more than one folder (or select all subfolders of some branch)",
303 " - import jrt files into a subfolder",
304 " - include configuration option on whether a branch should be opened when",
305 " updating a folder",
306 " - IF opening a branch when updating a folder, show last ref, then first ref",
307 " (same strategy as for list).",
308 " - - Add sort functionality (and have different sorting categories)",
309 " - Maybe allow the 'key' that is displayed in the list and tree to vary",
310 " (perhaps one could choose different keys for list and tree?)",
311 " - Option for merging two folders.",
312 " - Validate the XML files that they follow the bibteXML.dtd standard.",
313 " - Write documentation."
314 };
315 JOptionPane.showMessageDialog(null,message,"TODO",
316 JOptionPane.INFORMATION_MESSAGE);
317 }
318
319 public static void displayAbout() {
320 final String[] text = {"This is JRefTree (Java Reference Tree Organizer) "+
321 "version "+version,"(C) "+year+" Lance O. Eastgate"};
322 JOptionPane.showMessageDialog(null, text, "About",JOptionPane.INFORMATION_MESSAGE);
323 }
324
325 public static void displayHelp() {
326 JOptionPane.showMessageDialog(null,
327 "See http://jreftree.sf.net for more help.",
328 "Help",JOptionPane.INFORMATION_MESSAGE);
329 }
330 }