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

java.lang.Object
  extended by edu.rice.cs.drjava.ui.config.OptionComponent<KeyStroke>
      extended by edu.rice.cs.drjava.ui.config.KeyStrokeOptionComponent
All Implemented Interfaces:
Serializable, Comparable<KeyStrokeOptionComponent>

public class KeyStrokeOptionComponent
extends OptionComponent<KeyStroke>
implements Comparable<KeyStrokeOptionComponent>

Graphical form of a KeyStrokeOption.

Version:
$Id: KeyStrokeOptionComponent.java 4691 2008-12-02 23:33:27Z dlsmith $
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
OptionComponent.ChangeListener
 
Field Summary
static HashMap<KeyStroke,KeyStrokeOptionComponent> _keyToKSOC
           
 
Fields inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
_entireColumn, _label, _labelText, _option, _parent
 
Constructor Summary
KeyStrokeOptionComponent(KeyStrokeOption opt, String text, SwingFrame parent)
           
KeyStrokeOptionComponent(KeyStrokeOption opt, String text, SwingFrame parent, String description)
          Constructor that allows for a tooltip description.
 
Method Summary
 int compareTo(KeyStrokeOptionComponent other)
          Compares two KeyStrokeOptionComponents based on the text of their labels.
 JComponent getComponent()
          Return's this OptionComponent's configurable component.
 KeyStroke getConfigKeyStroke()
          Returns the KeyStroke current set in the Config settings.
 KeyStroke getKeyStroke()
          Returns the currently selected KeyStroke.
 void setDescription(String description)
          Sets the tooltip description text for this option.
 void setValue(KeyStroke value)
          Displays the given value.
 String toString()
          Returns a custom string representation of this option component.
 boolean updateConfig()
          Updates the config object with the new setting.
 
Methods inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
addChangeListener, getEntireColumn, getLabel, getLabelText, getOption, notifyChangeListeners, removeChangeListener, resetToCurrent, resetToDefault, setEntireColumn, showErrorMessage, showErrorMessage, useEntireColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_keyToKSOC

public static final HashMap<KeyStroke,KeyStrokeOptionComponent> _keyToKSOC
Constructor Detail

KeyStrokeOptionComponent

public KeyStrokeOptionComponent(KeyStrokeOption opt,
                                String text,
                                SwingFrame parent)

KeyStrokeOptionComponent

public KeyStrokeOptionComponent(KeyStrokeOption opt,
                                String text,
                                SwingFrame parent,
                                String description)
Constructor that allows for a tooltip description.

Method Detail

setDescription

public void setDescription(String description)
Sets the tooltip description text for this option.

Specified by:
setDescription in class OptionComponent<KeyStroke>
Parameters:
description - the tooltip text

toString

public String toString()
Returns a custom string representation of this option component.

Overrides:
toString in class Object

updateConfig

public boolean updateConfig()
Updates the config object with the new setting. Should run in event thread.

Specified by:
updateConfig in class OptionComponent<KeyStroke>
Returns:
true if the new value is set successfully

setValue

public void setValue(KeyStroke value)
Displays the given value.

Specified by:
setValue in class OptionComponent<KeyStroke>

compareTo

public int compareTo(KeyStrokeOptionComponent other)
Compares two KeyStrokeOptionComponents based on the text of their labels.

Specified by:
compareTo in interface Comparable<KeyStrokeOptionComponent>
Returns:
Comparison based on labels, or 1 if o is not a KeyStrokeOptionComponent

getKeyStroke

public KeyStroke getKeyStroke()
Returns the currently selected KeyStroke.


getConfigKeyStroke

public KeyStroke getConfigKeyStroke()
Returns the KeyStroke current set in the Config settings.


getComponent

public JComponent getComponent()
Return's this OptionComponent's configurable component.

Specified by:
getComponent in class OptionComponent<KeyStroke>