java.lang.Objectcom.realtime.crossfire.jxclient.shortcuts.Shortcuts
public class Shortcuts
Manages a list of Shortcuts.
| Field Summary | |
|---|---|
private  CommandQueue | 
commandQueue
The command queue for executing commands.  | 
private  java.io.File | 
file
The backing file.  | 
private  javax.swing.event.EventListenerList | 
listeners
The listeners to be notified.  | 
private  boolean | 
modified
Whether the contents of shortcuts have been modified from the
 last saved state. | 
private  java.util.List<Shortcut> | 
shortcuts
The shortcuts.  | 
private  SpellsManager | 
spellsManager
The SpellsManager instance to watch. | 
| Constructor Summary | |
|---|---|
Shortcuts(CommandQueue commandQueue,
          SpellsManager spellsManager)
Creates a new instance.  | 
|
| Method Summary | |
|---|---|
 void | 
addShortcutsListener(ShortcutsListener listener)
Adds a ShortcutsListener. | 
 void | 
clearShortcuts()
Clears all defined shortcuts.  | 
 void | 
executeShortcut(int index)
Executes a shortcut.  | 
 java.io.File | 
getFile()
Returns the backing file.  | 
private  Shortcut | 
getShortcut(int index)
Returns a shortcut.  | 
 boolean | 
isModified()
Returns whether the shortcuts have been modified since creation or last call to resetModified(). | 
 java.util.Iterator<Shortcut> | 
iterator()
 | 
 void | 
removeShortcutsListener(ShortcutsListener listener)
Removes a ShortcutsListener. | 
 void | 
resetModified()
Resets the modified state.  | 
 void | 
setCommandShortcut(int index,
                   java.lang.String command)
Sets a Shortcut to a command. | 
 void | 
setFile(java.io.File file)
Sets the backing file.  | 
 void | 
setShortcut(int index,
            Shortcut shortcut)
Sets a Shortcut. | 
 void | 
setSpellShortcut(int index,
                 Spell spell,
                 boolean cast)
Sets a Shortcut to a spell. | 
 void | 
setSpellShortcut(int index,
                 java.lang.String spellName,
                 boolean cast)
Sets a Shortcut to a spell. | 
 void | 
unsetShortcut(int index)
Unsets a Shortcut. | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
@NotNull private final CommandQueue commandQueue
@Nullable private java.io.File file
@NotNull private final javax.swing.event.EventListenerList listeners
private boolean modified
shortcuts have been modified from the
 last saved state.
@NotNull private final java.util.List<Shortcut> shortcuts
Shortcut. Unset entries are set to
 null.
@NotNull private final SpellsManager spellsManager
SpellsManager instance to watch.
| Constructor Detail | 
|---|
public Shortcuts(@NotNull
                 CommandQueue commandQueue,
                 @NotNull
                 SpellsManager spellsManager)
commandQueue - the command queue for executing commandsspellsManager - the instance to watch| Method Detail | 
|---|
public void addShortcutsListener(@NotNull
                                 ShortcutsListener listener)
ShortcutsListener.
listener - the listener to addpublic void clearShortcuts()
public void executeShortcut(int index)
index - the shortcut index@Nullable public java.io.File getFile()
null if unknown@Nullable private Shortcut getShortcut(int index)
index - the shortcut index
null if the shortcut is unsetpublic boolean isModified()
resetModified().
public java.util.Iterator<Shortcut> iterator()
iterator in interface java.lang.Iterable<Shortcut>
public void removeShortcutsListener(@NotNull
                                    ShortcutsListener listener)
ShortcutsListener.
listener - the listener to removepublic void resetModified()
public void setCommandShortcut(int index,
                               @NotNull
                               java.lang.String command)
Shortcut to a command.
index - the shortcut indexcommand - the command to execute
public void setFile(@Nullable
                    java.io.File file)
file - the backing file or null if unknown
public void setShortcut(int index,
                        @Nullable
                        Shortcut shortcut)
Shortcut.
index - the shortcut indexshortcut - the shortcut to set or null to unset
public void setSpellShortcut(int index,
                             @NotNull
                             Spell spell,
                             boolean cast)
Shortcut to a spell.
index - the shortcut indexspell - the spell to cast or invokecast - whether the spell should be cast (true) or
 invoked (false)
public void setSpellShortcut(int index,
                             @NotNull
                             java.lang.String spellName,
                             boolean cast)
Shortcut to a spell.
index - the shortcut indexspellName - the spell name to cast or invokecast - whether the spell should be cast (true) or
 invoked (false)public void unsetShortcut(int index)
Shortcut.
index - the shortcut index