org.crosswire.common.config
Interface Choice

All Known Subinterfaces:
MultipleChoice
All Known Implementing Classes:
AbstractReflectedChoice, BooleanChoice, ClassChoice, DirectoryChoice, FileChoice, FontChoice, IntOptionsChoice, NumberChoice, PathChoice, StringArrayChoice, StringChoice, StringOptionsChoice

public interface Choice

Choice is the fundamental building block of the config system. Every Choice must be able to:

Author:
Joe Walker [joe at eireneh dot com]
See Also:
for license details. The copyright to this program is held by it's authors.

Field Summary
static int PRIORITY_ACCESSOR
          The priority level for configuring previously created items
static int PRIORITY_CTOR
          The priority level for creating items for later configuring
static int PRIORITY_EXTENDER
          The priority level for important but non system level stuff
static int PRIORITY_HIGHEST
          The priority level for important but non system level stuff
static int PRIORITY_LOWEST
          The lowest level priority generally for system level stuff
static int PRIORITY_NORMAL
          The priority level for normal use
static int PRIORITY_SYSTEM
          The highest level priority generally for system level stuff
 
Method Summary
 Class getConvertionClass()
          The class that this Choice works on.
 String getFullPath()
          The full path of the option.
 String getHelpText()
          Gets a brief description of what is going on
 int getPriority()
          Sometimes we need to ensure that we configure items in a certain order, the config package moves the changes to the application starting with the highest priority, moving to the lowest.
 String getString()
          String value to associate with the name (key)
 String getType()
          The type by which UIs can pick an appropriate editor
 void init(org.jdom.Element option, ResourceBundle configResources)
          String value to associate with the name (key)
 boolean isSaveable()
          Is this Choice OK to write out to a file, or should we use settings in this run of the program, but forget them for next time.
 boolean requiresRestart()
          Do we need to restart the program in order for this change to have effect?
 void setFullPath(String fullPath)
          Sets the full path of the option.
 void setHelpText(String helptext)
          Sets a brief description of what is going on
 void setString(String value)
          String value to associate with this Field.
 

Field Detail

PRIORITY_SYSTEM

static final int PRIORITY_SYSTEM
The highest level priority generally for system level stuff

See Also:
Constant Field Values

PRIORITY_EXTENDER

static final int PRIORITY_EXTENDER
The priority level for important but non system level stuff

See Also:
Constant Field Values

PRIORITY_HIGHEST

static final int PRIORITY_HIGHEST
The priority level for important but non system level stuff

See Also:
Constant Field Values

PRIORITY_NORMAL

static final int PRIORITY_NORMAL
The priority level for normal use

See Also:
Constant Field Values

PRIORITY_CTOR

static final int PRIORITY_CTOR
The priority level for creating items for later configuring

See Also:
Constant Field Values

PRIORITY_ACCESSOR

static final int PRIORITY_ACCESSOR
The priority level for configuring previously created items

See Also:
Constant Field Values

PRIORITY_LOWEST

static final int PRIORITY_LOWEST
The lowest level priority generally for system level stuff

See Also:
Constant Field Values
Method Detail

init

void init(org.jdom.Element option,
          ResourceBundle configResources)
          throws StartupException
String value to associate with the name (key)

Throws:
StartupException

getFullPath

String getFullPath()
The full path of the option.

Returns:
String The path string as supplied in config.properties

setFullPath

void setFullPath(String fullPath)
Sets the full path of the option.

Parameters:
fullPath - The path string as supplied in config.properties

getType

String getType()
The type by which UIs can pick an appropriate editor

Returns:
String The type string as supplied in config.xml

getConvertionClass

Class getConvertionClass()
The class that this Choice works on. Used to decide how to display the choice to the user.

Returns:
The Class that this Choice works using.

getString

String getString()
String value to associate with the name (key)

Returns:
value of this Choice

setString

void setString(String value)
               throws Exception
String value to associate with this Field. This method can throw any Exception since almost anything could go wrong at this point. The Config dialog ought to cope with any errors.

Parameters:
value - The new value for this Choice
Throws:
Exception

getHelpText

String getHelpText()
Gets a brief description of what is going on

Returns:
Some help text

setHelpText

void setHelpText(String helptext)
Sets a brief description of what is going on

Parameters:
helptext - Some help text

isSaveable

boolean isSaveable()
Is this Choice OK to write out to a file, or should we use settings in this run of the program, but forget them for next time. A typical use of this is for password configuration.

Returns:
True if it is safe to store the value in a config file.

getPriority

int getPriority()
Sometimes we need to ensure that we configure items in a certain order, the config package moves the changes to the application starting with the highest priority, moving to the lowest. The normal priorities are 0-10 or the PRIORITY_* constants, the default being PRIORITY_NORMAL

Returns:
A priority level

requiresRestart

boolean requiresRestart()
Do we need to restart the program in order for this change to have effect?

Returns:
True if a restart is required

Copyright ยจ 2003-2005