edu.rice.cs.drjava.ui.config
Class OptionComponent

java.lang.Object
  |
  +--edu.rice.cs.drjava.ui.config.OptionComponent
Direct Known Subclasses:
BooleanOptionComponent, ColorOptionComponent, FileOptionComponent, FontOptionComponent, IntegerOptionComponent, KeyStrokeOptionComponent, LabelComponent, StringOptionComponent, ToolbarOptionComponent, VectorOptionComponent

public abstract class OptionComponent
extends Object

The graphical form of an Option. Provides a way to see the values of Option while running DrJava and perform live updating of Options.

Version:
$Id: OptionComponent.java,v 1.10 2002/09/02 21:24:13 csreis Exp $

Field Summary
protected  JLabel _label
           
protected  Option _option
           
protected  Frame _parent
           
 
Constructor Summary
OptionComponent(Option option, String labelText, Frame parent)
           
OptionComponent(String labelText, Frame parent)
          Special constructor for degenerate option components does not take an option.
 
Method Summary
abstract  JComponent getComponent()
           
 JLabel getLabel()
           
 String getLabelText()
           
 Option getOption()
           
 void resetToCurrent()
          Resets the entry field to reflect the actual stored value for the option.
 void resetToDefault()
          Resets the actual value of the component to the original default.
abstract  void setValue(Object value)
          Sets the value that is currently displayed by this component.
 void showErrorMessage(String title, OptionParseException e)
           
 void showErrorMessage(String title, String value, String message)
           
abstract  boolean updateConfig()
          Updates the appropriate configuration option with the new value if different from the old value and legal.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

_option

protected Option _option

_label

protected JLabel _label

_parent

protected Frame _parent
Constructor Detail

OptionComponent

public OptionComponent(Option option,
                       String labelText,
                       Frame parent)

OptionComponent

public OptionComponent(String labelText,
                       Frame parent)
Special constructor for degenerate option components does not take an option.
Parameters:
labelText - Text for descriptive label of this option.
parent - The parent frame.
Method Detail

getOption

public Option getOption()

getLabelText

public String getLabelText()

getLabel

public JLabel getLabel()

getComponent

public abstract JComponent getComponent()

updateConfig

public abstract boolean updateConfig()
Updates the appropriate configuration option with the new value if different from the old value and legal. Any changes should be done immediately such that current and future references to the Option should reflect the changes.
Returns:
false, if value is invalid; otherwise true.

resetToCurrent

public void resetToCurrent()
Resets the entry field to reflect the actual stored value for the option.

resetToDefault

public void resetToDefault()
Resets the actual value of the component to the original default.

setValue

public abstract void setValue(Object value)
Sets the value that is currently displayed by this component.

showErrorMessage

public void showErrorMessage(String title,
                             OptionParseException e)

showErrorMessage

public void showErrorMessage(String title,
                             String value,
                             String message)