net.sf.freecol.client.gui.action
Class SelectableAction
java.lang.Object
javax.swing.AbstractAction
net.sf.freecol.client.gui.action.FreeColAction
net.sf.freecol.client.gui.action.MapboardAction
net.sf.freecol.client.gui.action.SelectableAction
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, Option<FreeColAction>
- Direct Known Subclasses:
- ChangeWindowedModeAction, DisplayBordersAction, DisplayGridAction, DisplayTileTextAction, MapControlsAction
public abstract class SelectableAction
- extends MapboardAction
An action for selecting one of several options.
- See Also:
- Serialized Form
|
Field Summary |
static java.lang.String |
id
|
private java.lang.String |
optionId
|
protected boolean |
selected
|
| Fields inherited from class javax.swing.AbstractAction |
changeSupport, enabled |
| Fields inherited from interface javax.swing.Action |
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON |
| Methods inherited from class net.sf.freecol.client.gui.action.FreeColAction |
addImageIcons, clone, getAccelerator, getFreeColClient, getId, getKeyStrokeText, getMenuKeyListener, getMnemonic, getName, getShortDescription, getValue, getXMLElementTagName, hasOrderButtons, readFromXML, readFromXMLImpl, setAccelerator, setMnemonic, setValue, toString, toXML, toXMLImpl |
| Methods inherited from class javax.swing.AbstractAction |
addPropertyChangeListener, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.awt.event.ActionListener |
actionPerformed |
id
public static final java.lang.String id
- See Also:
- Constant Field Values
optionId
private java.lang.String optionId
selected
protected boolean selected
SelectableAction
protected SelectableAction(FreeColClient freeColClient,
GUI gui,
java.lang.String id,
java.lang.String optionId)
- Creates this action.
- Parameters:
freeColClient - The main controller object for the clientid - a String valueoptionId - the id of a boolean client option
update
public void update()
- Updates the "enabled" status with the value returned by
MapboardAction.shouldBeEnabled() and the "selected" status with the value
returned by shouldBeSelected().
- Overrides:
update in class FreeColAction
isSelected
public boolean isSelected()
- Returns whether the action is selected.
- Returns:
true if the map controls is selected.
setSelected
public void setSelected(boolean b)
- Sets whether the action is selected.
- Parameters:
b - a boolean value
shouldBeSelected
protected boolean shouldBeSelected()
- Returns true if this action should be selected.
- Returns:
- a
boolean value
updateOption
protected void updateOption(boolean value)