Source code: com/eireneh/bible/book/config/DefaultBibleChoice.java
1
2 package com.eireneh.bible.book.config;
3
4 import java.io.IOException;
5
6 import com.eireneh.config.*;
7 import com.eireneh.config.choices.*;
8 import com.eireneh.bible.book.*;
9
10 /**
11 * The default Bible Choice.
12 *
13 * <table border='1' cellPadding='3' cellSpacing='0' width="100%">
14 * <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
15 * Distribution Licence:<br />
16 * Project B is free software; you can redistribute it
17 * and/or modify it under the terms of the GNU General Public License,
18 * version 2 as published by the Free Software Foundation.<br />
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * General Public License for more details.<br />
23 * The License is available on the internet
24 * <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
25 * <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26 * MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
27 * The copyright to this program is held by it's authors.
28 * </font></td></tr></table>
29 * @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
30 * @see docs.Licence
31 * @author Joe Walker
32 * @version D5.I8.T0
33 */
34 public class DefaultBibleChoice extends AbstractChoice
35 {
36 /**
37 * Get the name of the default version
38 */
39 public String getString()
40 {
41 try
42 {
43 return Bibles.getDefaultName();
44 }
45 catch (BookException ex)
46 {
47 return "#Error#";
48 }
49 }
50
51 /**
52 * Set the name of the default version
53 */
54 public void setString(String data) throws BookException, IOException
55 {
56 Bibles.setDefaultName(data);
57 }
58
59 /**
60 * How should this Choice be edited
61 */
62 public String getType()
63 {
64 return "options";
65 }
66
67 /**
68 * What can we tell the editor to help it present the user with a
69 * good way of editing this choice
70 */
71 public Object getTypeOptions()
72 {
73 try
74 {
75 return Bibles.getBibleNames();
76 }
77 catch (BookException ex)
78 {
79 return new String[0];
80 }
81 }
82
83 /**
84 * Fetch some basic help text
85 */
86 public String getHelpText()
87 {
88 return "Which of the available Bibles is the default.";
89 }
90 }