net.sf.freecol.client.gui.action
Class ChangeAction

java.lang.Object
  extended by javax.swing.AbstractAction
      extended by net.sf.freecol.client.gui.action.FreeColAction
          extended by net.sf.freecol.client.gui.action.MapboardAction
              extended by net.sf.freecol.client.gui.action.UnitAction
                  extended by net.sf.freecol.client.gui.action.ChangeAction
All Implemented Interfaces:
java.awt.event.ActionListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, javax.swing.Action, Option

public class ChangeAction
extends UnitAction

An action for changing the view. This action will:

  1. Open a colony panel if the active unit is located on a tile with a colony.
  2. If onboard a carrier then the carrier will be the active unit..
  3. In other cases: switch to another unit on the same tile.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class net.sf.freecol.client.gui.action.FreeColAction
FreeColAction.InnerMenuKeyListener
 
Field Summary
static java.lang.String id
           
 
Fields inherited from class net.sf.freecol.client.gui.action.FreeColAction
ACTION_ID, BUTTON_DISABLED_IMAGE, BUTTON_IMAGE, BUTTON_PRESSED_IMAGE, BUTTON_ROLLOVER_IMAGE, freeColClient, NO_MNEMONIC
 
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
 
Constructor Summary
ChangeAction(FreeColClient freeColClient)
          Creates this action.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Applies this action.
protected  boolean shouldBeEnabled()
          Checks if this action should be enabled.
 void update()
          Updates the "enabled"-status with the value returned by shouldBeEnabled() and updates the name of the action.
 
Methods inherited from class net.sf.freecol.client.gui.action.FreeColAction
addImageIcons, getAccelerator, getFreeColClient, getId, getKeyStrokeText, getMenuKeyListener, getMnemonic, getName, getShortDescription, getXMLElementTagName, hasOrderButtons, isPreviewEnabled, readFromXML, readFromXMLElement, readFromXMLImpl, setAccelerator, setMnemonic, toString, toXML, toXMLElement, toXMLImpl
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, 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 net.sf.freecol.common.option.Option
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

id

public static final java.lang.String id
See Also:
Constant Field Values
Constructor Detail

ChangeAction

ChangeAction(FreeColClient freeColClient)
Creates this action.

Parameters:
freeColClient - The main controller object for the client.
Method Detail

update

public void update()
Updates the "enabled"-status with the value returned by shouldBeEnabled() and updates the name of the action.

Overrides:
update in class FreeColAction

shouldBeEnabled

protected boolean shouldBeEnabled()
Checks if this action should be enabled.

Overrides:
shouldBeEnabled in class UnitAction
Returns:
false if there is no active unit.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Applies this action.

Parameters:
e - The ActionEvent.