cdox.util.conf
Class YesNoOption

java.lang.Object
  extended bycdox.util.conf.AbstractOption
      extended bycdox.util.conf.YesNoOption

public class YesNoOption
extends AbstractOption

This class represents a YesNo option. Below is an example of an appropriate section in the XML file:

 <yesno package="cdox.gui.CDoxFrame" key="playsounds">
   <default value="yes"/>
   <hint xml:lang="de">Sounds abspielen</hint>
   <hint xml:lang="en">Play sounds</hint>
 </yesno>
The value of the default attribute value should either equal "yes" or "no".

Version:
May 22nd 2002
Author:
Rutger Bezema, Andreas Schmitz

Field Summary
 
Fields inherited from class cdox.util.conf.AbstractOption
key, node, prefs
 
Constructor Summary
YesNoOption(org.w3c.dom.Node n, Localizer lang)
          Constructs one.
 
Method Summary
 boolean commitChanges()
          Causes the option to write its changes to its preferences node.
 javax.swing.JComponent getComponent()
          Returns a component which is used to alter this option.
 javax.swing.JLabel getText()
          Returns a JLabel which describes the option.
 void reset()
          Resets the values to the original ones, either from the preferences, or, if they don't exist, to the ones in the XML file.
 void setToDefault()
          Causes the preferences to re-read its default value from the DOM document and thus resetting its value in the component.
 
Methods inherited from class cdox.util.conf.AbstractOption
getTextByLanguage, setMapping
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YesNoOption

public YesNoOption(org.w3c.dom.Node n,
                   Localizer lang)
Constructs one.

Parameters:
n - the DOM node where this option is described.
lang - a localizer.
Method Detail

getText

public javax.swing.JLabel getText()
Description copied from class: AbstractOption
Returns a JLabel which describes the option. This method should be invoked only once.

Specified by:
getText in class AbstractOption
Returns:
a JLabel.

getComponent

public javax.swing.JComponent getComponent()
Description copied from class: AbstractOption
Returns a component which is used to alter this option. This method should be invoked only once.

Specified by:
getComponent in class AbstractOption
Returns:
a JComponent value.

commitChanges

public boolean commitChanges()
Description copied from class: AbstractOption
Causes the option to write its changes to its preferences node. The preferences' flush() method is NOT invoked by this method.

Specified by:
commitChanges in class AbstractOption
Returns:
true, if the application must be restarted in order to get the changes into effect.

setToDefault

public void setToDefault()
Description copied from class: AbstractOption
Causes the preferences to re-read its default value from the DOM document and thus resetting its value in the component.

Specified by:
setToDefault in class AbstractOption

reset

public void reset()
Description copied from class: AbstractOption
Resets the values to the original ones, either from the preferences, or, if they don't exist, to the ones in the XML file.

Specified by:
reset in class AbstractOption