com.realtime.crossfire.jxclient.settings.options
Class CheckBoxOption

java.lang.Object
  extended by com.realtime.crossfire.jxclient.settings.options.Option
      extended by com.realtime.crossfire.jxclient.settings.options.CheckBoxOption
Direct Known Subclasses:
CommandCheckBoxOption, PickupOption, SoundCheckBoxOption

public abstract class CheckBoxOption
extends Option

The base class for all check box options. It manages the checked/unchecked state and notifies listeners about changes.


Field Summary
private  boolean checked
          The current state.
private  java.lang.String tooltipText
          The tooltip text to explain this option.
 
Constructor Summary
protected CheckBoxOption(java.lang.String tooltipText)
          Creates a new instance.
 
Method Summary
protected abstract  void execute(boolean checked)
          Execute the action associated with this check box option.
protected  void fireStateChangedEvent()
          Notifies all listeners that the state has changed.
 java.lang.String getTooltipText()
          Returns the tooltip text to explain this option.
 boolean isChecked()
          Return the current state.
abstract  boolean isDefaultChecked()
          Return the default value of isChecked().
 void setChecked(boolean checked)
          Set the current state.
 void toggleChecked()
          Toggle the checked state.
 
Methods inherited from class com.realtime.crossfire.jxclient.settings.options.Option
addOptionListener, inhibitSave, removeOptionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

checked

private boolean checked
The current state.


tooltipText

@NotNull
private final java.lang.String tooltipText
The tooltip text to explain this option.

Constructor Detail

CheckBoxOption

protected CheckBoxOption(@NotNull
                         java.lang.String tooltipText)
Creates a new instance.

Parameters:
tooltipText - the tooltip text to explain this option
Method Detail

execute

protected abstract void execute(boolean checked)
Execute the action associated with this check box option. Must be implemented in sub-classes.

Parameters:
checked - whether the check box option is checked

fireStateChangedEvent

protected void fireStateChangedEvent()
Notifies all listeners that the state has changed.

Overrides:
fireStateChangedEvent in class Option

getTooltipText

@NotNull
public java.lang.String getTooltipText()
Returns the tooltip text to explain this option.

Returns:
the tooltip text

isChecked

public boolean isChecked()
Return the current state.

Returns:
The current state.

isDefaultChecked

public abstract boolean isDefaultChecked()
Return the default value of isChecked().

Returns:
The default value.

setChecked

public void setChecked(boolean checked)
Set the current state.

Parameters:
checked - The new state.

toggleChecked

public void toggleChecked()
Toggle the checked state.