2
package org.crosswire.common.config.choices;
4
import org.crosswire.common.config.Choice;
5
import org.crosswire.common.util.UserLevel;
8
* An AbstractChoice is one that registers itself with
9
* AbstractChoice when it starts up, so that we don't need to pass
10
* parameters around the place the whole time.
12
* <p><table border='1' cellPadding='3' cellSpacing='0'>
13
* <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
15
* Distribution Licence:<br />
16
* JSword 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>, or by writing to:
25
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
26
* MA 02111-1307, USA<br />
27
* The copyright to this program is held by it's authors.
28
* </font></td></tr></table>
30
* @author Joe Walker [joe at eireneh dot com]
33
public abstract class AbstractChoice implements Choice
36
* Gets a default user level (beginner to advanced)
37
* @return The user level
39
public UserLevel getUserLevel()
41
return UserLevel.BEGINNER;
45
* Get some help on this Field. In this case we are just providing
46
* a default help text, that isn't much use.
47
* @return The default help text
49
public String getHelpText()
55
* This method is used to configure a good way of editing this
56
* component. It returns a MIME style string, which a config
57
* ui can use to select a suitable ui tool.
58
* @return The editor style to use to edit this Choice
60
public String getType()
66
* This method is used to configure a the type selected above.
67
* The object returned will depend on the type of editor selected.
68
* For example an editor of type "options" may need a String array.
69
* @return a configuration parameter for the type
71
public Object getTypeOptions()
77
* Is this Choice OK to write out to a file, or should we use settings
78
* in this run of the program, but forget them for next time. A
79
* typical use of this is for password configuration.
80
* @return True if it is safe to store the value in a config file.
82
public boolean isSaveable()
88
* Sometimes we need to ensure that we configure items in a certain
89
* order, the config package moves the changes to the application
90
* starting with the highest priority, moving to the lowest
91
* @return A priority level
95
return PRIORITY_NORMAL;
99
* Do we need to restart the program in order for this change to have
101
* @return True if a restart is required
103
public boolean requiresRestart()