|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.AbstractAction
net.sf.freecol.client.gui.action.FreeColAction
public abstract class FreeColAction
The super class of all actions in FreeCol. Subclasses of this object is
stored in an ActionManager.
| Nested Class Summary | |
|---|---|
class |
FreeColAction.InnerMenuKeyListener
A class used by Actions which have a mnemonic. |
| Field Summary | |
|---|---|
static java.lang.String |
ACTION_ID
|
static java.lang.String |
BUTTON_DISABLED_IMAGE
|
static java.lang.String |
BUTTON_IMAGE
|
static java.lang.String |
BUTTON_PRESSED_IMAGE
|
static java.lang.String |
BUTTON_ROLLOVER_IMAGE
|
protected FreeColClient |
freeColClient
|
private static java.util.logging.Logger |
logger
|
static java.lang.Integer |
NO_MNEMONIC
|
| Fields inherited from class javax.swing.AbstractAction |
|---|
changeSupport, enabled |
| Fields inherited from interface net.sf.freecol.common.option.Option |
|---|
NO_ID |
| 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 | |
|---|---|
protected |
FreeColAction(FreeColClient freeColClient,
java.lang.String id)
Creates a new FreeColAction. |
| Method Summary | |
|---|---|
protected void |
addImageIcons(java.lang.String key)
|
javax.swing.KeyStroke |
getAccelerator()
Gets the keyboard accelerator for this option. |
protected FreeColClient |
getFreeColClient()
Gets the main controller object for the client. |
java.lang.String |
getId()
Returns the id of this Option. |
static java.lang.String |
getKeyStrokeText(javax.swing.KeyStroke keyStroke)
Creates a String that keeps the attributes given
KeyStroke. |
javax.swing.event.MenuKeyListener |
getMenuKeyListener()
|
java.lang.Integer |
getMnemonic()
Gets the mnemonic to be used for selecting this action |
java.lang.String |
getName()
Returns the name of this Option. |
java.lang.String |
getShortDescription()
Gives a short description of this Option. |
static java.lang.String |
getXMLElementTagName()
Gets the tag name of the root element representing this object. |
boolean |
isPreviewEnabled()
Should this option be updated directly so that changes may be previewes? |
void |
readFromXML(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
readFromXMLElement(org.w3c.dom.Element element)
Initialize this object from an XML-representation of this object. |
protected void |
readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
Initialize this object from an XML-representation of this object. |
void |
setAccelerator(javax.swing.KeyStroke accelerator)
Sets a keyboard accelerator. |
void |
setMnemonic(int mnemonic)
Describe setMnemonic method here. |
protected boolean |
shouldBeEnabled()
Checks if this action should be enabled. |
java.lang.String |
toString()
Returns a textual representation of this object. |
void |
toXML(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
org.w3c.dom.Element |
toXMLElement(org.w3c.dom.Document document)
This method writes an XML-representation of this object to the given stream. |
protected void |
toXMLImpl(javax.xml.stream.XMLStreamWriter out)
This method writes an XML-representation of this object to the given stream. |
void |
update()
Updates the "enabled"-status with the value returned by shouldBeEnabled(). |
| 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 |
| Methods inherited from interface java.awt.event.ActionListener |
|---|
actionPerformed |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
public static final java.lang.String ACTION_ID
public static final java.lang.String BUTTON_IMAGE
public static final java.lang.String BUTTON_ROLLOVER_IMAGE
public static final java.lang.String BUTTON_PRESSED_IMAGE
public static final java.lang.String BUTTON_DISABLED_IMAGE
public static final java.lang.Integer NO_MNEMONIC
protected final FreeColClient freeColClient
| Constructor Detail |
|---|
protected FreeColAction(FreeColClient freeColClient,
java.lang.String id)
FreeColAction.
freeColClient - The main controller object for the client.id - a String value| Method Detail |
|---|
public java.lang.Integer getMnemonic()
public void setMnemonic(int mnemonic)
setMnemonic method here.
mnemonic - an int valueprotected FreeColClient getFreeColClient()
protected void addImageIcons(java.lang.String key)
public void update()
shouldBeEnabled().
protected boolean shouldBeEnabled()
false if the
ClientOptionsDialog is
visible and true otherwise. This method should be
extended by subclasses if the action should be disabled in other
cases.public void setAccelerator(javax.swing.KeyStroke accelerator)
accelerator - The KeyStroke. Using null
is the same as disabling the keyboard accelerator.public javax.swing.KeyStroke getAccelerator()
KeyStroke or null if the
keyboard accelerator is disabled.public java.lang.String getShortDescription()
Option. Can for
instance be used as a tooltip text.
getShortDescription in interface Optionpublic java.lang.String toString()
toString in interface OptiontoString in class java.lang.ObjectOption.getName()public java.lang.String getId()
Option.
getId in interface Optionpublic java.lang.String getName()
Option.
getName in interface Optionpublic static java.lang.String getKeyStrokeText(javax.swing.KeyStroke keyStroke)
String that keeps the attributes given
KeyStroke. This String can be used to
store the key stroke in an XML-file.
keyStroke - The KeyStroke.
String that produces a key stroke equal to the
given KeyStroke if passed as a parameter to
getAWTKeyStroke(String).public boolean isPreviewEnabled()
isPreviewEnabled in interface Optionfalse.
protected void toXMLImpl(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
out - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to the
stream.
protected void readFromXMLImpl(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
in - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.
public void toXML(javax.xml.stream.XMLStreamWriter out)
throws javax.xml.stream.XMLStreamException
toXML in interface Optionout - The target stream.
javax.xml.stream.XMLStreamException - if there are any problems writing to the
stream.
public void readFromXML(javax.xml.stream.XMLStreamReader in)
throws javax.xml.stream.XMLStreamException
readFromXML in interface Optionin - The input stream with the XML.
javax.xml.stream.XMLStreamException - if a problem was encountered during parsing.public org.w3c.dom.Element toXMLElement(org.w3c.dom.Document document)
toXMLElement in interface Optiondocument - The Document.
public void readFromXMLElement(org.w3c.dom.Element element)
readFromXMLElement in interface Optionelement - The DOM-element ("Document Object Model") made to represent this "Option".public javax.swing.event.MenuKeyListener getMenuKeyListener()
public static java.lang.String getXMLElementTagName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||