Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.common.config
Class AbstractReflectedChoice

    java.lang.Object
      org.crosswire.common.config.AbstractReflectedChoice

All Implemented Interfaces:
  Choice

Direct Known Subclasses:
  BooleanChoice, ClassChoice, FileChoice, FontChoice, IntOptionsChoice, NumberChoice, PathChoice, StringArrayChoice, StringChoice, StringOptionsChoice

    public abstract class AbstractReflectedChoice

extends Object
implements Choice

A helper for when we need to be a choice created dynamically.

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
`private Class` | `clazz` The type that we reflect to
`private String` | `fullPath` The full path of this item
`private Method` | `getter` The method to call to get the value
`private String` | `helptext` The help text (tooltip) for this item
`private static Logger` | `log` The log stream
`private int` | `priority` The priority of this config level
`private String` | `propertyname` The property that we call on the reflecting class
`private Method` | `setter` The method to call to set the value
`private String` | `type` The type (as specified in config.xml)

Fields inherited from interface org.crosswire.common.config.Choice
`PRIORITY_ACCESSOR, PRIORITY_CTOR, PRIORITY_EXTENDER, PRIORITY_HIGHEST, PRIORITY_LOWEST, PRIORITY_NORMAL, PRIORITY_SYSTEM`

Constructor Summary
`AbstractReflectedChoice()`

Method Summary
`abstract Object` | `convertToObject(String orig)` Convert from a stored string to an object to use with relfection
`abstract String` | `convertToString(Object orig)` Convert from a reflection return value to a String for storage
`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 newFullPath)` Sets the full path of the option.
`void` | `setHelpText(String helptext)` Sets a brief description of what is going on
`void` | `setPriority(int priority)` 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
`void` | `setString(String value)` String value to associate with this Field.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.crosswire.common.config.Choice
`getConversionClass`

Field Detail

### clazz

    private Class clazz

  The type that we reflect to

### propertyname

    private String propertyname

  The property that we call on the reflecting class

### type

    private String type

  The type (as specified in config.xml)

### getter

    private Method getter

  The method to call to get the value

### setter

    private Method setter

  The method to call to set the value

### helptext

    private String helptext

  The help text (tooltip) for this item

### fullPath

    private String fullPath

  The full path of this item

### priority

    private int priority

  The priority of this config level

### log

    private static final Logger log

  The log stream

Constructor Detail

### AbstractReflectedChoice

    public AbstractReflectedChoice()

Method Detail

### init

    public void init(org.jdom.Element option,
                     ResourceBundle configResources)
              throws StartupException

  Description copied from interface: `Choice`
  String value to associate with the name (key)

  Specified by:
    `init` in interface `Choice`
  Throws:
    `StartupException`

### getType

    public String getType()

  Description copied from interface: `Choice`
  The type by which UIs can pick an appropriate editor

  Specified by:
    `getType` in interface `Choice`
  Returns:
    String The type string as supplied in config.xml

### convertToString

    public abstract String convertToString(Object orig)

  Convert from a reflection return value to a String for storage

### convertToObject

    public abstract Object convertToObject(String orig)

  Convert from a stored string to an object to use with relfection

### getFullPath

    public String getFullPath()

  Description copied from interface: `Choice`
  The full path of the option.

  Specified by:
    `getFullPath` in interface `Choice`
  Returns:
    String The path string as supplied in config.properties

### setFullPath

    public void setFullPath(String newFullPath)

  Description copied from interface: `Choice`
  Sets the full path of the option.

  Specified by:
    `setFullPath` in interface `Choice`
  Parameters:
    `newFullPath` - The path string as supplied in config.properties

### getHelpText

    public String getHelpText()

  Description copied from interface: `Choice`
  Gets a brief description of what is going on

  Specified by:
    `getHelpText` in interface `Choice`
  Returns:
    Some help text

### setHelpText

    public void setHelpText(String helptext)

  Description copied from interface: `Choice`
  Sets a brief description of what is going on

  Specified by:
    `setHelpText` in interface `Choice`
  Parameters:
    `helptext` - Some help text

### isSaveable

    public boolean isSaveable()

  Description copied from interface: `Choice`
  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.

  Specified by:
    `isSaveable` in interface `Choice`
  Returns:
    True if it is safe to store the value in a config file.

### getPriority

    public 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

  Specified by:
    `getPriority` in interface `Choice`
  Returns:
    A priority level

### setPriority

    public void setPriority(int priority)

  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

  Parameters:
    `priority` - A priority level

### requiresRestart

    public boolean requiresRestart()

  Description copied from interface: `Choice`
  Do we need to restart the program in order for this change to have effect?

  Specified by:
    `requiresRestart` in interface `Choice`
  Returns:
    True if a restart is required

### getString

    public String getString()

  Description copied from interface: `Choice`
  String value to associate with the name (key)

  Specified by:
    `getString` in interface `Choice`
  Returns:
    value of this Choice

### setString

    public void setString(String value)
                   throws Exception

  Description copied from interface: `Choice`
  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.

  Specified by:
    `setString` in interface `Choice`
  Parameters:
    `value` - The new value for this Choice
  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2006
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD