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

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

public class KeyStrokeOptionComponent
extends OptionComponent<javax.swing.KeyStroke,javax.swing.JPanel>
implements java.lang.Comparable<KeyStrokeOptionComponent>

Graphical form of a KeyStrokeOption.

Version:
$Id: KeyStrokeOptionComponent.java 5232 2010-04-24 00:14:05Z mgricken $
See Also:
Serialized Form

Nested Class Summary
private  class KeyStrokeOptionComponent.GetKeyDialog
          A dialog that allows the user to type in a keystroke to be bound to the action that was clicked.
 
Nested classes/interfaces inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
OptionComponent.ChangeListener
 
Field Summary
private  javax.swing.JButton _button
           
private static KeyStrokeOptionComponent.GetKeyDialog _getKeyDialog
           
private  javax.swing.KeyStroke _key
           
static java.util.HashMap<javax.swing.KeyStroke,KeyStrokeOptionComponent> _keyToKSOC
           
private  javax.swing.JPanel _panel
           
private static int DIALOG_HEIGHT
           
 
Fields inherited from class edu.rice.cs.drjava.ui.config.OptionComponent
_entireColumn, _guiComponent, _label, _labelText, _option, _parent
 
Constructor Summary
KeyStrokeOptionComponent(KeyStrokeOption opt, java.lang.String text, SwingFrame parent)
           
KeyStrokeOptionComponent(KeyStrokeOption opt, java.lang.String text, SwingFrame parent, java.lang.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.
 javax.swing.KeyStroke getConfigKeyStroke()
          Returns the KeyStroke current set in the Config settings.
 javax.swing.KeyStroke getKeyStroke()
          Returns the currently selected KeyStroke.
 void setDescription(java.lang.String description)
          Sets the tooltip description text for this option.
 void setValue(javax.swing.KeyStroke value)
          Displays the given value.
 java.lang.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, getComponent, getEntireColumn, getLabel, getLabelText, getOption, notifyChangeListeners, removeChangeListener, resetToCurrent, resetToDefault, setComponent, setEntireColumn, showErrorMessage, showErrorMessage, useEntireColumn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DIALOG_HEIGHT

private static final int DIALOG_HEIGHT
See Also:
Constant Field Values

_keyToKSOC

public static final java.util.HashMap<javax.swing.KeyStroke,KeyStrokeOptionComponent> _keyToKSOC

_button

private javax.swing.JButton _button

_panel

private javax.swing.JPanel _panel

_getKeyDialog

private static KeyStrokeOptionComponent.GetKeyDialog _getKeyDialog

_key

private javax.swing.KeyStroke _key
Constructor Detail

KeyStrokeOptionComponent

public KeyStrokeOptionComponent(KeyStrokeOption opt,
                                java.lang.String text,
                                SwingFrame parent)

KeyStrokeOptionComponent

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

Method Detail

setDescription

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

Specified by:
setDescription in class OptionComponent<javax.swing.KeyStroke,javax.swing.JPanel>
Parameters:
description - the tooltip text

toString

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

Overrides:
toString in class java.lang.Object

updateConfig

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

Specified by:
updateConfig in class OptionComponent<javax.swing.KeyStroke,javax.swing.JPanel>
Returns:
true if the new value is set successfully

setValue

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

Specified by:
setValue in class OptionComponent<javax.swing.KeyStroke,javax.swing.JPanel>

compareTo

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

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

getKeyStroke

public javax.swing.KeyStroke getKeyStroke()
Returns the currently selected KeyStroke.


getConfigKeyStroke

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